LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/yarn.c
// Function: launch_
thread *launch_(void (*probe)(void *), void *payload,
                char const *file, long line) {
    // construct the requested call and argument for the ignition() routine
    // (allocated instead of automatic so that we're sure this will still be
    // there when ignition() actually starts up -- ignition() will free this
    // allocation)
    struct capsule *capsule = my_malloc(sizeof(struct capsule), file, line);
    capsule->probe = probe;
    capsule->payload = payload;
    capsule->file = file;
    capsule->line = line;

    // assure this thread is in the list before join_all() or ignition() looks
    // for it
    possess_(&(threads_lock), file, line);

    // create the thread and call ignition() from that thread
    thread *th = my_malloc(sizeof(struct thread_s), file, line);
    pthread_attr_t attr;
    int ret = pthread_attr_init(&attr);
    if (ret)
        fail(ret, file, line, "attr_init");
    ret = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
    if (ret)
        fail(ret, file, line, "attr_setdetachstate");
    ret = pthread_create(&(th->id), &attr, ignition, capsule);
    if (ret)
        fail(ret, file, line, "create");
    ret = pthread_attr_destroy(&attr);
    if (ret)
        fail(ret, file, line, "attr_destroy");

    // put the thread in the threads list for join_all()
    th->done = 0;
    th->next = threads;
    threads = th;
    release_(&(threads_lock), file, line);
    return th;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r13
movl $0x20, %edi
callq *0xee74(%rip)           # 0x1d328
testq %rax, %rax
je 0xe580
movq %rax, %r12
movq %r13, (%rax)
movq %r15, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %rbx, 0x18(%rax)
leaq 0x2f142(%rip), %rdi     # 0x3d618
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe2b3
movl $0x18, %edi
callq *0xee3c(%rip)           # 0x1d328
testq %rax, %rax
je 0xe580
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x32d0
testl %eax, %eax
jne 0xe58e
leaq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x33c0
testl %eax, %eax
jne 0xe597
leaq 0x9c(%rip), %rdx        # 0xe5bd
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
movq %r12, %rcx
callq 0x3470
testl %eax, %eax
jne 0xe5a0
leaq 0x8(%rsp), %rdi
callq 0x3520
testl %eax, %eax
jne 0xe5a9
movl $0x0, 0x8(%r15)
movq 0x2f126(%rip), %rax     # 0x3d678
movq %rax, 0x10(%r15)
movq %r15, 0x2f11b(%rip)     # 0x3d678
leaq 0x2f0b4(%rip), %rdi     # 0x3d618
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe2e2
movq %r15, %rax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x865a(%rip), %rcx      # 0x16be1
movl $0xc, %edi
jmp 0xe5b2
leaq 0x85fd(%rip), %rcx      # 0x16b92
jmp 0xe5b0
leaq 0x85fe(%rip), %rcx      # 0x16b9c
jmp 0xe5b0
leaq 0x8609(%rip), %rcx      # 0x16bb0
jmp 0xe5b0
leaq 0x8607(%rip), %rcx      # 0x16bb7
movl %eax, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe1c2
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/yarn.c
// Function: ignition
local void *ignition(void *arg) {
    struct capsule *capsule = arg;

    // run reenter() before leaving
    pthread_cleanup_push(reenter, arg);

    // execute the requested function with argument
    capsule->probe(capsule->payload);

    // mark this thread as done, letting join_all() know, and free capsule
    pthread_cleanup_pop(1);

    // exit thread
    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x35d0
testl %eax, %eax
jne 0xe600
movq %rsp, %r14
movq %r14, %rdi
callq 0x3590
movq 0x8(%rbx), %rdi
callq *(%rbx)
movq %r14, %rdi
callq 0x31f0
movq %rbx, %rdi
callq 0xe7b3
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
callq 0xe7b3
movq %rsp, %rdi
callq 0x3450
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/yarn.c
// Function: join_
void join_(thread *ally, char const *file, long line) {
    // wait for thread to exit and return its resources
    int ret = pthread_join(ally->id, NULL);
    if (ret)
        fail(ret, file, line, "join");

    // find the thread in the threads list
    possess_(&(threads_lock), file, line);
    thread **prior = &(threads);
    thread *match;
    while ((match = *prior) != NULL) {
        if (match == ally)
            break;
        prior = &(match->next);
    }
    if (match == NULL)
        fail(ESRCH, file, line, "join lost");

    // remove thread from list and update exited count, free thread
    if (match->done)
        threads_lock.value--;
    *prior = match->next;
    release_(&(threads_lock), file, line);
    my_free(ally);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %rdi
xorl %esi, %esi
callq 0x35a0
testl %eax, %eax
jne 0xe691
leaq 0x2efe5(%rip), %rdi     # 0x3d618
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe2b3
leaq 0x2f033(%rip), %rcx     # 0x3d678
movq %rcx, %rax
movq (%rcx), %rdx
leaq 0x10(%rdx), %rcx
testq %rdx, %rdx
je 0xe659
cmpq %r15, %rdx
jne 0xe645
testq %rdx, %rdx
je 0xe69c
cmpl $0x0, 0x8(%rdx)
je 0xe66b
decq 0x2f005(%rip)           # 0x3d670
movq (%rcx), %rcx
movq %rcx, (%rax)
leaq 0x2efa0(%rip), %rdi     # 0x3d618
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe2e2
movq %r15, %rdi
popq %rbx
popq %r14
popq %r15
jmpq *0xec9f(%rip)           # 0x1d330
leaq 0x852c(%rip), %rcx      # 0x16bc4
movl %eax, %edi
jmp 0xe6a8
leaq 0x8526(%rip), %rcx      # 0x16bc9
movl $0x3, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe1c2
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/yarn.c
// Function: join_all_
int join_all_(char const *file, long line) {
    // grab the threads list and initialize the joined count
    int count = 0;
    possess_(&(threads_lock), file, line);

    // do until threads list is empty
    while (threads != NULL) {
        // wait until at least one thread has reentered
        wait_for_(&(threads_lock), NOT_TO_BE, 0, file, line);

        // find the first thread marked done (should be at or near the top)
        thread **prior = &(threads);
        thread *match;
        while ((match = *prior) != NULL) {
            if (match->done)
                break;
            prior = &(match->next);
        }
        if (match == NULL)
            fail(ESRCH, file, line, "join_all lost");

        // join the thread (will be almost immediate), remove from the threads
        // list, update the reenter count, and free the thread
        int ret = pthread_join(match->id, NULL);
        if (ret)
            fail(ret, file, line, "join");
        threads_lock.value--;
        *prior = match->next;
        my_free(match);
        count++;
    }

    // let go of the threads list and return the number of threads joined
    release_(&(threads_lock), file, line);
    return count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x2ef4d(%rip), %rdi     # 0x3d618
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe2b3
cmpq $0x0, 0x2ef9a(%rip)     # 0x3d678
je 0xe76a
xorl %r15d, %r15d
leaq 0x2ef8a(%rip), %r12     # 0x3d678
leaq 0x2ef23(%rip), %rdi     # 0x3d618
movl $0x1, %esi
xorl %edx, %edx
movq %r14, %rcx
movq %rbx, %r8
callq 0xe36e
movq 0x2ef6a(%rip), %r13     # 0x3d678
testq %r13, %r13
je 0xe791
cmpl $0x0, 0x8(%r13)
movq %r12, %rbp
jne 0xe734
movq %r13, %rbp
movq 0x10(%r13), %r13
testq %r13, %r13
je 0xe791
cmpl $0x0, 0x8(%r13)
je 0xe71d
addq $0x10, %rbp
movq (%r13), %rdi
xorl %esi, %esi
callq 0x35a0
testl %eax, %eax
jne 0xe7a8
decq 0x2ef26(%rip)           # 0x3d670
movq 0x10(%r13), %rax
movq %rax, (%rbp)
movq %r13, %rdi
callq *0xebd5(%rip)           # 0x1d330
incl %r15d
cmpq $0x0, 0x2ef12(%rip)     # 0x3d678
jne 0xe6ee
jmp 0xe76d
xorl %r15d, %r15d
leaq 0x2eea4(%rip), %rdi     # 0x3d618
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe2e2
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x843b(%rip), %rcx      # 0x16bd3
movl $0x3, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xe1c2
leaq 0x8415(%rip), %rcx      # 0x16bc4
movl %eax, %edi
jmp 0xe79d
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/yarn.c
// Function: reenter
local void reenter(void *arg) {
    struct capsule *capsule = arg;

    // find this thread in the threads list by matching the thread id
    pthread_t me = pthread_self();
    possess_(&(threads_lock), capsule->file, capsule->line);
    thread **prior = &(threads);
    thread *match;
    while ((match = *prior) != NULL) {
        if (pthread_equal(match->id, me))
            break;
        prior = &(match->next);
    }
    if (match == NULL)
        fail(ESRCH, capsule->file, capsule->line, "reenter lost");

    // mark this thread as done and move it to the head of the list
    match->done = 1;
    if (threads != match) {
        *prior = match->next;
        match->next = threads;
        threads = match;
    }

    // update the count of threads to be joined and alert join_all()
    twist_(&(threads_lock), BY, +1, capsule->file, capsule->line);

    // free the capsule resource, even if the thread is cancelled (though yarn
    // doesn't use pthread_cancel() -- you never know)
    my_free(capsule);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x34e0
movq %rax, %r14
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
leaq 0x2ee42(%rip), %rdi     # 0x3d618
callq 0xe2b3
movq 0x2ee96(%rip), %r15     # 0x3d678
testq %r15, %r15
je 0xe884
movq (%r15), %rdi
movq %r14, %rsi
callq 0x34c0
testl %eax, %eax
je 0xe806
leaq 0x2ee77(%rip), %r13     # 0x3d678
movq %r15, %r12
jmp 0xe82a
movq %r15, %r12
movq %r12, %r13
movq 0x10(%r12), %r12
testq %r12, %r12
je 0xe884
movq (%r12), %rdi
movq %r14, %rsi
callq 0x34c0
testl %eax, %eax
je 0xe809
addq $0x10, %r13
movl $0x1, 0x8(%r12)
cmpq %r12, %r15
je 0xe854
movq 0x10(%r12), %rax
movq %rax, (%r13)
movq 0x2ee30(%rip), %rax     # 0x3d678
movq %rax, 0x10(%r12)
movq %r12, 0x2ee24(%rip)     # 0x3d678
movq 0x10(%rbx), %rcx
movq 0x18(%rbx), %r8
leaq 0x2edb5(%rip), %rdi     # 0x3d618
movl $0x1, %edx
movl $0x1, %esi
callq 0xe311
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmpq *0xeaac(%rip)           # 0x1d330
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
leaq 0x83ea(%rip), %rcx      # 0x16c7d
movl $0x3, %edi
callq 0xe1c2
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: ZopfliCalculateBlockSize
double ZopfliCalculateBlockSize(const ZopfliLZ77Store* lz77,
                                size_t lstart, size_t lend, int btype) {
  unsigned ll_lengths[ZOPFLI_NUM_LL];
  unsigned d_lengths[ZOPFLI_NUM_D];

  double result = 3; /* bfinal and btype bits */

  if (btype == 0) {
    size_t length = ZopfliLZ77GetByteRange(lz77, lstart, lend);
    size_t rem = length % 65535;
    size_t blocks = length / 65535 + (rem ? 1 : 0);
    /* An uncompressed block must actually be split into multiple blocks if it's
       larger than 65535 bytes long. Eeach block header is 5 bytes: 3 bits,
       padding, LEN and NLEN (potential less padding for first one ignored). */
    return blocks * 5 * 8 + length * 8;
  } if (btype == 1) {
    GetFixedTree(ll_lengths, d_lengths);
    result += CalculateBlockSymbolSize(
        ll_lengths, d_lengths, lz77, lstart, lend);
  } else {
    result += GetDynamicLengths(lz77, lstart, lend, ll_lengths, d_lengths);
  }

  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf10, %rsp            # imm = 0xF10
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x1, %ecx
je 0xedc0
testl %ecx, %ecx
jne 0xedfb
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x11eb5
movq %rax, %rcx
movabsq $-0x7fff7fff7fff7fff, %rdx # imm = 0x8000800080008001
mulq %rdx
shrq $0xf, %rdx
movabsq $-0x1000100010001, %rax # imm = 0xFFFEFFFEFFFEFFFF
imulq %rcx, %rax
movabsq $0x1000100010001, %rsi  # imm = 0x1000100010001
xorl %edi, %edi
cmpq %rsi, %rax
seta %dil
addq %rdx, %rdi
leaq (%rdi,%rdi,4), %rax
shlq $0x3, %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, %xmm1
punpckldq 0x6279(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x6281(%rip), %xmm1     # 0x15030
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
jmp 0xee87
leaq 0x190(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xee98
leaq 0x360(%rbx), %rax
cmpq %r14, %rax
jbe 0xee18
leaq 0x190(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
movq %rbx, %rcx
movq %r14, %r8
callq 0x10151
jmp 0xee5e
leaq 0x190(%rsp), %rcx
leaq 0x10(%rsp), %r8
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xef0d
jmp 0xee7f
leaq 0x610(%rsp), %r12
leaq 0x90(%rsp), %r13
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x11ee9
movq %r14, (%rsp)
leaq 0x190(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %r8
movq %rbx, %r9
callq 0x10270
movq %rax, %xmm1
punpckldq 0x61b5(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x61bd(%rip), %xmm1     # 0x15030
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
addsd 0x7f39(%rip), %xmm0     # 0x16dc0
addq $0xf10, %rsp            # imm = 0xF10
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: ZopfliCalculateBlockSizeAutoType
double ZopfliCalculateBlockSizeAutoType(const ZopfliLZ77Store* lz77,
                                        size_t lstart, size_t lend) {
  double uncompressedcost = ZopfliCalculateBlockSize(lz77, lstart, lend, 0);
  /* Don't do the expensive fixed cost calculation for larger blocks that are
     unlikely to use it. */
  double fixedcost = (lz77->size > 1000) ?
      uncompressedcost : ZopfliCalculateBlockSize(lz77, lstart, lend, 1);
  double dyncost = ZopfliCalculateBlockSize(lz77, lstart, lend, 2);
  return (uncompressedcost < fixedcost && uncompressedcost < dyncost)
      ? uncompressedcost
      : (fixedcost < dyncost ? fixedcost : dyncost);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x520, %rsp            # imm = 0x520
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x11eb5
movq %rax, %rcx
movabsq $-0x7fff7fff7fff7fff, %rdx # imm = 0x8000800080008001
mulq %rdx
shrq $0xf, %rdx
movabsq $-0x1000100010001, %rax # imm = 0xFFFEFFFEFFFEFFFF
imulq %rcx, %rax
movabsq $0x1000100010001, %rsi  # imm = 0x1000100010001
xorl %edi, %edi
cmpq %rsi, %rax
seta %dil
addq %rdx, %rdi
leaq (%rdi,%rdi,4), %rax
shlq $0x3, %rcx
leaq (%rcx,%rax,8), %rax
movq %rax, %xmm0
punpckldq 0x5dc7(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x5dcf(%rip), %xmm0     # 0x15030
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
cmpq $0x3e8, 0x10(%r15)      # imm = 0x3E8
movapd %xmm1, 0x10(%rsp)
movapd %xmm1, %xmm0
ja 0xf294
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0xed1e
movapd %xmm0, (%rsp)
leaq 0xa0(%rsp), %rcx
leaq 0x20(%rsp), %r8
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xef0d
movapd (%rsp), %xmm4
addsd 0x7aff(%rip), %xmm0     # 0x16dc0
movapd 0x10(%rsp), %xmm3
movapd %xmm3, %xmm1
cmpltpd %xmm0, %xmm1
movapd %xmm3, %xmm2
cmpltpd %xmm4, %xmm2
andpd %xmm1, %xmm2
movd %xmm2, %eax
testb $0x1, %al
jne 0xf2ed
minsd %xmm0, %xmm4
movapd %xmm4, %xmm3
movapd %xmm3, %xmm0
addq $0x520, %rsp            # imm = 0x520
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: CalculateBlockSymbolSizeSmall
static size_t CalculateBlockSymbolSizeSmall(const unsigned* ll_lengths,
                                            const unsigned* d_lengths,
                                            const ZopfliLZ77Store* lz77,
                                            size_t lstart, size_t lend) {
  size_t result = 0;
  size_t i;
  for (i = lstart; i < lend; i++) {
    assert(i < lz77->size);
    assert(lz77->litlens[i] < 259);
    if (lz77->dists[i] == 0) {
      result += ll_lengths[lz77->litlens[i]];
    } else {
      int ll_symbol = ZopfliGetLengthSymbol(lz77->litlens[i]);
      int d_symbol = ZopfliGetDistSymbol(lz77->dists[i]);
      result += ll_lengths[ll_symbol];
      result += d_lengths[d_symbol];
      result += ZopfliGetLengthSymbolExtraBits(ll_symbol);
      result += ZopfliGetDistSymbolExtraBits(d_symbol);
    }
  }
  result += ll_lengths[256]; /*end symbol*/
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movq %rdi, (%rsp)
movq %r8, 0x10(%rsp)
cmpq %r8, %rcx
jae 0x10213
movq %rcx, %r15
movq %rdx, %r12
xorl %r13d, %r13d
cmpq 0x10(%r12), %r15
jae 0x10251
movq (%r12), %rax
movzwl (%rax,%r15,2), %edi
cmpl $0x103, %edi            # imm = 0x103
jae 0x10232
movq 0x8(%r12), %rax
cmpw $0x0, (%rax,%r15,2)
je 0x101f7
callq 0x14f25
movl %eax, %ebp
movq 0x8(%r12), %rax
movzwl (%rax,%r15,2), %edi
callq 0x14ee4
movslq %ebp, %rdi
movq (%rsp), %rcx
movl (%rcx,%rdi,4), %ecx
addq %rcx, %r13
movslq %eax, %rbp
movq 0x8(%rsp), %rax
movl (%rax,%rbp,4), %ebx
callq 0x14f33
movslq %eax, %r14
addq %rbx, %r14
addq %r13, %r14
movl %ebp, %edi
callq 0x14f45
movslq %eax, %r13
addq %r14, %r13
jmp 0x10203
movl %edi, %eax
movq (%rsp), %rcx
movl (%rcx,%rax,4), %eax
addq %rax, %r13
incq %r15
cmpq %r15, 0x10(%rsp)
jne 0x1017f
jmp 0x10216
xorl %r13d, %r13d
movq (%rsp), %rax
movl 0x400(%rax), %eax
addq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6c79(%rip), %rdi      # 0x16eb2
leaq 0x6bdc(%rip), %rsi      # 0x16e1c
leaq 0x6bf1(%rip), %rcx      # 0x16e38
movl $0x164, %edx            # imm = 0x164
callq 0x3220
leaq 0x6bb5(%rip), %rdi      # 0x16e0d
leaq 0x6bbd(%rip), %rsi      # 0x16e1c
leaq 0x6bd2(%rip), %rcx      # 0x16e38
movl $0x163, %edx            # imm = 0x163
callq 0x3220
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: CalculateBlockSymbolSizeGivenCounts
static size_t CalculateBlockSymbolSizeGivenCounts(const size_t* ll_counts,
                                                  const size_t* d_counts,
                                                  const unsigned* ll_lengths,
                                                  const unsigned* d_lengths,
                                                  const ZopfliLZ77Store* lz77,
                                                  size_t lstart, size_t lend) {
  size_t result = 0;
  size_t i;
  if (lstart + ZOPFLI_NUM_LL * 3 > lend) {
    return CalculateBlockSymbolSizeSmall(
        ll_lengths, d_lengths, lz77, lstart, lend);
  } else {
    for (i = 0; i < 256; i++) {
      result += ll_lengths[i] * ll_counts[i];
    }
    for (i = 257; i < 286; i++) {
      result += ll_lengths[i] * ll_counts[i];
      result += ZopfliGetLengthSymbolExtraBits(i) * ll_counts[i];
    }
    for (i = 0; i < 30; i++) {
      result += d_lengths[i] * d_counts[i];
      result += ZopfliGetDistSymbolExtraBits(i) * d_counts[i];
    }
    result += ll_lengths[256]; /*end symbol*/
    return result;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq 0x40(%rsp), %rax
leaq 0x360(%r9), %rdx
cmpq %rax, %rdx
jbe 0x102b1
movq %r14, %rdi
movq %rcx, %rsi
movq %r8, %rdx
movq %r9, %rcx
movq %rax, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10151
movq %rsi, %r15
movq %rdi, %r12
movq %rcx, (%rsp)
pxor %xmm0, %xmm0
xorl %eax, %eax
pxor %xmm1, %xmm1
movq (%r14,%rax,4), %xmm2
punpckldq %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1]
movdqu (%r12,%rax,8), %xmm3
movdqa %xmm3, %xmm4
pmuludq %xmm2, %xmm4
paddq %xmm1, %xmm4
psrlq $0x20, %xmm3
pmuludq %xmm2, %xmm3
psllq $0x20, %xmm3
movdqa %xmm3, %xmm1
paddq %xmm4, %xmm1
addq $0x2, %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x102c5
pshufd $0xee, %xmm1, %xmm0     # xmm0 = xmm1[2,3,2,3]
paddq %xmm1, %xmm0
movq %xmm0, %r13
movl $0x101, %ebp            # imm = 0x101
movl (%r14,%rbp,4), %ebx
imulq (%r12,%rbp,8), %rbx
movl %ebp, %edi
callq 0x14f33
cltq
imulq (%r12,%rbp,8), %rax
addq %rax, %r13
addq %rbx, %r13
incq %rbp
cmpq $0x11e, %rbp            # imm = 0x11E
jne 0x10316
xorl %r12d, %r12d
movq (%rsp), %rbp
movl (%rbp,%r12,4), %ebx
imulq (%r15,%r12,8), %rbx
movl %r12d, %edi
callq 0x14f45
cltq
imulq (%r15,%r12,8), %rax
addq %rax, %r13
addq %rbx, %r13
incq %r12
cmpq $0x1e, %r12
jne 0x10346
movl 0x400(%r14), %eax
addq %rax, %r13
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/deflate.c
// Function: CalculateTreeSize
static size_t CalculateTreeSize(const unsigned* ll_lengths,
                                const unsigned* d_lengths) {
  size_t result = 0;
  int i;

  for(i = 0; i < 8; i++) {
    size_t size = EncodeTree(ll_lengths, d_lengths,
                             i & 1, i & 2, i & 4,
                             0, 0, 0);
    if (result == 0 || size < result) result = size;
  }

  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
xorl %ebp, %ebp
movq %rax, %r15
movl %ebp, %edx
andl $0x1, %edx
movl %ebp, %ecx
andl $0x2, %ecx
movl %ebp, %r8d
andl $0x4, %r8d
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
xorl %r9d, %r9d
callq 0x103e4
leaq -0x1(%r15), %rcx
cmpq %rax, %rcx
cmovbq %r15, %rax
incl %ebp
cmpl $0x8, %ebp
jne 0x1039e
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliAppendLZ77Store
void ZopfliAppendLZ77Store(const ZopfliLZ77Store* store,
                           ZopfliLZ77Store* target) {
  size_t i;
  for (i = 0; i < store->size; i++) {
    ZopfliStoreLitLenDist(store->litlens[i], store->dists[i],
                          store->pos[i], target);
  }
}

// Assembly:
cmpq $0x0, 0x10(%rdi)
je 0x11eb4
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %r15d, %r15d
movq (%r14), %rax
movq 0x8(%r14), %rcx
movzwl (%rax,%r15,2), %edi
movzwl (%rcx,%r15,2), %esi
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rdx
movq %rbx, %rcx
callq 0x11a5f
incq %r15
cmpq 0x10(%r14), %r15
jb 0x11e85
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliLZ77GetByteRange
size_t ZopfliLZ77GetByteRange(const ZopfliLZ77Store* lz77,
                              size_t lstart, size_t lend) {
  size_t l = lend - 1;
  if (lstart == lend) return 0;
  return lz77->pos[l] + ((lz77->dists[l] == 0) ?
      1 : lz77->litlens[l]) - lz77->pos[lstart];
}

// Assembly:
cmpq %rdx, %rsi
jne 0x11ebd
xorl %eax, %eax
retq
movq 0x8(%rdi), %rax
movq 0x20(%rdi), %rcx
movq -0x8(%rcx,%rdx,8), %r8
cmpw $0x0, -0x2(%rax,%rdx,2)
je 0x11edc
movq (%rdi), %rax
movzwl -0x2(%rax,%rdx,2), %eax
jmp 0x11ee1
movl $0x1, %eax
addq %r8, %rax
subq (%rcx,%rsi,8), %rax
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliLZ77GetHistogram
void ZopfliLZ77GetHistogram(const ZopfliLZ77Store* lz77,
                           size_t lstart, size_t lend,
                           size_t* ll_counts, size_t* d_counts) {
  size_t i;
  if (lstart + ZOPFLI_NUM_LL * 3 > lend) {
    memset(ll_counts, 0, sizeof(*ll_counts) * ZOPFLI_NUM_LL);
    memset(d_counts, 0, sizeof(*d_counts) * ZOPFLI_NUM_D);
    for (i = lstart; i < lend; i++) {
      ll_counts[lz77->ll_symbol[i]]++;
      if (lz77->dists[i] != 0) d_counts[lz77->d_symbol[i]]++;
    }
  } else {
    /* Subtract the cumulative histograms at the end and the start to get the
    histogram for this range. */
    ZopfliLZ77GetHistogramAt(lz77, lend - 1, ll_counts, d_counts);
    if (lstart > 0) {
      size_t ll_counts2[ZOPFLI_NUM_LL];
      size_t d_counts2[ZOPFLI_NUM_D];
      ZopfliLZ77GetHistogramAt(lz77, lstart - 1, ll_counts2, d_counts2);

      for (i = 0; i < ZOPFLI_NUM_LL; i++) {
        ll_counts[i] -= ll_counts2[i];
      }
      for (i = 0; i < ZOPFLI_NUM_D; i++) {
        d_counts[i] -= d_counts2[i];
      }
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa00, %rsp            # imm = 0xA00
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r12
leaq 0x360(%rsi), %rax
cmpq %rdx, %rax
jbe 0x11f6e
movl $0x900, %edx            # imm = 0x900
movq %r14, %rdi
xorl %esi, %esi
callq 0x3260
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
callq 0x3260
cmpq %r13, %r15
jae 0x11fde
movq 0x8(%r12), %rax
movq 0x28(%r12), %rcx
movzwl (%rcx,%r15,2), %edx
incq (%r14,%rdx,8)
cmpw $0x0, (%rax,%r15,2)
je 0x11f64
movq 0x30(%r12), %rdx
movzwl (%rdx,%r15,2), %edx
incq (%rbx,%rdx,8)
incq %r15
cmpq %r15, %r13
jne 0x11f45
jmp 0x11fde
decq %r13
movq %r12, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x11fef
testq %r15, %r15
je 0x11fde
decq %r15
leaq 0x100(%rsp), %rdx
movq %rsp, %rcx
movq %r12, %rdi
movq %r15, %rsi
callq 0x11fef
xorl %eax, %eax
movdqu (%r14,%rax,8), %xmm0
psubq 0x100(%rsp,%rax,8), %xmm0
movdqu %xmm0, (%r14,%rax,8)
addq $0x2, %rax
cmpq $0x120, %rax            # imm = 0x120
jne 0x11fa2
xorl %eax, %eax
movdqu (%rbx,%rax,8), %xmm0
psubq (%rsp,%rax,8), %xmm0
movdqu %xmm0, (%rbx,%rax,8)
addq $0x2, %rax
cmpq $0x20, %rax
jne 0x11fc5
addq $0xa00, %rsp            # imm = 0xA00
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliLZ77GetHistogramAt
static void ZopfliLZ77GetHistogramAt(const ZopfliLZ77Store* lz77, size_t lpos,
                                     size_t* ll_counts, size_t* d_counts) {
  /* The real histogram is created by using the histogram for this chunk, but
  all superfluous values of this chunk subtracted. */
  size_t llpos = ZOPFLI_NUM_LL * (lpos / ZOPFLI_NUM_LL);
  size_t dpos = ZOPFLI_NUM_D * (lpos / ZOPFLI_NUM_D);
  size_t i;
  for (i = 0; i < ZOPFLI_NUM_LL; i++) {
    ll_counts[i] = lz77->ll_counts[llpos + i];
  }
  for (i = lpos + 1; i < llpos + ZOPFLI_NUM_LL && i < lz77->size; i++) {
    ll_counts[lz77->ll_symbol[i]]--;
  }
  for (i = 0; i < ZOPFLI_NUM_D; i++) {
    d_counts[i] = lz77->d_counts[dpos + i];
  }
  for (i = lpos + 1; i < dpos + ZOPFLI_NUM_D && i < lz77->size; i++) {
    if (lz77->dists[i] != 0) d_counts[lz77->d_symbol[i]]--;
  }
}

// Assembly:
movq %rdx, %r8
movabsq $-0x1c71c71c71c71c71, %r11 # imm = 0xE38E38E38E38E38F
movq %rsi, %rax
mulq %r11
shrq $0x3, %rdx
andq $-0x20, %rdx
leaq (%rdx,%rdx,8), %rax
leaq (,%rax,8), %rdx
addq 0x38(%rdi), %rdx
xorl %r9d, %r9d
movq (%rdx,%r9,8), %r10
movq %r10, (%r8,%r9,8)
incq %r9
cmpq $0x120, %r9             # imm = 0x120
jne 0x1201d
movq %rsi, %r10
andq $-0x20, %r10
leaq 0x1(%rsi), %r9
addq $0x120, %rax            # imm = 0x120
cmpq %rax, %r9
jae 0x12088
movq %rsi, %rax
mulq %r11
shrq $0x3, %rdx
andq $-0x20, %rdx
leaq (%rdx,%rdx,8), %rdx
movq $-0x11f, %rax           # imm = 0xFEE1
subq %rdx, %rax
movq %r9, %rdx
cmpq 0x10(%rdi), %rdx
jae 0x12088
movq 0x28(%rdi), %rsi
movzwl (%rsi,%rdx,2), %esi
decq (%r8,%rsi,8)
leaq (%rax,%rdx), %rsi
incq %rsi
incq %rdx
cmpq $0x1, %rsi
jne 0x12066
leaq (,%r10,8), %rax
addq 0x40(%rdi), %rax
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
movq %rsi, (%rcx,%rdx,8)
incq %rdx
cmpq $0x20, %rdx
jne 0x12096
leaq 0x20(%r10), %rax
cmpq %rax, %r9
jae 0x120e9
movq $-0x1f, %rax
subq %r10, %rax
cmpq 0x10(%rdi), %r9
jae 0x120e9
movq 0x8(%rdi), %rdx
cmpw $0x0, (%rdx,%r9,2)
je 0x120d9
movq 0x30(%rdi), %rdx
movzwl (%rdx,%r9,2), %edx
decq (%rcx,%rdx,8)
leaq (%rax,%r9), %rdx
incq %rdx
incq %r9
cmpq $0x1, %rdx
jne 0x120ba
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliInitBlockState
void ZopfliInitBlockState(const ZopfliOptions* options,
                          size_t blockstart, size_t blockend, int add_lmc,
                          ZopfliBlockState* s) {
  s->options = options;
  s->blockstart = blockstart;
  s->blockend = blockend;
#ifdef ZOPFLI_LONGEST_MATCH_CACHE
  if (add_lmc) {
    s->lmc = (ZopfliLongestMatchCache*)malloc(sizeof(ZopfliLongestMatchCache));
    ZopfliInitCache(blockend - blockstart, s->lmc);
  } else {
    s->lmc = 0;
  }
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %r8, %rbx
movq %rdi, (%r8)
movq %rsi, 0x10(%r8)
movq %rdx, 0x18(%r8)
testl %ecx, %ecx
je 0x12128
movq %rdx, %r14
movq %rsi, %r15
movl $0x18, %edi
callq 0x33e0
movq %rax, 0x8(%rbx)
subq %r15, %r14
movq %r14, %rdi
movq %rax, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x12c04
movq $0x0, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/lz77.c
// Function: ZopfliCleanBlockState
void ZopfliCleanBlockState(ZopfliBlockState* s) {
#ifdef ZOPFLI_LONGEST_MATCH_CACHE
  if (s->lmc) {
    ZopfliCleanCache(s->lmc);
    free(s->lmc);
  }
#endif
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x12152
callq 0x12f51
movq 0x8(%rbx), %rdi
popq %rbx
jmp 0x3050
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/hash.c
// Function: ZopfliResetHash
void ZopfliResetHash(size_t window_size, ZopfliHash* h) {
  size_t i;

  h->val = 0;
  for (i = 0; i < 65536; i++) {
    h->head[i] = -1;  /* -1 indicates no head so far. */
  }
  for (i = 0; i < window_size; i++) {
    h->prev[i] = i;  /* If prev[j] == j, then prev[j] is uninitialized. */
    h->hashval[i] = -1;
  }

#ifdef ZOPFLI_HASH_SAME
  for (i = 0; i < window_size; i++) {
    h->same[i] = 0;
  }
#endif

#ifdef ZOPFLI_HASH_SAME_HASH
  h->val2 = 0;
  for (i = 0; i < 65536; i++) {
    h->head2[i] = -1;
  }
  for (i = 0; i < window_size; i++) {
    h->prev2[i] = i;
    h->hashval2[i] = -1;
  }
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x0, 0x18(%rsi)
movq (%rsi), %rdi
movl $0x40000, %edx          # imm = 0x40000
movl $0xff, %esi
callq 0x3260
testq %rbx, %rbx
je 0x134d6
movq 0x8(%r14), %rax
movq 0x10(%r14), %rcx
xorl %edx, %edx
movw %dx, (%rax,%rdx,2)
movl $0xffffffff, (%rcx,%rdx,4) # imm = 0xFFFFFFFF
incq %rdx
cmpq %rdx, %rbx
jne 0x13473
movq 0x40(%r14), %rdi
leaq (%rbx,%rbx), %rdx
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x3260
movl $0x0, 0x38(%r14)
movq 0x20(%r14), %rdi
movl $0x40000, %edx          # imm = 0x40000
movl $0xff, %esi
callq 0x3260
movq 0x28(%r14), %rax
movq 0x30(%r14), %rcx
movw %r15w, (%rax,%r15,2)
movl $0xffffffff, (%rcx,%r15,4) # imm = 0xFFFFFFFF
incq %r15
cmpq %r15, %rbx
jne 0x134bb
popq %rbx
popq %r14
popq %r15
retq
movl $0x0, 0x38(%r14)
movq 0x20(%r14), %rdi
movl $0x40000, %edx          # imm = 0x40000
movl $0xff, %esi
popq %rbx
popq %r14
popq %r15
jmp 0x3260
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/squeeze.c
// Function: GetCostStat
static double GetCostStat(unsigned litlen, unsigned dist, void* context) {
  SymbolStats* stats = (SymbolStats*)context;
  if (dist == 0) {
    return stats->ll_symbols[litlen];
  } else {
    int lsym = ZopfliGetLengthSymbol(litlen);
    int lbits = ZopfliGetLengthExtraBits(litlen);
    int dsym = ZopfliGetDistSymbol(dist);
    int dbits = ZopfliGetDistExtraBits(dist);
    return lbits + dbits + stats->ll_symbols[lsym] + stats->d_symbols[dsym];
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl %edi, %r14d
testl %esi, %esi
je 0x14855
movl %esi, %ebp
movl %r14d, %edi
callq 0x14f25
movl %eax, %r15d
movl %r14d, %edi
callq 0x14f09
movl %eax, %r14d
movl %ebp, %edi
callq 0x14ee4
movl %eax, %r12d
movl %ebp, %edi
callq 0x14ea4
addl %r14d, %eax
cvtsi2sd %eax, %xmm0
movslq %r15d, %rax
addsd 0xa00(%rbx,%rax,8), %xmm0
movslq %r12d, %rax
addsd 0x1300(%rbx,%rax,8), %xmm0
jmp 0x14861
movl %r14d, %eax
movsd 0xa00(%rbx,%rax,8), %xmm0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/squeeze.c
// Function: ZopfliLZ77OptimalFixed
void ZopfliLZ77OptimalFixed(ZopfliBlockState *s,
                            const unsigned char* in,
                            size_t instart, size_t inend,
                            ZopfliLZ77Store* store)
{
  /* Dist to get to here with smallest cost. */
  size_t blocksize = inend - instart;
  unsigned short* length_array =
      (unsigned short*)malloc(sizeof(unsigned short) * (blocksize + 1));
  unsigned short* path = 0;
  size_t pathsize = 0;
  ZopfliHash hash;
  ZopfliHash* h = &hash;
  float* costs = (float*)malloc(sizeof(float) * (blocksize + 1));

  if (!costs) exit(-1); /* Allocation failed. */
  if (!length_array) exit(-1); /* Allocation failed. */

  ZopfliAllocHash(ZOPFLI_WINDOW_SIZE, h);

  s->blockstart = instart;
  s->blockend = inend;

  /* Shortest path for fixed tree This one should give the shortest possible
  result for fixed tree, no repeated runs are needed since the tree is known. */
  LZ77OptimalRun(s, in, instart, inend, &path, &pathsize,
                 length_array, GetCostFixed, 0, store, h, costs);

  free(length_array);
  free(path);
  free(costs);
  ZopfliCleanHash(h);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %rbp
movq %rcx, %r15
subq %rdx, %r15
leaq 0x2(,%r15,2), %rdi
callq 0x33e0
movq %rax, %r14
xorl %eax, %eax
movq %rax, 0x18(%rsp)
movq %rax, 0x10(%rsp)
leaq 0x4(,%r15,4), %rdi
callq 0x33e0
testq %rax, %rax
je 0x14950
testq %r14, %r14
je 0x14950
movq %rax, %r15
leaq 0x20(%rsp), %rsi
movl $0x8000, %edi           # imm = 0x8000
callq 0x133d0
movq %r13, 0x10(%rbp)
movq %r12, 0x18(%rbp)
leaq 0x6f(%rip), %rax        # 0x1495a
leaq 0x18(%rsp), %r8
leaq 0x10(%rsp), %r9
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r12, %rcx
movq %r8, %rbx
pushq %r15
leaq 0x28(%rsp), %r10
pushq %r10
pushq 0x18(%rsp)
pushq $0x0
pushq %rax
pushq %r14
callq 0x13dd3
addq $0x30, %rsp
movq %r14, %rdi
callq 0x3050
movq (%rbx), %rdi
callq 0x3050
movq %r15, %rdi
callq 0x3050
leaq 0x20(%rsp), %rdi
callq 0x134f6
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3550
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/squeeze.c
// Function: GetCostFixed
static double GetCostFixed(unsigned litlen, unsigned dist, void* unused) {
  (void)unused;
  if (dist == 0) {
    if (litlen <= 143) return 8;
    else return 9;
  } else {
    int dbits = ZopfliGetDistExtraBits(dist);
    int lbits = ZopfliGetLengthExtraBits(litlen);
    int lsym = ZopfliGetLengthSymbol(litlen);
    int cost = 0;
    if (lsym <= 279) cost += 7;
    else cost += 8;
    cost += 5;  /* Every dist symbol has length 5. */
    return cost + dbits + lbits;
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
testl %esi, %esi
je 0x14998
movl %esi, %edi
callq 0x14ea4
movl %eax, %ebp
movl %ebx, %edi
callq 0x14f09
movl %eax, %r14d
movl %ebx, %edi
callq 0x14f25
xorl %ecx, %ecx
cmpl $0x118, %eax            # imm = 0x118
setl %cl
xorl $0xd, %ecx
addl %ebp, %r14d
addl %ecx, %r14d
cvtsi2sd %r14d, %xmm0
jmp 0x149af
xorl %eax, %eax
cmpl $0x90, %ebx
setb %al
leaq 0x3036(%rip), %rcx      # 0x179e0
movsd (%rcx,%rax,8), %xmm0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/madler[P]pigz/zopfli/src/zopfli/katajainen.c
// Function: BoundaryPM
static void BoundaryPM(Node* (*lists)[2], Node* leaves, int numsymbols,
                       NodePool* pool, int index) {
  Node* newchain;
  Node* oldchain;
  int lastcount = lists[index][1]->count;  /* Count of last chain of list. */

  if (index == 0 && lastcount >= numsymbols) return;

  newchain = pool->next++;
  oldchain = lists[index][1];

  /* These are set up before the recursive calls below, so that there is a list
  pointing to the new node, to let the garbage collection know it's in use. */
  lists[index][0] = oldchain;
  lists[index][1] = newchain;

  if (index == 0) {
    /* New leaf node in list 0. */
    InitNode(leaves[lastcount].weight, lastcount + 1, 0, newchain);
  } else {
    size_t sum = lists[index - 1][0]->weight + lists[index - 1][1]->weight;
    if (lastcount < numsymbols && sum > leaves[lastcount].weight) {
      /* New leaf inserted in list, so count is incremented. */
      InitNode(leaves[lastcount].weight, lastcount + 1, oldchain->tail,
          newchain);
    } else {
      InitNode(sum, lastcount, lists[index - 1][1], newchain);
      /* Two lookahead chains of previous list used up, create new ones. */
      BoundaryPM(lists, leaves, numsymbols, pool, index - 1);
      BoundaryPM(lists, leaves, numsymbols, pool, index - 1);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %rbx
movslq %r8d, %r12
movq %r12, %rsi
shlq $0x4, %rsi
movq %rdi, (%rsp)
movq 0x8(%rdi,%rsi), %rax
movl 0x10(%rax), %eax
cmpl %edx, %eax
setl %cl
testl %r12d, %r12d
setne %dl
jne 0x14de3
cmpl %ebp, %eax
jge 0x14e94
movq (%rsp), %rdi
leaq (%rdi,%rsi), %r13
addq $0x8, %r13
leaq -0x1(%r12), %r15
decl %r12d
movq (%r14), %rsi
leaq 0x18(%rsi), %rdi
movq %rdi, (%r14)
movq (%r13), %rdi
movq %rdi, -0x8(%r13)
movq %rsi, (%r13)
testb $0x1, %dl
je 0x14e75
movq -0x18(%r13), %r9
movq -0x10(%r13), %rdx
movq (%rdx), %r8
addq (%r9), %r8
testb $0x1, %cl
je 0x14e35
movslq %eax, %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rbx,%rcx,8), %rcx
cmpq %rcx, %r8
ja 0x14e84
movq %r8, (%rsi)
movl %eax, 0x10(%rsi)
movq %rdx, 0x8(%rsi)
movq (%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
movq %r14, %rcx
movl %r12d, %r8d
callq 0x14da5
movq -0x10(%r13), %rax
addq $-0x10, %r13
movl 0x10(%rax), %eax
cmpl %ebp, %eax
setl %cl
decl %r12d
addq $-0x1, %r15
setb %dl
jb 0x14df7
cmpl %ebp, %eax
jl 0x14df7
jmp 0x14e94
movslq %eax, %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rbx,%rcx,8), %rcx
xorl %edx, %edx
jmp 0x14e88
movq 0x8(%rdi), %rdx
incl %eax
movq %rcx, (%rsi)
movl %eax, 0x10(%rsi)
movq %rdx, 0x8(%rsi)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/./utils.h
// Function: recv_until
int recv_until(char* buf,int size,char end){
    char tmp;
    int i;
    for(i=0;i<size;i++){
        read(0,&tmp,1);
        if(tmp==end){
            break;
        }
        buf[i]=tmp;
    }
    buf[i+1]=='\x00';
    return i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
jle 0x13ef
movl %edx, %ebx
movq %rdi, %r15
movl %esi, %r13d
xorl %r14d, %r14d
leaq -0x29(%rbp), %r12
movl $0x1, %edx
xorl %edi, %edi
movq %r12, %rsi
callq 0x1110
movb -0x29(%rbp), %al
cmpb %bl, %al
je 0x13f2
movb %al, (%r15,%r14)
incq %r14
cmpq %r14, %r13
jne 0x13c8
movl %r13d, %r14d
jmp 0x13f2
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/main.c
// Function: elf_executor_free
void elf_executor_free(struct executor_queue* eq){
    short buffer_size=0;
    free(eq);
    ppl_node_unlink(&eq->list);
    puts("feedback?");
    read(0, &buffer_size, 2);
    char *buffer = malloc((unsigned int)buffer_size);
    read(0, buffer, buffer_size);
    puts("thanks for the feedback, we will definitely read it");
    free(buffer);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq -0x12(%rbp), %r14
movw $0x0, (%r14)
callq 0x1030
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
leaq 0x304e(%rip), %rdi      # 0x4485
callq 0x1060
movl $0x2, %edx
xorl %edi, %edi
movq %r14, %rsi
callq 0x1110
movswq (%r14), %rbx
movl %ebx, %edi
callq 0x1170
movq %rax, %r14
xorl %edi, %edi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1110
leaq 0x3022(%rip), %rdi      # 0x448f
callq 0x1060
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1030
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/main.c
// Function: elf_check_patch
int elf_check_patch(struct executor_queue* eq, void* value){
    // get different size
    int i;
    int diff = 0;
    int fail = 0;
    char* pv = (char*)value; // patched version

    for(i = 0; i < elf_unpatched_size; i++){
        if(pv[i] != elf_unpatched[i]){
            diff++;
        }
        if(diff > 0x100){
            break;
        }
    }

#ifdef DEBUG
    printf("diff: %d\n",diff);
#endif
    if(diff > 0x100){
        fail = 1;
    }

    // check elf header        
    // todo
    ELF64_FileRef file;
    ELF64_HeaderRef header;
    file = ELF64_ReadFromData(pv);
    header = ELF64_FileGetHeader(file);
    if( ELF64_FileIsValid(file) == false){
        puts("bad elf :(");
        fail = 1;
    }
    dump_program_header_entry(file, header);
    if(fail){
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rdi
movl 0x6c2f(%rip), %eax      # 0x8144
testq %rax, %rax
je 0x1561
movq 0x6c27(%rip), %rcx      # 0x8148
movb (%rdi), %sil
xorl %edx, %edx
cmpb (%rcx), %sil
setne %dl
movl $0x1, %r8d
movq %r8, %rsi
cmpq %r8, %rax
je 0x1558
movb (%rdi,%rsi), %r8b
xorl %r9d, %r9d
cmpb (%rcx,%rsi), %r8b
setne %r9b
addl %r9d, %edx
leaq 0x1(%rsi), %r8
cmpl $0x101, %edx            # imm = 0x101
jb 0x1532
xorl %ebx, %ebx
cmpq %rax, %rsi
sbbl %ebx, %ebx
jmp 0x1563
xorl %ebx, %ebx
callq 0x2aa0
movq %rax, %r14
movq %rax, %rdi
callq 0x2acf
movq %rax, %r15
movq %r14, %rdi
callq 0x2aa9
testb %al, %al
jne 0x1593
leaq 0x2ebd(%rip), %rdi      # 0x4446
callq 0x1060
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %r14, %rdi
movq %r15, %rsi
callq 0x17c0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/main.c
// Function: safe_read
int safe_read(int fd, char* buffer, unsigned int size){
    int total, tmp;
    total = 0;
    tmp = 0;
    while(total < size){
        tmp = read(fd, buffer+total,size-total);
        if(tmp<0){
            exit(0);
        }
        total+=tmp;
        if(total==size){
            break;
        }
    }
    return total;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r14d
movq %rsi, %r15
movl %edi, %r12d
xorl %ebx, %ebx
movl %r14d, %edx
subl %ebx, %edx
jbe 0x17ae
movl %ebx, %esi
addq %r15, %rsi
movl %r12d, %edi
callq 0x1110
testl %eax, %eax
js 0x17b9
addl %eax, %ebx
cmpl %r14d, %ebx
jne 0x178c
movl %r14d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x11d0
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/main.c
// Function: rand_str
void rand_str(char *dest, unsigned char* seed, unsigned int size){
    int i;
    unsigned char index;
    for(i=0; i < size; i++){
        index = seed[i] % 62;
#ifdef DEBUG
        //printf("%d,%c ",index, charset[index]);
#endif
        dest[i] = charset[index];
    }
    dest[size]='\x00';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testl %edx, %edx
je 0x1a03
movl %edx, %eax
xorl %ecx, %ecx
leaq 0x267a(%rip), %rdx      # 0x4040
movb (%rsi,%rcx), %r8b
movl %r8d, %r9d
shrb %r9b
movzbl %r9b, %r9d
imull $0x85, %r9d, %r9d
shrl $0xc, %r9d
leal (%r9,%r9), %r10d
shll $0x6, %r9d
subl %r10d, %r9d
subb %r9b, %r8b
movzbl %r8b, %r8d
movb (%r8,%rdx), %r8b
movb %r8b, (%rdi,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x19c6
jmp 0x1a05
xorl %eax, %eax
movb $0x0, (%rdi,%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/main.c
// Function: init_executor_queue
void init_executor_queue(struct executor_queue* eq, struct patch_attr *attr){
    eq->queue_type = attr->queue_type;
    eq->max_queue_entries = attr->max_queue_entries;
    eq->value_size = attr->value_size;
    eq->executor_idx = global_executor_idx;
    eq->head = 0;
    eq->tail = 0;
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl (%rsi), %eax
movl %eax, 0x8(%rdi)
movl 0x4(%rsi), %eax
movl %eax, 0x10(%rdi)
movl 0x8(%rsi), %eax
movl %eax, 0x14(%rdi)
movl 0x66e0(%rip), %eax      # 0x8140
movl %eax, 0xc(%rdi)
movq $0x0, 0x18(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/main.c
// Function: safe_read_flag
unsigned int* safe_read_flag()
{
    flag_fp = fopen(FLAGPATH,"rb");
	if(flag_fp<0){
		perror("fopen");
		exit(1);
	}
	unsigned int *p = (unsigned int *)sha3_hash;
	sha3_ctx ctx;
	memset(sha3_hash,0,65);
	fread(flag, FLAGLENGTH, 1, flag_fp);
	flag[FLAGLENGTH]='\x00';
#ifdef DEBUG
	printf("%s\n",flag);
#endif
	rhash_sha3_256_init(&ctx);
	rhash_sha3_update(&ctx, (const unsigned char*)flag, FLAGLENGTH);
	rhash_sha3_final(&ctx,(unsigned char*)sha3_hash);
	printf("sha3 of flag: %x %x %x %x %x %x %x %x\n",p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7]);

	memset(flag,0,FLAGLENGTH);
    return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
leaq 0x2a3f(%rip), %rdi      # 0x44c3
leaq 0x2a4c(%rip), %rsi      # 0x44d7
callq 0x11a0
movq %rax, 0x66c1(%rip)      # 0x8158
xorps %xmm0, %xmm0
movaps %xmm0, 0x66bf(%rip)     # 0x8160
movaps %xmm0, 0x66c8(%rip)     # 0x8170
movaps %xmm0, 0x66d1(%rip)     # 0x8180
movaps %xmm0, 0x66da(%rip)     # 0x8190
xorl %r15d, %r15d
movb %r15b, 0x66e0(%rip)     # 0x81a0
leaq 0x6699(%rip), %rbx      # 0x8160
leaq 0x66e2(%rip), %r14      # 0x81b0
movl $0x4f, %esi
movl $0x1, %edx
movq %r14, %rdi
movq %rax, %rcx
callq 0x1070
movb %r15b, 0x6715(%rip)     # 0x81ff
leaq -0x1a8(%rbp), %r15
movq %r15, %rdi
callq 0x2472
movl $0x4f, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x24e4
movq %r15, %rdi
movq %rbx, %rsi
callq 0x29c7
movl 0x6646(%rip), %esi      # 0x8160
movl 0x6644(%rip), %edx      # 0x8164
movl 0x6642(%rip), %ecx      # 0x8168
movl 0x663f(%rip), %r8d      # 0x816c
movl 0x663c(%rip), %r9d      # 0x8170
movl 0x6639(%rip), %r10d     # 0x8174
movl 0x6636(%rip), %r11d     # 0x8178
movl 0x6633(%rip), %r14d     # 0x817c
subq $0x8, %rsp
leaq 0x2986(%rip), %rdi      # 0x44da
xorl %eax, %eax
pushq %r14
pushq %r11
pushq %r10
callq 0x10d0
addq $0x20, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x6641(%rip)     # 0x81b0
movaps %xmm0, 0x664a(%rip)     # 0x81c0
movaps %xmm0, 0x6653(%rip)     # 0x81d0
movaps %xmm0, 0x665c(%rip)     # 0x81e0
movups %xmm0, 0x6664(%rip)     # 0x81ef
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ww9210[P]xnuca_final_ssp/main.c
// Function: print_options
void print_options(){
    puts("[u] upload patches");
    puts("[c] complain");
    puts("[a] add patch pipeline");
    puts("[s] swap a patch");
    puts("[e] exit");
    puts("[r] run patches");
    puts("[d] remove a pipeline");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x2949(%rip), %rdi      # 0x4501
callq 0x1060
leaq 0x2950(%rip), %rdi      # 0x4514
callq 0x1060
leaq 0x2951(%rip), %rdi      # 0x4521
callq 0x1060
leaq 0x295c(%rip), %rdi      # 0x4538
callq 0x1060
leaq 0x2961(%rip), %rdi      # 0x4549
callq 0x1060
leaq 0x295e(%rip), %rdi      # 0x4552
callq 0x1060
leaq 0x2962(%rip), %rdi      # 0x4562
popq %rbp
jmp 0x1060