How to fix the read operation: | READ -> cmd "popq %rdi" "BEGIN read, put arg in %rdi"; cmd "movq $0,%rax" "signal no floating point args"; cmd "pushq %r11" "%r11 is caller-saved "; cmd "movq %rsp, %r12" "save stack pointer temporarily"; cmd "andq $-16, %rsp" "align stack to closest 16 bits"; cmd "call read" "get user input"; cmd "movq %r12 , %rsp" "restore stack pointer"; cmd "popq %r11" "restore %r11"; cmd "pushq %rax" "END read, a C-call, so result in %rax \n" The three new instructions temporarily change the stack pointer to be 16 byte aligned before the read function is called and then put it back. I think the bug only occurs on 64-bit systems.