The 'code' is unimportant, it simply multiplies by 2000. The trick is in the union. In C, a union of two (or more) variables assigns them to the exact same memory address.
Think of it this way: Draw a sideways rectangle 4 units wide (4 bytes, 32 bits) This is the representation of 'value' - an unsigned 32 bit variable. Maybe tentatively subdivide it into 4 equal blocks.
Now below that rectangle, draw 4 rectangles side to side so they wind up, in total, the same width as the first rectangle. These are the 4 bytes of regs - still just 32 bits. You can think of the left-most block as regs[0] and we fill them left to right.
Finally, below the 4 blocks, draw 2 medium size rectangles side to side. Each is half of the width of the 32 bit rectangle and twice the size of the 8 bit rectangles. In the same way that the left-most block of the 4 blocks was regs[0], the left-most block here is results[0]. Two 16 bit values is still 32 bits.
Now, stuff a value into regs[0]..regs[4] and copy them over to the other two representations and you can see how the values change representation. Easy! But remember, all 3 representations have exactly the same address and their contents are identical because they are all the same variable.
No matter which way I choose to address the union (as a 32-bit word, or 4 8-bit bytes or 2 16-bit ints), the address is identical and the values are divided up properly.
Magic!