// File: /workspace/github_c_makefile_star2_O3/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 $0x2dc708, %rsp         # imm = 0x2DC708
movl %ecx, 0xc(%rsp)
movq %rdx, %r13
movl %esi, %ebx
movq %rdi, %r14
movslq %esi, %r12
cmpl $0x5, %esi
ja 0x805a2
movl $0xb, %eax
btl %ebx, %eax
jae 0x80545
leaq 0x2fe41(%rip), %rsi     # 0xb0384
jmp 0x8055a
movl $0x30, %eax
btl %ebx, %eax
jae 0x80a72
leaq 0x2fe3c(%rip), %rsi     # 0xb0396
leaq 0x3132a(%rip), %rdx     # 0xb188b
leaq 0x27938(%rip), %rcx     # 0xa7ea0
leaq 0x7a160(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x53802(%rip), %rax     # 0xd3d80
movq (%rax,%r12,8), %r15
leaq 0x25e9b(%rip), %rdx     # 0xa6424
leaq 0x27910(%rip), %rcx     # 0xa7ea0
leaq 0x1e84c0(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
leaq 0x3042a(%rip), %rsi     # 0xb09d3
movl $0x4, %edi
movl $0x5, %edx
callq 0x3a0e1
movq %rax, 0x20(%rsp)
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0x15064
movq %rax, 0x28(%rsp)
leaq 0x14(%rsp), %rsi
movq %r13, %rdi
callq 0x15156
movq %rax, %rbp
leaq 0x303ce(%rip), %rdx     # 0xb09b4
leaq 0x25bbc(%rip), %rcx     # 0xa61a9
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x0, 0xc(%rsp)
je 0x80616
leaq 0x2789b(%rip), %rdx     # 0xa7ea0
leaq 0x25b9d(%rip), %rcx     # 0xa61a9
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
movl 0x1bc(%r13), %r8d
decl %r8d
leaq 0x30692(%rip), %r15     # 0xb0cb9
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7de42
movl 0x14(%rsp), %ecx
testl %ecx, %ecx
jle 0x80780
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
callq 0x7dbeb
cmpl $0x5, %ebx
ja 0x806d4
movl $0xb, %eax
btl %ebx, %eax
jae 0x8067a
leaq 0x2fd0c(%rip), %rsi     # 0xb0384
jmp 0x8068f
movl $0x30, %eax
btl %ebx, %eax
jae 0x80a9e
leaq 0x2fd07(%rip), %rsi     # 0xb0396
leaq 0x301ee(%rip), %rdx     # 0xb0884
leaq 0x30317(%rip), %rcx     # 0xb09b4
leaq 0x40(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x536d0(%rip), %rax     # 0xd3d80
movq (%rax,%r12,8), %r15
leaq 0x30243(%rip), %rdx     # 0xb08fe
leaq 0x305f7(%rip), %rcx     # 0xb0cb9
leaq 0xf4280(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
cmpl $0x0, 0xc(%rsp)
je 0x8072e
leaq 0x302fe(%rip), %rsi     # 0xb09e0
leaq 0x16e3a0(%rsp), %r15
leaq 0xf4280(%rsp), %rdx
leaq 0x7a160(%rsp), %rcx
leaq 0x1e84c0(%rsp), %r8
movq %r15, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x40(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7d316
leaq 0x2777b(%rip), %rdx     # 0xa7ea0
leaq 0x302c9(%rip), %rcx     # 0xb09f5
jmp 0x8073b
leaq 0x40(%rsp), %rdx
leaq 0xf4280(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
leaq 0x30268(%rip), %rdx     # 0xb09b4
leaq 0x3017c(%rip), %rcx     # 0xb08cf
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x3, %ebx
ja 0x80780
cmpl $0x2, %ebx
je 0x80780
leaq 0x2fccb(%rip), %rdi     # 0xb0439
movl $0x7, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movq %rbp, 0x30(%rsp)
movq %r13, 0x18(%rsp)
cmpl $0x0, 0x10(%rsp)
jle 0x8096e
movq 0x18(%rsp), %rax
leaq 0x30f20(%rax), %r15
xorl %ebp, %ebp
movq 0x28(%rsp), %rax
movl (%rax,%rbp,4), %eax
movq 0x20(%rsp), %rdx
movl %eax, (%rdx)
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %ecx
callq 0x7dbeb
movl (%r15), %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x305b2(%rip), %r12     # 0xb0d82
movq %r12, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7e3dc
movl %ebx, %edi
leaq 0x2873f(%rip), %rsi     # 0xa8f28
leaq 0xf4280(%rsp), %rdx
movq %r12, %rcx
leaq 0x2625e0(%rsp), %r12
movq %r12, %r8
callq 0x7df46
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7e093
cmpl $0x0, 0xc(%rsp)
je 0x808d0
movq %r15, 0x38(%rsp)
movl %ebx, %r15d
movq %r14, %rbx
leaq 0x16e3a0(%rsp), %r14
movq %r14, %rdi
leaq 0x301c2(%rip), %rsi     # 0xb09fb
leaq 0x7a160(%rsp), %rdx
leaq 0x1e84c0(%rsp), %r13
movq %r13, %rcx
xorl %eax, %eax
callq 0x41b0
movq %rbx, %rdi
movl %r15d, %esi
leaq 0x40(%rsp), %r12
movq %r12, %rdx
movq %r14, %rcx
callq 0x7d316
movq %rbx, %rdi
movl %r15d, %esi
callq 0x7e1e3
movq %r14, %rdi
leaq 0x30193(%rip), %rsi     # 0xb0a11
leaq 0x7a160(%rsp), %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x41b0
movq %rbx, %rdi
movl %r15d, %esi
movq %r12, %rdx
movq %r14, %rcx
movq %rbx, %r14
movl %r15d, %ebx
movq 0x38(%rsp), %r15
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e23a
movq %r14, %rdi
movl %ebx, %esi
leaq 0x275de(%rip), %rdx     # 0xa7ea0
leaq 0x3012c(%rip), %rcx     # 0xb09f5
callq 0x7d316
jmp 0x80911
movq %r14, %rdi
movl %ebx, %esi
leaq 0x40(%rsp), %r12
movq %r12, %rdx
leaq 0x27c4a(%rip), %rcx     # 0xa852e
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e1e3
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
leaq 0x30313(%rip), %rcx     # 0xb0c15
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e23a
movq %r14, %rdi
movl %ebx, %esi
leaq 0x30097(%rip), %rdx     # 0xb09b4
leaq 0x2ffab(%rip), %rcx     # 0xb08cf
callq 0x7d316
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
cmpl $0x3, %ebx
ja 0x80956
cmpl $0x2, %ebx
je 0x80956
movl $0x7, %esi
movl $0x1, %edx
leaq 0x2faeb(%rip), %rdi     # 0xb0439
movq %r14, %rcx
callq 0x42c0
incq %rbp
movslq 0x10(%rsp), %rax
addq $0x340, %r15            # imm = 0x340
cmpq %rax, %rbp
jl 0x807a3
movq 0x18(%rsp), %r15
movl 0x1407128(%r15), %eax
movq 0x20(%rsp), %rdx
movl %eax, (%rdx)
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %ecx
callq 0x7dbeb
movl 0x1c0(%r15), %edx
decl %edx
leaq 0x30255(%rip), %rsi     # 0xb0bf5
leaq 0x16e3a0(%rsp), %rdi
xorl %eax, %eax
callq 0x41b0
cmpl $0x5, %ebx
ja 0x809dc
movl %ebx, %eax
leaq 0x533c3(%rip), %rcx     # 0xd3d80
movq (%rcx,%rax,8), %rsi
leaq 0x2febc(%rip), %rdx     # 0xb0884
leaq 0x40(%rsp), %rdi
leaq 0x16e3a0(%rsp), %rcx
xorl %eax, %eax
callq 0x41b0
leaq 0x40(%rsp), %rdx
leaq 0xf4280(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x0, 0xc(%rsp)
movq 0x30(%rsp), %r15
je 0x80a17
leaq 0x2749a(%rip), %rdx     # 0xa7ea0
leaq 0x2ffe8(%rip), %rcx     # 0xb09f5
movq %r14, %rdi
movl %ebx, %esi
callq 0x7d316
cmpl $0x3, %ebx
ja 0x80a3a
cmpl $0x2, %ebx
je 0x80a3a
leaq 0x2fa11(%rip), %rdi     # 0xb0439
movl $0x7, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movq %r14, %rdi
movl %ebx, %esi
callq 0x7deaa
movq %r14, %rdi
movl %ebx, %esi
callq 0x7e686
movq 0x28(%rsp), %rdi
callq 0x3a180
movq %r15, %rdi
callq 0x3a180
addq $0x2dc708, %rsp         # imm = 0x2DC708
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2f912(%rip), %r15     # 0xb038b
leaq 0x30e0b(%rip), %rdx     # 0xb188b
leaq 0x27419(%rip), %rcx     # 0xa7ea0
leaq 0x7a160(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
jmp 0x80582
leaq 0x2f8e6(%rip), %r15     # 0xb038b
leaq 0x2fdd8(%rip), %rdx     # 0xb0884
leaq 0x2ff01(%rip), %rcx     # 0xb09b4
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x41b0
jmp 0x806b4