// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/savecode.c
// Function: generate_test_code_c45rules
void generate_test_code_c45rules(FILE* testcodefile, PROGRAMMING_LANGUAGE_TYPE language, Datasetptr d, Rulesetptr m)
{
 /*!Last Changed 15.06.2006*/
 char st[MAXLENGTH];
 Decisionruleptr rule;
 int i, classno = -1, rulecount = 0;
 code_function_header(testcodefile, "c45rules", d->featurecount, language);
 code_variable_start(testcodefile, language); 
 code_add_variable(testcodefile, language, INTEGER_VARIABLE, 1, "bestclass");
 code_add_variable(testcodefile, language, REAL_VARIABLE, 2, "bestestimate", "laplaceestimate");
 code_start(testcodefile, language);
 code_set_variable(testcodefile, language, "bestestimate", "1.5"); 
 rule = m->start;
 while (rule)
  {
   if (rule->classno != classno)
    {
     if (classno != -1)
      {
       for (i = 0; i < rulecount; i++)
         code_endif(testcodefile, language);
      }
     classno = rule->classno;     
     rulecount = 0;
    }
   code_rule(testcodefile, language, d, "c45rules", rule);
   sprintf(st, "(%d + 1.0) / (%d + %d + 2.0)", rule->falsepositives, rule->covered, rule->falsepositives);
   code_set_variable(testcodefile, language, "laplaceestimate", st);
   code_if(testcodefile, language, "<", "laplaceestimate", "bestestimate");
   code_set_variable(testcodefile, language, "bestestimate", "laplaceestimate");
   sprintf(st, "%d", rule->classno);
   code_set_variable(testcodefile, language, "bestclass", st);
   code_endif(testcodefile, language);
   if (rule->next && rule->next->classno == rule->classno)
     code_else(testcodefile, language);
   rulecount++;
   rule = rule->next;
  }
 for (i = 0; i < rulecount; i++)
   code_endif(testcodefile, language);
 code_if(testcodefile, language, "!=", "bestestimate", "1.5");
 code_function_return_string(testcodefile, "c45rules", language, "bestclass");   
 code_else(testcodefile, language);
 code_function_return_classification(testcodefile, "c45rules", language, m->defaultclass);
 code_endif(testcodefile, language);
 code_function_end(testcodefile, language);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf4268, %rsp          # imm = 0xF4268
movq %rcx, %r15
movl %esi, %ebx
movq %rdi, %r14
movq %rdx, 0x18(%rsp)
movl 0x1bc(%rdx), %edx
leaq 0x21dc5(%rip), %rsi     # 0xa2f55
movl %ebx, %ecx
callq 0x7b551
cmpl $0x2, %ebx
jne 0x8120e
leaq 0x2c0c5(%rip), %rdi     # 0xad268
movl $0x4, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
leaq 0x2c95f(%rip), %r8      # 0xadb1b
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x7bd1c
leaq 0x2c94f(%rip), %r8      # 0xadb25
leaq 0x21cde(%rip), %r9      # 0xa2ebb
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x2, %ecx
xorl %eax, %eax
callq 0x7bd1c
leaq 0x2be7e(%rip), %rdi     # 0xad078
movl $0x6, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x42c0
jmp 0x8124c
leaq 0x2c906(%rip), %r8      # 0xadb1b
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0x7bd1c
leaq 0x2c8f6(%rip), %r8      # 0xadb25
leaq 0x21c85(%rip), %r9      # 0xa2ebb
movq %r14, %rdi
movl %ebx, %esi
movl $0x1, %edx
movl $0x2, %ecx
xorl %eax, %eax
callq 0x7bd1c
incl 0x32df96(%rip)          # 0x3af1e8
leaq 0x2c8cc(%rip), %rdx     # 0xadb25
leaq 0x2c8d2(%rip), %rcx     # 0xadb32
movq %r14, %rdi
movl %ebx, %esi
callq 0x7ba46
movq %r15, 0x10(%rsp)
movq (%r15), %r13
testq %r13, %r13
je 0x813b3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %r12d, %r12d
cmpl %eax, (%r13)
jne 0x8128f
movl %eax, 0xc(%rsp)
jmp 0x812bc
cmpl $-0x1, %eax
setne %al
testl %r12d, %r12d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x812b1
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c903
decl %r12d
jne 0x812a2
movl (%r13), %eax
movl %eax, 0xc(%rsp)
xorl %r12d, %r12d
movq %r14, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %rdx
movq %r13, %r8
callq 0x7e19b
movl 0x4(%r13), %ecx
movl 0x8(%r13), %edx
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
leaq 0x2c851(%rip), %rsi     # 0xadb36
movl %edx, %r8d
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
movl %ebx, %esi
leaq 0x21bc0(%rip), %r15     # 0xa2ebb
movq %r15, %rdx
movq %rbp, %rcx
callq 0x7ba46
movl %ebx, %edi
leaq 0x24be1(%rip), %rsi     # 0xa5ef0
movq %r15, %rdx
leaq 0x2c80c(%rip), %rcx     # 0xadb25
leaq 0x7a140(%rsp), %rbp
movq %rbp, %r8
callq 0x7c601
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
callq 0x7c75c
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2c7e3(%rip), %rdx     # 0xadb25
movq %r15, %rcx
callq 0x7ba46
movl (%r13), %edx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
leaq 0x2c800(%rip), %rsi     # 0xadb5d
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
movl %ebx, %esi
leaq 0x2c7ab(%rip), %rdx     # 0xadb1b
movq %r15, %rcx
callq 0x7ba46
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c903
movq 0x30(%r13), %rax
testq %rax, %rax
je 0x8139d
movl (%rax), %eax
cmpl (%r13), %eax
jne 0x8139d
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c8ac
incl %r12d
movq 0x30(%r13), %r13
testq %r13, %r13
movl 0xc(%rsp), %eax
jne 0x81283
jmp 0x813b6
xorl %r12d, %r12d
testl %r12d, %r12d
jle 0x813ca
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c903
decl %r12d
jne 0x813bb
leaq 0x24b2a(%rip), %rsi     # 0xa5efb
leaq 0x2c74d(%rip), %rdx     # 0xadb25
leaq 0x2c753(%rip), %rcx     # 0xadb32
leaq 0x7a140(%rsp), %r15
movl %ebx, %edi
movq %r15, %r8
callq 0x7c601
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0x7c75c
leaq 0x21b50(%rip), %r15     # 0xa2f55
leaq 0x2c70f(%rip), %rcx     # 0xadb1b
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x7bffb
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c8ac
movq 0x10(%rsp), %rax
movl 0x14(%rax), %ecx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x7bf18
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c903
movq %r14, %rdi
movl %ebx, %esi
callq 0x7c1ca
addq $0xf4268, %rsp          # imm = 0xF4268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq