#include <kernel>
#include <thread>

#include <math>

#ifndef PREEMPTION_RATE
#define PREEMPTION_RATE 10`ms
#endif

Duration default_preemption() {
	return PREEMPTION_RATE;
}

thread worker_t {};

void main(worker_t & this) {
	volatile long long p = 5_021_609ul;
	volatile long long a = 326_417ul;
	volatile long long n = 1l;
	for (volatile long long i = 0; i < p; i++) {
		n *= a;
		n %= p;
	}

	if( n != a ) {
		abort();
	}
}

extern "C" {
static worker_t * workers;
}

int main(int argc, char* argv[]) {
	processor p;
	{
		worker_t w[7];
		workers = w;
	}
}
