// File: /workspace/github_c_makefile_star2_O1/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 0x7dd14
movq %r8, %r13
movl 0x1e8500(%rsp), %eax
movl %eax, 0xc(%rsp)
testl %ecx, %ecx
js 0x7dd36
movq %rdx, 0x18(%rsp)
imulq $0x340, %rcx, %rax      # imm = 0x340
cmpl $0x1, 0x30f08(%r13,%rax)
jne 0x7decd
movq %r13, 0x28(%rsp)
leaq 0x30f08(%r13), %r15
leaq 0x2fc5d(%rip), %rsi     # 0xad854
movl $0x4, %edi
movl $0x3, %edx
callq 0x390f5
movq %rax, 0x30(%rsp)
movl 0x30(%r14), %ecx
leaq 0x40(%rsp), %r13
movq %r13, %rdi
movl %ebx, %esi
movq 0x10(%rsp), %rdx
callq 0x7c219
movq %rbp, 0x20(%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x7c4fd
movslq 0x30(%r14), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movq %r15, 0x38(%rsp)
cmpl $0x0, 0x18(%r15,%rax)
jle 0x7dcf9
incl 0xc(%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x30(%rsp), %rdx
movl %r15d, (%rdx)
movl %ebx, %ebp
movq %r14, %rbx
movq 0x20(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
movl $0x1, %ecx
callq 0x7c2a3
movq %rbx, %r12
movq 0x10(%rbx), %r9
movl %ebp, %ebx
addq %r13, %r9
movl 0xc(%rsp), %eax
movl %eax, (%rsp)
movq %r14, %rdi
movl %ebp, %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x28(%rsp), %r8
callq 0x7db83
cmpl $0x3, %ebp
ja 0x7dccd
cmpl $0x2, %ebx
je 0x7dccd
movl $0x7, %esi
movl $0x1, %edx
leaq 0x2f6de(%rip), %rdi     # 0xad3a1
movq 0x20(%rsp), %rcx
callq 0x42c0
incq %r15
movq %r12, %r14
movslq 0x30(%r12), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movq 0x38(%rsp), %rcx
movslq 0x18(%rcx,%rax), %rax
addq $0x160, %r13            # imm = 0x160
cmpq %rax, %r15
jl 0x7dc5b
movq 0x20(%rsp), %rdi
movl %ebx, %esi
callq 0x7c565
movq 0x30(%rsp), %rdi
callq 0x39194
jmp 0x7df71
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 0x7bf18
cmpl $-0x2, %ecx
jne 0x7df71
movq %rbp, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movsd 0x48(%r14), %xmm0
leaq 0x2f45c(%rip), %rsi     # 0xad1b2
leaq 0x16e3a0(%rsp), %rdi
movb $0x1, %al
callq 0x41b0
leaq 0x2fdf1(%rip), %rsi     # 0xadb5d
leaq 0xf4280(%rsp), %r15
movq %r15, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x2fa65(%rip), %rdx     # 0xad7ec
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7c24c
movq 0x40(%r14), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
leaq 0x2fa9f(%rip), %rsi     # 0xad84a
leaq 0x7a160(%rsp), %rdi
movq %r12, %rdx
movb $0x1, %al
callq 0x41b0
cmpl $0x3, 0x1c0(%r13)
movq %r13, 0x28(%rsp)
jl 0x7de4a
movl $0x1, %r12d
leaq 0x40(%rsp), %r15
leaq 0x7a160(%rsp), %r13
leaq 0xf4280(%rsp), %rbp
movq %rbp, %rdi
leaq 0x2fd6c(%rip), %rsi     # 0xadb5d
movl %r12d, %edx
xorl %eax, %eax
callq 0x41b0
movq %r15, %rdi
movl %ebx, %esi
leaq 0x2f9e5(%rip), %rdx     # 0xad7ec
movq %rbp, %rcx
callq 0x7c24c
movq 0x40(%r14), %rax
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
movq %r13, %rdi
leaq 0x2fa1f(%rip), %rsi     # 0xad845
movq %r13, %rdx
movq %r15, %rcx
movb $0x1, %al
callq 0x41b0
incq %r12
movq 0x28(%rsp), %rax
movslq 0x1c0(%rax), %rax
decq %rax
cmpq %rax, %r12
jl 0x7dddf
leaq 0x280a1(%rip), %rdx     # 0xa5ef2
leaq 0x7a160(%rsp), %rcx
leaq 0x16e3a0(%rsp), %r8
movq 0x20(%rsp), %r15
movq %r15, %rdi
movl %ebx, %esi
callq 0x7c7c3
movq (%r14), %r9
movl 0xc(%rsp), %r13d
incl %r13d
movl %r13d, (%rsp)
movq %r15, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %r12
movq %r12, %rcx
movq 0x28(%rsp), %rbp
movq %rbp, %r8
callq 0x7db83
movq %r15, %rdi
movl %ebx, %esi
callq 0x7c8ac
movq 0x8(%r14), %r9
movl %r13d, (%rsp)
movq %r15, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %rdx
movq %r12, %rcx
movq %rbp, %r8
callq 0x7db83
movq %r15, %rdi
jmp 0x7df6a
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq 0x10(%rsp), %rdx
callq 0x7c219
movsd 0x28(%r14), %xmm0
leaq 0x2f2c4(%rip), %rsi     # 0xad1b2
leaq 0xf4280(%rsp), %r15
movq %r15, %rdi
movb $0x1, %al
callq 0x41b0
leaq 0x27feb(%rip), %rdx     # 0xa5ef2
movq %rbp, %rdi
movl %ebx, %esi
movq %r12, %rcx
movq %r15, %r8
callq 0x7c7c3
movq (%r14), %r9
movl 0xc(%rsp), %r12d
incl %r12d
movl %r12d, (%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %r15
movq %r15, %rdx
movq 0x10(%rsp), %rcx
movq %r13, %r8
callq 0x7db83
movq %rbp, %rdi
movl %ebx, %esi
callq 0x7c8ac
movq 0x8(%r14), %r9
movl %r12d, (%rsp)
movq %rbp, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq 0x10(%rsp), %rcx
movq %r13, %r8
callq 0x7db83
movq %rbp, %rdi
movl %ebx, %esi
callq 0x7c903
addq $0x1e84c8, %rsp         # imm = 0x1E84C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq