LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/saulvargas[P]re-C-sys/test_itemsim.c
// Function: main
int main(int argc, char** argv) {
    FILE* user_data;
    FILE* item_data;
    int N_users;
    int N_items;
    int N_prefs;
    int binary;
    recdata_t* recdata;
    recdata_t* cerdata;
    int iid;
    int i;
    similarity_t* similarity;
    idpairs_t* pairs;

    if (!read_args(argc, argv, &user_data, &item_data, &N_users, &N_items, &N_prefs, &binary)) {
        return EXIT_FAILURE;
    }

    recdata = recdata_simple_create(user_data, item_data, N_users, N_items, N_prefs, binary);
    cerdata = recdata_transposed_create(recdata);
    
    fclose(user_data);
    fclose(item_data);

    if (!binary) {
        similarity = similarity_veccosine_create(cerdata);
    } else {
        similarity = similarity_setcosine_create(cerdata);
    }

    for (iid = 0; iid < recdata->N_items; iid++) {
        pairs = similarity_calculate(similarity, iid, 10);

        for (i = 0; i < idpairs_size(pairs); i++) {
            printf("%d\t%d\t%.4f\n", iid, idpairs_keys(pairs)[i], idpairs_values(pairs)[i]);
        }
        
        idpairs_close_deep(pairs);
    }
 
    similarity_close(similarity);
    
    recdata_close(recdata);
    recdata_close(cerdata);
   
    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x4(%rsp), %rax
leaq 0x14(%rsp), %r10
leaq 0x28(%rsp), %rdx
leaq 0x20(%rsp), %rcx
leaq 0x1c(%rsp), %r8
leaq 0x18(%rsp), %r9
pushq %rax
pushq %r10
callq 0x26c4
addq $0x10, %rsp
testl %eax, %eax
je 0x12a3
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %ecx
movl 0x14(%rsp), %r8d
movl 0x4(%rsp), %r9d
callq 0x16cd
movq %rax, 0x8(%rsp)
movq %rax, %rdi
callq 0x17ad
movq %rax, %rbx
movq 0x28(%rsp), %rdi
callq 0x1060
movq 0x20(%rsp), %rdi
callq 0x1060
cmpl $0x0, 0x4(%rsp)
movq %rbx, 0x30(%rsp)
movq %rbx, %rdi
je 0x12ad
callq 0x198b
jmp 0x12b2
movl $0x1, %eax
jmp 0x135a
callq 0x1c56
movq %rax, %r15
movq 0x8(%rsp), %rax
cmpl $0x0, 0x4(%rax)
jle 0x133c
xorl %r12d, %r12d
leaq 0x1d3a(%rip), %r13      # 0x3004
movq %r15, %rdi
movl %r12d, %esi
movl $0xa, %edx
callq 0x1804
movq %rax, %rbp
movq %rax, %rdi
callq 0x25e1
testl %eax, %eax
jle 0x1326
xorl %ebx, %ebx
movq %rbp, %rdi
callq 0x25e4
movl (%rax,%rbx,4), %r14d
movq %rbp, %rdi
callq 0x25e9
movsd (%rax,%rbx,8), %xmm0
movq %r13, %rdi
movl %r12d, %esi
movl %r14d, %edx
movb $0x1, %al
callq 0x1080
incq %rbx
movq %rbp, %rdi
callq 0x25e1
cltq
cmpq %rax, %rbx
jl 0x12eb
movq %rbp, %rdi
callq 0x25bd
incl %r12d
movq 0x8(%rsp), %rax
cmpl 0x4(%rax), %r12d
jl 0x12ca
movq %r15, %rdi
callq 0x1814
movq 0x8(%rsp), %rdi
callq 0x13a4
movq 0x30(%rsp), %rdi
callq 0x13a4
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/pavel-demin[P]ft8d-c/pffft.c
// Function: cffti1_ps
void cffti1_ps(int n, float *wa, int *ifac)
{
  static const int ntryh[] = { 5,3,4,2,0 };
  int k1, j, ii;

  int nf = decompose(n,ifac,ntryh);
  float argh = (2*M_PI)/(float)n;
  int i = 1;
  int l1 = 1;
  for (k1=1; k1<=nf; k1++) {
    int ip = ifac[k1+1];
    int ld = 0;
    int l2 = l1*ip;
    int ido = n / l2;
    int idot = ido + ido + 2;
    int ipm = ip - 1;
    for (j=1; j<=ipm; j++) {
      float argld;
      int i1 = i, fi = 0;
      wa[i-1] = 1;
      wa[i] = 0;
      ld += l1;
      argld = ld*argh;
      for (ii = 4; ii <= idot; ii += 2) {
        i += 2;
        fi += 1;
        wa[i-1] = cos(fi*argld);
        wa[i] = sin(fi*argld);
      }
      if (ip > 5) {
        wa[i1-1] = wa[i-1];
        wa[i1] = wa[i];
      }
    }
    l1 = l2;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, %rax
movq %rsi, %r14
leaq 0x6c17(%rip), %rdx      # 0x8120
movl %edi, 0x4(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, %rsi
callq 0x16a7
movq %rax, 0x8(%rsp)
testl %eax, %eax
jle 0x1698
cvtsi2ssl 0x4(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x6b7f(%rip), %xmm1     # 0x80b8
divsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss %xmm0, 0x14(%rsp)
movq 0x8(%rsp), %rax
incl %eax
movq %rax, 0x8(%rsp)
movl $0x1, %r13d
movl $0x1, %ecx
movl $0x1, %eax
movq %r14, 0x38(%rsp)
movl %eax, %edx
movq 0x28(%rsp), %rax
movq %rcx, 0x30(%rsp)
movl 0x4(%rax,%rcx,4), %esi
movl %esi, %ecx
movl %edx, 0x1c(%rsp)
imull %edx, %ecx
movl 0x4(%rsp), %eax
cltd
movl %ecx, 0x10(%rsp)
idivl %ecx
cmpl $0x2, %esi
jl 0x1681
leal (%rax,%rax), %ebx
xorl %ecx, %ecx
movl $0x1, %r12d
movl %esi, 0x18(%rsp)
movq %rax, 0x40(%rsp)
addl 0x1c(%rsp), %ecx
movslq %r13d, %rdx
movss 0x6b0d(%rip), %xmm0     # 0x80c8
movlps %xmm0, -0x4(%r14,%rdx,4)
testl %eax, %eax
movl %ecx, 0x20(%rsp)
movq %rdx, 0x48(%rsp)
jle 0x163c
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
mulss 0x14(%rsp), %xmm0
movss %xmm0, 0x24(%rsp)
leaq (%r14,%rdx,4), %r14
movl $0x2, %ebp
movl $0x1, %r15d
xorps %xmm0, %xmm0
cvtsi2ss %r15d, %xmm0
mulss 0x24(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
callq 0x10b0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4(%r14,%rbp,4)
movsd 0x50(%rsp), %xmm0
callq 0x1120
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%r14,%rbp,4)
addq $0x2, %rbp
addl $0x2, %r13d
incl %r15d
cmpl %ebx, %ebp
jle 0x15f0
movl 0x18(%rsp), %esi
cmpl $0x6, %esi
movq 0x38(%rsp), %r14
jb 0x166c
movslq %r13d, %rax
movss -0x4(%r14,%rax,4), %xmm0
movq 0x48(%rsp), %rcx
movss %xmm0, -0x4(%r14,%rcx,4)
movss (%r14,%rax,4), %xmm0
movss %xmm0, (%r14,%rcx,4)
incl %r12d
cmpl %esi, %r12d
movq 0x40(%rsp), %rax
movl 0x20(%rsp), %ecx
jne 0x15ac
movq 0x30(%rsp), %rcx
incq %rcx
cmpq 0x8(%rsp), %rcx
movl 0x10(%rsp), %eax
jne 0x156b
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/pavel-demin[P]ft8d-c/pffft.c
// Function: decompose
static int decompose(int n, int *ifac, const int *ntryh) {
  int nl = n, nf = 0, i, j = 0;
  for (j=0; ntryh[j]; ++j) {
    int ntry = ntryh[j];
    while (nl != 1) {
      int nq = nl / ntry;
      int nr = nl - ntry * nq;
      if (nr == 0) {
        ifac[2+nf++] = ntry;
        nl = nq;
        if (ntry == 2 && nf != 1) {
          for (i = 2; i <= nf; ++i) {
            int ib = nf - i + 2;
            ifac[ib + 1] = ifac[ib];
          }
          ifac[2] = 2;
        }
      } else break;
    }
  }
  ifac[0] = n;
  ifac[1] = nf;
  return nf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movl (%rdx), %ebx
testl %ebx, %ebx
je 0x1754
movq %rdx, %rcx
leaq 0x8(%rsi), %r10
xorl %r11d, %r11d
movl %edi, %r9d
xorl %r8d, %r8d
movl $0x1, %eax
cmpl $0x1, %r9d
jne 0x16d7
movl %eax, %r9d
jmp 0x1742
movl %r8d, %ebp
movslq %r8d, %r8
addl $0x2, %ebp
leaq (%r10,%r8,4), %r14
movl %r9d, %eax
cltd
idivl %ebx
movl %eax, %edx
imull %ebx, %edx
cmpl %edx, %r9d
jne 0x1742
movl %ebx, 0x8(%rsi,%r8,4)
cmpl $0x2, %ebx
jne 0x172b
movl %ebp, %r9d
movl $0x2, %edx
subq %r9, %rdx
testq %r8, %r8
je 0x172b
jle 0x1724
xorl %r9d, %r9d
movl -0x4(%r14,%r9,4), %r15d
movl %r15d, (%r14,%r9,4)
decq %r9
cmpq %r9, %rdx
jne 0x1713
movl $0x2, 0x8(%rsi)
incq %r8
incl %ebp
addq $0x4, %r14
movl %eax, %r9d
cmpl $0x1, %eax
jne 0x16e4
movl $0x1, %r9d
movl 0x4(%rcx,%r11,4), %ebx
incq %r11
testl %ebx, %ebx
jne 0x16c7
jmp 0x1757
xorl %r8d, %r8d
movl %edi, (%rsi)
movl %r8d, 0x4(%rsi)
movl %r8d, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/pavel-demin[P]ft8d-c/pffft.c
// Function: passf2_ps
static NEVER_INLINE(void) passf2_ps(int ido, int l1, const v4sf *cc, v4sf *ch, const float *wa1, float fsign) {
  int k, i;
  int l1ido = l1*ido;
  if (ido <= 2) {
    for (k=0; k < l1ido; k += ido, ch += ido, cc+= 2*ido) {
      ch[0]         = VADD(cc[0], cc[ido+0]);
      ch[l1ido]     = VSUB(cc[0], cc[ido+0]);
      ch[1]         = VADD(cc[1], cc[ido+1]);
      ch[l1ido + 1] = VSUB(cc[1], cc[ido+1]);
    }
  } else {
    for (k=0; k < l1ido; k += ido, ch += ido, cc += 2*ido) {
      for (i=0; i<ido-1; i+=2) {
        v4sf tr2 = VSUB(cc[i+0], cc[i+ido+0]);
        v4sf ti2 = VSUB(cc[i+1], cc[i+ido+1]);
        v4sf wr = LD_PS1(wa1[i]), wi = VMUL(LD_PS1(fsign), LD_PS1(wa1[i+1]));
        ch[i]   = VADD(cc[i+0], cc[i+ido+0]);
        ch[i+1] = VADD(cc[i+1], cc[i+ido+1]);
        VCPLXMUL(tr2, ti2, wr, wi);
        ch[i+l1ido]   = tr2;
        ch[i+l1ido+1] = ti2;
      }
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
imull %edi, %esi
cmpl $0x3, %edi
jge 0x21a8
testl %esi, %esi
jle 0x2274
movslq %edi, %rax
movl %esi, %r8d
shlq $0x4, %rax
leaq 0x10(%rax), %r9
leal (%rdi,%rdi), %r10d
movslq %r10d, %r10
shlq $0x4, %r10
shlq $0x4, %r8
leaq 0x10(%r8), %r11
xorl %ebx, %ebx
movaps (%rdx), %xmm0
addps (%rdx,%rax), %xmm0
movaps %xmm0, (%rcx)
movaps (%rdx), %xmm0
subps (%rdx,%rax), %xmm0
movaps %xmm0, (%rcx,%r8)
movaps 0x10(%rdx), %xmm0
addps (%rdx,%r9), %xmm0
movaps %xmm0, 0x10(%rcx)
movaps 0x10(%rdx), %xmm0
subps (%rdx,%r9), %xmm0
movaps %xmm0, (%rcx,%r11)
addl %edi, %ebx
addq %r10, %rdx
addq %rax, %rcx
cmpl %esi, %ebx
jl 0x2166
jmp 0x2274
testl %esi, %esi
jle 0x2274
leal -0x1(%rdi), %eax
movl %edi, %r9d
leal (%rdi,%rdi), %r10d
movl %esi, %r11d
shlq $0x4, %r11
addq %rcx, %r11
addq $0x10, %r11
shlq $0x4, %r9
leaq (%r9,%rdx), %rbx
addq $0x10, %rbx
shlq $0x4, %r10
xorl %r14d, %r14d
xorl %r15d, %r15d
xorl %r12d, %r12d
movaps -0x10(%rbx,%r15,4), %xmm1
movaps (%rdx,%r15,4), %xmm2
movaps 0x10(%rdx,%r15,4), %xmm3
movaps %xmm2, %xmm4
subps (%rbx,%r15,4), %xmm3
subps %xmm1, %xmm4
movss (%r8,%r15), %xmm5
shufps $0x0, %xmm5, %xmm5      # xmm5 = xmm5[0,0,0,0]
movss 0x4(%r8,%r15), %xmm6
mulss %xmm0, %xmm6
shufps $0x0, %xmm6, %xmm6      # xmm6 = xmm6[0,0,0,0]
addps %xmm1, %xmm2
movaps %xmm2, (%rcx,%r15,4)
movaps 0x10(%rdx,%r15,4), %xmm1
addps (%rbx,%r15,4), %xmm1
movaps %xmm1, 0x10(%rcx,%r15,4)
movaps %xmm4, %xmm1
mulps %xmm6, %xmm1
mulps %xmm5, %xmm4
mulps %xmm3, %xmm6
subps %xmm6, %xmm4
mulps %xmm3, %xmm5
addps %xmm1, %xmm5
movaps %xmm4, -0x10(%r11,%r15,4)
movaps %xmm5, (%r11,%r15,4)
addq $0x2, %r12
addq $0x8, %r15
cmpq %rax, %r12
jb 0x21e1
addl %edi, %r14d
addq %r9, %r11
addq %r10, %rbx
addq %r9, %rcx
addq %r10, %rdx
cmpl %esi, %r14d
jl 0x21db
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/pavel-demin[P]ft8d-c/ft8d.c
// Function: check
int check()
{
  int i, j;
  uint8_t poly[15] = {1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1 };
  uint8_t data[96] = {0};

  memcpy(data, message, 77);

  for(i = 0; i < 82; ++i)
  {
    if(data[i])
    {
      for(j = 0; j < 15; ++j)
      {
        data[i + j] ^= poly[j];
      }
    }
  }

  for(i = 0; i < 14; ++i)
  {
    if(data[82 + i] != message[77 + i]) return 0;
  }

  return 1;
}

// Assembly:
xorps %xmm0, %xmm0
leaq -0x68(%rsp), %rdx
movups %xmm0, 0x4d(%rdx)
movl $0x0, 0x5c(%rdx)
leaq 0x6e40(%rip), %rax      # 0xd4b0
movl $0x9, %ecx
movq %rdx, %rdi
movq %rax, %rsi
rep  movsq (%rsi), %es:(%rdi)
movl 0x6e74(%rip), %ecx      # 0xd4f8
movl %ecx, 0x48(%rdx)
movb 0x6e6f(%rip), %cl       # 0xd4fc
movb %cl, 0x4c(%rdx)
xorl %ecx, %ecx
leaq 0x22df(%rip), %rsi      # 0x8978
cmpb $0x0, -0x68(%rsp,%rcx)
je 0x66b3
xorl %edi, %edi
movb (%rdi,%rsi), %r8b
xorb %r8b, (%rdx,%rdi)
incq %rdi
cmpq $0xf, %rdi
jne 0x66a2
incq %rcx
incq %rdx
cmpq $0x52, %rcx
jne 0x6699
movl $0x4d, %ecx
movb -0x63(%rsp,%rcx), %dl
cmpb (%rcx,%rax), %dl
jne 0x66dc
incq %rcx
cmpq $0x5b, %rcx
jne 0x66c4
movl $0x1, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/pavel-demin[P]ft8d-c/ft8d.c
// Function: trim
void trim(char *s)
{
  char *p = s;
  int l = strlen(p);

  while(isspace(p[l - 1])) p[--l] = 0;
  while(*p && isspace(*p)) ++p, --l;

  memmove(s, p, l + 1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x1060
movq %rax, %r14
callq 0x1150
movq (%rax), %rcx
movslq %r14d, %rdx
movsbq -0x1(%rbx,%rdx), %rdx
testb $0x20, 0x1(%rcx,%rdx,2)
je 0x6b90
movslq %r14d, %rdx
leaq -0x1(%rdx), %r14
movb $0x0, -0x1(%rbx,%rdx)
movq (%rax), %rcx
movsbq -0x2(%rbx,%rdx), %rdx
testb $0x20, 0x1(%rcx,%rdx,2)
movq %r14, %rdx
jne 0x6b74
movb (%rbx), %al
movq %rbx, %rsi
testb %al, %al
je 0x6baf
movsbq %al, %rax
testb $0x20, 0x1(%rcx,%rax,2)
je 0x6baf
decl %r14d
movb 0x1(%rsi), %al
incq %rsi
jmp 0x6b95
incl %r14d
movslq %r14d, %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/fibonacci_test.c
// Function: syllables_no
int syllables_no(char* s) {
	int num = 1;
	for (; *s != '\0'; s++)
		if (*s == ' ' || *s == '-')
			num++;

	return num;
}

// Assembly:
movl $0x1, %eax
movzbl (%rdi), %ecx
cmpl $0x20, %ecx
je 0x3c36
cmpl $0x2d, %ecx
je 0x3c36
testl %ecx, %ecx
jne 0x3c38
jmp 0x3c3d
incl %eax
incq %rdi
jmp 0x3c23
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/fibonacci.c
// Function: fibonacci
int fibonacci(int n) {
	if (memory == NULL) {
		// Αρχικοποίηση της μνήμης με τα πρώτα 2 στοιχεία της ακολουθίας
		memory = int_vector_create(0);
		int_vector_insert_last(memory, 0);
		int_vector_insert_last(memory, 1);
	}

	// Αν δεν έχουμε ήδη το αποτέλεσμα το υπολογίζουμε και το αποθηκεύουμε
	if (n >= int_vector_size(memory)) {
		int res = fibonacci(n-2) + fibonacci(n-1);
		int_vector_insert_last(memory, res);
	}

	return int_vector_get_at(memory, n);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
movq 0x55f8(%rip), %rdi      # 0xa438
testq %rdi, %rdi
jne 0x4e75
xorl %edi, %edi
callq 0x4ec0
movq %rax, 0x55e5(%rip)      # 0xa438
movq %rax, %rdi
xorl %esi, %esi
callq 0x4f1b
movq 0x55d4(%rip), %rdi      # 0xa438
movl $0x1, %esi
callq 0x4f1b
movq 0x55c3(%rip), %rdi      # 0xa438
callq 0x4f00
cmpl %ebx, %eax
jg 0x4ea0
leal -0x2(%rbx), %edi
callq 0x4e34
movl %eax, %ebp
leal -0x1(%rbx), %edi
callq 0x4e34
addl %eax, %ebp
movq 0x559f(%rip), %rdi      # 0xa438
movl %ebp, %esi
callq 0x4f1b
movq 0x5591(%rip), %rdi      # 0xa438
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4f11
// File: /workspace/github_c_makefile_star2_O3/felipelouza[P]egap/tools/heap.c
// Function: write_buffer
void write_buffer(heap *h, FILE *f_out, int level) {

  int i;
  if(level){
    for(i=0; i<h->out_idx; i++){
      fwrite(&h->out_buffer[i], h->pos_size+h->lcp_size, 1, f_out);
    }
  }
  else{
    for(i=0; i<h->out_idx; i++){
      uint64_t lcp = lcp(h->out_buffer[i]);
      fwrite(&lcp, h->lcp_size, 1, f_out);
    }
  }
  h->out_idx = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x210(%rdi), %eax
testl %edx, %edx
je 0x2aed
testl %eax, %eax
jle 0x2b44
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x208(%rbx), %rdi
addq %r15, %rdi
movslq 0x214(%rbx), %rax
movslq 0x218(%rbx), %rsi
addq %rax, %rsi
movl $0x1, %edx
movq %r14, %rcx
callq 0x11d0
incq %r12
movslq 0x210(%rbx), %rax
addq $0x10, %r15
cmpq %rax, %r12
jl 0x2ab0
jmp 0x2b44
testl %eax, %eax
jle 0x2b44
xorl %r12d, %r12d
leaq 0x1ab5(%rip), %r13      # 0x45b0
movq %rsp, %r15
xorl %ebp, %ebp
movq 0x208(%rbx), %rax
movslq 0x218(%rbx), %rsi
movq %rsi, %rcx
shlq $0x4, %rcx
movq (%rcx,%r13), %rcx
andq (%rax,%r12), %rcx
movq %rcx, (%rsp)
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x11d0
incq %rbp
movslq 0x210(%rbx), %rax
addq $0x10, %r12
cmpq %rax, %rbp
jl 0x2b00
movl $0x0, 0x210(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/felipelouza[P]egap/tools/heap.c
// Function: heap_free
void heap_free(heap *h, FILE *f_out, int level) {

  int i;
  for (i=0; i<h->size; i++){
    //fclose(h->heap[i]->f_in);
    free(h->heap[i]->buffer);
    free(h->heap[i]);
  }

  #if OUTPUT_BUFFER 
    if(h->out_idx) write_buffer(h, f_out, level);
    free(h->out_buffer);
  #endif
  
  fclose(h->f_in);
      
  free(h->heap);
  free(h);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x8(%rdi)
jle 0x2b9c
xorl %r15d, %r15d
movq (%rbx), %rax
movq (%rax,%r15,8), %rax
movq (%rax), %rdi
callq 0x3149
movq (%rbx), %rax
movq (%rax,%r15,8), %rdi
callq 0x3149
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x2b75
cmpl $0x0, 0x210(%rbx)
je 0x2bb2
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2a87
movq 0x208(%rbx), %rdi
callq 0x3149
movq 0x200(%rbx), %rdi
callq 0x10b0
movq (%rbx), %rdi
callq 0x3149
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3149
// File: /workspace/github_c_makefile_star2_O3/felipelouza[P]egap/tools/heap.c
// Function: heapfy_down
void heapfy_down(heap *h, int i) {

  int last = h->size-1;

  // Selects the child s of i with smaller cost:
  int l = 2*i+1;
  int r = l+1;
  int s;
  if (r <= last)
    s = key(l) < key(r) ? l : r;    
  else if (l == last)
    s = l;
  else
    return;

  // Swaps down:
  while (key(i) > key(s)) {   
    
    heap_node *aux = h->heap[i];
    h->heap[i] = h->heap[s];
    h->heap[s] = aux;

    i = s;
    l = 2*i+1;
    r = l+1;

    if (r <= last)
      s = key(l) < key(r) ? l : r;      
    else if (l == last)
      s = l;
    else
      return;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x8(%rdi), %eax
leal -0x1(%rax), %ecx
leal 0x1(,%rsi,2), %r8d
leal 0x2(,%rsi,2), %edx
cmpl %eax, %edx
jge 0x2cad
movq (%rdi), %r9
movslq %r8d, %r10
movq (%r9,%r10,8), %r10
movq (%r10), %r11
movslq 0x8(%r10), %r10
shlq $0x4, %r10
movq (%r11,%r10), %rbx
movslq %edx, %r14
movq (%r9,%r14,8), %r14
movq (%r14), %r15
movslq 0x8(%r14), %r14
shlq $0x4, %r14
cmpq (%r15,%r14), %rbx
movq 0x8(%r11,%r10), %r10
sbbq 0x8(%r15,%r14), %r10
cmovbl %r8d, %edx
jmp 0x2cbb
cmpl %ecx, %r8d
jne 0x2da3
movq (%rdi), %r9
movl %ecx, %edx
movslq %esi, %rsi
movq (%r9,%rsi,8), %r8
movq (%r8), %rbx
movslq 0x8(%r8), %r14
shlq $0x4, %r14
movslq %edx, %r10
movq (%r9,%r10,8), %r11
movq (%r11), %r15
movslq 0x8(%r11), %r12
shlq $0x4, %r12
movq (%r15,%r12), %r13
cmpq (%rbx,%r14), %r13
movq 0x8(%r15,%r12), %r15
sbbq 0x8(%rbx,%r14), %r15
jae 0x2da3
leaq (%r9,%rsi,8), %rbx
movq %r11, (%rbx)
movq (%rdi), %rsi
movq %r8, (%rsi,%r10,8)
leal 0x1(,%rdx,2), %esi
leal 0x2(,%rdx,2), %r8d
cmpl %eax, %r8d
jge 0x2d59
movq (%rdi), %r9
movslq %esi, %r10
movq (%r9,%r10,8), %r10
movq (%r10), %r11
movslq 0x8(%r10), %r10
shlq $0x4, %r10
movq (%r11,%r10), %rbx
movslq %r8d, %r14
movq (%r9,%r14,8), %r14
movq (%r14), %r15
movslq 0x8(%r14), %r14
shlq $0x4, %r14
cmpq (%r15,%r14), %rbx
movq 0x8(%r11,%r10), %r10
sbbq 0x8(%r15,%r14), %r10
jb 0x2d62
movl %r8d, %esi
jmp 0x2d62
cmpl %ecx, %esi
jne 0x2da3
movq (%rdi), %r9
movl %ecx, %esi
movslq %edx, %rdx
leaq (%r9,%rdx,8), %rbx
movq (%rbx), %r8
movq (%r8), %rdx
movslq 0x8(%r8), %r14
shlq $0x4, %r14
movslq %esi, %r10
movq (%r9,%r10,8), %r11
movq (%r11), %r9
movslq 0x8(%r11), %r15
shlq $0x4, %r15
movq (%r9,%r15), %r12
movq 0x8(%r9,%r15), %r9
cmpq (%rdx,%r14), %r12
sbbq 0x8(%rdx,%r14), %r9
movl %esi, %edx
jb 0x2cfb
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/felipelouza[P]egap/tools/heap.c
// Function: read_buffer
void  read_buffer(heap *h, heap_node *node){

//  fseek(h->f_in, node->seek*sizeof(pair), SEEK_SET);
    fseek(h->f_in, node->seek*(h->pos_size+h->lcp_size), SEEK_SET);

    int i;
    for(i=0; i<h->input_size; i++){
      node->buffer[i]=0;
      int e = fread(&node->buffer[i], h->pos_size+h->lcp_size, 1, h->f_in);
      if(e!=1) {perror(__func__); exit(1);}
      if(node->buffer[i]==MAX_KEY) break; 
    }

    node->seek += h->input_size;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x200(%rdi), %rdi
movslq 0x214(%r14), %rax
movslq 0x218(%r14), %rsi
addq %rax, %rsi
imulq 0x10(%rbx), %rsi
xorl %r13d, %r13d
xorl %edx, %edx
callq 0x1140
cmpq $0x0, 0x220(%r14)
je 0x2e99
movq (%rbx), %rdi
movl 0x214(%r14), %edx
movl 0x218(%r14), %eax
movl $0x1, %r12d
xorl %r15d, %r15d
addl %edx, %eax
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi,%r15)
addq %r15, %rdi
movslq %eax, %rsi
movq 0x200(%r14), %rcx
movl $0x1, %edx
callq 0x1090
cmpl $0x1, %eax
jne 0x2ea7
movq (%rbx), %rdi
movl 0x214(%r14), %edx
movl 0x218(%r14), %eax
leal (%rax,%rdx), %esi
shll $0x3, %esi
movb $-0x80, %cl
subb %sil, %cl
movq $-0x1, %rsi
shrq %cl, %rsi
testb $0x40, %cl
movq $-0x1, %rcx
cmovneq %rsi, %rcx
movl $0x0, %r8d
cmoveq %rsi, %r8
xorq 0x8(%rdi,%r15), %r8
xorq (%rdi,%r15), %rcx
orq %r8, %rcx
movq 0x220(%r14), %r13
je 0x2e99
leaq 0x1(%r12), %rcx
addq $0x10, %r15
cmpq %r12, %r13
movq %rcx, %r12
ja 0x2e0b
addq %r13, 0x10(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x1308
// File: /workspace/github_c_makefile_star2_O3/felipelouza[P]egap/tools/heap.c
// Function: heap_insert
int heap_insert(heap *h, size_t pos) {

  if (!h->heap[h->size])
    h->heap[h->size] = malloc(sizeof(heap_node));

  if (!h->heap[h->size]) 
    return errno = ENOMEM;

  heap_node *node = h->heap[h->size];

  //alloc buffer <pos, lcp>
  node->buffer = (pair*) malloc(h->input_size*sizeof(pair));
  if (!node->buffer) 
    return errno = ENOMEM;
  node->idx = 0;
  
  //load buffer
  node->seek = pos;
  read_buffer(h, node);

  #if DEBUG
    int i;
    for(i=0; i<h->input_size; i++) 
      printf("<%lu, %lu (%lu)> ", lcp(node->buffer[i]), pos(node->buffer[i]), node->buffer[i]);
    printf("**\n");
  #endif
  
  heapfy_up(h,h->size++);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r13
movslq 0x8(%rdi), %r12
movq (%r13,%r12,8), %r14
testq %r14, %r14
jne 0x2eed
movl $0x18, %edi
callq 0x3092
movq %rax, (%r13,%r12,8)
movq (%rbx), %rax
movq (%rax,%r12,8), %r14
testq %r14, %r14
je 0x2fb4
movq 0x220(%rbx), %rdi
shlq $0x4, %rdi
callq 0x3092
movq %rax, (%r14)
testq %rax, %rax
je 0x2fb4
movl $0x0, 0x8(%r14)
movq %r15, 0x10(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2dad
cmpq $0x0, 0x220(%rbx)
je 0x2f93
leaq 0x167f(%rip), %r12      # 0x45b0
leaq 0x1659(%rip), %r15      # 0x4591
xorl %r13d, %r13d
xorl %ebp, %ebp
movq (%r14), %rcx
movq (%rcx,%r13), %rax
movq 0x8(%rcx,%r13), %r8
movslq 0x218(%rbx), %rdx
leal (,%rdx,8), %ecx
movq %r8, %rdi
shrq %cl, %rdi
shlq $0x4, %rdx
movq (%rdx,%r12), %rsi
movq %rax, %rdx
shrdq %cl, %r8, %rdx
andq %rax, %rsi
testb $0x40, %cl
cmovneq %rdi, %rdx
movq %r15, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x10d0
incq %rbp
addq $0x10, %r13
cmpq %rbp, 0x220(%rbx)
ja 0x2f3d
leaq 0x14a6(%rip), %rdi      # 0x4440
callq 0x1080
movl 0x8(%rbx), %esi
leal 0x1(%rsi), %eax
movl %eax, 0x8(%rbx)
movq %rbx, %rdi
callq 0x2be4
xorl %eax, %eax
jmp 0x2fc4
callq 0x1050
movl $0xc, (%rax)
movl $0xc, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/felipelouza[P]egap/tools/heap.c
// Function: heap_delete_min
pair heap_delete_min(heap *h) {

  heap_node *node = h->heap[0];

  pair tmp=0;
  tmp= node->buffer[node->idx];

  if(++node->idx == h->input_size){ //load from disk
    node->idx = 0; 
    read_buffer(h, node);
  }

  heapfy_down(h,0);
  
  return tmp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rax), %rsi
movq (%rsi), %rax
movslq 0x8(%rsi), %rcx
movq %rcx, %rdx
shlq $0x4, %rdx
movq (%rax,%rdx), %r14
movq 0x8(%rax,%rdx), %r15
incq %rcx
movl %ecx, 0x8(%rsi)
cmpq %rcx, 0x220(%rdi)
jne 0x3016
movl $0x0, 0x8(%rsi)
movq %rbx, %rdi
callq 0x2dad
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2c4c
movq %r14, %rax
movq %r15, %rdx
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/utilities.c
// Function: initialize
int initialize(FILE *fileName, DocumentNode *documentArray){
    int maxLength = 1, curLength = 0, lineId = 0, docWords;
    char lineBuffer[100000], *newDoc;

    // start reading the file until EOF is read
    while(fgets(lineBuffer, 99999, fileName)){                  // read docfile contents
        strtok(lineBuffer, "\n");                               // remove the useless \n character at the end of the line

        curLength = strlen(lineBuffer);
        if( curLength > maxLength)
            maxLength = curLength;

        // every document will have the length of the line read
        newDoc = (char *) malloc(strlen(lineBuffer) +1);
        // copy the useful content (just the text) of lineBuffer to newDoc
        strcpy(newDoc, lineBuffer);

        docWords = 1;                                           // init at 1 so we don't have to increment it for this instance
        strtok(lineBuffer, "/");

        while((strtok(NULL, "/"))){                             // count the path's words
            docWords++;
        }

        addDocument(documentArray, lineId, newDoc, docWords);   // add document to our array
        lineId++;
    }
    return maxLength;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x186b8, %rsp          # imm = 0x186B8
movq %rsi, -0x38(%rbp)
movq %rdi, %rdx
leaq -0x186e0(%rbp), %rdi
movl $0x1869f, %esi          # imm = 0x1869F
movq %rdx, -0x30(%rbp)
callq 0x2170
movl $0x1, %r15d
testq %rax, %rax
je 0x2902
xorl %r13d, %r13d
leaq -0x186e0(%rbp), %rbx
leaq 0x29f1(%rip), %r12      # 0x5261
movq %rbx, %rdi
leaq 0x2be1(%rip), %rsi      # 0x545b
callq 0x22d0
movq %rbx, %rdi
callq 0x20d0
movq %rax, %r14
leaq 0x1(%rax), %rdi
callq 0x2240
movq %rax, -0x40(%rbp)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
movq %rbx, %rdi
movq %r12, %rsi
callq 0x22d0
xorl %ebx, %ebx
xorl %edi, %edi
movq %r12, %rsi
callq 0x22d0
incl %ebx
testq %rax, %rax
jne 0x28af
cmpl %r14d, %r15d
cmovlel %r14d, %r15d
movq %r13, %rax
shlq $0x4, %rax
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rdx
movq %rdx, (%rcx,%rax)
movl %ebx, 0x8(%rcx,%rax)
incq %r13
leaq -0x186e0(%rbp), %rbx
movq %rbx, %rdi
movl $0x1869f, %esi          # imm = 0x1869F
movq -0x30(%rbp), %rdx
callq 0x2170
testq %rax, %rax
jne 0x2870
movl %r15d, %eax
addq $0x186b8, %rsp          # imm = 0x186B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/utilities.c
// Function: destroyDocuments
void destroyDocuments(DocumentNode *documentNodes, int nLines){
    int i;

    for (i = 0;i < nLines; i++)
        free(documentNodes[i].text);
    free(documentNodes);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
jle 0x2959
movl %esi, %r14d
shlq $0x4, %r14
xorl %r15d, %r15d
movq (%rbx,%r15), %rdi
callq 0x2030
addq $0x10, %r15
cmpq %r15, %r14
jne 0x2947
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/utilities.c
// Function: determineWorkload
int determineWorkload(int nDocs, int numWorkers, int *remainder){
    int increment = 0;

    if ((nDocs % numWorkers) == 0){
        increment = nDocs / numWorkers;            // determine how many files each worker will get
    }
    else if ((nDocs % numWorkers) > 0){
        increment = nDocs / numWorkers;
        (*remainder) = nDocs % numWorkers;
    }

    return increment;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdx, %rcx
movl %edi, %eax
cltd
idivl %esi
testl %edx, %edx
je 0x2981
jle 0x2988
movl %edx, (%rcx)
jmp 0x298a
movl %edi, %eax
cltd
idivl %esi
jmp 0x298a
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/utilities.c
// Function: splitWorkload
int *splitWorkload(int increment, int *remainder, int numWorkers) {
    int i, *workerLoad;

    workerLoad = (int *) malloc(sizeof(int) * numWorkers);

    for(i = 0; i < numWorkers; i++){
        if(*remainder > 0) {
            workerLoad[i] = increment + 1;          // split the remainder between the workers
            (*remainder)--;
        }
        else
            workerLoad[i] = increment;
    }

    return workerLoad;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movq %rsi, %rbx
movl %edi, %r14d
movslq %edx, %r12
leaq (,%r12,4), %rdi
callq 0x2240
testl %r12d, %r12d
jle 0x29dc
leal 0x1(%r14), %ecx
movl (%rbx), %edx
movl %r15d, %esi
xorl %edi, %edi
testl %edx, %edx
jle 0x29cd
decl %edx
movl %edx, (%rbx)
movl %ecx, %r8d
jmp 0x29d0
movl %r14d, %r8d
movl %r8d, (%rax,%rdi,4)
incq %rdi
cmpq %rdi, %rsi
jne 0x29c0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/utilities.c
// Function: distributeDocs
void distributeDocs(DocumentNode *documentArray, int *incrementArray, int numWorkers, int *fdIn){
    int i, j, lines = 0;
    char tempSize[5], sizeTriple[4] = "000", sizeDouble[3] = "00", sizeSimple[2] = "0";

    for(i = 0; i < numWorkers; i++){
        for(j = 0; j < incrementArray[i]; j++){
            // Pipe atomicity is guaranteed at 4096 bytes max so make the size payload contain 4 digits
            if(strlen(documentArray[lines].text) < 10 )
                sprintf(tempSize, "%s%d",sizeTriple, (int) strlen(documentArray[lines].text));
            else if(strlen(documentArray[lines].text) < 100)
                sprintf(tempSize, "%s%d", sizeDouble, (int) strlen(documentArray[lines].text));
            else if(strlen(documentArray[lines].text) < 1000)
                sprintf(tempSize, "%s%d", sizeSimple, (int) strlen(documentArray[lines].text));

            if((write(fdIn[i], tempSize, strlen(tempSize))) == -1)
                perror("write");

            if((write(fdIn[i], documentArray[lines].text, strlen(documentArray[lines].text))) == -1)
                perror("write");

            lines++;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, -0x50(%rbp)
movq %rdi, -0x58(%rbp)
movl $0x303030, -0x3c(%rbp)  # imm = 0x303030
movb $0x0, -0x2c(%rbp)
movw $0x3030, -0x2e(%rbp)    # imm = 0x3030
movw $0x30, -0x2a(%rbp)
testl %edx, %edx
jle 0x2b1c
movq %rcx, %r12
movl %edx, %eax
movq %rax, -0x60(%rbp)
xorl %ebx, %ebx
xorl %ecx, %ecx
movq -0x50(%rbp), %rax
cmpl $0x0, (%rax,%rbx,4)
jle 0x2b0f
movl %ecx, -0x34(%rbp)
movslq %ecx, %r13
shlq $0x4, %r13
addq -0x58(%rbp), %r13
xorl %edx, %edx
movl %edx, -0x38(%rbp)
movq (%r13), %rdi
callq 0x20d0
leaq -0x3c(%rbp), %rdx
cmpq $0xa, %rax
jb 0x2a74
leaq -0x2e(%rbp), %rdx
cmpq $0x64, %rax
jb 0x2a74
leaq -0x2a(%rbp), %rdx
cmpq $0x3e7, %rax            # imm = 0x3E7
ja 0x2a88
leaq -0x41(%rbp), %rdi
leaq 0x26f8(%rip), %rsi      # 0x5177
movl %eax, %ecx
xorl %eax, %eax
callq 0x2320
movl (%r12,%rbx,4), %r15d
leaq -0x41(%rbp), %r14
movq %r14, %rdi
callq 0x20d0
movl %r15d, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x2090
cmpq $-0x1, %rax
je 0x2aee
movq %r12, %r14
movl (%r12,%rbx,4), %r15d
movq (%r13), %r12
movq %r12, %rdi
callq 0x20d0
movl %r15d, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2090
cmpq $-0x1, %rax
je 0x2afc
movl -0x38(%rbp), %edx
incl %edx
addq $0x10, %r13
movq -0x50(%rbp), %rax
cmpl (%rax,%rbx,4), %edx
movq %r14, %r12
jl 0x2a48
jmp 0x2b0a
leaq 0x2687(%rip), %rdi      # 0x517c
callq 0x22c0
jmp 0x2aac
leaq 0x2679(%rip), %rdi      # 0x517c
callq 0x22c0
jmp 0x2ad3
movl -0x34(%rbp), %ecx
addl %edx, %ecx
incq %rbx
cmpq -0x60(%rbp), %rbx
jne 0x2a2a
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/utilities.c
// Function: countWords
int countWords(char *query){
    int counter = 0, queryLength = strlen(query), i = 0;

    if (!strcmp(query, ""))
        return 0;

    while (i++ <= queryLength && counter < 10){
        if (*query == ' ' || *query == '\t' || *query == '\0')
            counter++;      // increase the number of words
        query++;            // go to next character
    }
    return counter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x20d0
movb (%rbx), %dil
testb %dil, %dil
setne %cl
testl %eax, %eax
setns %dl
andb %cl, %dl
xorl %ecx, %ecx
cmpb $0x1, %dl
jne 0x2dcf
xorl %ecx, %ecx
movl $0x1, %edx
movabsq $0x100000201, %rsi      # imm = 0x100000201
cmpb $0x20, %dil
ja 0x2dbd
movzbl %dil, %edi
btq %rdi, %rsi
jae 0x2dbd
incl %ecx
cmpl %eax, %edx
jg 0x2dcf
cmpl $0xa, %ecx
jge 0x2dcf
movb (%rbx,%rdx), %dil
incq %rdx
jmp 0x2dab
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: place
void place(pool_t *pool, char *url) {

    pthread_mutex_lock(&mtx);

    while (pool->count >= POOL_SIZE){
        pthread_cond_wait(&cond_nonfull, &mtx);
    }
    pool->end = (pool->end + 1) % POOL_SIZE;

    strcpy(pool->url[pool->end], url);
    pool->count++;

    pthread_mutex_unlock(&mtx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x575b(%rip), %rdi      # 0x8598
callq 0x23b0
cmpl $0x32, 0x1390(%rbx)
jl 0x2e6d
leaq 0x57c6(%rip), %r15      # 0x8618
leaq 0x573f(%rip), %r12      # 0x8598
movq %r15, %rdi
movq %r12, %rsi
callq 0x20a0
cmpl $0x31, 0x1390(%rbx)
jg 0x2e59
movl 0x138c(%rbx), %eax
movl %eax, %ecx
incl %ecx
movslq %ecx, %rcx
imulq $0x51eb851f, %rcx, %rcx # imm = 0x51EB851F
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x24, %rcx
addl %edx, %ecx
imull $0x32, %ecx, %ecx
negl %ecx
addl %ecx, %eax
incl %eax
movl %eax, 0x138c(%rbx)
cltq
imulq $0x64, %rax, %rdi
addq %rbx, %rdi
movq %r14, %rsi
callq 0x2050
incl 0x1390(%rbx)
leaq 0x56dd(%rip), %rdi      # 0x8598
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2230
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: obtain
char  *obtain(pool_t *pool) {
    char *url;

    pthread_mutex_lock(&mtx);

    while (pool->count <= 0){
        ready++;
        pthread_cond_wait(&cond_nonempty, &mtx);
    }
    url = pool->url[pool->end];

    pool->start = (pool->start + 1) % POOL_SIZE;
    pool->count--;
    pthread_mutex_unlock(&mtx);

    return url;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x56bc(%rip), %rdi      # 0x8598
callq 0x23b0
movl 0x1390(%rbx), %eax
testl %eax, %eax
jg 0x2f14
leaq 0x56f6(%rip), %r14      # 0x85e8
leaq 0x569f(%rip), %r15      # 0x8598
incl 0x5751(%rip)            # 0x8650
movq %r14, %rdi
movq %r15, %rsi
callq 0x20a0
movl 0x1390(%rbx), %eax
testl %eax, %eax
jle 0x2ef9
movslq 0x138c(%rbx), %rcx
imulq $0x64, %rcx, %r14
addq %rbx, %r14
movl 0x1388(%rbx), %ecx
movl %ecx, %edx
incl %edx
movslq %edx, %rdx
imulq $0x51eb851f, %rdx, %rdx # imm = 0x51EB851F
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x24, %rdx
addl %esi, %edx
imull $0x32, %edx, %edx
negl %edx
addl %edx, %ecx
incl %ecx
movl %ecx, 0x1388(%rbx)
decl %eax
movl %eax, 0x1390(%rbx)
leaq 0x5637(%rip), %rdi      # 0x8598
callq 0x2230
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: readSaveFolder
void readSaveFolder(char *path){
    DIR *dp;
    struct dirent *dir;
    char *newName;
    if((dp = opendir(path)) == NULL){                       // Open directory
        perror("save_dir opendir");
        return;
    }
    while((dir = readdir(dp)) != NULL){                     // Read contents till the end
        if(dir->d_ino == 0)                                 // Ignore removed entries
            continue;
        newName = malloc(strlen(path)+strlen(dir->d_name)+2);
        strcpy(newName, path);                              // Compose pathname

        if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, "..") ) { //Filter out
            //do nothing
        }
        else{
            strcat(newName, dir->d_name);
            strcat(newName, "/");
            insertDocfile(newName);
        }
        free(newName);
    }
    closedir(dp);                                           // Close directory
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x20c0
testq %rax, %rax
je 0x35a0
movq %rax, %r14
movq %rax, %rdi
callq 0x2220
testq %rax, %rax
je 0x358a
movq %rax, %r15
cmpq $0x0, (%r15)
je 0x3576
movq %rbx, %rdi
callq 0x20d0
movq %rax, %r12
leaq 0x13(%r15), %r13
movq %r13, %rdi
callq 0x20d0
leaq (%r12,%rax), %rdi
addq $0x2, %rdi
callq 0x2240
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2050
cmpb $0x2e, 0x13(%r15)
jne 0x354c
cmpb $0x0, 0x14(%r15)
je 0x356e
cmpb $0x2e, 0x14(%r15)
jne 0x354c
cmpb $0x0, 0x15(%r15)
je 0x356e
movq %r12, %rdi
movq %r13, %rsi
callq 0x2310
movq %r12, %rdi
callq 0x20d0
movw $0x2f, (%r12,%rax)
movq %r12, %rdi
callq 0x3da9
movq %r12, %rdi
callq 0x2030
movq %r14, %rdi
callq 0x2220
movq %rax, %r15
testq %rax, %rax
jne 0x34f8
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2140
leaq 0x1f14(%rip), %rdi      # 0x54bb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22c0
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: prepareReq
int prepareReq(char *domain, int port, char *path, int sockfd){
    char request[500];

    sprintf(request, "GET %s HTTP/1.1\nUser-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)\nHost: %s\nAccept-Language: en-us\nAccept-Encoding: gzip, deflate\nConnection: Keep-Alive\n\n", path, domain);
    customWrite(sockfd, request, strlen(request));

    return (int) strlen(request);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movl %ecx, %ebx
movq %rdi, %rcx
leaq 0x1a38(%rip), %rsi      # 0x53ba
leaq -0x210(%rbp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x2320
movq %r14, %rdi
callq 0x20d0
movl %ebx, %edi
movq %r14, %rsi
movl %eax, %edx
callq 0x3694
movq %r14, %rdi
callq 0x20d0
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: getHeaderSize
int getHeaderSize(char *header){
    char *size;
    int headerSize = 0, start, end;

    start = strlen(header);
    size = strstr(header, "<!DOCTYPE html>");
    end = strlen(size);

    headerSize = start - end;

    return headerSize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x20d0
movq %rax, %r14
leaq 0x1a53(%rip), %rsi      # 0x546e
movq %rbx, %rdi
callq 0x23a0
movq %rax, %rdi
callq 0x20d0
subl %eax, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: createSaveFile
FILE *createSaveFile(char *path, char *save_dir){
    char folderName[200], saveDir[200], *folder, tempPath[200];
    FILE *file;
    struct stat st = {0};

    strcpy(saveDir, "./");
    strcat(saveDir, save_dir);
    strcat(saveDir, "/");

    if (stat(saveDir, &st) == -1) {
        if(mkdir(saveDir, 0700) == -1)                  // Create parent dir
            perror("parent mkdir");
    }
    strcpy(tempPath,path);
    folder = strtok(tempPath, "/");

    strcat(saveDir, folder);

    if (stat(saveDir, &st) == -1) {
        if(mkdir(saveDir, 0700) == -1)                  // Create siteX dir
            perror("subdir mkdir");
    }

    strcpy(folderName, save_dir);
    strcat(folderName, path);

    file = fopen(folderName, "w+");                     // Create desired file

    if(file == NULL){
        perror_exit("fopen");
    }

    return file;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x300, %rsp            # imm = 0x300
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x180(%rbp), %r15
movl $0x90, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2120
leaq -0xf0(%rbp), %r12
movw $0x2f2e, (%r12)         # imm = 0x2F2E
movb $0x0, 0x2(%r12)
movq %r12, %rdi
movq %r14, %rsi
callq 0x2310
movq %r12, %rdi
callq 0x20d0
movw $0x2f, -0xf0(%rbp,%rax)
movq %r12, %rdi
movq %r15, %rsi
callq 0x21e0
cmpl $-0x1, %eax
jne 0x3ad9
leaq -0xf0(%rbp), %rdi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x2060
cmpl $-0x1, %eax
je 0x3b77
leaq -0x250(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2050
leaq 0x176f(%rip), %rsi      # 0x5261
movq %r15, %rdi
callq 0x22d0
leaq -0xf0(%rbp), %r15
movq %r15, %rdi
movq %rax, %rsi
callq 0x2310
leaq -0x180(%rbp), %rsi
movq %r15, %rdi
callq 0x21e0
cmpl $-0x1, %eax
jne 0x3b36
leaq -0xf0(%rbp), %rdi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x2060
cmpl $-0x1, %eax
je 0x3b88
leaq -0x320(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x2050
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2310
leaq 0x193e(%rip), %rsi      # 0x5498
movq %r15, %rdi
callq 0x22b0
testq %rax, %rax
je 0x3b96
addq $0x300, %rsp            # imm = 0x300
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1900(%rip), %rdi      # 0x547e
callq 0x22c0
jmp 0x3ad9
leaq 0x18fc(%rip), %rdi      # 0x548b
callq 0x22c0
jmp 0x3b36
callq 0x2410
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: searchUrl
char *searchUrl(char *inputFile, pool_t *pool){
    char *ahref, *relativeUrl, *temp, *saveptr, *fullpath, *finalUrl = NULL;
    int exists = 0;

    temp = (char *) malloc(strlen(inputFile) + 1);

    while ((ahref = strstr(inputFile, "<a href="))) {
        strcpy(temp, ahref);
        relativeUrl = strtok_r(temp + 8, "\"", &saveptr);                                       // Thread safe strtok

        finalUrl = (char *) malloc(strlen(relativeUrl) + 1);
        fullpath = (char *) malloc(strlen("./save_dir") + strlen(relativeUrl) + 1);

        finalUrl = stringReplace(relativeUrl, finalUrl);

        strcpy(fullpath, "save_dir");
        strcat(fullpath, finalUrl);                                                             // Pass relative path to access

        if ((searchPool(pool, finalUrl) == 1) && ((!fileExist(fullpath)))) {   					// Url doesnt exist anywhere
            place(pool, finalUrl);
        }
        if(inputFile != NULL)
            inputFile = ahref + 8;                                                              // Move pointer after a href
    }
    free(temp);
    free(finalUrl);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rsi, -0x30(%rbp)
movq %rdi, %r14
callq 0x20d0
leaq 0x1(%rax), %rdi
callq 0x2240
movq %rax, %rbx
leaq 0x18d3(%rip), %rsi      # 0x54a1
movq %r14, -0x40(%rbp)
movq %r14, %rdi
callq 0x23a0
testq %rax, %rax
je 0x3cc3
movq %rax, %r12
movq %rbx, %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movq %rbx, %r14
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2050
movq -0x38(%rbp), %rdi
leaq 0x18a0(%rip), %rsi      # 0x54aa
leaq -0x48(%rbp), %rdx
callq 0x2150
movq %rax, %rbx
movq %rax, %rdi
callq 0x20d0
movq %rax, %r13
leaq 0x1(%rax), %rdi
callq 0x2240
movq %rax, %r15
addq $0xb, %r13
movq %r13, %rdi
callq 0x2240
movq %rax, %r13
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3ce8
movabsq $0x7269645f65766173, %rax # imm = 0x7269645F65766173
movq %rax, (%r13)
movb $0x0, 0x8(%r13)
movq %r13, %rdi
movq %r15, %rsi
callq 0x2310
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x3d34
testl %eax, %eax
je 0x3c94
movq %r13, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x21e0
testl %eax, %eax
je 0x3c94
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x2e25
addq $0x8, %r12
movq -0x40(%rbp), %rax
testq %rax, %rax
cmoveq %rax, %r12
movq %r12, %rdi
leaq 0x17f4(%rip), %rsi      # 0x54a1
callq 0x23a0
movq %rax, %r12
testq %rax, %rax
movq %r14, %rbx
jne 0x3bf1
jmp 0x3cc6
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x2030
movq %r15, %rdi
callq 0x2030
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: stringReplace
char *stringReplace(char *string, char *output){

    if((strstr(string, "..")) != NULL){                             // If the file is like "../siteX/"
        string += 2;
    }
    else if(strstr(string, "./") != NULL)                           // If the file is like "./siteY/"
        string++;

    strcpy(output, string);

    return output;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1810(%rip), %rsi      # 0x550c
callq 0x23a0
movl $0x2, %ecx
testq %rax, %rax
jne 0x3d22
leaq 0x154e(%rip), %rsi      # 0x5260
movq %r14, %rdi
callq 0x23a0
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
addq %rcx, %r14
movq %rbx, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x2050
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: searchPool
int searchPool(pool_t *pool, char *url){
    int max, i;
    max = pool->count;
    for (i = 0; i <= max; i++) {
        if (!strcmp(url, pool->url[i]))                             // Url exists in pool
            return 0;
    }

    return 1;                                                       // Url doesnt exist
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl 0x1390(%rdi), %r12d
movl $0x1, %ebx
testl %r12d, %r12d
js 0x3d75
movq %rsi, %r14
movq %rdi, %r15
incq %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x2190
testl %eax, %eax
je 0x3d73
addq $0x64, %r15
decq %r12
jne 0x3d59
jmp 0x3d75
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/support.c
// Function: insertDocfile
void insertDocfile(char *path){
    FILE *file;

    file = fopen("docfile", "a");                          	// Create desired file

    if(file == NULL){
        perror_exit("fopen");
    }

    fprintf(file, "%s\n", path);

    fclose(file);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x14f0(%rip), %rdi      # 0x52aa
leaq 0x16f4(%rip), %rsi      # 0x54b5
callq 0x22b0
testq %rax, %rax
je 0x3dee
movq %rax, %r14
leaq 0x16e2(%rip), %rsi      # 0x54b7
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x21c0
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x20b0
callq 0x2428
nop
// File: /workspace/github_c_makefile_star2_O3/devkot[P]SearchEngine/Crawler/jobexec.c
// Function: cleanUp
void cleanUp(int numWorkers, DocumentNode *documentArray, int nDocs) {
    int i;
    char pipeOut[50], pipeIn[50];

    for (i = 0; i < numWorkers; i++) {
        sprintf(pipeIn, "/tmp/fifo_%d_in", i);
        sprintf(pipeOut, "/tmp/fifo_%d_out", i);

        close(fdIn[i]);
        close(fdOut[i]);

        unlink(pipeIn);
        unlink(pipeOut);
    }

    destroyDocuments(documentArray, nDocs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %edx, -0x2c(%rbp)
movq %rsi, -0x38(%rbp)
testl %edi, %edi
jle 0x4131
movl %edi, %r15d
leaq -0x70(%rbp), %r12
leaq -0xb0(%rbp), %rbx
leaq 0x459a(%rip), %r13      # 0x8668
xorl %r14d, %r14d
movq %r12, %rdi
leaq 0x14db(%rip), %rsi      # 0x55b6
movl %r14d, %edx
xorl %eax, %eax
callq 0x2320
movq %rbx, %rdi
leaq 0x14d7(%rip), %rsi      # 0x55c6
movl %r14d, %edx
xorl %eax, %eax
callq 0x2320
leaq 0x4560(%rip), %rax      # 0x8660
movq (%rax), %rax
movl (%rax,%r14,4), %edi
callq 0x2130
movq (%r13), %rax
movl (%rax,%r14,4), %edi
callq 0x2130
movq %r12, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
incq %r14
cmpq %r14, %r15
jne 0x40d1
movq -0x38(%rbp), %rdi
movl -0x2c(%rbp), %esi
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x292c