// File: /workspace/github_c_makefile_star2_O2/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 $0x1e84b8, %rsp         # imm = 0x1E84B8
movq %r9, %rbp
movq %rcx, 0x10(%rsp)
movl %esi, %ebx
movq %rdi, %r14
movl 0x30(%r9), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rcx
je 0x74a0c
movq %r8, %r13
movl 0x1e84f0(%rsp), %eax
movl %eax, 0xc(%rsp)
testl %ecx, %ecx
js 0x74a2d
movq %rdx, 0x20(%rsp)
imulq $0x340, %rcx, %rax      # imm = 0x340
cmpl $0x1, 0x30f08(%r13,%rax)
jne 0x74b32
movq %r13, 0x18(%rsp)
leaq 0x30f08(%r13), %rax
movq %rax, 0x28(%rsp)
leaq 0x2beef(%rip), %rsi     # 0xa0850
pushq $0x4
popq %rdi
pushq $0x3
popq %rdx
callq 0x34f59
movq %rax, %r12
movl 0x30(%rbp), %ecx
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movl %ebx, %esi
movq 0x10(%rsp), %rdx
callq 0x73250
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x734bf
incl 0xc(%rsp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movslq 0x30(%rbp), %rax
imulq $0x340, %rax, %rax      # imm = 0x340
movq 0x28(%rsp), %rcx
movslq 0x18(%rcx,%rax), %rax
cmpq %rax, %r13
jge 0x74bcc
movl %r13d, (%r12)
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
pushq $0x1
popq %rcx
callq 0x732d6
movq 0x10(%rbp), %r9
addq %r15, %r9
movl 0xc(%rsp), %eax
movl %eax, (%rsp)
movq %r14, %rdi
movl %ebx, %esi
movq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r8
callq 0x748e8
movq %r14, %rdi
movl %ebx, %esi
callq 0x7349f
incq %r13
addq $0x160, %r15            # imm = 0x160
jmp 0x7499d
movl 0x34(%rbp), %ecx
movq %r14, %rdi
movq %rdx, %rsi
movl %ebx, %edx
addq $0x1e84b8, %rsp         # imm = 0x1E84B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x72fce
cmpl $-0x2, %ecx
jne 0x74c64
movq %rdx, 0x20(%rsp)
movq %r13, 0x18(%rsp)
movsd 0x48(%rbp), %xmm0
leaq 0x2b762(%rip), %rsi     # 0xa01ae
leaq 0x16e390(%rsp), %rdi
movb $0x1, %al
callq 0x41b0
leaq 0x2c0f7(%rip), %rsi     # 0xa0b59
leaq 0xf4270(%rsp), %r15
movq %r15, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x2bd6b(%rip), %rdx     # 0xa07e8
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq %r15, %rcx
callq 0x7327f
movq 0x40(%rbp), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
leaq 0x2bda5(%rip), %rsi     # 0xa0846
leaq 0x7a150(%rsp), %rdi
movq %r12, %rdx
movb $0x1, %al
callq 0x41b0
pushq $0x1
popq %r12
movq 0x18(%rsp), %rax
movslq 0x1c0(%rax), %rax
decq %rax
cmpq %rax, %r12
jge 0x74be3
leaq 0xf4270(%rsp), %r13
movq %r13, %rdi
leaq 0x2c078(%rip), %rsi     # 0xa0b59
movl %r12d, %edx
xorl %eax, %eax
callq 0x41b0
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movl %ebx, %esi
leaq 0x2bcec(%rip), %rdx     # 0xa07e8
movq %r13, %rcx
callq 0x7327f
movq 0x40(%rbp), %rax
movq (%rax), %rax
movsd (%rax,%r12,8), %xmm0
leaq 0x7a150(%rsp), %rdi
leaq 0x2bd21(%rip), %rsi     # 0xa0841
movq %rdi, %rdx
movq %r15, %rcx
movb $0x1, %al
callq 0x41b0
incq %r12
jmp 0x74ab7
leaq 0x30(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movq 0x10(%rsp), %rdx
callq 0x73250
movsd 0x28(%rbp), %xmm0
leaq 0x2b65c(%rip), %rsi     # 0xa01ae
leaq 0xf4270(%rsp), %r15
movq %r15, %rdi
movb $0x1, %al
callq 0x41b0
leaq 0x24327(%rip), %rdx     # 0x98e92
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rcx
movq %r15, %r8
callq 0x736fc
movq (%rbp), %r9
movl 0xc(%rsp), %r12d
incl %r12d
movl %r12d, (%rsp)
movq %r14, %rdi
movl %ebx, %esi
movq 0x20(%rsp), %r15
movq %r15, %rdx
movq 0x10(%rsp), %rcx
movq %r13, %r8
callq 0x748e8
movq %r14, %rdi
movl %ebx, %esi
callq 0x737c1
movq 0x8(%rbp), %r9
movl %r12d, (%rsp)
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq 0x10(%rsp), %rcx
movq %r13, %r8
jmp 0x74c55
movq %r14, %rdi
movl %ebx, %esi
callq 0x734fe
movq %r12, %rdi
callq 0x34ff7
jmp 0x74c64
leaq 0x242a8(%rip), %rdx     # 0x98e92
leaq 0x7a150(%rsp), %rcx
leaq 0x16e390(%rsp), %r8
movq %r14, %rdi
movl %ebx, %esi
callq 0x736fc
movq (%rbp), %r9
movl 0xc(%rsp), %r15d
incl %r15d
movl %r15d, (%rsp)
movq %r14, %rdi
movl %ebx, %esi
movq 0x20(%rsp), %r12
movq %r12, %rdx
movq 0x10(%rsp), %r13
movq %r13, %rcx
movq 0x18(%rsp), %r8
callq 0x748e8
movq %r14, %rdi
movl %ebx, %esi
callq 0x737c1
movq 0x8(%rbp), %r9
movl %r15d, (%rsp)
movq %r14, %rdi
movl %ebx, %esi
movq %r12, %rdx
movq %r13, %rcx
movq 0x18(%rsp), %r8
callq 0x748e8
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
addq $0x1e84b8, %rsp         # imm = 0x1E84B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq