Пример #1
0
int main(int argc, char** args){
	int64_t* max;
	int64_t n;
	_DECL_1DARRAY(coins);
	int64_t i;
	_DECL_1DARRAY(moves);
	int64_t sum_alice;
	int64_t* _7;
	_DECL_2DARRAY(_8);
	int64_t _9;
	_DECL_1DARRAY(_10);
	int64_t _11;
	_DECL_1DARRAY(_12);
	int64_t _13;
	int64_t _14;
	int64_t _15;
	int64_t _16;
	int64_t _17;
	int64_t _18;
	int64_t _19;
	int64_t _20;
	int64_t _21;
	int64_t _22;
	int64_t _23;
	_DECL_1DARRAY(_24);
	_DECL_1DARRAY(_25);
	int64_t _26;
	int64_t _27;
	int64_t _28;
	void* _29;
	_DECL_1DARRAY(_31);
	void* _32;
	void* _34;
	_DECL_1DARRAY(_36);
	//fieldload %8 = %0 args : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	_CONV_ARGS(_8);
	//const %9 = 0 : int
	_9 = 0;
	//indexof %10 = %8, %9 : int[][]
	_10=_8[_9];
	_10_size = _8_size_size;
	//invoke (%7) = (%10) whiley/lang/Int:parse : function(whiley/lang/ASCII:string)->(null|int)
	{
		_STR_TO_INT(_7, _10);
	}
	//assign %1 = %7  : null|int
	_NEW_INTEGER_POINTER(max, _7);
	//ifis %1, null goto blklab4 : null|int
	if(max == NULL) { goto blklab4;}
	//assign %2 = %1  : int
	n = *max;
	//const %11 = 0 : int
	_11 = 0;
	//arraygen %12 = [11; 2] : int[]
	_NEW_1DARRAY_int64_t(_12, n, _11);
	//assign %3 = %12  : int[]
	_COPY_1DARRAY_int64_t(coins, _12);
	//const %13 = 0 : int
	_13 = 0;
	//assign %4 = %13  : int
	i = _13;
	//loop (%3, %4, %14, %15, %16, %17)
	while(true){
		//ifge %4, %2 goto blklab5 : int
		if(i>=n){goto blklab5;}
		//const %14 = 5 : int
		_14 = 5;
		//rem %15 = %4, %14 : int
		_15=i%_14;
		//update %3[%4] = %15 : int[] -> int[]
		coins[i] = _15;
		//const %16 = 1 : int
		_16 = 1;
		//add %17 = %4, %16 : int
		_17=i+_16;
		//assign %4 = %17  : int
		i = _17;
//.blklab6
blklab6:;
	}
//.blklab5
blklab5:;
	//const %18 = 0 : int
	_18 = 0;
	//const %19 = 2 : int
	_19 = 2;
	//add %20 = %2, %19 : int
	_20=n+_19;
	//const %21 = 2 : int
	_21 = 2;
	//add %22 = %2, %21 : int
	_22=n+_21;
	//mul %23 = %20, %22 : int
	_23=_20*_22;
	//arraygen %24 = [18; 23] : int[]
	_NEW_1DARRAY_int64_t(_24, _23, _18);
	//assign %5 = %24  : int[]
	_COPY_1DARRAY_int64_t(moves, _24);
	//invoke (%25) = (%5, %2, %3) CoinGame_original:findMoves : function(int[],int,int[])->(int[])
	{
		void* tmp_moves;
		_COPY_1DARRAY_PARAM(moves, tmp_moves, int64_t);
		void* tmp_coins;
		_COPY_1DARRAY_PARAM(coins, tmp_coins, int64_t);
		_25 = _findMoves_(tmp_moves, moves_size, n, tmp_coins, coins_size, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_25));
	}
	//assign %5 = %25  : int[]
	_COPY_1DARRAY_int64_t(moves, _25);
	//const %26 = 1 : int
	_26 = 1;
	//sub %27 = %2, %26 : int
	_27=n-_26;
	//indexof %28 = %5, %27 : int[]
	_28=moves[_27];
	//assign %6 = %28  : int
	sum_alice = _28;
	//fieldload %29 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %30 = %29 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//const %31 = [84,104,101,32,116,111,116,97,108,32,97,109,111,117,110,116,32,111,102,32,109,111,110,101,121,32,40,109,97,120,105,109,117,109,41,32,65,108,105,99,101,32,103,101,116,115,32,105,115,32] : int[]
	_NEW_1DARRAY_int64_t(_31, 50, 0);
	_31[0] = 84; _31[1] = 104; _31[2] = 101; _31[3] = 32; _31[4] = 116; _31[5] = 111; _31[6] = 116; _31[7] = 97; _31[8] = 108; _31[9] = 32; _31[10] = 97; _31[11] = 109; _31[12] = 111; _31[13] = 117; _31[14] = 110; _31[15] = 116; _31[16] = 32; _31[17] = 111; _31[18] = 102; _31[19] = 32; _31[20] = 109; _31[21] = 111; _31[22] = 110; _31[23] = 101; _31[24] = 121; _31[25] = 32; _31[26] = 40; _31[27] = 109; _31[28] = 97; _31[29] = 120; _31[30] = 105; _31[31] = 109; _31[32] = 117; _31[33] = 109; _31[34] = 41; _31[35] = 32; _31[36] = 65; _31[37] = 108; _31[38] = 105; _31[39] = 99; _31[40] = 101; _31[41] = 32; _31[42] = 103; _31[43] = 101; _31[44] = 116; _31[45] = 115; _31[46] = 32; _31[47] = 105; _31[48] = 115; _31[49] = 32; 
	//indirectinvoke () = %30 (%31) : method(int[])->()
	{
		printf_s(_31, _31_size);
	}
	//fieldload %32 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %33 = %32 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//indirectinvoke () = %33 (%6) : method(any)->()
	{
		printf("%"PRId64"\n", sum_alice);
	}
	//fieldload %34 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %35 = %34 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//const %36 = [80,97,115,115,32,67,111,105,110,71,97,109,101,32,116,101,115,116,32,99,97,115,101] : int[]
	_NEW_1DARRAY_int64_t(_36, 23, 0);
	_36[0] = 80; _36[1] = 97; _36[2] = 115; _36[3] = 115; _36[4] = 32; _36[5] = 67; _36[6] = 111; _36[7] = 105; _36[8] = 110; _36[9] = 71; _36[10] = 97; _36[11] = 109; _36[12] = 101; _36[13] = 32; _36[14] = 116; _36[15] = 101; _36[16] = 115; _36[17] = 116; _36[18] = 32; _36[19] = 99; _36[20] = 97; _36[21] = 115; _36[22] = 101; 
	//indirectinvoke () = %35 (%36) : method(int[])->()
	{
		println_s(_36, _36_size);
	}
//.blklab4
blklab4:;
	//return
	exit(0);
}
Пример #2
0
int main(int argc, char** args){
	int64_t n;
	_DECL_1DARRAY(moves);
	int64_t sum_alice;
	int64_t _4;
	int64_t _5;
	int64_t _6;
	_DECL_1DARRAY(_7);
	_DECL_1DARRAY(_8);
	int64_t _9;
	int64_t _10;
	int64_t _11;
	int64_t _12;
	void* _13;
	_DECL_1DARRAY(_15);
	void* _16;
	void* _18;
	_DECL_1DARRAY(_20);
	//const %4 = 10 : int
	_4 = 10;
	//assign %1 = %4  : int
	n = _4;
	//const %5 = 0 : int
	_5 = 0;
	//mul %6 = %1, %1 : int
	_6=n*n;
	//arraygen %7 = [5; 6] : int[]
	_NEW_1DARRAY_int64_t(_7, _6, _5);
	//assign %2 = %7  : int[]
	_COPY_1DARRAY_int64_t(moves, _7);
	//invoke (%8) = (%2, %1) CoinGame2:findMoves : function(int[],int)->(int[])
	{
		void* tmp_moves;
		_COPY_1DARRAY_PARAM(moves, tmp_moves, int64_t);
		_8 = _findMoves_(tmp_moves, moves_size, n, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_8));
	}
	//assign %2 = %8  : int[]
	_COPY_1DARRAY_int64_t(moves, _8);
	//const %9 = 1 : int
	_9 = 1;
	//sub %10 = %1, %9 : int
	_10=n-_9;
	//indexof %11 = %2, %10 : int[]
	_11=moves[_10];
	//assign %3 = %11  : int
	sum_alice = _11;
	//assert
	{
		//const %12 = 25 : int
		_12 = 25;
		//ifeq %3, %12 goto blklab11 : int
		if(sum_alice==_12){goto blklab11;}
		//fail
		fprintf(stderr,"fail");
		exit(-1);
//.blklab11
blklab11:;
	//assert
	}
	//fieldload %13 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %14 = %13 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//const %15 = [84,104,101,32,116,111,116,97,108,32,97,109,111,117,110,116,32,111,102,32,109,111,110,101,121,32,40,109,97,120,105,109,117,109,41,32,65,108,105,99,101,32,103,101,116,115,32,105,115,32] : int[]
	_NEW_1DARRAY_int64_t(_15, 50, 0);
	_15[0] = 84; _15[1] = 104; _15[2] = 101; _15[3] = 32; _15[4] = 116; _15[5] = 111; _15[6] = 116; _15[7] = 97; _15[8] = 108; _15[9] = 32; _15[10] = 97; _15[11] = 109; _15[12] = 111; _15[13] = 117; _15[14] = 110; _15[15] = 116; _15[16] = 32; _15[17] = 111; _15[18] = 102; _15[19] = 32; _15[20] = 109; _15[21] = 111; _15[22] = 110; _15[23] = 101; _15[24] = 121; _15[25] = 32; _15[26] = 40; _15[27] = 109; _15[28] = 97; _15[29] = 120; _15[30] = 105; _15[31] = 109; _15[32] = 117; _15[33] = 109; _15[34] = 41; _15[35] = 32; _15[36] = 65; _15[37] = 108; _15[38] = 105; _15[39] = 99; _15[40] = 101; _15[41] = 32; _15[42] = 103; _15[43] = 101; _15[44] = 116; _15[45] = 115; _15[46] = 32; _15[47] = 105; _15[48] = 115; _15[49] = 32; 
	//indirectinvoke () = %14 (%15) : method(int[])->()
	{
		printf_s(_15, _15_size);
	}
	//fieldload %16 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %17 = %16 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//indirectinvoke () = %17 (%3) : method(any)->()
	{
		printf("%"PRId64"\n", sum_alice);
	}
	//fieldload %18 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %19 = %18 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//const %20 = [80,97,115,115,32,67,111,105,110,71,97,109,101,32,116,101,115,116,32,99,97,115,101] : int[]
	_NEW_1DARRAY_int64_t(_20, 23, 0);
	_20[0] = 80; _20[1] = 97; _20[2] = 115; _20[3] = 115; _20[4] = 32; _20[5] = 67; _20[6] = 111; _20[7] = 105; _20[8] = 110; _20[9] = 71; _20[10] = 97; _20[11] = 109; _20[12] = 101; _20[13] = 32; _20[14] = 116; _20[15] = 101; _20[16] = 115; _20[17] = 116; _20[18] = 32; _20[19] = 99; _20[20] = 97; _20[21] = 115; _20[22] = 101; 
	//indirectinvoke () = %19 (%20) : method(int[])->()
	{
		println_s(_20, _20_size);
	}
	//return
	exit(0);
}
Пример #3
0
int main(int argc, char** args){
	int64_t* max;
	_DECL_DEALLOC(max);
	int64_t n = 0;
	_DECL_1DARRAY(moves);
	_DECL_DEALLOC(moves);
	int64_t sum_alice = 0;
	int64_t* _5;
	_DECL_DEALLOC(_5);
	_DECL_2DARRAY(_6);
	_DECL_DEALLOC(_6);
	int64_t _7 = 0;
	_DECL_1DARRAY(_8);
	_DECL_DEALLOC(_8);
	int64_t _9 = 0;
	int64_t _10 = 0;
	int64_t _11 = 0;
	int64_t _12 = 0;
	int64_t _13 = 0;
	int64_t _14 = 0;
	_DECL_1DARRAY(_15);
	_DECL_DEALLOC(_15);
	_DECL_1DARRAY(_16);
	_DECL_DEALLOC(_16);
	int64_t _17 = 0;
	int64_t _18 = 0;
	int64_t _19 = 0;
	void* _20;
	_DECL_1DARRAY(_22);
	_DECL_DEALLOC(_22);
	void* _23;
	void* _25;
	_DECL_1DARRAY(_27);
	_DECL_DEALLOC(_27);
	//fieldload %6 = %0 args : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	_DEALLOC_2DARRAY_int64_t(_6);
	_CONV_ARGS(_6);
	_ADD_DEALLOC(_6);
	//const %7 = 0 : int
	_7 = 0;
	//indexof %8 = %6, %7 : int[][]
	_8=_6[_7];
	_8_size = _6_size_size;
	_REMOVE_DEALLOC(_8);
	//invoke (%5) = (%8) whiley/lang/Int:parse : function(whiley/lang/ASCII:string)->(null|int)
	{
		_STR_TO_INT(_5, _8);
		_ADD_DEALLOC(_5);
		_REMOVE_DEALLOC(_8);
	}
	//assign %1 = %5  : null|int
	_DEALLOC(max);
	// isCopyEliminated = true
	max = _5;
	_TRANSFER_DEALLOC(max, _5);
	//ifis %1, null goto blklab4 : null|int
	if(max == NULL) { goto blklab4;}
	//assign %2 = %1  : int
	// isCopyEliminated = true
	n = *max;
	//const %9 = 0 : int
	_9 = 0;
	//const %10 = 2 : int
	_10 = 2;
	//add %11 = %2, %10 : int
	_11=n+_10;
	//const %12 = 2 : int
	_12 = 2;
	//add %13 = %2, %12 : int
	_13=n+_12;
	//mul %14 = %11, %13 : int
	_14=_11*_13;
	//arraygen %15 = [9; 14] : int[]
	_DEALLOC(_15);
	_NEW_1DARRAY_int64_t(_15, _14, _9);
	_ADD_DEALLOC(_15);
	//assign %3 = %15  : int[]
	_DEALLOC(moves);
	// isCopyEliminated = true
	_UPDATE_1DARRAY(moves, _15);
	_TRANSFER_DEALLOC(moves, _15);
	//invoke (%16) = (%3, %2) CoinGame_original:findMoves : function(int[],int)->(int[])
	{
		_DEALLOC(_16);
		// isCopyEliminated of '_3' = true
		_16 = _findMoves_(_1DARRAY_PARAM(moves), false, n, _1DARRAYSIZE_PARAM_CALLBYREFERENCE(_16));
		_RESET_DEALLOC(moves, "true-true-false" , "findMoves");
		_ADD_DEALLOC(_16);
	}
	//assign %3 = %16  : int[]
	_DEALLOC(moves);
	// isCopyEliminated = true
	_UPDATE_1DARRAY(moves, _16);
	_TRANSFER_DEALLOC(moves, _16);
	//const %17 = 1 : int
	_17 = 1;
	//sub %18 = %2, %17 : int
	_18=n-_17;
	//indexof %19 = %3, %18 : int[]
	_19=moves[_18];
	//assign %4 = %19  : int
	// isCopyEliminated = true
	sum_alice = _19;
	//fieldload %20 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %21 = %20 print_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//const %22 = [84,104,101,32,116,111,116,97,108,32,97,109,111,117,110,116,32,111,102,32,109,111,110,101,121,32,40,109,97,120,105,109,117,109,41,32,65,108,105,99,101,32,103,101,116,115,32,105,115,32] : int[]
	_DEALLOC(_22);
	_NEW_1DARRAY_int64_t(_22, 50, 0);
	_22[0] = 84; _22[1] = 104; _22[2] = 101; _22[3] = 32; _22[4] = 116; _22[5] = 111; _22[6] = 116; _22[7] = 97; _22[8] = 108; _22[9] = 32; _22[10] = 97; _22[11] = 109; _22[12] = 111; _22[13] = 117; _22[14] = 110; _22[15] = 116; _22[16] = 32; _22[17] = 111; _22[18] = 102; _22[19] = 32; _22[20] = 109; _22[21] = 111; _22[22] = 110; _22[23] = 101; _22[24] = 121; _22[25] = 32; _22[26] = 40; _22[27] = 109; _22[28] = 97; _22[29] = 120; _22[30] = 105; _22[31] = 109; _22[32] = 117; _22[33] = 109; _22[34] = 41; _22[35] = 32; _22[36] = 65; _22[37] = 108; _22[38] = 105; _22[39] = 99; _22[40] = 101; _22[41] = 32; _22[42] = 103; _22[43] = 101; _22[44] = 116; _22[45] = 115; _22[46] = 32; _22[47] = 105; _22[48] = 115; _22[49] = 32;
	_ADD_DEALLOC(_22);
	//indirectinvoke () = %21 (%22) : method(int[])->()
	{
		printf_s(_1DARRAY_PARAM(_22));
	}
	//fieldload %23 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %24 = %23 println : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//indirectinvoke () = %24 (%4) : method(any)->()
	{
		printf("%"PRId64"\n", sum_alice);
	}
	//fieldload %25 = %0 out : {int[][] args,{method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s} out}
	//fieldload %26 = %25 println_s : {method(any)->() print,method(int[])->() print_s,method(any)->() println,method(int[])->() println_s}
	//const %27 = [80,97,115,115,32,67,111,105,110,71,97,109,101,32,116,101,115,116,32,99,97,115,101] : int[]
	_DEALLOC(_27);
	_NEW_1DARRAY_int64_t(_27, 23, 0);
	_27[0] = 80; _27[1] = 97; _27[2] = 115; _27[3] = 115; _27[4] = 32; _27[5] = 67; _27[6] = 111; _27[7] = 105; _27[8] = 110; _27[9] = 71; _27[10] = 97; _27[11] = 109; _27[12] = 101; _27[13] = 32; _27[14] = 116; _27[15] = 101; _27[16] = 115; _27[17] = 116; _27[18] = 32; _27[19] = 99; _27[20] = 97; _27[21] = 115; _27[22] = 101;
	_ADD_DEALLOC(_27);
	//indirectinvoke () = %26 (%27) : method(int[])->()
	{
		println_s(_27, _27_size);
	}
//.blklab4
blklab4:;
	//return
	_DEALLOC(max);
	_DEALLOC(moves);
	_DEALLOC(_5);
	_DEALLOC_2DARRAY_int64_t(_6);
	_DEALLOC(_8);
	_DEALLOC(_15);
	_DEALLOC(_16);
	_DEALLOC(_22);
	_DEALLOC(_27);
	exit(0);
}