C Internals
while very educative, it just teaches one possible translation from C.<p>Lets pick the &quot;Translation of Arithmetic Operations&quot; example and convert it to float instead of int<p><pre><code>    int a = 2;
    int b= 3;
    int c = 24;
    a = a + b;
    a = a + b * c;
</code></pre>
<a href="http:&#x2F;&#x2F;www.avabodh.com&#x2F;cin&#x2F;arithmeticop.html" rel="nofollow">http:&#x2F;&#x2F;www.avabodh.com&#x2F;cin&#x2F;arithmeticop.html</a><p>And pack it into a function so that Golbolt can compile it.<p><pre><code>    float hn_demo(void) {
      float a = 2;
      float b = 3;
      float c = 24;
      a = a + b;
      a = a + b * c;
      return a;
    }
</code></pre>
And now pick a CPU that isn&#x27;t that good with floating point, like AVR, using GCC 4.5.4, and we get:<p><pre><code>        ldi r24,lo8(0x40000000)
        ldi r25,hi8(0x40000000)
        ldi r26,hlo8(0x40000000)
        ldi r27,hhi8(0x40000000)
        std Y+1,r24
        std Y+2,r25
        std Y+3,r26
        std Y+4,r27
        ldi r24,lo8(0x40400000)
        ldi r25,hi8(0x40400000)
        ldi r26,hlo8(0x40400000)
        ldi r27,hhi8(0x40400000)
        std Y+5,r24
        std Y+6,r25
        std Y+7,r26
        std Y+8,r27
        ldi r24,lo8(0x41c00000)
        ldi r25,hi8(0x41c00000)
        ldi r26,hlo8(0x41c00000)
        ldi r27,hhi8(0x41c00000)
        std Y+9,r24
        std Y+10,r25
        std Y+11,r26
        std Y+12,r27
        ldd r22,Y+1
        ldd r23,Y+2
        ldd r24,Y+3
        ldd r25,Y+4
        ldd r18,Y+5
        ldd r19,Y+6
        ldd r20,Y+7
        ldd r21,Y+8
        rcall __addsf3
        mov r27,r25
        mov r26,r24
        mov r25,r23
        mov r24,r22
        std Y+1,r24
        std Y+2,r25
        std Y+3,r26
        std Y+4,r27
        ldd r22,Y+5
        ldd r23,Y+6
        ldd r24,Y+7
        ldd r25,Y+8
        ldd r18,Y+9
        ldd r19,Y+10
        ldd r20,Y+11
        ldd r21,Y+12
        rcall __mulsf3
        mov r27,r25
        mov r26,r24
        mov r25,r23
        mov r24,r22
        mov r18,r24
        mov r19,r25
        mov r20,r26
        mov r21,r27
        ldd r22,Y+1
        ldd r23,Y+2
        ldd r24,Y+3
        ldd r25,Y+4
        rcall __addsf3
        mov r27,r25
        mov r26,r24
        mov r25,r23
        mov r24,r22
        std Y+1,r24
        std Y+2,r25
        std Y+3,r26
        std Y+4,r27
</code></pre>
Which includes calls to a floating point emulation library and quite different from the x86 example, with numbers using multiple registers.<p>So more of an heads up, sometimes the C translation to Assembly isn&#x27;t as direct as one might think.