The 'g_APinDescription' table is indexed by ARDUINO pin number so for Arduino Pin 51 you would use 51, not 12:
bool myState = !!(g_APinDescription[51].pPort->PIO_PDSR & g_APinDescription[51].ulPin);
And I already gave you the contents of that table entry (above) so you can avoid the two look-ups:
bool myState = !!(PIOC->PIO_PDSR & PIO_PC12);