/* assembly file for function add3, which adds 3 args on stack written directly by Lin Jensen to assemble: gcc -c add3.s the object file is named add3.o see also: add3c.s, which is compiled from add3c.c add3p.s, which also calls printf from assembler add3n.asm -- intel assembler, assembled with nasm MARCH 22 2012, b squard - 4ac */ .global add3 add3: movl 4(%esp),%eax # a - fetch and add args from stack movl 8(%esp),%edx # b imul %edx, %edx # b squared imull 12(%esp),%eax # a*c imull $4, %eax sub %eax, %edx # edx = b2 - 4ac mov %edx, %eax ret # return with sum in eax