// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x7a160, %rsp          # imm = 0x7A160
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0xffffffff, -0x7a150(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x7a154(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x1bc(%rax), %edx
movl -0xc(%rbp), %ecx
leaq 0x2cea7(%rip), %rsi     # 0xe2bed
callq 0xaf1e0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb00e0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
xorl %edx, %edx
movl $0x1, %ecx
leaq 0x374b7(%rip), %r8      # 0xed223
movb $0x0, %al
callq 0xafe40
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl $0x1, %edx
movl $0x2, %ecx
leaq 0x374a2(%rip), %r8      # 0xed22d
leaq 0x2cdc1(%rip), %r9      # 0xe2b53
movb $0x0, %al
callq 0xafe40
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xaf2c0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3747a(%rip), %rdx     # 0xed22d
leaq 0x37480(%rip), %rcx     # 0xed23a
callq 0xafa00
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x7a148(%rbp)
cmpq $0x0, -0x7a148(%rbp)
je 0xb5f88
movq -0x7a148(%rbp), %rax
movl (%rax), %eax
cmpl -0x7a150(%rbp), %eax
je 0xb5e45
cmpl $-0x1, -0x7a150(%rbp)
je 0xb5e2c
movl $0x0, -0x7a14c(%rbp)
movl -0x7a14c(%rbp), %eax
cmpl -0x7a154(%rbp), %eax
jge 0xb5e2a
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0ec0
movl -0x7a14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a14c(%rbp)
jmp 0xb5dff
jmp 0xb5e2c
movq -0x7a148(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x7a150(%rbp)
movl $0x0, -0x7a154(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x18(%rbp), %rdx
movq -0x7a148(%rbp), %r8
leaq 0x2cd8f(%rip), %rcx     # 0xe2bed
callq 0xb2da0
leaq -0x7a140(%rbp), %rdi
movq -0x7a148(%rbp), %rax
movl 0x8(%rax), %edx
movq -0x7a148(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x7a148(%rbp), %rax
movl 0x8(%rax), %r8d
leaq 0x373ae(%rip), %rsi     # 0xed23e
movb $0x0, %al
callq 0x4170
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %rcx
leaq 0x2cca7(%rip), %rdx     # 0xe2b53
callq 0xafa00
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x2fc01(%rip), %rdx     # 0xe5ac0
leaq 0x2cc8d(%rip), %rcx     # 0xe2b53
leaq 0x37360(%rip), %r8      # 0xed22d
callq 0xb0d00
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x3734d(%rip), %rdx     # 0xed22d
leaq 0x2cc6c(%rip), %rcx     # 0xe2b53
callq 0xafa00
leaq -0x7a140(%rbp), %rdi
movq -0x7a148(%rbp), %rax
movl (%rax), %edx
leaq 0x37362(%rip), %rsi     # 0xed265
movb $0x0, %al
callq 0x4170
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq -0x7a140(%rbp), %rcx
leaq 0x37304(%rip), %rdx     # 0xed223
callq 0xafa00
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0ec0
movq -0x7a148(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0xb5f62
movq -0x7a148(%rbp), %rax
movq 0x30(%rax), %rax
movl (%rax), %eax
movq -0x7a148(%rbp), %rcx
cmpl (%rcx), %eax
jne 0xb5f62
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0e70
movl -0x7a154(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a154(%rbp)
movq -0x7a148(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x7a148(%rbp)
jmp 0xb5dcd
movl $0x0, -0x7a14c(%rbp)
movl -0x7a14c(%rbp), %eax
cmpl -0x7a154(%rbp), %eax
jge 0xb5fbd
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0ec0
movl -0x7a14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7a14c(%rbp)
jmp 0xb5f92
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
leaq 0x2fb00(%rip), %rdx     # 0xe5acb
leaq 0x3725b(%rip), %rcx     # 0xed22d
leaq 0x37261(%rip), %r8      # 0xed23a
callq 0xb0d00
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
leaq 0x2cc01(%rip), %rsi     # 0xe2bed
leaq 0x37230(%rip), %rcx     # 0xed223
callq 0xb01f0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0e70
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %edx
movq -0x20(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x2cbd4(%rip), %rsi     # 0xe2bed
callq 0xb0120
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb0ec0
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0xb03a0
addq $0x7a160, %rsp          # imm = 0x7A160
popq %rbp
retq
nop