// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/statistics.c
// Function: find_cliques
void find_cliques(char** files, int filecount)
{
 BOOLEAN isclique, subset;
 char clique[MAXLENGTH];
 int *counts, **subsets, res, i, j, k, t, index, cliquecount = 0, *cliques = NULL, count = 0;
 Comparisonptr comparisons;
 comparisons = all_pairwise_comparisons(files, filecount, get_parameter_l("correctiontype"), get_parameter_l("testtype"));
 subsets = generate_subsets(filecount, &res, &counts);
 for (i = 0; i < res; i++)
   if (counts[i] > 1)
    {
     isclique = BOOLEAN_TRUE;
     for (j = 0; j < counts[i]; j++)
       for (k = j + 1; k < counts[i]; k++)
        {
         index = -1;
         for (t = 0; t < (filecount * (filecount - 1)) / 2; t++)
           if (comparisons[t].alg1 == subsets[i][j] && comparisons[t].alg2 == subsets[i][k])
            {
             index = t;
             break;
            }
         if (index == -1)
          {
           printf("Error in indexing\n");
           isclique = BOOLEAN_FALSE;
           break;           
          }
         if (!comparisons[index].accepted)
          {
           isclique = BOOLEAN_FALSE;
           break;
          }
        }
     if (isclique)
      {
       cliques = alloc(cliques, (cliquecount + 1) * sizeof(int), cliquecount + 1);
       cliques[cliquecount] = i;
       cliquecount++;
      }   
    }
 for (i = 0; i < cliquecount; i++)
  {
   subset = BOOLEAN_FALSE;
   for (j = 0; j < cliquecount; j++)
     if (i != j && is_subset(subsets[cliques[i]], subsets[cliques[j]], counts[cliques[i]], counts[cliques[j]]))
      {
       subset = BOOLEAN_TRUE;
       break;
      }
   if (!subset)
    {
     count++;
     sprintf(clique, "(");
     for (j = 0; j < counts[cliques[i]] - 1; j++)
       sprintf(clique, "%s%d ", clique, subsets[cliques[i]][j] + 1);
     sprintf(clique, "%s%d)", clique, subsets[cliques[i]][j] + 1);  
     write_array_variables("aout", count, 1, "s", clique);
    }
  }
 set_default_variable("out1", count + 0.0);
 for (i = 0; i < res; i++)
   if (counts[i] > 0)
     safe_free(subsets[i]);
 safe_free(subsets);
 safe_free(counts); 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a168, %rsp          # imm = 0x7A168
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x167a0(%rip), %rdi     # 0xa2938
callq 0x535f7
movl %eax, %ebp
leaq 0x1b25b(%rip), %rdi     # 0xa7401
callq 0x535f7
movq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %eax, %ecx
callq 0x8bf42
movq %rax, %r15
leaq 0x14(%rsp), %r12
leaq 0x8(%rsp), %rdx
movl %r14d, %edi
movq %r12, %rsi
callq 0x389b4
movq %rax, 0x30(%rsp)
cmpl $0x0, (%r12)
jle 0x8c324
leal -0x1(%r14), %ebp
imull %r14d, %ebp
movl %ebp, %r13d
shrl $0x1f, %r13d
addl %ebp, %r13d
sarl %r13d
movq %r15, %rax
addq $0x4, %rax
movq %rax, 0x28(%rsp)
xorl %r14d, %r14d
movq $0x0, 0x18(%rsp)
xorl %r12d, %r12d
movq 0x8(%rsp), %rax
cmpl $0x2, (%rax,%r14,4)
jl 0x8c311
movq 0x8(%rsp), %rax
movl (%rax,%r14,4), %edx
testl %edx, %edx
jle 0x8c2ed
movq %r12, 0x38(%rsp)
movl $0x1, 0x20(%rsp)
movl $0x1, %r12d
xorl %ebx, %ebx
movq %rbx, %rcx
incq %rbx
movslq %edx, %rsi
cmpq %rsi, %rbx
jge 0x8c2cc
movl %edx, %edx
movq %r12, %rsi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpl $0x2, %ebp
jl 0x8c29a
movq 0x30(%rsp), %rax
movq (%rax,%r14,8), %r8
movl (%r8,%rcx,4), %r9d
movq 0x28(%rsp), %r11
xorl %r10d, %r10d
cmpl %r9d, -0x4(%r11)
jne 0x8c289
movl (%r11), %eax
cmpl (%r8,%rsi,4), %eax
je 0x8c297
incq %r10
addq $0x18, %r11
cmpq %r10, %r13
jne 0x8c27a
jmp 0x8c29a
movl %r10d, %edi
cmpl $-0x1, %edi
je 0x8c2b8
movslq %edi, %rax
leaq (%rax,%rax,2), %rax
cmpl $0x0, 0x10(%r15,%rax,8)
je 0x8c2c4
incq %rsi
cmpq %rdx, %rsi
jne 0x8c25b
jmp 0x8c2cc
leaq 0x224be(%rip), %rdi     # 0xae77d
callq 0x4090
movl $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movslq (%rax,%r14,4), %rdx
incq %r12
cmpq %rdx, %rbx
jl 0x8c248
cmpl $0x0, 0x20(%rsp)
movq 0x38(%rsp), %r12
je 0x8c311
movslq %r12d, %rbx
incl %r12d
leaq 0x4(,%rbx,4), %rsi
movq 0x18(%rsp), %rdi
movl %r12d, %edx
callq 0x390c8
movq %rax, 0x18(%rsp)
movl %r14d, (%rax,%rbx,4)
incq %r14
movslq 0x14(%rsp), %rax
cmpq %rax, %r14
jl 0x8c212
jmp 0x8c330
xorl %r12d, %r12d
movq $0x0, 0x18(%rsp)
testl %r12d, %r12d
jle 0x8c459
movl %r12d, %ebp
leaq 0x223b0(%rip), %r12     # 0xae6f3
leaq 0x40(%rsp), %r14
xorl %r13d, %r13d
movl $0x0, 0x28(%rsp)
movq 0x18(%rsp), %r15
movq %rbp, 0x20(%rsp)
xorl %ebx, %ebx
cmpq %rbx, %r13
je 0x8c393
movslq (%r15,%r13,4), %rax
movq 0x30(%rsp), %rdx
movq (%rdx,%rax,8), %rdi
movslq (%r15,%rbx,4), %rcx
movq (%rdx,%rcx,8), %rsi
movq 0x8(%rsp), %r8
movl (%r8,%rax,4), %edx
movl (%r8,%rcx,4), %ecx
callq 0x3897d
testl %eax, %eax
jne 0x8c445
incq %rbx
cmpq %rbx, %rbp
jne 0x8c35f
movw $0x28, 0x40(%rsp)
movq 0x8(%rsp), %rcx
movslq (%r15,%r13,4), %rax
cmpl $0x2, (%rcx,%rax,4)
jl 0x8c3f1
xorl %ebx, %ebx
movq 0x30(%rsp), %rbp
movq 0x18(%rsp), %r15
movq (%rbp,%rax,8), %rax
movl (%rax,%rbx,4), %ecx
incl %ecx
movq %r14, %rdi
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x41b0
incq %rbx
movq 0x8(%rsp), %rcx
movslq (%r15,%r13,4), %rax
movslq (%rcx,%rax,4), %rcx
decq %rcx
cmpq %rcx, %rbx
jl 0x8c3bd
jmp 0x8c3fd
xorl %ebx, %ebx
movq 0x30(%rsp), %rbp
movq 0x18(%rsp), %r15
incl 0x28(%rsp)
movq (%rbp,%rax,8), %rax
movl (%rax,%rbx,4), %ecx
incl %ecx
movq %r14, %rdi
leaq 0x222e4(%rip), %rsi     # 0xae6f9
movq %r14, %rdx
xorl %eax, %eax
callq 0x41b0
leaq 0x1638a(%rip), %rdi     # 0xa27b0
movl 0x28(%rsp), %esi
movl $0x1, %edx
leaq 0x18ac3(%rip), %rcx     # 0xa4ef9
movq %r14, %r8
xorl %eax, %eax
callq 0x32c64
movq 0x20(%rsp), %rbp
incq %r13
cmpq %rbp, %r13
jne 0x8c35d
cvtsi2sdl 0x28(%rsp), %xmm0
jmp 0x8c45d
xorpd %xmm0, %xmm0
leaq 0x19b54(%rip), %rdi     # 0xa5fb8
callq 0x3403a
cmpl $0x0, 0x14(%rsp)
movq 0x30(%rsp), %r14
jle 0x8c498
xorl %ebx, %ebx
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax,%rbx,4)
jle 0x8c48b
movq (%r14,%rbx,8), %rdi
callq 0x39194
incq %rbx
movslq 0x14(%rsp), %rax
cmpq %rax, %rbx
jl 0x8c477
movq %r14, %rdi
callq 0x39194
movq 0x8(%rsp), %rdi
callq 0x39194
addq $0x7a168, %rsp          # imm = 0x7A168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq