// File: /workspace/github_c_makefile_star2_O1/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, -0x20(%rsp)
movq %rcx, -0x8(%rsp)
movl $0x1, %eax
testl %r9d, %r9d
jle 0x8b10a
movl %r9d, %eax
movq %rax, -0x18(%rsp)
movl %edx, %eax
movq %rax, -0x10(%rsp)
movl $0xffffffff, -0x28(%rsp) # imm = 0xFFFFFFFF
xorl %ebx, %ebx
leaq 0x23440(%rip), %r14     # 0xae450
movl %edx, -0x24(%rsp)
movb $0x1, %r12b
testl %edx, %edx
jle 0x8b0e0
movl %edx, %ecx
xorl %r13d, %r13d
xorl %r10d, %r10d
movslq (%rsi,%r13,4), %rax
testq %rax, %rax
jle 0x8b0a1
movq -0x8(%rsp), %rdx
movl (%rdx,%rbx,4), %ebp
movl %r10d, %r8d
leaq (%rdi,%r8,4), %r15
xorl %r9d, %r9d
movslq (%r15,%r9,4), %r11
imulq $0x66666667, %r11, %r8  # imm = 0x66666667
movq %r8, %rdx
shrq $0x3f, %rdx
sarq $0x22, %r8
addl %edx, %r8d
movl %r11d, %edx
shrl $0x1f, %edx
addl %r11d, %edx
andl $-0x2, %edx
movslq %r8d, %r8
movl (%r14,%r8,4), %r8d
andl %ebp, %r8d
subl %edx, %r11d
jne 0x8b07b
testl %r8d, %r8d
jg 0x8b08f
testl %r11d, %r11d
je 0x8b085
testl %r8d, %r8d
je 0x8b08f
incq %r9
cmpq %r9, %rax
jne 0x8b042
jmp 0x8b0a1
addl %r10d, %eax
incq %r13
movl %eax, %r10d
cmpq -0x10(%rsp), %r13
jne 0x8b027
jmp 0x8b0de
movq -0x20(%rsp), %rax
movl 0x38(%rsp), %edx
cmpl %edx, (%rax,%rbx,4)
jne 0x8b0c7
xorl %r12d, %r12d
cmpl %r13d, -0x28(%rsp)
jge 0x8b0de
cmpl %r13d, -0x24(%rsp)
jle 0x8b108
movl %r13d, -0x28(%rsp)
jmp 0x8b0de
cmpl %r13d, -0x24(%rsp)
jle 0x8b0de
movl %r13d, -0x24(%rsp)
cmpl %r13d, -0x28(%rsp)
movl %ecx, %edx
jl 0x8b0e0
jmp 0x8b108
movl %ecx, %edx
testb %r12b, %r12b
je 0x8b0f3
movq -0x20(%rsp), %rax
movl 0x38(%rsp), %ecx
cmpl %ecx, (%rax,%rbx,4)
je 0x8b108
incq %rbx
cmpq -0x18(%rsp), %rbx
jne 0x8b014
movl $0x1, %eax
jmp 0x8b10a
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq