// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/savecode.c
// Function: code_decisionnode
void code_decisionnode(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, char* algorithm, char* arrayname, Datasetptr d, Decisionnodeptr m, int level)
{
 /*!Last Changed 24.06.2006 added linear model*/
 /*!Last Changed 14.06.2006*/
 int i, *cases;
 char st[MAXLENGTH], st2[MAXLENGTH], st3[MAXLENGTH], operand1[MAXLENGTH], operand2[MAXLENGTH];
 if (m->featureno != LEAF_NODE)
  {
		 if (m->featureno >= 0)
			 {
     if (d->features[m->featureno].type == STRING)
					 {
       cases = safemalloc(sizeof(int), "code_decisionnode", 3);
       code_array_index(st, language, arrayname, m->featureno);
       code_switch(testcodefile, language, st);
       for (i = 0; i < d->features[m->featureno].valuecount; i++)
							 {
         cases[0] = i;
         code_case(testcodefile, language, cases, 1);
         code_decisionnode(testcodefile, language, algorithm, arrayname, d, &(m->string[i]), level + 1);
         code_endcase(testcodefile, language);
							 }
       code_endswitch(testcodefile, language);
       safe_free(cases);
					 }
     else
					 {
       code_array_index(st, language, arrayname, m->featureno);
       sprintf(st2, "%.6f", m->split);
       code_if(testcodefile, language, "<=", st, st2); 
       code_decisionnode(testcodefile, language, algorithm, arrayname, d, m->left, level + 1);
       code_else(testcodefile, language);
       code_decisionnode(testcodefile, language, algorithm, arrayname, d, m->right, level + 1);
       code_endif(testcodefile, language);
					 }
			 }
			else
     if (m->featureno == LINEAR)
					 {
       sprintf(operand2, "%.6f", m->w0);
       sprintf(st2, "%d", 0);
       code_array_index_variable(st3, language, "testdataconverted", st2);
       sprintf(operand1, "%.6f * %s", m->w.values[0][0], st3);
       for (i = 1; i < d->multifeaturecount - 1; i++)
							 {
         sprintf(st2, "%d", i);
         code_array_index_variable(st3, language, "testdataconverted", st2);
         sprintf(operand1, "%s + %.6f * %s", operand1, m->w.values[0][i], st3);
							 }     
       code_if(testcodefile, language, "<=", operand1, operand2); 
       code_decisionnode(testcodefile, language, algorithm, arrayname, d, m->left, level + 1);
       code_else(testcodefile, language);
       code_decisionnode(testcodefile, language, algorithm, arrayname, d, m->right, level + 1);
       code_endif(testcodefile, language);
					 }
	 }
 else
   code_function_return_classification(testcodefile, algorithm, language, m->classno);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e84c8, %rsp         # imm = 0x1E84C8
movq %r9, %r14
movq %rcx, 0x10(%rsp)
movl %esi, %ebx
movq %rdi, %rbp
movl 0x30(%r9), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rcx
je 0x7f91e
movq %r8, %r12
movl 0x1e8500(%rsp), %eax
movl %eax, 0xc(%rsp)
testl %ecx, %ecx
js 0x7f940
movq %rdx, 0x18(%rsp)
imulq $0x340, %rcx, %rax      # imm = 0x340
cmpl $0x1, 0x30f08(%r12,%rax)
jne 0x7faf2
movq %r12, 0x38(%rsp)
leaq 0x30f08(%r12), %r15
leaq 0x310eb(%rip), %rsi     # 0xb08ec
movl $0x4, %edi
movl $0x3, %edx
callq 0x3a0e1
movq %rax, 0x28(%rsp)
movl 0x30(%r14), %ecx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq 0x10(%rsp), %rdx
callq 0x7db6a
movq %rbp, 0x20(%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq %r12, %rdx
callq 0x7de42
movslq 0x30(%r14), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movq %r15, 0x30(%rsp)
cmpl $0x0, 0x18(%r15,%rax)
jle 0x7f903
incl 0xc(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq 0x28(%rsp), %rdx
movl %r13d, (%rdx)
movl %ebx, %ebp
movq %r14, %rbx
movq 0x20(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
movl $0x1, %ecx
callq 0x7dbeb
movq %rbx, %r12
movq 0x10(%rbx), %r9
movl %ebp, %ebx
addq %r15, %r9
movl 0xc(%rsp), %eax
movl %eax, (%rsp)
movq %r14, %rdi
movl %ebp, %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x38(%rsp), %r8
callq 0x7f78c
cmpl $0x3, %ebp
ja 0x7f8d7
cmpl $0x2, %ebx
je 0x7f8d7
movl $0x7, %esi
movl $0x1, %edx
leaq 0x30b6c(%rip), %rdi     # 0xb0439
movq 0x20(%rsp), %rcx
callq 0x42c0
incq %r13
movq %r12, %r14
movslq 0x30(%r12), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movq 0x30(%rsp), %rcx
movslq 0x18(%rcx,%rax), %rax
addq $0x160, %r15            # imm = 0x160
cmpq %rax, %r13
jl 0x7f865
movq 0x20(%rsp), %rdi
movl %ebx, %esi
callq 0x7deaa
movq 0x28(%rsp), %rdi
callq 0x3a180
jmp 0x7fb96
movl 0x34(%r14), %ecx
movq %rbp, %rdi
movq %rdx, %rsi
movl %ebx, %edx
addq $0x1e84c8, %rsp         # imm = 0x1E84C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7d813
cmpl $-0x2, %ecx
jne 0x7fb96
movq %rdx, 0x18(%rsp)
movsd 0x48(%r14), %xmm0
leaq 0x308ef(%rip), %rsi     # 0xb024a
leaq 0x16e3a0(%rsp), %rdi
movb $0x1, %al
callq 0x41b0
leaq 0x31284(%rip), %rsi     # 0xb0bf5
leaq 0x7a160(%rsp), %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x41b0
cmpl $0x5, %ebx
ja 0x7f9af
movl %ebx, %eax
leaq 0x543f0(%rip), %rcx     # 0xd3d80
movq (%rcx,%rax,8), %rsi
leaq 0x30ee9(%rip), %rdx     # 0xb0884
leaq 0x40(%rsp), %rdi
leaq 0x7a160(%rsp), %rcx
xorl %eax, %eax
callq 0x41b0
movq 0x40(%r14), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
leaq 0x30f21(%rip), %rsi     # 0xb08e2
leaq 0xf4280(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movb $0x1, %al
callq 0x41b0
movq %r12, %r15
cmpl $0x3, 0x1c0(%r12)
jl 0x7fa81
movl %ebx, %eax
movq %rax, 0x20(%rsp)
movl $0x1, %r12d
leaq 0xf4280(%rsp), %r13
leaq 0x7a160(%rsp), %rdi
leaq 0x311ea(%rip), %rsi     # 0xb0bf5
movl %r12d, %edx
xorl %eax, %eax
callq 0x41b0
cmpl $0x5, %ebx
ja 0x7fa45
movq 0x20(%rsp), %rax
leaq 0x5435a(%rip), %rcx     # 0xd3d80
movq (%rcx,%rax,8), %rsi
leaq 0x40(%rsp), %rdi
leaq 0x30e4e(%rip), %rdx     # 0xb0884
leaq 0x7a160(%rsp), %rcx
xorl %eax, %eax
callq 0x41b0
movq 0x40(%r14), %rax
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
movq %r13, %rdi
leaq 0x30e81(%rip), %rsi     # 0xb08dd
movq %r13, %rdx
leaq 0x40(%rsp), %rcx
movb $0x1, %al
callq 0x41b0
incq %r12
movslq 0x1c0(%r15), %rax
decq %rax
cmpq %rax, %r12
jl 0x7f9fc
leaq 0x2949a(%rip), %rdx     # 0xa8f22
leaq 0xf4280(%rsp), %rcx
leaq 0x16e3a0(%rsp), %r8
movq %rbp, %rdi
movl %ebx, %esi
callq 0x7e0fa
movq (%r14), %r9
movl 0xc(%rsp), %r12d
incl %r12d
movl %r12d, (%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %r13
movq %r13, %rcx
movq %r15, %r8
callq 0x7f78c
movq %rbp, %rdi
movl %ebx, %esi
callq 0x7e1e3
movq 0x8(%r14), %r9
movl %r12d, (%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %rdx
movq %r13, %rcx
movq %r15, %r8
jmp 0x7fb87
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movl %ebx, %esi
movq 0x10(%rsp), %rdx
callq 0x7db6a
movsd 0x28(%r14), %xmm0
leaq 0x30737(%rip), %rsi     # 0xb024a
leaq 0x7a160(%rsp), %r15
movq %r15, %rdi
movb $0x1, %al
callq 0x41b0
leaq 0x293f6(%rip), %rdx     # 0xa8f22
movq %rbp, %rdi
movl %ebx, %esi
movq %r13, %rcx
movq %r15, %r8
callq 0x7e0fa
movq (%r14), %r9
movl 0xc(%rsp), %r13d
incl %r13d
movl %r13d, (%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %r15
movq %r15, %rdx
movq 0x10(%rsp), %rcx
movq %r12, %r8
callq 0x7f78c
movq %rbp, %rdi
movl %ebx, %esi
callq 0x7e1e3
movq 0x8(%r14), %r9
movl %r13d, (%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq 0x10(%rsp), %rcx
movq %r12, %r8
callq 0x7f78c
movq %rbp, %rdi
movl %ebx, %esi
callq 0x7e23a
addq $0x1e84c8, %rsp         # imm = 0x1E84C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq