I'm new in assembly. I'm trying to get the forming triangle in assembly. When I compile it, I get a "32-bit absolute addressing is not supported in 64-bit mode" error. Can you explain what I miss? And is the way I did correct
#include <stdio.h>
int main()
{
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if(c < a + b && b < a + c && a < b + c)
printf("yes");
else
printf("no");
}
This is my code.
.data
.yes: .string "Yes"
.no: .string "No"
.global main
tri:
push %rsi
push %rdx
add %rdi, %rsi # a + b
cmp %rdx, %rsi # a + b > c
jle no
pop %rsi
add %rsi, %rdx # c + a
cmp %rdi, %rdx # c + a > b
jle no
pop %rdx
add %rdx, %rdi # b + c
cmp %rsi, %rdi # b + c > a
jle no
mov $.yes, %rdi
mov %rax, %rsi
xor %rax, %rax
call printf
ret
no:
mov $.no, %rdi
mov %rax, %rsi
xor %rax, %rax
call printf
ret
main:
mov $2, %rsi
mov $2, %rdi
mov $3, %rdx
call tri