okay, this is the entire program in IA32 asm... I got it working except y is set to whatever x is somehow...or somehow x is passed in twice to pow.
running:
./p1 2 4
results in
x^y = 4
running:
./p1 4 2
results in
x^y = 256
here is the code, thanks for the help guys i am beginning to understand it all
.file "p1.c" .section .rodata.LC0: .string "x^y = %d\n" .text.globl pow .type pow, @functionpow: pushl %ebp movl %esp, %ebp pushl %ebx # save ebx pushl %esi # save esi pushl %edi # save edi movl 8(%ebp),%eax # eax now holds x movl 12(%ebp),%edx # edx now holds y xor %ebx,%ebx addl %eax,%ebx .L1: decl %edx imull %ebx,%eax cmpl $1,%edx jg .L1 popl %edi # restore edi popl %esi # restore esi popl %ebx # restore ebx leave ret.globl main .type main, @functionmain: pushl %ebp movl %esp, %ebp pushl %ebx # save ebx movl 12(%ebp),%eax # load argv into eax (temp) movl 4(%eax),%ebx # x = argv[1] movl 8(%eax),%ecx # y = argv[2] pushl %ecx # push y on the stack, as it gets # clobbered by atoi pushl %ebx # push x into atoi via stack call atoi # call atoi movl %eax,%ebx # move result into (x) ebx call atoi # call atoi with y movl %eax,%ecx # put result into (y) ecx pushl %ecx # push y as second param pushl %ebx # push x as first parameter call pow # call power function push %eax # push returned value push $.LC0 # push fmt string call printf # call printf popl %ebx # restore ebx xor %eax, %eax leave ret .size main, .-main .section .note.GNU-stack,"",@progbits .ident "GCC: (GNU) 3.3.5 20050117 (prerelease) (SUSE Linux)"