input_fd dq -1 input dq -1 file_stat s_stat ;;; The input filename should be in rdi load_file: mov r8, rdi ;; Determine the file size of the input file stat r8, file_stat ;; Open a file descriptor for the input file open r8, 0 mov [input_fd], rax ;; Map the input file into memory mmap 0, [file_stat.st_size], PROT_READ, MAP_PRIVATE, [input_fd], 0 mov [input], rax ;; Close the input file close [input_fd] ret unload_file: ;; Unmap the mapped file munmap [input], [file_stat.st_size] ret