I have problem with understanding loops in asm. I'm trying to change value at index to '1' but i don't know how to increment %0 by x, currently x is 4 in code, but i dont know how to automatise this, to program to be able to read value of 'x' from register. I made some misconception then sorry but there is really not much in internet about GCC asm and i know i shouldn't do this but i just want to understand how this work
#include <stdio.h>
int main(void)
{
const int size = 20;
int index = 8;
int arr[size]= {};
__asm__(
"movl $1, %%eax;"
//"add $8, %%SP;"
"movl %%eax, 4%0;"
: "+m"(*(arr))
: "r"(size)
: "memory"
);
for (int i = 0; i < 20; i++)
{
printf("%d \n", arr[i]);
}
return 0;
}