1.text
2.globl _asm_add
3
4_asm_add:
5 # Simple function to add two integers
6 # On macOS x86_64: first arg in %edi, second in %esi
7 # On macOS ARM64: first arg in w0, second in w1
8#ifdef __aarch64__
9 add w0, w0, w1
10 ret
11#else
12 movl %edi, %eax
13 addl %esi, %eax
14 ret
15#endif