I am traying to make a simple division in x86-64 and when I give input like 4 and 2 the result should look like 4 / 2 = 2 but I am getting 4 / 0 = 0 any ideas ?
4 / 2 = 2 instead I got 4 / 0 = 0
sub $8, %rsp
mov $input_format, %rdi
mov $a, %rax
mov $b, %rsi
mov $0, %al
call scanf
xor %rdx, %rdx
mov a, %rax
mov b, %rsi
idiv %rsi
mov $output_format, %rdi
mov $0, %al
call printf
add $8, %rsp