GNU Assembler Code for Adding Two Numbers

The following is a simple example of adding two numbers using GNU Assembler syntax.

        .section .text, rwx
        .global _start
       ._start:
            mov $1, %rax
            mov $2, %rdx
            mov %rax, %r1
            add %rdx, %r1
            mov %r1, %rax
            mov $1, %rax
            ret
        
Output: 0