/* assemby for 2**n, with n in ecx and eax as accumulator */ .section .rodata STR0: .string "the answer is %d\n" STR1: .string "%d" .global main main: /* scanf("%d",&a) */ sub $4,%esp mov %esp,%eax push %eax push $STR1 call scanf add $8,%esp pop %ecx /* mov $8,%ecx */ mov $1, %eax loop: cmp $0,%ecx jle endloop imul $2,%eax dec %ecx jmp loop endloop: push %eax push $STR0 call printf add $8,%esp push $0 call exit