I've got the following code:
.align 32
.data
input1: .string "Give short: \n"
input2: .string "Give char: \n"
arg1: .string "%hu"
arg2: .string "%c"
output1: .string "%hu\n"
output2: .string "%c\n"
short: .short 1
char: .byte 1
.global main
main:
pushl %ebp
movl %esp, %ebp
pushl $input1
call printf
addl $4, %esp
pushl $short
pushl $arg1
call scanf
addl $8, %esp
pushl (short)
pushl $output1
call printf
addl $8, %esp
pushl $input2
call printf
addl $4, %esp
pushl $char
pushl $arg2
call scanf
addl $8, %esp
pushl (char)
pushl $output2
call printf
addl $8, %esp
movl %ebp, %esp
popl %ebp
ret
I want to input short, print it, input char and print it but instead, after printing 'Give char' program ends leaving two blank lines. Any ideas why? It's working when I get the arguments in one function call.