I'm trying to make an assignment that has to have the program ask for an integer, only to increment it by one, and then outputting it again. However, i'm getting the "Segmentation fault" error message after inputting said integer. I'm completely lost, please help, it's probably a very stupid mistake.
.global main
readString: .asciz "%ld"
main:
subq $8, %rsp # reserving space for the variable on the stack
leaq -8(%rbp), %rsi # loading the effective memory adress into %rsi
movq $readString, %rdi # Load the first argument of scanf into %rdi
movq $0, %rax # Clear %rax
call scanf # Calling scanf from the C library
movq %rsi, %r9 # Loading the scanned integer into %r9
inc %r9 # Increment %r9 by one
movq $0, %rax # Clear %rax
movq %r9, %rdi # Loading the incremented integer into %rdi
call printf # Calling printf from the C library
call end # Ending the program
end:
mov $0, %rdi # Loading the exit code
call exit # Calling the exit code