.section .data scanf_format: .asciz "%d" prompt: .asciz "Enter a number: " result_message: .asciz "You entered %d\n" .section .text .globl main main: # Prompt the user for a number mov $prompt, %rdi mov $0, %rax call printf # Call malloc mov $4, %rdi call malloc push %rax # Result from malloc # Read the number with scanf mov $scanf_format, %rdi mov %rax, %rsi call scanf # Print out the results pop %rax # Get the address back mov (%rax), %rsi push %rax mov $result_message, %rdi mov $0, %rax call printf # Free the memory pop %rdi call free # Exit the program with status 0 movl $1, %eax movl $0, %ebx int $0x80