# Declaration of input variables stack32 ap_in stack32 bp_in stack32 cp_in stack32 len_in input ap_in input bp_in input cp_in input len_in # Declaration of local variables int32 ap int32 bp int32 cp int32 len int32 a int32 b int32 c # Declaration of caller (callee safe) variables int32 eax int32 ebx int32 esi int32 edi int32 ebp caller eax caller ebx caller esi caller edi caller ebp # Allocation of stack space stack32 eax_stack stack32 ebx_stack stack32 esi_stack stack32 edi_stack stack32 ebp_stack # enter the add function enter add # Save caller registers on the stack eax_stack = eax ebx_stack = ebx esi_stack = esi edi_stack = edi ebp_stack = ebp ap = ap_in bp = bp_in cp = cp_in len = len_in # Enter the loop for vector addition mainloop: # Check whether length is still larger than 0 unsigned>? len - 0 # ...leave the loop if not goto end if !unsigned> # Load values from the arrays a and b a = *(uint32 *) (ap + 0) b = *(uint32 *) (bp + 0) # Add the values c = a + b # Store the result *(uint32 *) (cp + 0) = c # Increase pointers to input and output arrays ap += 4 bp += 4 cp += 4 # Decrement len len -= 1 goto mainloop end: # Restore caller registers from stack eax = eax_stack ebx = ebx_stack esi = esi_stack edi = edi_stack ebp = ebp_stack # Leave the function leave