Skip to content

Instantly share code, notes, and snippets.

@kurotych
Created May 30, 2018 15:06
Show Gist options
  • Save kurotych/c69cd250272f097d96de7a28f6721542 to your computer and use it in GitHub Desktop.
Save kurotych/c69cd250272f097d96de7a28f6721542 to your computer and use it in GitHub Desktop.
.text
.global _start
_start:
mov $2, %eax
mov $3, %edx
call power
mov %eax, %ebx
mov $1, %eax
int $0x80
power:
test %edx, %edx
jz RETURN_ONE
mov %eax, %ebx
dec %edx
LOOP:
imul %ebx, %eax
dec %edx
jnz LOOP
cmp $0, %edx
jmp RETURN
jle LOOP
RETURN:
ret
RETURN_ONE:
mov $1, %eax
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment