Skip to content

Instantly share code, notes, and snippets.

@amanuel2
Last active July 13, 2016 16:45
Show Gist options
  • Save amanuel2/036f08501b1b3dd4b2a217bf644b9579 to your computer and use it in GitHub Desktop.
Save amanuel2/036f08501b1b3dd4b2a217bf644b9579 to your computer and use it in GitHub Desktop.
#STORE CURRENT_INDEX %edi
#STORE BIGGEST_VALUE %ebx
#STORE CURRENT_VALUE %eax
.section .data
data:
.long 3,67,34,222,45,75,54,34,44,33,22,11,66,0
second_data:
.int 4,5,2,224,45,3,23
.section .text
.globl _start
_start:
movl $0, %edi
movl data(,%edi,4) , %eax
movl %eax,%ebx
_loopstart:
cmp $13, %edi
je _intloop
incl %edi
movl data(,%edi,4) , %eax
cmp %eax,%ebx
jl _greaterfound
jmp _loopstart
_greaterfound:
movl %eax,%ebx
incl %edi
movl data(,%edi,4) , %eax
jmp _loopstart
_intloop:
movl $0, %edi
movl second_data(,%edi,2) , %eax
_intloopstart:
cmp $7, %edi
je _eof
incl %edi
movl second_data(,%edi,2) , %eax
cmp %eax,%ebx
jl _greaterFoundInt
jmp _intloopstart
_greaterFoundInt:
movl %ebx,%eax
jmp _intloopstart
_eof:
movl $1, %eax
int $0x80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment