// File: /workspace/github_c_makefile_star2_O1/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 $0x2dc6f8, %rsp         # imm = 0x2DC6F8
movl %ecx, %ebp
movq %rdx, %r13
movl %esi, %ebx
movq %rdi, %r14
leaq 0x30044(%rip), %rdx     # 0xae7fb
leaq 0x2668a(%rip), %r15     # 0xa4e48
leaq 0x16e390(%rsp), %rdi
movq %r15, %rcx
callq 0x7c24c
leaq 0x24c4f(%rip), %rdx     # 0xa3424
leaq 0xf4270(%rsp), %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7c24c
leaq 0x2f14d(%rip), %rsi     # 0xad93b
movl $0x4, %edi
movl $0x5, %edx
callq 0x390f5
movq %rax, 0x18(%rsp)
leaq 0x4(%rsp), %rsi
movq %r13, %rdi
callq 0x14fc3
movq %rax, 0x20(%rsp)
leaq 0x14(%rsp), %rsi
movq %r13, 0x8(%rsp)
movq %r13, %rdi
callq 0x150b9
movq %rax, %r13
leaq 0x2f0ec(%rip), %rdx     # 0xad91c
leaq 0x24972(%rip), %rcx     # 0xa31a9
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
movl %ebp, (%rsp)
testl %ebp, %ebp
je 0x7e860
leaq 0x265f9(%rip), %rdx     # 0xa4e48
leaq 0x24953(%rip), %rcx     # 0xa31a9
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
movq 0x8(%rsp), %rax
movl 0x1bc(%rax), %r8d
decl %r8d
leaq 0x2f3ab(%rip), %r15     # 0xadc21
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7c4fd
movl 0x14(%rsp), %ecx
testl %ecx, %ecx
jle 0x7e993
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x7c2a3
leaq 0x2ef34(%rip), %rdx     # 0xad7ec
leaq 0x2f05d(%rip), %rcx     # 0xad91c
leaq 0x30(%rsp), %rdi
movl %ebx, %esi
callq 0x7c24c
leaq 0x2ef94(%rip), %rdx     # 0xad866
leaq 0x2f348(%rip), %rcx     # 0xadc21
leaq 0x7a150(%rsp), %rdi
movl %ebx, %esi
callq 0x7c24c
cmpl $0x0, (%rsp)
je 0x7e941
leaq 0x2f053(%rip), %rsi     # 0xad948
leaq 0x1e84b0(%rsp), %r15
leaq 0x7a150(%rsp), %rdx
leaq 0x16e390(%rsp), %rcx
leaq 0xf4270(%rsp), %r8
movq %r15, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x30(%rsp), %rdx
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7ba46
leaq 0x26510(%rip), %rdx     # 0xa4e48
leaq 0x2f01e(%rip), %rcx     # 0xad95d
jmp 0x7e94e
leaq 0x30(%rsp), %rdx
leaq 0x7a150(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
leaq 0x2efbd(%rip), %rdx     # 0xad91c
leaq 0x2eed1(%rip), %rcx     # 0xad837
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
cmpl $0x3, %ebx
ja 0x7e993
cmpl $0x2, %ebx
je 0x7e993
leaq 0x2ea20(%rip), %rdi     # 0xad3a1
movl $0x7, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movq %r13, 0x28(%rsp)
cmpl $0x0, 0x4(%rsp)
jle 0x7eb55
movq 0x8(%rsp), %rax
leaq 0x30f20(%rax), %r15
xorl %ebp, %ebp
movq 0x20(%rsp), %rax
movl (%rax,%rbp,4), %eax
movq 0x18(%rsp), %rdx
movl %eax, (%rdx)
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %ecx
callq 0x7c2a3
movl (%r15), %r8d
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2f30c(%rip), %r12     # 0xadcea
movq %r12, %rdx
xorl %ecx, %ecx
movl $0x1, %r9d
callq 0x7ca9f
movl %ebx, %edi
leaq 0x27501(%rip), %rsi     # 0xa5ef8
leaq 0x7a150(%rsp), %rdx
movq %r12, %rcx
leaq 0x2625d0(%rsp), %r12
movq %r12, %r8
callq 0x7c601
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7c75c
cmpl $0x0, (%rsp)
je 0x7ea99
movq %r14, %r13
leaq 0x1e84b0(%rsp), %r14
movq %r14, %rdi
leaq 0x2ef29(%rip), %rsi     # 0xad963
leaq 0x16e390(%rsp), %rdx
leaq 0xf4270(%rsp), %rcx
xorl %eax, %eax
callq 0x41b0
movq %r13, %rdi
movl %ebx, %esi
leaq 0x30(%rsp), %r12
movq %r12, %rdx
movq %r14, %rcx
callq 0x7ba46
movq %r13, %rdi
movl %ebx, %esi
callq 0x7c8ac
movq %r14, %rdi
leaq 0x2eeff(%rip), %rsi     # 0xad979
leaq 0x16e390(%rsp), %rdx
leaq 0xf4270(%rsp), %rcx
xorl %eax, %eax
callq 0x41b0
movq %r14, %rcx
movq %r13, %r14
jmp 0x7eac3
movq %r14, %rdi
movl %ebx, %esi
leaq 0x30(%rsp), %r12
movq %r12, %rdx
leaq 0x26a29(%rip), %rcx     # 0xa54d6
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c8ac
leaq 0x2f0ba(%rip), %rcx     # 0xadb7d
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c903
cmpl $0x0, (%rsp)
je 0x7eaf8
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2635c(%rip), %rdx     # 0xa4e48
leaq 0x2ee6a(%rip), %rcx     # 0xad95d
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2ee18(%rip), %rdx     # 0xad91c
leaq 0x2ed2c(%rip), %rcx     # 0xad837
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
cmpl $0x3, %ebx
ja 0x7eb3d
cmpl $0x2, %ebx
je 0x7eb3d
movl $0x7, %esi
movl $0x1, %edx
leaq 0x2e86c(%rip), %rdi     # 0xad3a1
movq %r14, %rcx
callq 0x42c0
incq %rbp
movslq 0x4(%rsp), %rax
addq $0x340, %r15            # imm = 0x340
cmpq %rax, %rbp
jl 0x7e9b1
movq 0x8(%rsp), %r15
movl 0x1407128(%r15), %eax
movq 0x18(%rsp), %rdx
movl %eax, (%rdx)
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %ecx
callq 0x7c2a3
movl 0x1c0(%r15), %edx
decl %edx
leaq 0x2efd6(%rip), %rsi     # 0xadb5d
leaq 0x1e84b0(%rsp), %r15
movq %r15, %rdi
xorl %eax, %eax
callq 0x41b0
leaq 0x2ec4c(%rip), %rdx     # 0xad7ec
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7c24c
leaq 0x7a150(%rsp), %rcx
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7ba46
cmpl $0x0, (%rsp)
je 0x7ebe5
leaq 0x26274(%rip), %rdx     # 0xa4e48
leaq 0x2ed82(%rip), %rcx     # 0xad95d
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
cmpl $0x3, %ebx
movq 0x28(%rsp), %r15
ja 0x7ec0d
cmpl $0x2, %ebx
je 0x7ec0d
leaq 0x2e7a6(%rip), %rdi     # 0xad3a1
movl $0x7, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c565
movq %r14, %rdi
movl %ebx, %esi
callq 0x7cd49
movq 0x20(%rsp), %rdi
callq 0x39194
movq %r15, %rdi
callq 0x39194
addq $0x2dc6f8, %rsp         # imm = 0x2DC6F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq