2024-06-11 13:42:37 +07:00
|
|
|
;###############################
|
|
|
|
;
|
|
|
|
; MINIMUM IN X64
|
|
|
|
;
|
|
|
|
;##############################
|
|
|
|
|
|
|
|
; =============================
|
|
|
|
; Find smallest number
|
|
|
|
; rax = current item
|
|
|
|
; rbx = index of data_items
|
|
|
|
; rcx = smallest item found
|
|
|
|
; rdi = return value
|
|
|
|
; =============================
|
|
|
|
|
|
|
|
format ELF64 executable 0
|
|
|
|
|
|
|
|
segment readable executable
|
|
|
|
|
|
|
|
entry main
|
|
|
|
main:
|
|
|
|
mov rbx, 0
|
|
|
|
mov rax, [data_items + rbx * 8]
|
|
|
|
mov rcx, rax
|
|
|
|
|
|
|
|
loop_through:
|
|
|
|
cmp rax, 255
|
|
|
|
je exit
|
|
|
|
inc rbx
|
|
|
|
|
|
|
|
mov rax, [data_items + rbx * 8]
|
|
|
|
cmp rax, rcx
|
|
|
|
jge loop_through
|
|
|
|
|
|
|
|
mov rcx, rax
|
|
|
|
jmp loop_through
|
|
|
|
|
|
|
|
exit:
|
2024-06-11 19:54:36 +07:00
|
|
|
mov rdi, rcx
|
2024-06-11 13:42:37 +07:00
|
|
|
mov rax, 0x3c
|
|
|
|
syscall
|
|
|
|
|
|
|
|
segment readable writable
|
|
|
|
data_items dq 3, 67, 34, 222, 45, 75, 54, 34, 44, 33, 22, 11, 66, 255
|