Skip to content

Instantly share code, notes, and snippets.

@zhrkvl
Created July 7, 2015 18:44
Show Gist options
  • Select an option

  • Save zhrkvl/840f1ec8cdbceeaa7766 to your computer and use it in GitHub Desktop.

Select an option

Save zhrkvl/840f1ec8cdbceeaa7766 to your computer and use it in GitHub Desktop.
BITS 64
section .data
a dd 45
b dd 6
msg1 db 'A is bigger', 0xa
msg2 db 'B is bigger', 0xa
msg3 db 'A == B', 0xa
msg1l equ $-msg1
msg2l equ $-msg2
msg3l equ $-msg3
section .text
global _start
_start:
mov DWORD eax, a
mov DWORD ebx, b
cmp eax, ebx
ja bigger
cmp eax, ebx
jb less
jmp equal
bigger:
mov eax, 4
mov ebx, 1
mov ecx, msg1
mov edx, msg1l
int 0x80
jmp endif
less:
mov eax, 4
mov ebx, 1
mov ecx, msg2
mov edx, msg2l
int 0x80
jmp endif
equal:
mov eax, 4
mov ebx, 1
mov ecx, msg3
mov edx, msg3l
int 0x80
jmp endif
endif:
mov eax, 1
int 0x80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment