LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_write.c
// Function: otf_tagorder_win_sort
int *otf_tagorder_win_sort(const struct _OTF_WRITE_TABLE *tables,int numTables) // {{{
{
  int *order=malloc(sizeof(int)*numTables);
  if (!order) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    return NULL;
  }

  // reverse intersection of both sorted arrays
  int priolist[NUM_PRIO]={0,};
  int iA=numTables-1,iB=sizeof(otf_tagorder_win)/sizeof(otf_tagorder_win[0])-1;
  int ret=numTables-1;
  while ( (iA>=0)&&(iB>=0) ) {
    if (tables[iA].tag==otf_tagorder_win[iB].tag) {
      priolist[otf_tagorder_win[iB--].prio]=1+iA--;
    } else if (tables[iA].tag>otf_tagorder_win[iB].tag) { // no order known: put unchanged at end of result
      order[ret--]=iA--;
    } else { // <
      iB--;
    }
  }
  while (iA>=0) {
    order[ret--]=iA--;
  }
  for (iA=NUM_PRIO-1;iA>=0;iA--) { // pick the matched tables up in sorted order (bucketsort principle)
    if (priolist[iA]) {
      order[ret--]=priolist[iA]-1;
    }
  }
  return order;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x50, %rsp
movl %esi, %r15d
movq %rdi, %r14
movslq %esi, %rdi
shlq $0x2, %rdi
callq 0x21c0
movq %rax, %rbx
testq %rax, %rax
je 0x8e48
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
leal -0x1(%r15), %eax
testl %r15d, %r15d
jle 0x8e1f
movl $0x13, %edx
leaq 0x2f71(%rip), %rsi      # 0xbd30
movl %eax, %ecx
movl %ecx, %edi
leaq (%rdi,%rdi,4), %r8
shlq $0x4, %r8
movl %edx, %edi
movl 0x4(%rsi,%rdi,8), %r9d
cmpq %r9, (%r14,%r8)
jne 0x8dec
leal -0x1(%rcx), %r8d
incl %ecx
decl %edx
movslq (%rsi,%rdi,8), %rdi
movl %ecx, (%rsp,%rdi,4)
movl %r8d, %ecx
jmp 0x8dfc
jbe 0x8dfa
movslq %eax, %rdi
decl %eax
movl %ecx, (%rbx,%rdi,4)
decl %ecx
jmp 0x8dfc
decl %edx
testl %ecx, %ecx
js 0x8e04
testl %edx, %edx
jns 0x8dc1
testl %ecx, %ecx
js 0x8e1f
cltq
leaq (%rbx,%rax,4), %rdx
movl %ecx, %esi
notl %esi
addl %esi, %eax
movl %ecx, (%rdx)
addq $-0x4, %rdx
addl $-0x1, %ecx
jb 0x8e14
movl $0x13, %ecx
movl (%rsp,%rcx,4), %edx
testl %edx, %edx
je 0x8e35
decl %edx
movslq %eax, %rsi
decl %eax
movl %edx, (%rbx,%rsi,4)
addq $-0x1, %rcx
jb 0x8e24
movq %rbx, %rax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %r15
retq
callq 0x2e90
jmp 0x8e3b
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_write.c
// Function: otf_tagorder_offset_sort
int *otf_tagorder_offset_sort(const OTF_FILE *otf) // {{{
{
  int *order=malloc(sizeof(int)*otf->numTables);
  if (!order) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    return NULL;
  }

  int iA;
  struct _OTF_KV tmp[otf->numTables]; // or tmp=malloc(sizeof(struct _OTF_KV)*otf->numTables); assert(tmp);
  for (iA=0;iA<otf->numTables;iA++) {
    tmp[iA].key=otf->tables[iA].offset;
    tmp[iA].value=iA;
  }
  qsort(tmp,otf->numTables,sizeof(struct _OTF_KV),otf_kv_compare); // qsort_r / qsort_s makes portability hard ...
  for (iA=0;iA<otf->numTables;iA++) {
    order[iA]=tmp[iA].value;
  }
  return order;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movzwl 0x38(%rdi), %r15d
leal (,%r15,4), %edi
callq 0x21c0
movq %rax, %rbx
testq %rax, %rax
je 0x8f00
movq %rsp, %r12
leal 0xf(,%r15,8), %eax
andl $-0x10, %eax
movq %rsp, %r15
subq %rax, %r15
movq %r15, %rsp
movzwl 0x38(%r14), %esi
testq %rsi, %rsi
je 0x8ebd
movq 0x40(%r14), %rax
addq $0x8, %rax
xorl %ecx, %ecx
movl (%rax), %edx
movl %edx, (%r15,%rcx,8)
movl %ecx, 0x4(%r15,%rcx,8)
incq %rcx
addq $0x14, %rax
cmpq %rcx, %rsi
jne 0x8ea6
leaq 0x43(%rip), %rcx        # 0x8f07
movl $0x8, %edx
movq %r15, %rdi
callq 0x2250
movzwl 0x38(%r14), %eax
testq %rax, %rax
je 0x8eed
xorl %ecx, %ecx
movl 0x4(%r15,%rcx,8), %edx
movl %edx, (%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x8edd
movq %r12, %rsp
movq %rbx, %rax
leaq -0x20(%rbp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x2ebc
jmp 0x8ef0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_write.c
// Function: otf_action_copy
void otf_action_copy(struct _OTF_WRITE_TABLE *self) // {{{
{
  OTF_FILE *otf=self->copy.otf;
  const OTF_DIRENT *table=otf->tables+self->copy.table_no;

  // get checksum and unpadded length
  self->info.table.tag=self->tag;
  self->info.table.checkSum=table->checkSum;
  self->info.table.offset=0; // later
  self->info.table.length=table->length; // unpadded
  self->info.table.compLength=table->length; // uncompressed

  self->info.data=NULL;
  self->info.load=action_copy_load;
  self->info.free=action_free;
}

// Assembly:
movq 0x10(%rdi), %rax
movq 0x40(%rax), %rax
movslq 0x18(%rdi), %rcx
leaq (%rcx,%rcx,4), %rcx
movl (%rdi), %edx
movl %edx, 0x28(%rdi)
movl 0x4(%rax,%rcx,4), %edx
movl %edx, 0x2c(%rdi)
movl $0x0, 0x30(%rdi)
movl 0xc(%rax,%rcx,4), %eax
movl %eax, 0x34(%rdi)
movl %eax, 0x38(%rdi)
movq $0x0, 0x20(%rdi)
leaq 0x10(%rip), %rax        # 0x8f65
movq %rax, 0x40(%rdi)
leaq 0x5e(%rip), %rax        # 0x8fbe
movq %rax, 0x48(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_write.c
// Function: action_copy_load
static int action_copy_load(struct _OTF_WRITE_TABLE *self) // {{{
{
  OTF_FILE *otf=self->copy.otf;
  const OTF_DIRENT *table=otf->tables+self->copy.table_no;

  char *data=otf_read_table(otf,NULL,table);
  if (!data) {
    return -1;
  }

  assert(!self->info.data);
  self->info.data=data;
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
movslq 0x18(%rbx), %rax
leaq (%rax,%rax,4), %rdx
shlq $0x2, %rdx
addq 0x40(%rdi), %rdx
xorl %esi, %esi
callq 0x3858
testq %rax, %rax
je 0x8f98
cmpq $0x0, 0x20(%rbx)
jne 0x8f9f
movq %rax, 0x20(%rbx)
xorl %eax, %eax
jmp 0x8f9d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
leaq 0x2c30(%rip), %rdi      # 0xbbd6
leaq 0x2b50(%rip), %rsi      # 0xbafd
leaq 0x2c33(%rip), %rcx      # 0xbbe7
movl $0xbc, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_write.c
// Function: otf_action_replace
void otf_action_replace(struct _OTF_WRITE_TABLE *self) // {{{
{
  char *data=self->replace.data;
  int length=self->replace.length;

  // get checksum and unpadded length
  self->info.table.tag=self->tag;
  self->info.table.checkSum=otf_checksum(data,otf_padded(length));
  self->info.table.offset=0; // later
  self->info.table.length=length; // unpadded
  self->info.table.compLength=length; // uncompressed

  assert(data);
  if (otf_padded(length)>length) { // clear padding bytes
    memset(data+length,0,otf_padded(length)-length);
  }
  self->info.data=data;
  self->info.load=NULL;
  self->info.free=action_nop;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %r14
movl 0x18(%rdi), %eax
movl (%rdi), %ecx
movl %ecx, 0x28(%rdi)
leal 0x3(%rax), %edx
movl %edx, %ecx
andl $-0x4, %ecx
je 0x9030
shrl $0x2, %edx
xorl %edi, %edi
xorl %esi, %esi
movl (%r14,%rdi,4), %r8d
bswapl %r8d
addl %r8d, %esi
incq %rdi
cmpl %edi, %edx
jne 0x901d
jmp 0x9032
xorl %esi, %esi
movl %esi, 0x2c(%rbx)
movl $0x0, 0x30(%rbx)
movl %eax, 0x34(%rbx)
movl %eax, 0x38(%rbx)
testq %r14, %r14
je 0x907a
subl %eax, %ecx
jle 0x905b
movslq %eax, %rdi
addq %r14, %rdi
movslq %ecx, %rdx
xorl %esi, %esi
callq 0x20c0
movq %r14, 0x20(%rbx)
movq $0x0, 0x40(%rbx)
leaq 0x2b(%rip), %rax        # 0x9099
movq %rax, 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x2b61(%rip), %rdi      # 0xbbe2
leaq 0x2a75(%rip), %rsi      # 0xbafd
leaq 0x2a7b(%rip), %rcx      # 0xbb0a
movl $0x104, %edx            # imm = 0x104
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_write.c
// Function: action_load_data
static int action_load_data(struct _OTF_WRITE_TABLE *self) // {{{
{
  if (!self->info.data) {
    assert(self->info.load);
    if (!self->info.load) {
      return -1;
    }
    const int res=(*self->info.load)(self);
    if (res<0) {
      return -1;
    }
  }
  return 0;
}

// Assembly:
pushq %rax
cmpq $0x0, 0x20(%rdi)
jne 0x9876
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x9881
callq *%rax
testl %eax, %eax
js 0x987a
xorl %eax, %eax
popq %rcx
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x9878
leaq 0x23fd(%rip), %rdi      # 0xbc85
leaq 0x226e(%rip), %rsi      # 0xbafd
leaq 0x23ff(%rip), %rcx      # 0xbc95
movl $0xd9, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/smilingthax[P]libfontembed/sfnt_write.c
// Function: otf_write_compressed_raw
static char *otf_write_compressed_raw(const char *in,unsigned int length,unsigned long *compLength) // {{{
{
  assert(compLength);
#ifdef WOFF_SUPPORT
  *compLength=compressBound(length); // known to be > otf_padded(length)
  char *tmp=malloc(sizeof(char)*(*compLength));
  if (!tmp) {
    fprintf(stderr,"Bad alloc: %s\n", strerror(errno));
    *compLength=-1;
    return NULL;
  }
  if (compress2((unsigned char *)tmp,compLength,(const unsigned char *)in,length,9)!=Z_OK) {
    fprintf(stderr,"Compression failed\n");
    free(tmp);
    *compLength=-1;
    return NULL;
  }
  if (*compLength<length) {
    return tmp; // compressed
  }
  free(tmp);
#endif
  *compLength=length; // uncompressed
  return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x9926
movq %rdx, %rbx
movq %rdi, %r12
movl %esi, %r14d
movq %r14, %rdi
callq 0x2200
movq %rax, (%rbx)
movq %rax, %rdi
callq 0x21c0
testq %rax, %rax
je 0x98fb
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r14, %rcx
movl $0x9, %r8d
callq 0x20b0
testl %eax, %eax
jne 0x9902
cmpq %r14, (%rbx)
jb 0x9917
movq %r15, %rdi
callq 0x21a0
jmp 0x9911
callq 0x2f3d
jmp 0x990a
movq %r15, %rdi
callq 0x2f14
movq $-0x1, %r14
movq %r14, (%rbx)
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2398(%rip), %rdi      # 0xbcc5
leaq 0x21c9(%rip), %rsi      # 0xbafd
leaq 0x2395(%rip), %rcx      # 0xbcd0
movl $0x22, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/ioerror[P]csidh-reference-implementation/csidh.c
// Function: csidh_private
__attribute__((visibility("default"))) void csidh_private(private_key *priv)
{
    memset(&priv->e, 0, sizeof(priv->e));
    for (size_t i = 0; i < NUM_PRIMES; ) {
        int8_t buf[64];
        randombytes(buf, sizeof(buf));
        for (size_t j = 0; j < sizeof(buf); ++j) {
            if (buf[j] <= MAX_EXPONENT && buf[j] >= -MAX_EXPONENT) {
                priv->e[i / 2] |= (buf[j] & 0xf) << i % 2 * 4;
                if (++i >= NUM_PRIMES)
                    break;
            }
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rbx
vxorps %xmm0, %xmm0, %xmm0
vmovups %ymm0, (%rdi)
movq $0x0, 0x1d(%rdi)
xorl %r15d, %r15d
movq %rsp, %r14
movl $0x40, %esi
movq %r14, %rdi
vzeroupper
callq 0x119c
xorl %eax, %eax
movb (%rsp,%rax), %dl
leal 0x5(%rdx), %ecx
cmpb $0xa, %cl
ja 0x3111
andb $0xf, %dl
leal (,%r15,4), %ecx
andb $0x4, %cl
shlb %cl, %dl
movq %r15, %rcx
shrq %rcx
orb %dl, (%rbx,%rcx)
incq %r15
cmpq $0x4a, %r15
jae 0x3120
incq %rax
cmpq $0x40, %rax
jne 0x30e4
cmpq $0x4a, %r15
jb 0x30d2
addq $0x40, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ioerror[P]csidh-reference-implementation/csidh.c
// Function: validate
bool validate(public_key const *in)
{
    /* make sure the curve is nonsingular: A^2-4 != 0 */
    {
        ui dummy;
        if (!ui_sub3(&dummy, (ui *) &in->A, &p)) /* returns borrow */
            /* A >= p */
            return false;

        fp fp_pm2;
        fp_set(&fp_pm2, 2);
        if (!memcmp(&in->A, &fp_pm2, sizeof(fp)))
            /* A = 2 */
            return false;

        fp_sub3(&fp_pm2, &fp_0, &fp_pm2);
        if (!memcmp(&in->A, &fp_pm2, sizeof(fp)))
            /* A = -2 */
            return false;
    }

    const proj A = {in->A, fp_1};

    do {
        proj P;
        fp_random(&P.x);
        P.z = fp_1;

        /* maximal 2-power in p+1 */
        xDBL(&P, &A, &P);
        xDBL(&P, &A, &P);

        bool is_supersingular;
        ui order = ui_1;

        if (validate_rec(&P, &A, 0, NUM_PRIMES, &order, &is_supersingular))
            return is_supersingular;

    /* P didn't have big enough order to prove supersingularity. */
    } while (1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, %rbx
leaq 0xecc(%rip), %rdx       # 0x4010
leaq 0x150(%rsp), %rdi
movq %rbx, %rsi
callq 0x12a0
testb %al, %al
je 0x32ce
leaq 0xd0(%rsp), %r14
movl $0x2, %esi
movq %r14, %rdi
callq 0x1388
vmovdqu (%rbx), %ymm0
vmovdqu 0x20(%rbx), %ymm1
vpxor (%r14), %ymm0, %ymm0
vpternlogq $0xf6, 0x20(%r14), %ymm1, %ymm0
vptest %ymm0, %ymm0
je 0x32ce
leaq 0xeb7(%rip), %rsi       # 0x4050
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %r14, %rdx
vzeroupper
callq 0x1567
vmovdqu (%rbx), %ymm0
vmovdqu 0x20(%rbx), %ymm1
vpxor (%r14), %ymm0, %ymm0
vpternlogq $0xf6, 0x20(%r14), %ymm1, %ymm0
vptest %ymm0, %ymm0
je 0x32ce
vmovups (%rbx), %ymm0
vmovups 0x20(%rbx), %ymm1
leaq 0x150(%rsp), %rbx
vmovups %ymm1, 0x20(%rbx)
vmovups %ymm0, (%rbx)
leaq 0xe9f(%rip), %rax       # 0x4090
vmovups (%rax), %ymm0
vmovdqu 0x20(%rax), %ymm1
vmovups %ymm0, 0x70(%rsp)
vmovups %ymm0, 0x40(%rbx)
vmovdqu %ymm1, 0x50(%rsp)
vmovdqu %ymm1, 0x60(%rbx)
leaq 0x110(%rsp), %r13
leaq 0xd0(%rsp), %r14
leaq 0xfbe(%rip), %rax       # 0x41e5
vmovups (%rax), %ymm0
vmovups %ymm0, 0x30(%rsp)
vmovdqu 0x20(%rax), %ymm0
vmovdqu %ymm0, 0x10(%rsp)
leaq 0x90(%rsp), %r15
leaq 0xf(%rsp), %r12
movq %r14, %rdi
vzeroupper
callq 0x2463
vmovups 0x50(%rsp), %ymm0
vmovups %ymm0, 0x20(%r13)
vmovups 0x70(%rsp), %ymm0
vmovups %ymm0, (%r13)
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
vzeroupper
callq 0x26c4
movq %r14, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x26c4
vmovups 0x10(%rsp), %ymm0
vmovups %ymm0, 0xb0(%rsp)
vmovdqu 0x30(%rsp), %ymm0
vmovdqu %ymm0, 0x90(%rsp)
movl $0x4a, %ecx
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %r15, %r8
movq %r12, %r9
vzeroupper
callq 0x32e6
testb %al, %al
je 0x3249
movb 0xf(%rsp), %al
jmp 0x32d0
xorl %eax, %eax
andb $0x1, %al
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O3/ioerror[P]csidh-reference-implementation/csidh.c
// Function: csidh
__attribute__((visibility("default"))) bool csidh(public_key *out, public_key const *in, private_key const *priv)
{
    if (!validate(in)) {
        fp_random(&out->A);
        return false;
    }
    action(out, in, priv);
    return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq %rsi, %rdi
callq 0x312a
movl %eax, %ebx
movq %r15, %rdi
testb %al, %al
je 0x3a65
movq %r12, %rsi
movq %r14, %rdx
callq 0x3555
jmp 0x3a6a
callq 0x2463
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../include/acutest.h
// Function: acutest_finish_test_line_
static void
acutest_finish_test_line_(int result)
{
    if(acutest_tap_) {
        const char* str = (result == 0) ? "ok" : "not ok";

        printf("%s %d - %s\n", str, acutest_current_index_ + 1, acutest_current_test_->name);

        if(result == 0  &&  acutest_timer_) {
            printf("# Duration: ");
            acutest_timer_print_diff_();
            printf("\n");
        }
    } else {
        int color = (result == 0) ? ACUTEST_COLOR_GREEN_INTENSIVE_ : ACUTEST_COLOR_RED_INTENSIVE_;
        const char* str = (result == 0) ? "OK" : "FAILED";
        printf("[ ");
        acutest_colored_printf_(color, "%s", str);
        printf(" ]");

        if(result == 0  &&  acutest_timer_) {
            printf("  ");
            acutest_timer_print_diff_();
        }

        printf("\n");
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
cmpb $0x1, 0x7b1e(%rip)      # 0xa2e0
jne 0x2816
testl %ebx, %ebx
leaq 0x3e56(%rip), %rax      # 0x6623
leaq 0x3e4b(%rip), %rsi      # 0x661f
cmoveq %rax, %rsi
movl 0x7b2a(%rip), %edx      # 0xa308
incl %edx
movq 0x79a1(%rip), %rax      # 0xa188
movq (%rax), %rcx
leaq 0x3e35(%rip), %rdi      # 0x6626
xorl %eax, %eax
callq 0x20f0
testl %ebx, %ebx
jne 0x2890
cmpl $0x0, 0x7b05(%rip)      # 0xa30c
je 0x2890
leaq 0x3e1e(%rip), %rdi      # 0x6632
jmp 0x2876
xorl %ebp, %ebp
testl %ebx, %ebx
sete %bpl
leaq 0x3e1a(%rip), %rax      # 0x663f
leaq 0x3e16(%rip), %r14      # 0x6642
cmoveq %rax, %r14
xorl $0x5, %ebp
leaq 0x3e0f(%rip), %rdi      # 0x6649
xorl %eax, %eax
callq 0x20f0
leaq 0x3e43(%rip), %rsi      # 0x668b
movl %ebp, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x28fb
leaq 0x3df1(%rip), %rdi      # 0x664c
xorl %eax, %eax
callq 0x20f0
testl %ebx, %ebx
jne 0x2882
cmpl $0x0, 0x7a9f(%rip)      # 0xa30c
je 0x2882
leaq 0x38be(%rip), %rdi      # 0x6134
xorl %eax, %eax
callq 0x20f0
callq 0x4824
movl $0xa, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x2030
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../include/acutest.h
// Function: acutest_line_indent_
static void
acutest_line_indent_(int level)
{
    static const char spaces[] = "                ";
    int n = level * 2;

    if(acutest_tap_  &&  n > 0) {
        n--;
        printf("#");
    }

    while(n > 16) {
        printf("%s", spaces);
        n -= 16;
    }
    printf("%.*s", n, spaces);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
addl %ebx, %ebx
cmpb $0x1, 0x7a3b(%rip)      # 0xa2e0
jne 0x28b3
decl %ebx
movl $0x23, %edi
callq 0x2030
cmpl $0x11, %ebx
jl 0x28df
leaq 0x3dcc(%rip), %r14      # 0x668b
leaq 0x37aa(%rip), %r15      # 0x6070
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
leal -0x10(%rbx), %esi
cmpl $0x20, %ebx
movl %esi, %ebx
ja 0x28c6
jmp 0x28e1
movl %ebx, %esi
leaq 0x3d72(%rip), %rdi      # 0x665a
leaq 0x3781(%rip), %rdx      # 0x6070
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x20f0
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../include/acutest.h
// Function: acutest_case_
acutest_case_(const char* fmt, ...)
{
    va_list args;

    if(acutest_verbose_level_ < 2)
        return;

    if(acutest_case_name_[0]) {
        acutest_case_already_logged_ = 0;
        acutest_case_name_[0] = '\0';
    }

    if(fmt == NULL)
        return;

    va_start(args, fmt);
    vsnprintf(acutest_case_name_, sizeof(acutest_case_name_) - 1, fmt, args);
    va_end(args);
    acutest_case_name_[sizeof(acutest_case_name_) - 1] = '\0';

    if(acutest_verbose_level_ >= 3) {
        acutest_line_indent_(1);
        acutest_colored_printf_(ACUTEST_COLOR_DEFAULT_INTENSIVE_, "Case %s:\n", acutest_case_name_);
        acutest_test_already_logged_++;
        acutest_case_already_logged_++;
    }
}

// Assembly:
subq $0xd8, %rsp
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x2a6d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
cmpl $0x2, 0x76f4(%rip)      # 0xa168
jl 0x2b15
movq %rdi, %r10
cmpb $0x0, 0x771c(%rip)      # 0xa1a0
je 0x2a97
movl $0x0, 0x7704(%rip)      # 0xa194
movb $0x0, 0x7709(%rip)      # 0xa1a0
testq %r10, %r10
je 0x2b15
leaq 0x20(%rsp), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0x76d8(%rip), %rdi      # 0xa1a0
movl $0x3f, %esi
movq %r10, %rdx
callq 0x20a0
movb $0x0, 0x7703(%rip)      # 0xa1df
cmpl $0x3, 0x7685(%rip)      # 0xa168
jl 0x2b15
movl $0x1, %edi
callq 0x2895
leaq 0x3611(%rip), %rsi      # 0x6107
leaq 0x76a3(%rip), %rdx      # 0xa1a0
movl $0x3, %edi
xorl %eax, %eax
callq 0x28fb
incl 0x7671(%rip)            # 0xa180
incl 0x767f(%rip)            # 0xa194
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../include/acutest.h
// Function: acutest_message_
acutest_message_(const char* fmt, ...)
{
    char buffer[TEST_MSG_MAXSIZE];
    char* line_beg;
    char* line_end;
    va_list args;

    if(acutest_verbose_level_ < 2)
        return;

    /* We allow extra message only when something is already wrong in the
     * current test. */
    if(acutest_current_test_ == NULL  ||  !acutest_cond_failed_)
        return;

    va_start(args, fmt);
    vsnprintf(buffer, TEST_MSG_MAXSIZE, fmt, args);
    va_end(args);
    buffer[TEST_MSG_MAXSIZE-1] = '\0';

    line_beg = buffer;
    while(1) {
        line_end = strchr(line_beg, '\n');
        if(line_end == NULL)
            break;
        acutest_line_indent_(acutest_case_name_[0] ? 3 : 2);
        printf("%.*s\n", (int)(line_end - line_beg), line_beg);
        line_beg = line_end + 1;
    }
    if(line_beg[0] != '\0') {
        acutest_line_indent_(acutest_case_name_[0] ? 3 : 2);
        printf("%s\n", line_beg);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x2b7d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
cmpl $0x2, 0x75e4(%rip)      # 0xa168
jl 0x2c72
cmpq $0x0, 0x75f6(%rip)      # 0xa188
je 0x2c72
cmpl $0x0, 0x7641(%rip)      # 0xa1e0
je 0x2c72
movq %rdi, %r10
leaq 0x20(%rsp), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
leaq 0x4f0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0xd0(%rsp), %rbx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq %r10, %rdx
callq 0x20a0
movb $0x0, 0x3ff(%rbx)
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20e0
testq %rax, %rax
je 0x2c51
movq %rax, %r14
leaq 0xd0(%rsp), %rbx
leaq 0x350f(%rip), %r15      # 0x611f
cmpb $0x1, 0x7589(%rip)      # 0xa1a0
movl $0x3, %edi
sbbl $0x0, %edi
callq 0x2895
movl %r14d, %esi
subl %ebx, %esi
movq %r15, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x20f0
movq %r14, %rbx
incq %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x20e0
movq %rax, %r14
testq %rax, %rax
jne 0x2c10
cmpb $0x0, (%rbx)
je 0x2c72
cmpb $0x1, 0x7543(%rip)      # 0xa1a0
movl $0x3, %edi
sbbl $0x0, %edi
callq 0x2895
movq %rbx, %rdi
callq 0x2080
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/ADTSet_test.c
// Function: insert_and_test
void insert_and_test(Set set, int* value) {

	set_insert(set, value);
	TEST_ASSERT(set_is_proper(set));
	int search = *value;
	TEST_ASSERT(set_find(set, &search) == value);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x5088
movq %r14, %rdi
callq 0x55f1
movzbl %al, %edi
leaq 0x262d(%rip), %rsi      # 0x6318
leaq 0x2999(%rip), %rcx      # 0x668b
leaq 0x262d(%rip), %r8       # 0x6326
movl $0x26, %edx
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x3d50
movl (%rbx), %eax
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %r14, %rdi
callq 0x4dea
xorl %edi, %edi
cmpq %rbx, %rax
sete %dil
leaq 0x25ee(%rip), %rsi      # 0x6318
leaq 0x295a(%rip), %rcx      # 0x668b
leaq 0x2601(%rip), %r8       # 0x6339
movl $0x28, %edx
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x3d50
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x2e3b
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/ADTSet_test.c
// Function: shuffle
void shuffle(int** array, int n) {
	for (int i = 0; i < n; i++) {
		int j = i + rand() / (RAND_MAX / (n - i) + 1);
		int* t = array[j];
		array[j] = array[i];
		array[i] = t;
	}
}

// Assembly:
testl %esi, %esi
jle 0x3da3
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %r14d
xorl %r15d, %r15d
callq 0x2290
movl %eax, %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
idivl %r14d
movl %eax, %esi
incl %esi
movl %ecx, %eax
cltd
idivl %esi
cltq
addq %r15, %rax
movq (%rbx,%rax,8), %rcx
movq (%rbx,%r15,8), %rdx
movq %rdx, (%rbx,%rax,8)
movq %rcx, (%rbx,%r15,8)
incq %r15
decq %r14
jne 0x3d67
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/ADTSet_test.c
// Function: test_create
void test_create(void) {

	// Δημιουργούμε ένα κενό set (χωρίς συνάρτηση αποδεύσμευσης)
	Set set = set_create(compare_ints, NULL);
	set_set_destroy_value(set, NULL);

	TEST_ASSERT(set != NULL);
	TEST_ASSERT(set_size(set) == 0);

	set_destroy(set);
}

// Assembly:
pushq %rbx
leaq -0xe7(%rip), %rdi       # 0x3cc5
xorl %esi, %esi
callq 0x4d90
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
callq 0x55e8
xorl %edi, %edi
testq %rbx, %rbx
setne %dil
leaq 0x2548(%rip), %rsi      # 0x6318
leaq 0x28b4(%rip), %rcx      # 0x668b
leaq 0x257b(%rip), %r8       # 0x6359
movl $0x3f, %edx
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x3e2c
movq %rbx, %rdi
callq 0x4de6
xorl %edi, %edi
testl %eax, %eax
sete %dil
leaq 0x2513(%rip), %rsi      # 0x6318
leaq 0x287f(%rip), %rcx      # 0x668b
leaq 0x2552(%rip), %r8       # 0x6365
movl $0x40, %edx
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x3e2c
movq %rbx, %rdi
popq %rbx
jmp 0x4f8e
callq 0x2e3b
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/ADTSet_test.c
// Function: test_insert
void test_insert(void) {

	Set set = set_create(compare_ints, free);

	int N = 1000;

	int** value_array = malloc(N * sizeof(*value_array));

	// Δοκιμάζουμε την insert με νέες τιμές κάθε φορά και με αυτόματο free
	for (int i = 0; i < N; i++) {
		
		value_array[i] = create_int(i);

		insert_and_test(set, value_array[i]);

		TEST_ASSERT(set_size(set) == (i + 1));

	}

	// Δοκιμάζουμε την insert με τιμές που υπάρχουν ήδη στο Set
	// και ελέγχουμε ότι δεν ενημερώθηκε το size (καθώς δεν προστέθηκε νέος κόμβος)
	int* new_value = create_int(0);
	insert_and_test(set, new_value);

	TEST_ASSERT(set_size(set) == N);

	set_destroy(set);

	// Δοκιμάζουμε την insert χωρίς αυτόματο free
	Set set2 = set_create(compare_ints, NULL);
	
	int local_value1 = 0, local_value2 = 1, local_value3 = 1;

	insert_and_test(set2, &local_value1);
	insert_and_test(set2, &local_value2);
	insert_and_test(set2, &local_value3);		// ισοδύναμη τιμή => replace
	
	set_destroy(set2);
	free(value_array);

}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
leaq -0x180(%rip), %rdi      # 0x3cc5
movq 0x6174(%rip), %rsi      # 0x9fc0
callq 0x4d90
movq %rax, %rbx
movl $0x1, %r13d
leaq 0x24b7(%rip), %r14      # 0x6318
leaq 0x2823(%rip), %r15      # 0x668b
leaq 0x2509(%rip), %r12      # 0x6378
movl $0x4, %edi
callq 0x21a0
cmpl $0x3e9, %r13d           # imm = 0x3E9
je 0x3ec5
leal -0x1(%r13), %ecx
movl %ecx, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3cca
movq %rbx, %rdi
callq 0x4de6
xorl %edi, %edi
cmpl %eax, %r13d
sete %dil
movq %r14, %rsi
movl $0x54, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x25dc
incl %r13d
testl %eax, %eax
jne 0x3e6f
callq 0x2e3b
movl $0x0, (%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3cca
movq %rbx, %rdi
callq 0x4de6
xorl %edi, %edi
cmpl $0x3e8, %eax            # imm = 0x3E8
sete %dil
leaq 0x2428(%rip), %rsi      # 0x6318
leaq 0x2794(%rip), %rcx      # 0x668b
leaq 0x2493(%rip), %r8       # 0x6391
movl $0x5d, %edx
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x3ec0
movq %rbx, %rdi
callq 0x4f8e
leaq -0x258(%rip), %rdi      # 0x3cc5
xorl %esi, %esi
callq 0x4d90
movq %rax, %rbx
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
movl $0x1, %eax
leaq 0x8(%rsp), %r14
movl %eax, (%r14)
leaq 0x4(%rsp), %r15
movl %eax, (%r15)
movq %rbx, %rdi
callq 0x3cca
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3cca
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3cca
movq %rbx, %rdi
callq 0x4f8e
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/ADTSet_test.c
// Function: test_node_value
void test_node_value(void) {
	// Η συνάρτηση αυτή ελέγχει ότι ένας κόμβος περιέχει πάντα την αρχική του τιμή,
	// χωρίς να επηρρεάζεται από άλλους κόμβους που προστίθενται ή διαγράφονται.

	Set set = set_create(compare_ints, free);

	int N = 1000;
	int** value_array = malloc(N * sizeof(*value_array));

	for (int i = 0; i < N; i++)
		value_array[i] = create_int(i);

	shuffle(value_array, N);

	// Εισάγουμε έναν αριθμό και αποθηκεύουμε το node
	set_insert(set, value_array[0]);
	SetNode node = set_first(set);
	TEST_ASSERT(set_node_value(set, node) == value_array[0]);

	// Προσθήκη τιμών, και έλεγχος μετά από κάθε προσθήκη
	for (int i = 1; i < N; i++) {
		set_insert(set, value_array[i]);

		TEST_ASSERT(set_node_value(set, node) == value_array[0]);
	}

	// Διαγραφή τιμών, και έλεγχος μετά από κάθε διαγραφή
	for (int i = 1; i < N; i++) {
		set_remove(set, value_array[i]);

		TEST_ASSERT(set_node_value(set, node) == value_array[0]);
	}

	set_destroy(set);
	free(value_array);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq -0x9e7(%rip), %rdi      # 0x3cc5
movq 0x590d(%rip), %rsi      # 0x9fc0
callq 0x4d90
movq %rax, %rbx
movl $0x1f40, %edi           # imm = 0x1F40
callq 0x21a0
movq %rax, %r14
xorl %r15d, %r15d
movl $0x4, %edi
callq 0x21a0
movl %r15d, (%rax)
movq %rax, (%r14,%r15,8)
incq %r15
cmpq $0x3e8, %r15            # imm = 0x3E8
jne 0x46cb
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x3d55
movq (%r14), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5088
movq %rbx, %rdi
callq 0x4f53
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
callq 0x55e4
xorl %edi, %edi
cmpq %r15, %rax
sete %dil
leaq 0x1bef(%rip), %rsi      # 0x6318
leaq 0x1f5b(%rip), %rcx      # 0x668b
leaq 0x1e77(%rip), %r8       # 0x65ae
movl $0x118, %edx            # imm = 0x118
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x481f
movl $0x1, %ebp
leaq 0x1e57(%rip), %r13      # 0x65ae
movq (%r14,%rbp,8), %rsi
movq %rbx, %rdi
callq 0x5088
movq %rbx, %rdi
movq %r12, %rsi
callq 0x55e4
xorl %edi, %edi
cmpq %r15, %rax
sete %dil
leaq 0x1b9a(%rip), %rsi      # 0x6318
movl $0x11e, %edx            # imm = 0x11E
leaq 0x1f01(%rip), %rcx      # 0x668b
movq %r13, %r8
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x481f
incq %rbp
cmpq $0x3e8, %rbp            # imm = 0x3E8
jne 0x4757
movl $0x1, %ebp
leaq 0x1dfa(%rip), %r13      # 0x65ae
movq (%r14,%rbp,8), %rsi
movq %rbx, %rdi
callq 0x4e47
movq %rbx, %rdi
movq %r12, %rsi
callq 0x55e4
xorl %edi, %edi
cmpq %r15, %rax
sete %dil
leaq 0x1b3d(%rip), %rsi      # 0x6318
movl $0x125, %edx            # imm = 0x125
leaq 0x1ea4(%rip), %rcx      # 0x668b
movq %r13, %r8
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x481f
incq %rbp
cmpq $0x3e8, %rbp            # imm = 0x3E8
jne 0x47b4
movq %rbx, %rdi
callq 0x4f8e
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0
callq 0x2e3b
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../include/acutest.h
// Function: acutest_timer_print_diff_
static double
    acutest_timer_diff_(struct timespec start, struct timespec end)
    {
        double endns;
        double startns;

        endns = end.tv_sec;
        endns *= 1e9;
        endns += end.tv_nsec;

        startns = start.tv_sec;
        startns *= 1e9;
        startns += start.tv_nsec;

        return ((endns - startns)/ 1e9);
    }

// Assembly:
cvtsi2sdq 0x5af3(%rip), %xmm1 # 0xa320
movsd 0x17d3(%rip), %xmm2     # 0x6008
mulsd %xmm2, %xmm1
cvtsi2sdq 0x5ae6(%rip), %xmm0 # 0xa328
addsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x5abe(%rip), %xmm1 # 0xa310
cvtsi2sdq 0x5abd(%rip), %xmm3 # 0xa318
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm3
subsd %xmm3, %xmm0
divsd %xmm2, %xmm0
leaq 0x1ddd(%rip), %rdi      # 0x664f
movb $0x1, %al
jmp 0x20f0
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../include/acutest.h
// Function: acutest_error_
acutest_error_(const char* fmt, ...)
{
    if(acutest_verbose_level_ == 0)
        return;

    if(acutest_verbose_level_ >= 2) {
        va_list args;

        acutest_line_indent_(1);
        if(acutest_verbose_level_ >= 3)
            acutest_colored_printf_(ACUTEST_COLOR_RED_INTENSIVE_, "ERROR: ");
        va_start(args, fmt);
        vprintf(fmt, args);
        va_end(args);
        printf("\n");
    }

    if(acutest_verbose_level_ >= 3) {
        printf("\n");
    }
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
testb %al, %al
je 0x4a77
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
cmpl $0x2, 0x56d1(%rip)      # 0xa168
jl 0x4b0c
movq %rdi, %rbx
movl $0x1, %edi
callq 0x2895
cmpl $0x3, 0x56bb(%rip)      # 0xa168
jl 0x4ac2
leaq 0x1ee1(%rip), %rsi      # 0x6997
movl $0x5, %edi
xorl %eax, %eax
callq 0x28fb
leaq 0x20(%rsp), %rax
movq %rsp, %rsi
movq %rax, 0x10(%rsi)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rsi)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rsi)
movq %rbx, %rdi
callq 0x21c0
movl $0xa, %edi
callq 0x2030
cmpl $0x3, 0x5668(%rip)      # 0xa168
jl 0x4b0c
movl $0xa, %edi
callq 0x2030
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../modules/UsingBTree/ADTSet.c
// Function: set_create
Set set_create(CompareFunc compare, DestroyFunc destroy_value) {
	assert(compare != NULL);

	Set set = malloc(sizeof(*set));
	set->root = NULL;     // Kενό δέντρο.
	set->size = 0;
	set->compare = compare;
	set->destroy_value = destroy_value;

	return set;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4dc7
movq %rsi, %rbx
movq %rdi, %r14
movl $0x20, %edi
callq 0x21a0
movq $0x0, (%rax)
movl $0x0, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %rbx, 0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x224d(%rip), %rdi      # 0x701b
leaq 0x2256(%rip), %rsi      # 0x702b
leaq 0x226e(%rip), %rcx      # 0x704a
movl $0x22e, %edx            # imm = 0x22E
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../modules/UsingBTree/ADTSet.c
// Function: set_remove
bool set_remove(Set set, Pointer value) {

	bool removed;
	Pointer old_value = NULL;
	
	set->root = node_remove(set->root, set->compare, value, &removed, &old_value);

	if (removed) {
		set->size--;    // Το size αλλάζει μόνο αν πραγματικά αφαιρεθεί ένας κόμβος.

		if (set->destroy_value != NULL)
			set->destroy_value(old_value);
	}

	return removed;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq (%rdi), %r14
testq %r14, %r14
je 0x4ed6
movq %rsi, %rdx
movq %rdi, %rbx
movq 0x10(%rdi), %rsi
leaq 0xc(%rsp), %r15
movl $0x9, (%r15)
movq %r14, %rdi
movq %r15, %rcx
callq 0x5015
movslq (%r15), %r13
cmpq $-0x1, %r13
je 0x4ed3
movq %rax, %r12
movq 0x40(%rax,%r13,8), %rdi
movq (%rdi), %r15
callq 0x22b0
cmpq $0x0, 0x10(%r12)
je 0x4eda
movq 0x10(%r12,%r13,8), %rdx
xorl %eax, %eax
testq %rdx, %rdx
je 0x4ebf
movq %rdx, %rcx
movslq (%rdx), %rsi
movq 0x10(%rdx,%rsi,8), %rdx
testq %rdx, %rdx
jne 0x4ea5
movq 0x38(%rcx,%rsi,8), %rax
movq 0x8(%rax), %rcx
decl (%rcx)
movq %rax, 0x40(%r12,%r13,8)
movq %r12, 0x8(%rax)
movq %rcx, %r12
jmp 0x4f00
movq %r14, (%rbx)
xorl %ebx, %ebx
jmp 0x4f43
movslq (%r12), %rax
decq %rax
cmpl %eax, %r13d
jge 0x4efc
movq 0x48(%r12,%r13,8), %rcx
movq %rcx, 0x40(%r12,%r13,8)
leaq 0x1(%r13), %rcx
movq %rcx, %r13
cmpq %rcx, %rax
jne 0x4ee6
movl %eax, (%r12)
movq %r12, %rdi
callq 0x5809
cmpl $0x0, (%r14)
je 0x4f13
movq %r14, %r12
jmp 0x4f2d
movq 0x10(%r14), %r12
testq %r12, %r12
je 0x4f25
movq $0x0, 0x8(%r12)
movq %r14, %rdi
callq 0x22b0
movq %r12, (%rbx)
decl 0x8(%rbx)
movq 0x18(%rbx), %rax
movb $0x1, %bl
testq %rax, %rax
je 0x4f43
movq %r15, %rdi
callq *%rax
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../modules/UsingBTree/ADTSet.c
// Function: btree_destroy
static void btree_destroy(BTreeNode node, DestroyFunc destroy_value) {
	if (node == NULL)
		return;
	
	// Πρώτα κατάστρεψε τα παιδιά.
	for (int i = 0; i <= node->count; i++)
		btree_destroy(node->children[i], destroy_value);

	for (int i = 0; i < node->count; i++) {
		if (destroy_value != NULL)
			destroy_value(node->set_nodes[i]->value);	// Κατάστρεψε τις τιμές.

		free(node->set_nodes[i]);						// και free το set_node
	}

	free(node);  // Αποδέσμευσε το node.
}

// Assembly:
testq %rdi, %rdi
je 0x5014
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, (%rdi)
js 0x5007
movq %rsi, %r14
movq $-0x1, %r15
movq 0x18(%rbx,%r15,8), %rdi
movq %r14, %rsi
callq 0x4fa7
movslq (%rbx), %rax
incq %r15
cmpq %rax, %r15
jl 0x4fc3
testl %eax, %eax
jle 0x5007
xorl %r15d, %r15d
testq %r14, %r14
je 0x4ff2
movq 0x40(%rbx,%r15,8), %rax
movq (%rax), %rdi
callq *%r14
movq 0x40(%rbx,%r15,8), %rdi
callq 0x22b0
incq %r15
movslq (%rbx), %rax
cmpq %rax, %r15
jl 0x4fe2
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x22b0
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../modules/UsingBTree/ADTSet.c
// Function: node_find
static BTreeNode node_find(BTreeNode node, CompareFunc compare, Pointer value, int* index) {
	if (node == NULL)
		return NULL;

	int i;  // Ορίζει τη διαχωριστική τιμή σε σχέση με την οποιά αναζητούμε την τιμή.
	for (i = 0; i < node->count; i++) {
		int compare_res = compare(value, node->set_nodes[i]->value); // Aποθήκευση για να μην καλέσουμε την compare 2 φορές.

		if (compare_res == 0) {
			*index = i;
			return node;  // Η τιμή βρέθηκε στον τρέχοντα κόμβο.

		} else if (compare_res < 0) {
			// Αφού η τιμή που αναζητούμε είναι μικρότερη της διαχωριστικής τιμής
			// τότε βρίσκεται στο αριστερό παιδί που ορίζει η διαχωριστική τιμή (παιδί i)
			break;
		}
	}

	// Αν είμαστε σε φύλλο, η τιμή δεν βρέθηκε αλλά μπορεί να προστεθεί εδώ. Αλλιώς συνεχίζουμε στο παιδί i
	if (is_leaf(node)) {
		*index = -1;
		return node;
	} else {
		return node_find(node->children[i], compare, value, index);  
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x506e
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
cmpl $0x0, (%rbx)
jle 0x505b
xorl %r13d, %r13d
movq 0x40(%rbx,%r13,8), %rax
movq (%rax), %rsi
movq %r15, %rdi
callq *%r12
testl %eax, %eax
je 0x5078
js 0x5056
incq %r13
movslq (%rbx), %rax
cmpq %rax, %r13
jl 0x5037
movl %r13d, %eax
jmp 0x505d
xorl %eax, %eax
cmpq $0x0, 0x10(%rbx)
je 0x5072
movq 0x10(%rbx,%rax,8), %rbx
testq %rbx, %rbx
jne 0x502f
xorl %ebx, %ebx
jmp 0x507b
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, (%r14)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../modules/UsingBTree/ADTSet.c
// Function: merge
static void merge(BTreeNode left, BTreeNode right) {

	BTreeNode parent = left->parent;

	int sep_index = 0;    // Βρες τη θέση της διαχωριστικής τιμής στον πατέρα.
	while (parent->children[sep_index] != left && ++sep_index)
		;

	// Αντίγραψε τη διαχωριστική τιμή από τον πατέρα στον ελλιπή κόμβο.
	node_add_value(left, parent->set_nodes[sep_index], left->count);

	// Εαν ο δεξιός κόμβος δεν είναι φύλλο, μεταφορά των παιδιών
	if (!is_leaf(right))
		for (int i = 0; i <= right->count; i++)
			node_add_child(left, right->children[i], left->count+i);

	// Αντίγραψε όλα τα δεδομένα του δεξιού κόμβου στον ελλιπή κόμβο.
	for (int i = 0; i < right->count; i++)
		node_add_value(left, right->set_nodes[i], left->count);

	// Ολίσθησε προς τα αριστερά όλες τις τιμές και τα παιδιά του πατέρα
	// αρχίζοντας από την θέση της διαχωριστικής τιμής που αφαιρέθηκε.
	for (int i = sep_index; i < parent->count-1; i++) {
		parent->set_nodes[i] = parent->set_nodes[i+1];
		parent->children[i+1] = parent->children[i+2];
	}

	parent->count--;  // Η διαχωριστική τιμή αφαιρέθηκε.
	free(right);  	  // Διάγραψε τον κόμβο που συγχωνεύτηκε.

	// Ο πατέρας μπορεί να είναι πλέον ελλιπής. Ισορρόπησε το υποδέντρο του.
	repair_underflow(parent);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rdi), %rbx
movq $-0x1, %rax
movq %rax, %rcx
incq %rax
cmpq %rdi, 0x18(%rbx,%rcx,8)
jne 0x5a0c
movq 0x40(%rbx,%rax,8), %rdx
movslq (%rdi), %rcx
movq %rdi, 0x8(%rdx)
movq %rdx, 0x40(%rdi,%rcx,8)
leal 0x1(%rcx), %edx
movl %edx, (%rdi)
cmpq $0x0, 0x10(%rsi)
movl (%rsi), %r8d
je 0x5a74
testl %r8d, %r8d
js 0x5aa9
movslq %edx, %r9
leaq 0x1(%r8), %r10
leaq (%rdi,%r9,8), %r11
addq $0x10, %r11
xorl %r14d, %r14d
movq 0x10(%rsi,%r14,8), %r15
movq %rdi, 0x8(%r15)
testq %r14, %r14
jne 0x5a68
movq 0x10(%rdi,%r9,8), %r12
movq %r12, 0x18(%rdi,%r9,8)
movq %r15, (%r11,%r14,8)
incq %r14
cmpq %r14, %r10
jne 0x5a50
testl %r8d, %r8d
jle 0x5aa9
movslq %edx, %rdx
leaq (%rdi,%rdx,8), %rdx
addq $0x40, %rdx
addl $0x2, %ecx
xorl %r8d, %r8d
movq 0x40(%rsi,%r8,8), %r9
movq %rdi, 0x8(%r9)
movq %r9, (%rdx,%r8,8)
leal (%rcx,%r8), %r9d
movl %r9d, (%rdi)
incq %r8
movslq (%rsi), %r9
cmpq %r9, %r8
jl 0x5a8a
movl (%rbx), %ecx
decl %ecx
cmpl %eax, %ecx
jle 0x5ad3
movl %ecx, %edx
movq 0x20(%rbx,%rax,8), %rdi
movq 0x48(%rbx,%rax,8), %r8
movq %r8, 0x40(%rbx,%rax,8)
movq %rdi, 0x18(%rbx,%rax,8)
leaq 0x1(%rax), %rdi
movq %rdi, %rax
cmpq %rdi, %rdx
jne 0x5ab3
movl %ecx, (%rbx)
movq %rsi, %rdi
callq 0x22b0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x5809
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/tests/../modules/UsingBTree/ADTSet.c
// Function: get_height
static int get_height(BTreeNode node, bool *valid) {
	if (node == NULL)
		return 0;

	const int height = 1 + get_height(node->children[0], valid);
	
	for (int i = 1; i <= node->count; i++) {
		if (height != 1 + get_height(node->children[i], valid))
			*valid = false;
	}

	return height;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x5b3e
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rdi), %rdi
callq 0x5af0
movl %eax, %r15d
leal 0x1(%r15), %ebp
cmpl $0x0, (%r14)
jle 0x5b40
xorl %r12d, %r12d
movq 0x18(%r14,%r12,8), %rdi
movq %rbx, %rsi
callq 0x5af0
cmpl %eax, %r15d
je 0x5b31
movb $0x0, (%rbx)
movslq (%r14), %rax
incq %r12
cmpq %rax, %r12
jl 0x5b1c
jmp 0x5b40
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]rbtree/rbtree.c
// Function: rbtree_lookup
rbnode_t *rbtree_lookup(rbtree_t *tree, const void *key)
{
	rbnode_t *n = tree->root;
	int cmp;
	while (!rbnode_is_nil(n) && (cmp = tree->keycmp(n->key, key)) != 0) {
		if (cmp > 0)
			n = n->left;
		else
			n = n->right;
	}
	return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x1409
movq %rsi, %r14
movq %rdi, %r15
movq (%rbx), %rdi
movq %r14, %rsi
callq *0x8(%r15)
testl %eax, %eax
je 0x140b
setle %al
movzbl %al, %eax
movq 0x10(%rbx,%rax,8), %rbx
testq %rbx, %rbx
jne 0x13eb
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]rbtree/rbtree.c
// Function: rbtree_remove
void rbtree_remove(rbtree_t *tree, rbnode_t *n)
{
	rbnode_t *x, *y;

	y = rbnode_is_leaf(n) ? n : rbtree_successor(tree, n);
	x = rbnode_is_nil(y->left) ? y->right : y->left;

	if (!rbnode_is_nil(x))
		x->parent = y->parent;

	if (rbnode_is_root(y))
		tree->root = x;
	else if (rbnode_is_left(y))
		y->parent->left = x;
	else
		y->parent->right = x;

	if (y != n) {

        if (rbnode_is_black(y))
            rbtree_remove_fixup(tree, x, y->parent);

		y->left = n->left;
		y->right = n->right;
		y->parent = n->parent;
		y->color = n->color;

		if (!rbnode_is_nil(n->left))
			n->left->parent = y;

		if (!rbnode_is_nil(n->right))
			n->right->parent = y;

		if (rbnode_is_root(n))
			tree->root = y;
		else if (rbnode_is_left(n))
			n->parent->left = y;
		else
			n->parent->right = y;
	}
    else if (rbnode_is_black(y))
        rbtree_remove_fixup(tree, x, y->parent);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %rsi
movq %r14, %r15
testq %rsi, %rsi
je 0x1443
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x1458
movq %rax, %r15
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x1437
leaq 0x10(%r15), %r12
movq 0x18(%r15), %rsi
testq %rsi, %rsi
jne 0x145f
movq 0x20(%r15), %rdx
xorl %esi, %esi
jmp 0x1467
leaq 0x10(%r14), %r12
movq %r14, %r15
movq 0x20(%r15), %rdx
movq %rdx, 0x20(%rsi)
movq %rbx, %rax
testq %rdx, %rdx
je 0x147f
leaq 0x10(%rdx), %rcx
leaq 0x18(%rdx), %rax
cmpq %r15, 0x10(%rdx)
cmoveq %rcx, %rax
movq %rsi, (%rax)
movl 0x8(%r15), %eax
cmpq %r14, %r15
je 0x14de
testl %eax, %eax
jne 0x1497
movq %rbx, %rdi
callq 0x1507
movq 0x10(%r14), %rcx
movq %rcx, (%r12)
movq 0x18(%r14), %rax
movq %rax, 0x18(%r15)
movq 0x20(%r14), %rdx
movq %rdx, 0x20(%r15)
movl 0x8(%r14), %edx
movl %edx, 0x8(%r15)
testq %rcx, %rcx
je 0x14c0
movq %r15, 0x20(%rcx)
testq %rax, %rax
je 0x14c9
movq %r15, 0x20(%rax)
movq 0x20(%r14), %rax
testq %rax, %rax
je 0x14f2
cmpq %r14, 0x10(%rax)
je 0x14f7
movq %r15, 0x18(%rax)
jmp 0x14fb
testl %eax, %eax
jne 0x14fb
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1507
movq %r15, (%rbx)
jmp 0x14fb
movq %r15, 0x10(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]rbtree/rbtree.c
// Function: preorder
static int preorder(rbtree_t *tree, rbnode_t *n,
	rbtree_iterate_func_t iteration, void *state)
{
	if (!rbnode_is_nil(n)) {
		int r;
		if ((r = (*iteration)(tree, n, state)) != 0)
			return r;
		if ((r = preorder(tree, n->left, iteration, state)) != 0)
			return r;
		if ((r = preorder(tree, n->right, iteration, state)) != 0)
			return r;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x1847
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *%r15
testl %eax, %eax
jne 0x1845
movq 0x10(%r12), %rsi
movq %r13, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x17f6
testl %eax, %eax
jne 0x1845
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0x1812
jmp 0x1847
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]rbtree/rbtree.c
// Function: inorder
static int inorder(rbtree_t *tree, rbnode_t *n,
	rbtree_iterate_func_t iteration, void *state)
{
	if (!rbnode_is_nil(n)) {
		int r;
		if ((r = inorder(tree, n->left, iteration, state)) != 0)
			return r;
		if ((r = (*iteration)(tree, n, state)) != 0)
			return r;
		if ((r = inorder(tree, n->right, iteration, state)) != 0)
			return r;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x18af
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq 0x10(%r12), %rsi
movq %r13, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x185e
testl %eax, %eax
jne 0x18ad
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq *%r15
testl %eax, %eax
jne 0x18ad
movq 0x18(%r12), %r12
testq %r12, %r12
jne 0x187a
jmp 0x18af
movl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/GangZhuo[P]rbtree/rbtree.c
// Function: postorder
static int postorder(rbtree_t *tree, rbnode_t *n,
	rbtree_iterate_func_t iteration, void *state)
{
	if (!rbnode_is_nil(n)) {
		int r;
		if ((r = postorder(tree, n->left, iteration, state)) != 0)
			return r;
		if ((r = postorder(tree, n->right, iteration, state)) != 0)
			return r;
		if ((r = (*iteration)(tree, n, state)) != 0)
			return r;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x191b
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rsi), %rsi
movq %rdx, %r12
callq 0x18c6
testl %eax, %eax
jne 0x191d
movq 0x18(%r14), %rsi
movq %r15, %rdi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x18c6
testl %eax, %eax
jne 0x191d
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq