// File: /workspace/github_c_makefile_star2_O3/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 %rcx, -0x8(%rsp)
movq %rdi, -0x10(%rsp)
movl $0x1, %eax
testl %r9d, %r9d
jle 0x8d851
movl 0x38(%rsp), %ecx
movl %r9d, %eax
movq %rax, -0x20(%rsp)
movl %edx, %eax
movq %rax, -0x18(%rsp)
movl $0xffffffff, -0x24(%rsp) # imm = 0xFFFFFFFF
xorl %ebx, %ebx
leaq 0x23d74(%rip), %r14     # 0xb14e0
movl %edx, -0x28(%rsp)
testl %edx, %edx
jle 0x8d834
movl %edx, %edi
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq (%rsi,%r12,4), %r10
testq %r10, %r10
jle 0x8d802
movq -0x8(%rsp), %rax
movl (%rax,%rbx,4), %eax
movl %r13d, %r9d
movq -0x10(%rsp), %rdx
leaq (%rdx,%r9,4), %rbp
xorl %r15d, %r15d
movslq (%rbp,%r15,4), %r9
imulq $0x66666667, %r9, %r11  # imm = 0x66666667
movq %r11, %rdx
shrq $0x3f, %rdx
sarq $0x22, %r11
addl %edx, %r11d
movl %r9d, %edx
shrl $0x1f, %edx
addl %r9d, %edx
andl $-0x2, %edx
movslq %r11d, %r11
movl (%r14,%r11,4), %r11d
andl %eax, %r11d
subl %edx, %r9d
jne 0x8d7da
testl %r11d, %r11d
jg 0x8d7ee
testl %r9d, %r9d
je 0x8d7e4
testl %r11d, %r11d
je 0x8d7ee
incq %r15
cmpq %r15, %r10
jne 0x8d7a0
jmp 0x8d802
addl %r13d, %r10d
incq %r12
movl %r10d, %r13d
cmpq -0x18(%rsp), %r12
jne 0x8d780
movl %edi, %edx
jmp 0x8d834
cmpl %ecx, (%r8,%rbx,4)
jne 0x8d81f
cmpl %r12d, -0x24(%rsp)
movl %edi, %edx
jge 0x8d83a
movl %r12d, -0x24(%rsp)
cmpl %r12d, -0x28(%rsp)
jg 0x8d83a
jmp 0x8d84f
cmpl %r12d, -0x28(%rsp)
movl %edi, %edx
jle 0x8d834
movl %r12d, -0x28(%rsp)
cmpl %r12d, -0x24(%rsp)
jge 0x8d84f
cmpl %ecx, (%r8,%rbx,4)
je 0x8d84f
incq %rbx
cmpq -0x20(%rsp), %rbx
jne 0x8d770
movl $0x1, %eax
jmp 0x8d851
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq