need help understanding the movzbl call in this function

A corresponding C function would be something like

char fn(char * string, int index)
{
    return string[index];
}

Specifically, the movzbl instruction fetches the byte stored at the sum of the two parameters, zero pads it, and stores it into eax. The movsbl instruction takes the lowest byte of eax, sign extends it, and stores the result back in eax.

Leave a Comment