This moves table:
int moves_table[2][8] = { { 1, 2, 2, 1, -1, -2, -1, -1 },
{ -2, -1, 1, 2, -1, -2, -2, -1 } };
looks very odd. You have -1,-1 appearing twice, and -2,-2.
Perhaps it would work better with:
int moves_table[2][8] = { { 1, 2, 2, 1, -1, -2, -2, -1 },
{ -2, -1, 1, 2, -2, -1, 1, 2 } };