// File: /workspace/github_c_makefile_star2_O2/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 $0x7a148, %rsp          # imm = 0x7A148
movq %rcx, %r15
movl %esi, %ebx
movq %rdi, %r14
movq %rdx, 0x18(%rsp)
movl 0x1bc(%rdx), %edx
leaq 0x1eae6(%rip), %rsi     # 0x95f5d
movl %ebx, %ecx
callq 0x72674
movq %r14, %rdi
movl %ebx, %esi
callq 0x72fb3
leaq 0x29688(%rip), %r8      # 0xa0b17
pushq $0x1
popq %r12
movq %r14, %rdi
movl %ebx, %esi
xorl %edx, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x72de1
leaq 0x29676(%rip), %r13     # 0xa0b21
leaq 0x1ea11(%rip), %r9      # 0x95ec3
pushq $0x2
popq %rcx
movq %r14, %rdi
movl %ebx, %esi
movl %r12d, %edx
movq %r13, %r8
xorl %eax, %eax
callq 0x72de1
movq %r14, %rdi
movl %ebx, %esi
callq 0x726d3
leaq 0x29656(%rip), %rcx     # 0xa0b2e
movq %r14, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x72b25
pushq $-0x1
popq %rcx
movq %r15, 0x10(%rsp)
movq %r15, %r12
xorl %r15d, %r15d
movq (%r12), %r12
testq %r12, %r12
je 0x77624
movl (%r12), %eax
cmpl %ecx, %eax
jne 0x77513
movl %ecx, 0x8(%rsp)
movl %r15d, 0xc(%rsp)
jmp 0x77546
movl $0x0, 0xc(%rsp)
cmpl $-0x1, %ecx
je 0x77542
testl %r15d, %r15d
movl $0x0, %eax
cmovlel %eax, %r15d
subl $0x1, %r15d
jb 0x7753e
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
jmp 0x7752c
movl (%r12), %eax
movl %eax, 0x8(%rsp)
movq %r14, %rdi
movl %ebx, %esi
movq 0x18(%rsp), %rdx
movq %r12, %r8
callq 0x74e4f
movl 0x4(%r12), %ecx
movl 0x8(%r12), %edx
leaq 0x20(%rsp), %r13
movq %r13, %rdi
leaq 0x295c1(%rip), %rsi     # 0xa0b32
movl %edx, %r8d
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
movl %ebx, %esi
leaq 0x1e93c(%rip), %rbp     # 0x95ec3
movq %rbp, %rdx
movq %r13, %rcx
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
leaq 0x218f2(%rip), %rdx     # 0x98e90
movq %rbp, %rcx
leaq 0x29579(%rip), %r15     # 0xa0b21
movq %r15, %r8
callq 0x736fc
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x72b25
movl (%r12), %edx
movq %r13, %rdi
leaq 0x2958b(%rip), %rsi     # 0xa0b59
xorl %eax, %eax
callq 0x41b0
movq %r14, %rdi
movl %ebx, %esi
leaq 0x29536(%rip), %rdx     # 0xa0b17
movq %r13, %rcx
callq 0x72b25
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
movq 0x30(%r12), %rax
testq %rax, %rax
je 0x7760f
movl (%rax), %eax
cmpl (%r12), %eax
jne 0x7760f
movq %r14, %rdi
movl %ebx, %esi
callq 0x737c1
addq $0x30, %r12
movl 0xc(%rsp), %r15d
incl %r15d
movl 0x8(%rsp), %ecx
jmp 0x774f3
xorl %ebp, %ebp
testl %r15d, %r15d
cmovgl %r15d, %ebp
subl $0x1, %ebp
jb 0x7763e
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
jmp 0x7762d
leaq 0x21856(%rip), %rdx     # 0x98e9b
leaq 0x294d5(%rip), %rcx     # 0xa0b21
leaq 0x294db(%rip), %r8      # 0xa0b2e
movq %r14, %rdi
movl %ebx, %esi
callq 0x736fc
leaq 0x1e8f9(%rip), %r15     # 0x95f5d
leaq 0x294ac(%rip), %rcx     # 0xa0b17
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x7308c
movq %r14, %rdi
movl %ebx, %esi
callq 0x737c1
movq 0x10(%rsp), %rax
movl 0x14(%rax), %ecx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x72fce
movq %r14, %rdi
movl %ebx, %esi
callq 0x737fd
movq %r14, %rdi
movl %ebx, %esi
callq 0x7320f
addq $0x7a148, %rsp          # imm = 0x7A148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq