// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/savecode.c
// Function: code_realize
void code_realize(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d, int normalize)
{
 /*!Last Changed 01.20.2006 fixed for loop's ending value*/
 /*!Last Changed 24.06.2006*/
 int *symbolic, *numeric, scount, ncount, i, *cases;
 char st[MAXLENGTH], st2[MAXLENGTH], st3[MAXLENGTH], st4[MAXLENGTH], st5[MAXLENGTH];
 code_array_index_variable(st4, language, "mean", "a");  
 code_array_index_variable(st5, language, "variance", "a");  
	cases = safemalloc(sizeof(int), "code_realize", 5);
 symbolic = symbolic_features(d, &scount);
 numeric = numeric_features(d, &ncount);
 code_set_variable(testcodefile, language, "j", "0");
	if (normalize)
   code_set_variable(testcodefile, language, "a", "0");
 code_for(testcodefile, language, "i", 0, d->featurecount - 1, 1);   
 code_switch(testcodefile, language, "i");
	if (ncount > 0)
	 {
  	code_case(testcodefile, language, numeric, ncount);
   code_array_index_variable(st, language, "testdataconverted", "j");  
   code_array_index_variable(st2, language, "testdata", "i");  
	  if (normalize)
			 {
	  	 sprintf(st3, "(%s - %s) / sqrt(%s)", st2, st4, st5);
     code_set_variable(testcodefile, language, st, st3);
     code_set_variable(testcodefile, language, "a", "a + 1");
			 }
	  else
     code_set_variable(testcodefile, language, st, st2);
   code_set_variable(testcodefile, language, "j", "j + 1");
	  code_endcase(testcodefile, language);
	 }
 for (i = 0; i < scount; i++)
	 {
		 cases[0] = symbolic[i];
  	code_case(testcodefile, language, cases, 1);
			code_for(testcodefile, language, "k", 0, d->features[i].valuecount, 1);
			code_if(testcodefile, language, "==", st2, "k");
			if (normalize)
			 {
  		 sprintf(st3, "(1.0 - %s) / sqrt(%s)", st4, st5);
     code_set_variable(testcodefile, language, st, st3);
			 }
			else
     code_set_variable(testcodefile, language, st, "1.0");
			code_else(testcodefile, language);
			if (normalize)
			 {
  		 sprintf(st3, "-%s / sqrt(%s)", st4, st5);
     code_set_variable(testcodefile, language, st, st3);
			 }
			else
     code_set_variable(testcodefile, language, st, "0.0");
			code_endif(testcodefile, language);
   if (normalize)
     code_set_variable(testcodefile, language, "a", "a + 1");
			code_set_variable(testcodefile, language, "j", "j + 1");
			code_endfor(testcodefile, language, "k");
			code_endcase(testcodefile, language);
	 }
	cases[0] = d->classdefno;
	code_case(testcodefile, language, cases, 1);
	sprintf(st3, "%d", d->multifeaturecount - 1);
 code_array_index_variable(st, language, "testdataconverted", st3);  
 code_set_variable(testcodefile, language, st, st2);
	if (normalize)
   code_set_variable(testcodefile, language, "a", "a + 1");
 code_endcase(testcodefile, language);
	code_endswitch(testcodefile, language);
 code_endfor(testcodefile, language, "i");
	safe_free(symbolic);
	safe_free(numeric);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2625e8, %rsp         # imm = 0x2625E8
movl %ecx, %ebp
movq %rdx, %r13
movl %esi, %ebx
movq %rdi, %r14
leaq 0x2c3d4(%rip), %rdx     # 0xa17eb
leaq 0x22a02(%rip), %r15     # 0x97e20
leaq 0x16e3a0(%rsp), %rdi
movq %r15, %rcx
callq 0x7327f
leaq 0x20fef(%rip), %rdx     # 0x96424
leaq 0xf4280(%rsp), %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7327f
leaq 0x2b4e9(%rip), %rsi     # 0xa0937
pushq $0x4
popq %rdi
pushq $0x5
popq %rdx
callq 0x34f59
movq %rax, 0x20(%rsp)
leaq 0x1c(%rsp), %rsi
movq %r13, %rdi
callq 0x13e3f
movq %rax, 0x28(%rsp)
leaq 0x18(%rsp), %rsi
movq %r13, 0x10(%rsp)
movq %r13, %rdi
callq 0x13efa
movq %rax, %r13
leaq 0x2b48c(%rip), %rdx     # 0xa0918
leaq 0x20d1e(%rip), %rcx     # 0x961b1
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b25
movl %ebp, 0xc(%rsp)
testl %ebp, %ebp
je 0x754bd
leaq 0x22974(%rip), %rdx     # 0x97e20
leaq 0x20cfe(%rip), %rcx     # 0x961b1
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b25
movq 0x10(%rsp), %rax
movl 0x1bc(%rax), %r8d
decl %r8d
leaq 0x2b74a(%rip), %r15     # 0xa0c1d
pushq $0x1
popq %r9
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x73938
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x734bf
movl 0x18(%rsp), %ecx
testl %ecx, %ecx
jle 0x755d6
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x732d6
leaq 0x2b2d5(%rip), %rdx     # 0xa07e8
leaq 0x2b3fe(%rip), %rcx     # 0xa0918
leaq 0x7a160(%rsp), %rdi
movl %ebx, %esi
callq 0x7327f
leaq 0x2b332(%rip), %rdx     # 0xa0862
leaq 0x2b6e6(%rip), %rcx     # 0xa0c1d
leaq 0x40(%rsp), %rdi
movl %ebx, %esi
callq 0x7327f
cmpl $0x0, 0xc(%rsp)
je 0x7559d
leaq 0x2b3f3(%rip), %rsi     # 0xa0944
leaq 0x1e84c0(%rsp), %r15
leaq 0x40(%rsp), %rdx
leaq 0x16e3a0(%rsp), %rcx
leaq 0xf4280(%rsp), %r8
movq %r15, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x7a160(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x72b25
leaq 0x2288c(%rip), %rdx     # 0x97e20
leaq 0x2b3be(%rip), %rcx     # 0xa0959
jmp 0x755aa
leaq 0x7a160(%rsp), %rdx
leaq 0x40(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b25
leaq 0x2b35d(%rip), %rdx     # 0xa0918
leaq 0x2b271(%rip), %rcx     # 0xa0833
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x7349f
movq %r13, 0x30(%rsp)
movq 0x10(%rsp), %rax
leaq 0x30f20(%rax), %r13
leaq 0x7a160(%rsp), %r15
xorl %ebp, %ebp
pushq $0x1
popq %r12
movslq 0x1c(%rsp), %rax
cmpq %rax, %rbp
jge 0x75765
movq 0x28(%rsp), %rax
movl (%rax,%rbp,4), %eax
movq 0x20(%rsp), %rdx
movl %eax, (%rdx)
movq %r14, %rdi
movl %ebx, %esi
movl %r12d, %ecx
callq 0x732d6
movq %r13, 0x38(%rsp)
movl (%r13), %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2b6b2(%rip), %r13     # 0xa0ce6
movq %r13, %rdx
xorl %ecx, %ecx
movl %r12d, %r9d
callq 0x73938
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2384b(%rip), %rdx     # 0x98e98
leaq 0x40(%rsp), %rcx
movq %r13, %r8
callq 0x736fc
cmpl $0x0, 0xc(%rsp)
je 0x756ca
leaq 0x1e84c0(%rsp), %r13
movq %r13, %rdi
leaq 0x2b2ec(%rip), %rsi     # 0xa095f
leaq 0x16e3a0(%rsp), %rdx
leaq 0xf4280(%rsp), %rcx
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %r13, %rcx
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x737c1
movq %r13, %rdi
leaq 0x2b2c7(%rip), %rsi     # 0xa0975
leaq 0x16e3a0(%rsp), %rdx
leaq 0xf4280(%rsp), %rcx
xorl %eax, %eax
callq 0x41b0
movq %r13, %rcx
jmp 0x756ef
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
leaq 0x22dd5(%rip), %rcx     # 0x984ae
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x737c1
leaq 0x2b48a(%rip), %rcx     # 0xa0b79
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
cmpl $0x0, 0xc(%rsp)
movq 0x38(%rsp), %r13
je 0x7572a
movq %r14, %rdi
movl %ebx, %esi
leaq 0x22702(%rip), %rdx     # 0x97e20
leaq 0x2b234(%rip), %rcx     # 0xa0959
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2b1e2(%rip), %rdx     # 0xa0918
leaq 0x2b0f6(%rip), %rcx     # 0xa0833
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
movq %r14, %rdi
movl %ebx, %esi
callq 0x7349f
incq %rbp
addq $0x340, %r13            # imm = 0x340
jmp 0x755f5
movq 0x10(%rsp), %r15
movl 0x1407128(%r15), %eax
movq 0x20(%rsp), %rdx
movl %eax, (%rdx)
pushq $0x1
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x732d6
movl 0x1c0(%r15), %edx
decl %edx
leaq 0x2b3c4(%rip), %rsi     # 0xa0b59
leaq 0x1e84c0(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2b03a(%rip), %rdx     # 0xa07e8
leaq 0x7a160(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7327f
leaq 0x40(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x72b25
cmpl $0x0, 0xc(%rsp)
je 0x757f4
leaq 0x2263d(%rip), %rdx     # 0x97e20
leaq 0x2b16f(%rip), %rcx     # 0xa0959
movq %r14, %rdi
movl %ebx, %esi
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x7349f
movq %r14, %rdi
movl %ebx, %esi
callq 0x734fe
movq %r14, %rdi
movl %ebx, %esi
callq 0x73b72
movq 0x28(%rsp), %rdi
callq 0x34ff7
movq 0x30(%rsp), %rdi
callq 0x34ff7
addq $0x2625e8, %rsp         # imm = 0x2625E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq