/* assembly file for function add3, which adds 3 args on stack */ .global add3 add3: movl 4(%esp),%eax addl 8(%esp),%eax addl 12(%esp),%eax pushl %eax #save the result #--- print it from assembler pushl %eax #PASS second arg pushl $fmt call printf add $8,%esp #remove arguments popl %eax #get arguments back ret .data fmt: .asciz "assembly calculates %d\n"