I got access to Copilot technical preview earlier today, here's the completion you wanted to try:
// Computes the index of them item.
map_index(int item, int *array, int size)
{
int i;
for (i = 0; i < size; i++)
{
if (array[i] == item)
{
return i;
}
}
return -1;
}