I get a segfault from this line of code:
int fatblob[1820][286][5];
Why is that?
Because stack overflows. Try to allocate that array on the heap.