Take care about asm inline, you risk to modify some register that are already use before your asm.
You need to put quote for each instruction and add brackets around variables.
Here's the code for do subtraction function:
int a = 2, b = 1, c;
int main(void)
{
int tmp;
asm (".intel_syntax noprefix");
asm ("mov eax, [a]");
asm ("sub eax, [b]");
asm ("mov [c], eax");
asm (".att_syntax noprefix");
printf("%d - %d = %d\n", a, b, c);
return (0);
}
And like you see, you need global variable (global label) for use variable written in ascii (a, b, c), else you need to use stack param.
(off-topic)
Unlike Nasm who give the ability to use 3 way to create variable: global label + param stack + local label (like structure in C code), variables range is just the way how see/manage their addresses.
We can expand those way with give the possibility to manage data's address directly while writing code maybe.