// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/instancelist.c
// Function: create_instancelist_from_rules
Instanceptr create_instancelist_from_rules(Decisionconditionptr rules, int count, Instanceptr* list)
{
 /*!Last Changed 09.04.2003*/
 int i, found, featureindex;
 double value, datavalue;
 char comparison;
 Instanceptr result = NULL, tmp = (*list), last = NULL, next, tmpbefore = NULL;
 while (tmp)
  {
   found = 0;
   for (i = 0; i < count; i++)
    {
     featureindex = rules[i].featureindex;
     value = rules[i].value;
     comparison = rules[i].comparison;
     switch (current_dataset->features[featureindex].type)
      {
       case INTEGER:datavalue = tmp->values[featureindex].intvalue;
                    if (comparison=='<' && datavalue>value)
                      found = 1;
                    if (comparison=='>' && datavalue<=value)
                      found = 1;
                    break;
       case    REAL:datavalue = tmp->values[featureindex].floatvalue;
                    if (comparison=='<' && datavalue>value)
                      found = 1;
                    if (comparison=='>' && datavalue<=value)
                      found = 1;
                    break;
       case  STRING:if (tmp->values[featureindex].stringindex != value)
                      found = 1;
                    break;
      }
     if (found)
       break;
    }
   next = tmp->next;
   if (!found)
    {
     if (last)
       last -> next = tmp;
     else
       result = tmp;
     last = tmp;
    }
   else
    {
     if (tmpbefore)
       tmpbefore -> next = tmp;
     else
       (*list) = tmp;
     tmpbefore = tmp;
    }
   tmp = next;
  }
 if (last)
   last -> next = NULL;
 if (!tmpbefore)
   (*list) = NULL;
 else
   tmpbefore -> next = NULL;   
 return result;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x68(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x464a3
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x46435
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
movl (%rax,%rcx), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
movsd 0x8(%rax,%rcx), %xmm0
movsd %xmm0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
imulq $0x70, %rcx, %rcx
movb 0x4(%rax,%rcx), %al
movb %al, -0x39(%rbp)
leaq 0xbf526(%rip), %rax     # 0x105840
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
movl 0x30f08(%rax,%rcx), %eax
movl %eax, -0x6c(%rbp)
testl %eax, %eax
je 0x46353
jmp 0x46338
movl -0x6c(%rbp), %eax
subl $0x1, %eax
je 0x463f9
jmp 0x46346
movl -0x6c(%rbp), %eax
subl $0x2, %eax
je 0x463a6
jmp 0x4641d
movq -0x50(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movsbl -0x39(%rbp), %eax
cmpl $0x3c, %eax
jne 0x46384
movsd -0x38(%rbp), %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x46384
movl $0x1, -0x20(%rbp)
movsbl -0x39(%rbp), %eax
cmpl $0x3e, %eax
jne 0x463a4
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x463a4
movl $0x1, -0x20(%rbp)
jmp 0x4641d
movq -0x50(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x38(%rbp)
movsbl -0x39(%rbp), %eax
cmpl $0x3c, %eax
jne 0x463d7
movsd -0x38(%rbp), %xmm0
ucomisd -0x30(%rbp), %xmm0
jbe 0x463d7
movl $0x1, -0x20(%rbp)
movsbl -0x39(%rbp), %eax
cmpl $0x3e, %eax
jne 0x463f7
movsd -0x38(%rbp), %xmm1
movsd -0x30(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x463f7
movl $0x1, -0x20(%rbp)
jmp 0x4641d
movq -0x50(%rbp), %rax
movq (%rax), %rax
movslq -0x24(%rbp), %rcx
cvtsi2sdl (%rax,%rcx,8), %xmm0
ucomisd -0x30(%rbp), %xmm0
jne 0x46414
jp 0x46414
jmp 0x4641b
movl $0x1, -0x20(%rbp)
jmp 0x4641d
cmpl $0x0, -0x20(%rbp)
je 0x46425
jmp 0x46435
jmp 0x46427
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x462cb
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x4646e
cmpq $0x0, -0x58(%rbp)
je 0x4645c
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x46464
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x46496
cmpq $0x0, -0x68(%rbp)
je 0x46483
movq -0x50(%rbp), %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x4648e
movq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x462b2
cmpq $0x0, -0x58(%rbp)
je 0x464b6
movq -0x58(%rbp), %rax
movq $0x0, 0x10(%rax)
cmpq $0x0, -0x68(%rbp)
jne 0x464ca
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
jmp 0x464d6
movq -0x68(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x48(%rbp), %rax
popq %rbp
retq
nopl (%rax)