// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/rise.c
// Function: distance_to_rule
double distance_to_rule(Model_riseptr m, Instanceptr inst, Decisionruleptr rule)
{
 Decisionconditionptr condition;
 int fno;
 double distance = 0.0;
 condition = rule->start;
 while (condition)
  {
   if (!condition_cover_instance(inst, condition))
    {
     fno = condition->featureindex;
     switch (current_dataset->features[fno].type)
      {
       case  STRING:distance += m->svdm[fno].values[inst->values[fno].stringindex][(int)condition->value];
                    break;
       case INTEGER:if (inst->values[fno].intvalue > condition->upperlimit)
                      distance += pow((inst->values[fno].intvalue - condition->upperlimit) / (current_dataset->features[fno].max.intvalue - current_dataset->features[fno].min.intvalue), 2);
                    else
                      distance += pow((condition->lowerlimit - inst->values[fno].intvalue) / (current_dataset->features[fno].max.intvalue - current_dataset->features[fno].min.intvalue), 2);
                    break;
       case    REAL:if (inst->values[fno].floatvalue > condition->upperlimit)
                      distance += pow((inst->values[fno].floatvalue - condition->upperlimit) / (current_dataset->features[fno].max.floatvalue - current_dataset->features[fno].min.floatvalue), 2);
                    else
                      distance += pow((condition->lowerlimit - inst->values[fno].floatvalue) / (current_dataset->features[fno].max.floatvalue - current_dataset->features[fno].min.floatvalue), 2);
                    break;
      }
    }
   condition = condition->next;
  }
 return distance;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xaac8e
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xabfc0
cmpl $0x0, %eax
jne 0xaac7d
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x24(%rbp)
leaq 0x5ae77(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movl %eax, -0x34(%rbp)
testl %eax, %eax
je 0xaaa4c
jmp 0xaa9e7
movl -0x34(%rbp), %eax
subl $0x1, %eax
je 0xaaa02
jmp 0xaa9f1
movl -0x34(%rbp), %eax
subl $0x2, %eax
je 0xaab68
jmp 0xaac7b
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x24(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rcx), %rcx
movslq -0x24(%rbp), %rdx
movslq (%rcx,%rdx,8), %rcx
movq (%rax,%rcx,8), %rax
movq -0x20(%rbp), %rcx
cvttsd2si 0x8(%rcx), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0xaac7b
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
ucomisd 0x10(%rax), %xmm0
jbe 0xaaae4
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
subsd 0x10(%rax), %xmm0
leaq 0x5adb9(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x10(%rax), %eax
leaq 0x5ad98(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
addq $0x30f08, %rcx          # imm = 0x30F08
movslq -0x24(%rbp), %rdx
imulq $0x340, %rdx, %rdx      # imm = 0x340
addq %rdx, %rcx
subl 0x8(%rcx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd 0x381cd(%rip), %xmm1    # 0xe2ca0
callq 0x4290
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0xaab63
movq -0x20(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,8), %xmm1
subsd %xmm1, %xmm0
leaq 0x5ad38(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x10(%rax), %eax
leaq 0x5ad17(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
addq $0x30f08, %rcx          # imm = 0x30F08
movslq -0x24(%rbp), %rdx
imulq $0x340, %rdx, %rdx      # imm = 0x340
addq %rdx, %rcx
subl 0x8(%rcx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
movsd 0x3814c(%rip), %xmm1    # 0xe2ca0
callq 0x4290
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0xaac7b
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
ucomisd 0x10(%rax), %xmm0
jbe 0xaabff
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
subsd 0x10(%rax), %xmm0
leaq 0x5ac9d(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movsd 0x10(%rax), %xmm1
leaq 0x5ac7a(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
subsd 0x8(%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x380b2(%rip), %xmm1    # 0xe2ca0
callq 0x4290
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0xaac79
movq -0x20(%rbp), %rax
movsd 0x18(%rax), %xmm0
movq -0x10(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
leaq 0x5ac21(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movsd 0x10(%rax), %xmm1
leaq 0x5abfe(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
subsd 0x8(%rax), %xmm1
divsd %xmm1, %xmm0
movsd 0x38036(%rip), %xmm1    # 0xe2ca0
callq 0x4290
addsd -0x30(%rbp), %xmm0
movsd %xmm0, -0x30(%rbp)
jmp 0xaac7b
jmp 0xaac7d
movq -0x20(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0xaa998
movsd -0x30(%rbp), %xmm0
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)