Hacked together a test program in C for troubleshooting purposes, no idea what's broken