.global _start .text _start: movq $0, max # initialize max to 0 movq $0, min # initialize min to 0 # write(1, greeting, 16) mov $1, %rax # system call 1 is write mov $1, %rdi # file handle 1 is stdout mov $greeting, %rsi # address of variable to pring mov $16, %rdx # number of bytes to write syscall # invoke operating system to do the write read_input: # read(0, input, 3) mov $0, %rax # system call 0 is read mov $0, %rdi # file handle 0 is stdin mov $input, %rsi # address of var to input mov $4, %rdx # number of bytes to read syscall # invoke operating system to do the write print_results: # write(1, max_message, 4) mov $1, %rax # system call 1 is write mov $1, %rdi # file handle 1 is stdout mov $max_message, %rsi # address of string to output mov $5, %rdx # number of bytes to write syscall # invoke operating system to do the write # write(1, input, 4) mov $1, %rax # system call 1 is write mov $1, %rdi # file handle 1 is stdout mov $input, %rsi # address of string to output mov $4, %rdx # number of bytes read syscall # invoke operating system to do the write # write(1, min_message, 4) mov $1, %rax # system call 1 is write mov $1, %rdi # file handle 1 is stdout mov $min_message, %rsi # address of string to output mov $5, %rdx # number of bytes syscall # invoke operating system to do the write # write(1, input, 4) mov $1, %rax # system call 1 is write mov $1, %rdi # file handle 1 is stdout mov $input, %rsi # address of string to output mov $4, %rdx # number of bytes syscall # invoke operating system to do the write # exit(0) mov $60, %rax # system call 60 is exit xor %rdi, %rdi # we want return code 0 syscall # invoke operating system to exit .data greeting: .ascii "Enter numbers: \n" max_message: .ascii "Max: " min_message: .ascii "Min: " input: .word 0 max: .word 0 min: .word 0