> int xn[100000], yn[100000], rxy[100000], rxy2[100000];
You might want to look up what the default stack size is for threads on your machine.
Because this little lot is approximately 1.6MBytes.
...