Simple C code as compiled by different compilers
SPIM assembly
##################################################################
# addition of two integers
#that are automatic variables.
# the result is stored on stack.
#################################################################.verstamp 3 19
li $24, 22 # the compiler is smart:
# performs addtion of two constants
MIPS assembly
Pentium Assembly
TITLE F:\Cs342fall99\Sep27\testadd\addasm.c
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
_DATA SEGMENT DWORD USE32 PUBLIC 'DATA'
CONST SEGMENT DWORD USE32 PUBLIC 'CONST'
_BSS SEGMENT DWORD USE32 PUBLIC 'BSS'
$$SYMBOLS SEGMENT BYTE USE32 'DEBSYM'
$$TYPES SEGMENT BYTE USE32 'DEBTYP'
_TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
_TEXT SEGMENT PARA USE32 PUBLIC 'CODE'
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
lea edi, DWORD PTR [ebp-76]
mov eax, -858993460 ; ccccccccH
mov DWORD PTR _a$[ebp], 7
mov DWORD PTR _b$[ebp], 15 ; 0000000fH
mov eax, DWORD PTR _b$[ebp]
add eax, DWORD PTR _a$[ebp]
mov DWORD PTR _c$[ebp], eax