Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- min:
- .long 0
- max:
- .long 0
- current
- .byte 0
- .text
- .type max_diff,@function
- .global max_diff
- max_diff:
- PUSH %rbp
- MOV %rsp,%rbp
- MOVL (%rdi), min
- MOVL (%rdi), max
- ADD $24, (%rbp)
- MOV $2, %rcx
- loop:
- CMP $0, %rcx
- JE exit
- DEC %rcx
- MOVL (%rbp), %eax
- CMP min, %eax
- JL changeMin
- CMP max, %eax
- JG changeMax
- changeMin:
- MOVL %eax, min
- ADD $8, (%rbp)
- JMP loop
- changeMax:
- MOVL %eax, max
- ADD $8, (%rbp)
- JMP loop
- exit:
- MOVL min, %eax
- MOVL max, %ebx
- SUB %eax, %ebx
- XOR %rax, %rax
- MOV %ebx, %rax
- RET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement