I\'m trying to learn x86-64 inline assembly and decided to implement this very simple swap method that simply orders a and b in ascending order:
You cannot assume values are in any particular register in your asm code -- you need to use constraints to tell gcc what values you want to read and write and get it to tell you which register they are in. The gcc docs tell you most of what you need to know, but are pretty dense. There are also tutorials out there that you can easily find with a web search (here or here)