// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/srm.c
// Function: can_ruleset_classify
BOOLEAN can_ruleset_classify(int* featurelist, int* ruleset, int rulecount, int* datacombination, int* classcombination, int size, int positiveclass)
{
 /*Last Changed 26.02.2008*/
 int pow2[16] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768};
 int i, j, k, fno, value, p, control, last_positive = -1, last_negative = rulecount;
 BOOLEAN covered_by_rule, covered_by_ruleset;
 for (p = 0; p < size; p++)
  {
   j = 0;
   covered_by_ruleset = BOOLEAN_FALSE;
   for (i = 0; i < rulecount; i++)
    {
     covered_by_rule = BOOLEAN_TRUE;
     for (k = 0; k < ruleset[i]; k++)
      {
       fno = featurelist[j + k] / 10;
       value = featurelist[j + k] % 2;
       control = datacombination[p] & pow2[fno];
       if ((control > 0 && value == 0) || (control == 0 && value != 0))
        {
         covered_by_rule = BOOLEAN_FALSE;
         break;
        } 
      }
     if (covered_by_rule)
      {
       if (classcombination[p] != positiveclass)
        {
         if (i < last_negative)
          {
           last_negative = i;
           if (last_positive >= last_negative)
             return BOOLEAN_FALSE;
          }
        }
       else
        {
         if (i > last_positive)
          {
           last_positive = i;
           if (last_positive >= last_negative)
             return BOOLEAN_FALSE;
          }
         covered_by_ruleset = BOOLEAN_TRUE;
        }
       break;
      }
     j += ruleset[i];
    }
   if (!covered_by_ruleset && classcombination[p] == positiveclass)
     return BOOLEAN_FALSE;
  }
 return BOOLEAN_TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, -0x28(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdi, -0x18(%rsp)
xorl %r15d, %r15d
testl %edx, %edx
movl $0x0, %eax
cmovgl %edx, %eax
movq %rax, -0x8(%rsp)
testl %r9d, %r9d
cmovlel %r15d, %r9d
movq %r9, -0x20(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x30(%rsp)
movl $0xa, %r13d
movl $0x2, %r14d
leaq 0x2162c(%rip), %r10     # 0xa1440
cmpq -0x20(%rsp), %r15
je 0x7feed
movl %edx, -0x2c(%rsp)
xorl %r8d, %r8d
xorl %r9d, %r9d
cmpq -0x8(%rsp), %r8
je 0x7fecc
movq -0x10(%rsp), %rax
movl (%rax,%r8,4), %r11d
movslq %r9d, %rax
testl %r11d, %r11d
movl $0x0, %r12d
cmovgl %r11d, %r12d
movq -0x18(%rsp), %rdx
leaq (%rdx,%rax,4), %rsi
xorl %edi, %edi
cmpq %rdi, %r12
je 0x7fe94
movl (%rsi,%rdi,4), %ebx
movl %ebx, %eax
cltd
idivl %r13d
movl %eax, %ebp
movl %ebx, %eax
cltd
idivl %r14d
movslq %ebp, %rax
movl (%r10,%rax,4), %eax
andl (%rcx,%r15,4), %eax
testl %edx, %edx
jne 0x7fe81
testl %eax, %eax
jg 0x7fe8c
incq %rdi
testl %edx, %edx
je 0x7fe58
testl %eax, %eax
jne 0x7fe58
addl %r11d, %r9d
incq %r8
jmp 0x7fe29
movq -0x28(%rsp), %rax
movl (%rax,%r15,4), %eax
cmpl 0x38(%rsp), %eax
jne 0x7feba
cmpl %r8d, -0x30(%rsp)
movl -0x2c(%rsp), %edx
jge 0x7fee5
movl %r8d, -0x30(%rsp)
cmpl %r8d, %edx
jg 0x7fee5
jmp 0x7fef4
movl -0x2c(%rsp), %edx
cmpl %r8d, %edx
jle 0x7fed9
cmpl %r8d, -0x30(%rsp)
jl 0x7fedc
jmp 0x7fef4
movq -0x28(%rsp), %rax
movl (%rax,%r15,4), %eax
movl -0x2c(%rsp), %edx
movl %edx, %r8d
movl %r8d, %edx
cmpl 0x38(%rsp), %eax
je 0x7fef4
incq %r15
jmp 0x7fe14
movl $0x1, %eax
jmp 0x7fef6
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq