#include <stdio.h>
#include <math.h>
main(int argc, char **argv){
	int i,j,k;
	j=1<<atoi(argv[1]);
	k=1<<atoi(argv[2]);
	printf("#define TABSIZE %d\n",j);
	printf("#define TABMAG %d\n",k);
	printf("int sintab[%d]={",j);
	for(i=0;i<j;i++) {
		if(i%8==0) fputs("\n\t",stdout);
		printf("%8d",(int)(sin(i*M_PI*2.0/j)*(k)));
		if(i!=(j-1)) putchar(',');
	}
	printf("\n};\n\n#define SIN(x) (sintab[(x)&%d])\n#define COS(x) SIN(x+%d)\n\n",j-1,j/4);
	return 0;
}
