Hello so i have a assignment that requires me to make an ASM mix C function. So what i understand is that i have to sub my char either '0' or 48 to get the decimal part. The issue i have is that it always return the address of rdi instead of the value even when i only do mov rax, rdi ; ret. Can someone please help me understand ? Also if you have insight on how to make the atoi function work...
global myitoa
myitoa:
mov rax, 0
mov rsi, rdi
sub rsi, 48
mov rax, rsi
ret
#include <stdio.h>
long long myitoa(char *s);
int main() {
printf("myitoa(\"5\")=%lli\n", myitoa("5")); // 5
the main issue is that i always get the adress back instead of the value