LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/arith_dynamic.c
// Function: arith_compress_bound
unsigned int arith_compress_bound(unsigned int size, int order) {
    int N = (order>>8) & 0xff;
    if (!N) N=4;
    return (order == 0
        ? 1.05*size + 257*3 + 4
        : 1.05*size + 257*257*3 + 4 + 257*3+4) + 5 +
        ((order & X_PACK) ? 1 : 0) +
        ((order & X_RLE) ? 1 + 257*3+4: 0) +
        ((order & X_STRIPE) ? 7 + 5*N: 0);
}

// Assembly:
movl %esi, %eax
movl %edi, %ecx
cvtsi2sd %rcx, %xmm0
mulsd 0x42d43(%rip), %xmm0    # 0x9ada8
testl %esi, %esi
je 0x58079
addsd 0x43997(%rip), %xmm0    # 0x9ba08
addsd 0x43997(%rip), %xmm0    # 0x9ba10
addsd 0x43997(%rip), %xmm0    # 0x9ba18
addsd 0x43987(%rip), %xmm0    # 0x9ba10
movzbl %ah, %ecx
movl %eax, %edx
shrl $0x7, %edx
andl $0x1, %edx
movl %eax, %esi
shll $0x19, %esi
sarl $0x1f, %esi
andl $0x308, %esi            # imm = 0x308
shll $0x1c, %eax
sarl $0x1f, %eax
addsd 0x43970(%rip), %xmm0    # 0x9ba20
cvtsi2sd %edx, %xmm1
testl %ecx, %ecx
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
leal 0x7(%rcx,%rcx,4), %ecx
movl $0x1b, %edx
cmovnel %ecx, %edx
addsd %xmm1, %xmm0
andl %eax, %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/varint.h
// Function: var_get_u32
static inline
int var_get_u32(uint8_t *cp, const uint8_t *endp, uint32_t *i) {
    uint8_t *op = cp, c;
    uint32_t j = 0;

    if (!endp || endp - cp >= 6) {
        // Known maximum loop count helps optimiser.
        // NB: this helps considerably at -O3 level, but may harm -O2.
        // (However we optimise for those that want optimal code.)
        int n = 5;
        do {
            c = *cp++;
            j = (j<<7) | (c & 0x7f);
        } while ((c & 0x80) && n-- > 0);
    } else {
        if (cp >= endp) {
            *i = 0;
            return 0;
        }

        if (*cp < 128) {
            *i = *cp;
            return 1;
        }

        do {
            c = *cp++;
            j = (j<<7) | (c & 0x7f);
        } while ((c & 0x80) && cp < endp);
    }

    *i = j;
    return cp-op;
}

// Assembly:
testq %rsi, %rsi
setne %al
movq %rsi, %rcx
subq %rdi, %rcx
cmpq $0x6, %rcx
setl %cl
testb %cl, %al
jne 0x5af05
xorl %esi, %esi
xorl %ecx, %ecx
movzbl (%rdi,%rsi), %r8d
movl %ecx, %eax
shll $0x7, %eax
movl %r8d, %ecx
andl $0x7f, %ecx
orl %eax, %ecx
leaq 0x1(%rsi), %rax
testb %r8b, %r8b
jns 0x5aefd
cmpl $0x5, %esi
movq %rax, %rsi
jne 0x5aeda
addq %rdi, %rax
movl %ecx, (%rdx)
subl %edi, %eax
retq
cmpq %rsi, %rdi
jae 0x5af19
movsbl (%rdi), %eax
testl %eax, %eax
js 0x5af22
movl %eax, (%rdx)
movl $0x1, %eax
retq
movl $0x0, (%rdx)
xorl %eax, %eax
retq
xorl %ecx, %ecx
movq %rdi, %rax
movzbl (%rax), %r8d
incq %rax
movl %ecx, %r9d
shll $0x7, %r9d
movl %r8d, %ecx
andl $0x7f, %ecx
orl %r9d, %ecx
testb %r8b, %r8b
jns 0x5af00
cmpq %rsi, %rax
jb 0x5af27
jmp 0x5af00
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/fqzcomp_qual.c
// Function: store_array
static int store_array(unsigned char *out, unsigned int *array, int size) {
    unsigned char tmp[2048];

    int i, j, k;
    for (i = j = k = 0; i < size; j++) {
        int run_len = i;
        while (i < size && array[i] == j)
            i++;
        run_len = i-run_len;

        int r;
        do {
            r = MIN(255, run_len);
            tmp[k++] = r;
            run_len -= r;
        } while (r == 255);
    }
    while (i < size)
        tmp[k++] = 0, j++;

    // RLE on out.
    //    1 2 3 3 3 3 3 4 4    5
    // => 1 2 3 3 +3... 4 4 +0 5
    int last = -1;
    for (i = j = 0; j < k; i++) {
        out[i] = tmp[j++];
        if (out[i] == last) {
            int n = j;
            while (j < k && tmp[j] == last)
                j++;
            out[++i] = j-n;
        } else {
            last = out[i];
        }
    }
    k = i;

//    fprintf(stderr, "Store_array %d => %d {", size, k);
//    for (i = 0; i < k; i++)
//      fprintf(stderr, "%d,", out[i]);
//    fprintf(stderr, "}\n");
    return k;
}

// Assembly:
testl %edx, %edx
jle 0x61374
pushq %rbp
pushq %rbx
subq $0x788, %rsp            # imm = 0x788
movl %edx, %eax
xorl %r11d, %r11d
movl $0xff, %r8d
xorl %r9d, %r9d
xorl %ecx, %ecx
movslq %r11d, %rbx
leal 0x1(%rbx), %r10d
cmpl %r10d, %edx
cmovgl %edx, %r10d
cmpl %r9d, (%rsi,%rbx,4)
jne 0x612b8
incq %rbx
cmpq %rax, %rbx
jl 0x612a8
jmp 0x612bb
movl %ebx, %r10d
movl %r10d, %ebx
subl %r11d, %ebx
movslq %ecx, %rcx
movl %ebx, %r11d
cmpl %r8d, %ebx
movl $0xff, %ebp
cmovll %ebx, %ebp
movb %bpl, -0x80(%rsp,%rcx)
incq %rcx
subl %ebp, %r11d
cmpl $0xfe, %ebx
movl %r11d, %ebx
jg 0x612c7
incl %r9d
movl %r10d, %r11d
cmpl %edx, %r10d
jl 0x6129a
movq %rcx, %rax
decq %rax
js 0x61377
movl %ecx, %edx
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
xorl %r8d, %r8d
movslq %r8d, %r9
incl %r8d
movzbl -0x80(%rsp,%r9), %r10d
movslq %eax, %r9
movb %r10b, (%rdi,%r9)
cmpl %r10d, %esi
jne 0x6134f
movl %r8d, %eax
cmpl %ecx, %r8d
jge 0x61357
movslq %r8d, %rax
leaq (%rsp,%rax), %r10
addq $-0x80, %r10
movq %rdx, %r11
subq %rax, %r11
xorl %eax, %eax
movzbl (%r10,%rax), %ebx
cmpl %ebx, %esi
jne 0x61354
incq %rax
cmpq %rax, %r11
jne 0x6133a
movl %ecx, %eax
jmp 0x61357
movl %r10d, %esi
jmp 0x6136b
addl %r8d, %eax
movl %eax, %r10d
subl %r8d, %r10d
movb %r10b, 0x1(%rdi,%r9)
incq %r9
movl %eax, %r8d
movl %r9d, %eax
incl %eax
cmpl %ecx, %r8d
jl 0x61307
jmp 0x61379
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x788, %rsp            # imm = 0x788
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/pack.c
// Function: hts_unpack_meta
uint8_t hts_unpack_meta(uint8_t *data, uint32_t data_len,
                        uint64_t udata_len, uint8_t *map, int *nsym) {
    if (data_len == 0)
        return 0;

    // Number of symbols used
    unsigned int n = data[0];
    if (n == 0)
        n = 256;

    // Symbols per byte
    if (n <= 1)
        *nsym = 0;
    else if (n <= 2)
        *nsym = 8;
    else if (n <= 4)
        *nsym = 4;
    else if (n <= 16)
        *nsym = 2;
    else {
        *nsym = 1; // no packing
        return 1;
    }

    if (data_len <= 1)
        return 0;

    int j = 1, c = 0;
    do {
        map[c++] = data[j++];
    } while (c < n && j < data_len);

    return c < n ? 0 : j;
}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
je 0x618dd
movzbl (%rdi), %r9d
testl %r9d, %r9d
movl $0x100, %edx            # imm = 0x100
cmovnel %r9d, %edx
cmpl $0x2, %edx
jb 0x618d3
movl $0x8, %eax
je 0x618d3
movl $0x4, %eax
cmpl $0x5, %edx
jb 0x618d3
movl $0x2, %eax
cmpl $0x11, %edx
jae 0x61909
movl %eax, (%r8)
cmpl $0x1, %esi
jne 0x618de
xorl %eax, %eax
retq
movl %esi, %eax
movl %edx, %edx
movl $0x1, %esi
movq %rsi, %r8
incq %rsi
movb (%rdi,%r8), %r9b
movb %r9b, -0x1(%rcx,%r8)
cmpq %rdx, %r8
jae 0x61900
cmpq %rax, %rsi
jb 0x618e7
xorl %eax, %eax
cmpq %rdx, %r8
cmovael %esi, %eax
retq
movl $0x1, (%r8)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/pack.c
// Function: hts_unpack_
uint8_t *hts_unpack_(uint8_t *data, int64_t len, uint8_t *out, uint64_t out_len, int nsym, uint8_t *p) {
    //uint8_t *out;
    uint8_t c = 0;
    int64_t i, j = 0, olen;

    if (nsym == 1) {
        // raw data; FIXME: shortcut the need for malloc & memcpy here
        memcpy(out, data, len);
        return out;
    }

    switch(nsym) {
    case 2: {
        uint16_t map[256], x, y;
        for (x = 0; x < 16; x++)
            for (y = 0; y < 16; y++)
                map[x*16+y] = p[x]*256+p[y];

        if ((out_len+1)/2 > len)
            return NULL;
        olen = out_len & ~1;

        uint16_t *o16 = (uint16_t *)out;
        for (i = 0; i+4 < olen/2; i+=4) {
            int k;
            for (k = 0; k < 4; k++)
                o16[i+k] = map[data[i+k]];
        }
        j = i; i *= 2;

        for (; i < olen; i+=2) {
            uint16_t w1 = map[data[j++]];
            *(uint16_t *)&out[i] = w1;
        }

        if (out_len != olen) {
            c = data[j++];
            out[i+0] = p[c&15];
        }
        break;
    }

    default:
        return NULL;
    }

    return out;
}

// Assembly:
movq %rsi, %rax
movq %rdi, %rsi
cmpl $0x2, %r8d
je 0x61d19
cmpl $0x1, %r8d
jne 0x61d8a
movq %rdx, %rdi
movq %rax, %rdx
jmp 0x43c0
pushq %rbp
pushq %r14
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
leaq -0x80(%rsp), %rdi
xorl %r8d, %r8d
pxor %xmm0, %xmm0
movzbl (%r9,%r8), %r10d
movd %r10d, %xmm1
pshuflw $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0,4,5,6,7]
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
psllw $0x8, %xmm1
xorl %r10d, %r10d
movq (%r9,%r10), %xmm2
punpcklbw %xmm0, %xmm2    # xmm2 = xmm2[0],xmm0[0],xmm2[1],xmm0[1],xmm2[2],xmm0[2],xmm2[3],xmm0[3],xmm2[4],xmm0[4],xmm2[5],xmm0[5],xmm2[6],xmm0[6],xmm2[7],xmm0[7]
por %xmm1, %xmm2
movdqa %xmm2, (%rdi,%r10,2)
addq $0x8, %r10
cmpq $0x10, %r10
jne 0x61d4c
incq %r8
addq $0x20, %rdi
cmpq $0x10, %r8
jne 0x61d30
leaq 0x1(%rcx), %rdi
shrq %rdi
cmpq %rax, %rdi
jbe 0x61d91
xorl %edx, %edx
jmp 0x61e18
xorl %edx, %edx
jmp 0x61e23
movq %rcx, %rax
andq $-0x2, %rax
movq %rcx, %r8
sarq %r8
cmpq $0x5, %r8
jl 0x61de0
movl $0x4, %ebx
movq %rdx, %r10
movq %rsi, %r11
movq %rbx, %rdi
xorl %ebx, %ebx
movzbl (%r11,%rbx), %r14d
movzwl -0x80(%rsp,%r14,2), %ebp
movw %bp, (%r10,%rbx,2)
incq %rbx
cmpq $0x4, %rbx
jne 0x61db4
leaq 0x4(%rdi), %rbx
addq $0x4, %r11
addq $0x8, %r10
cmpq %r8, %rbx
jl 0x61daf
jmp 0x61de2
xorl %edi, %edi
leaq (%rdi,%rdi), %r8
cmpq %rax, %r8
jge 0x61e04
movzbl (%rsi,%rdi), %r10d
incq %rdi
movzwl -0x80(%rsp,%r10,2), %r10d
movw %r10w, (%rdx,%r8)
addq $0x2, %r8
jmp 0x61de6
cmpq %rcx, %rax
je 0x61e18
movzbl (%rsi,%rdi), %eax
andl $0xf, %eax
movb (%r9,%rax), %al
movb %al, (%rdx,%r8)
addq $0x180, %rsp            # imm = 0x180
popq %rbx
popq %r14
popq %rbp
movq %rdx, %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/rANS_static4x16pr.c
// Function: rans_compress_bound_4x16
unsigned int rans_compress_bound_4x16(unsigned int size, int order) {
    int N = (order>>8) & 0xff;
    if (!N) N=4;

    order &= 0xff;
    unsigned int sz = (order == 0
        ? 1.05*size + 257*3 + 4
        : 1.05*size + 257*257*3 + 4 + 257*3+4) +
        ((order & RANS_ORDER_PACK) ? 1 : 0) +
        ((order & RANS_ORDER_RLE) ? 1 + 257*3+4: 0) + 20 +
        ((order & RANS_ORDER_X32) ? (32-4)*4 : 0) +
        ((order & RANS_ORDER_STRIPE) ? 7 + 5*N: 0);
    return sz + (sz&1) + 2; // make this even so buffers are word aligned
}

// Assembly:
movl %esi, %eax
movl %edi, %ecx
cvtsi2sd %rcx, %xmm0
mulsd 0x38f6f(%rip), %xmm0    # 0x9ada8
testb %al, %al
je 0x61e4d
addsd 0x39bc3(%rip), %xmm0    # 0x9ba08
addsd 0x39bc3(%rip), %xmm0    # 0x9ba10
addsd 0x39bc3(%rip), %xmm0    # 0x9ba18
addsd 0x39bb3(%rip), %xmm0    # 0x9ba10
movzbl %ah, %ecx
movl %eax, %edx
shrl $0x7, %edx
andl $0x1, %edx
movl %eax, %esi
shll $0x19, %esi
sarl $0x1f, %esi
andl $0x308, %esi            # imm = 0x308
movl %eax, %edi
shll $0x1d, %edi
sarl $0x1f, %edi
andl $0x70, %edi
shll $0x1c, %eax
sarl $0x1f, %eax
testl %ecx, %ecx
cvtsi2sd %edx, %xmm1
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
addsd %xmm1, %xmm0
addsd 0x39f14(%rip), %xmm0    # 0x9bdb8
xorps %xmm1, %xmm1
cvtsi2sd %edi, %xmm1
leal 0x7(%rcx,%rcx,4), %ecx
movl $0x1b, %edx
cmovnel %ecx, %edx
andl %eax, %edx
cvtsi2sd %edx, %xmm2
addsd %xmm0, %xmm1
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
movl %eax, %ecx
andl $0x1, %ecx
addl %ecx, %eax
addl $0x2, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/rANS_static4x16pr.c
// Function: rans_dec_func
static inline
unsigned char *(*rans_dec_func(int do_simd, int order))
    (unsigned char *in,
     unsigned int in_size,
     unsigned char *out,
     unsigned int out_size) {

    if (!do_simd) { // SIMD disabled
        return order & 1
            ? rans_uncompress_O1_4x16
            : rans_uncompress_O0_4x16;
    }

#ifdef NO_THREADS
    htscodecs_tls_cpu_init();
#else
    int err = pthread_once(&rans_cpu_once, htscodecs_tls_cpu_init);
    if (err != 0) {
        fprintf(stderr, "Initialising TLS data failed: pthread_once: %s\n",
                strerror(err));
        fprintf(stderr, "Using scalar code only\n");
    }
#endif

    int have_d_sse4_1  = have_sse4_1;
    int have_d_avx2    = have_avx2;
    int have_d_avx512f = have_avx512f;

    if (!(rans_cpu & RANS_CPU_DEC_AVX512)) have_d_avx512f = 0;
    if (!(rans_cpu & RANS_CPU_DEC_AVX2))   have_d_avx2    = 0;
    if (!(rans_cpu & RANS_CPU_DEC_SSE4))   have_d_sse4_1  = 0;

    if (order & 1) {
#if defined(HAVE_AVX512)
        if (have_d_avx512f)
            return rans_uncompress_O1_32x16_avx512;
#endif
#if defined(HAVE_AVX2)
        if (have_d_avx2)
            return rans_uncompress_O1_32x16_avx2;
#endif
#if defined(HAVE_SSE4_1) && defined(HAVE_SSSE3) && defined(HAVE_POPCNT)
        if (have_d_sse4_1)
            return rans_uncompress_O1_32x16_sse4;
#endif
        return rans_uncompress_O1_32x16;
    } else {
#if defined(HAVE_AVX512)
        if (have_d_avx512f)
            return rans_uncompress_O0_32x16_avx512;
#endif
#if defined(HAVE_AVX2)
        if (have_d_avx2)
            return rans_uncompress_O0_32x16_avx2;
#endif
#if defined(HAVE_SSE4_1) && defined(HAVE_SSSE3) && defined(HAVE_POPCNT)
        if (have_d_sse4_1)
            return rans_uncompress_O0_32x16_sse4;
#endif
        return rans_uncompress_O0_32x16;
    }
}

// Assembly:
pushq %rbx
movl %esi, %ebx
testl %edi, %edi
je 0x651c9
leaq 0x51faa(%rip), %rdi     # 0xb7114
leaq -0x1eca(%rip), %rsi     # 0x632a7
callq 0x4470
testl %eax, %eax
jne 0x6521d
movl 0x5160c(%rip), %eax     # 0xb6790
btl $0xa, %eax
setae %sil
movl %eax, %ecx
shll $0x16, %ecx
sarl $0x1f, %ecx
andl 0x51f72(%rip), %ecx     # 0xb710c
shll $0x17, %eax
sarl $0x1f, %eax
andl 0x51f62(%rip), %eax     # 0xb7108
cmpl $0x0, 0x51f63(%rip)     # 0xb7110
sete %dl
orb %sil, %dl
testb $0x1, %bl
jne 0x651e0
testb %dl, %dl
je 0x651f1
testl %ecx, %ecx
je 0x65203
leaq 0x3157(%rip), %rax      # 0x6831e
jmp 0x65201
testb $0x1, %bl
leaq -0x27da(%rip), %rcx     # 0x629f9
leaq 0x1079(%rip), %rax      # 0x66253
cmoveq %rcx, %rax
jmp 0x65201
testb %dl, %dl
je 0x651fa
testl %ecx, %ecx
je 0x65210
leaq 0x4eda(%rip), %rax      # 0x6a0c9
jmp 0x65201
leaq 0x80e0(%rip), %rax      # 0x6d2d8
jmp 0x65201
leaq 0xb1df(%rip), %rax      # 0x703e0
popq %rbx
retq
testl %eax, %eax
jne 0x65229
leaq 0x10aea(%rip), %rax     # 0x75cf8
jmp 0x65201
testl %eax, %eax
jne 0x65232
leaq 0x121e8(%rip), %rax     # 0x77403
jmp 0x65201
movl %eax, %edi
callq 0x4a85
jmp 0x6517e
leaq 0xc878(%rip), %rax      # 0x71aa8
jmp 0x65201
leaq 0xd427(%rip), %rax      # 0x72660
jmp 0x65201
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: create_context
static name_context *create_context(int max_names) {
    if (max_names <= 0)
        return NULL;

#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
    if (max_names > 100000)
        return NULL;
#endif

    // An arbitrary limit to prevent malformed data from consuming excessive
    // amounts of memory.  Consider upping this if we have genuine use cases
    // for larger blocks.
    if (max_names > 1e7) {
        fprintf(stderr, "Name codec currently has a max of 10 million rec.\n");
        return NULL;
    }

    name_context *ctx = htscodecs_tls_alloc(sizeof(*ctx) +
                                            ++max_names*sizeof(*ctx->lc));
    if (!ctx) return NULL;
    ctx->max_names = max_names;

    ctx->counter = 0;
    ctx->t_head = NULL;

    ctx->lc = (last_context *)(((char *)ctx) + sizeof(*ctx));
    ctx->pool = NULL;

     memset(&ctx->desc[0], 0, 2*16 * sizeof(ctx->desc[0]));
     memset(&ctx->token_dcount[0], 0, sizeof(int));
     memset(&ctx->token_icount[0], 0, sizeof(int));
     memset(&ctx->lc[0], 0, max_names*sizeof(ctx->lc[0]));
     ctx->max_tok = 1;

     ctx->lc[0].last_ntok = 0;

    return ctx;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testl %edi, %edi
jle 0x7caab
movl %edi, %r12d
cmpl $0x989681, %edi         # imm = 0x989681
jae 0x7caa6
leal 0x8(,%r12,8), %eax
leal (%rax,%rax,2), %r14d
leaq 0x14428(%r14), %rdi
callq 0x7e144
xorl %ebx, %ebx
testq %rax, %rax
je 0x7caad
movq %rax, %r15
incl %r12d
movl %r12d, 0x14424(%rax)
movl %ebx, 0x8(%rax)
movq $0x0, 0x10(%rax)
leaq 0x14428(%rax), %r12
movq %r12, (%rax)
movq %rax, %rdi
addq $0x18, %rdi
movl %ebx, 0x14020(%rax)
movl %ebx, 0x14220(%rax)
movl $0x508, %edx            # imm = 0x508
xorl %esi, %esi
callq 0x4260
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x4260
movl $0x1, 0x14420(%r15)
movl %ebx, 0x14430(%r15)
movq %r15, %rbx
jmp 0x7caad
callq 0x4ac8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: free_context
static void free_context(name_context *ctx) {
    if (!ctx)
        return;

    if (ctx->t_head)
        free(ctx->t_head);
    if (ctx->pool)
        pool_destroy(ctx->pool);

    int i;
    for (i = 0; i < ctx->max_tok*16; i++)
        free(ctx->desc[i].buf);

    for (i = 0; i < ctx->max_names; i++)
        free(ctx->lc[i].last);

    htscodecs_tls_free(ctx);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x7cad5
callq 0x45c0
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x7cb16
cmpq $0x0, 0x8(%r14)
je 0x7cb05
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%r14), %rax
movq (%rax,%r15), %rdi
callq 0x45c0
incq %r12
addq $0x10, %r15
cmpq 0x8(%r14), %r12
jb 0x7caeb
movq 0x10(%r14), %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
cmpl $0x0, 0x14420(%rbx)
jle 0x7cb45
leaq 0x20(%rbx), %r14
xorl %r15d, %r15d
movq (%r14), %rdi
callq 0x45c0
incq %r15
movslq 0x14420(%rbx), %rax
shlq $0x4, %rax
addq $0x28, %r14
cmpq %rax, %r15
jl 0x7cb26
cmpl $0x0, 0x14424(%rbx)
jle 0x7cb76
movl $0x10, %r14d
xorl %r15d, %r15d
movq (%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x45c0
incq %r15
movslq 0x14424(%rbx), %rax
addq $0x18, %r14
cmpq %rax, %r15
jl 0x7cb57
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x7e26a
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: encode_token_char
static int encode_token_char(name_context *ctx, int ntok, char c) {
    int id = (ntok<<4) | N_CHAR;

    if (encode_token_type(ctx, ntok, N_CHAR) < 0) return -1;
    if (descriptor_grow(&ctx->desc[id], 1) < 0)    return -1;
    ctx->desc[id].buf[ctx->desc[id].buf_l++] = c;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r14
shll $0x4, %r15d
movslq %r15d, %rax
leaq (%rax,%rax,4), %rax
leaq (%rdi,%rax,8), %r12
addq $0x20, %r12
movq %r12, %rdi
movl $0x1, %esi
callq 0x7dce8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7dab3
addq $0x20, %r14
movq (%r12), %rax
movq 0x10(%r12), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r12)
movb $0x2, (%rax,%rcx)
orl $0x2, %r15d
movslq %r15d, %rax
leaq (%rax,%rax,4), %rax
leaq (%r14,%rax,8), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x7dce8
testl %eax, %eax
js 0x7dab3
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r14)
movb %bl, (%rax,%rcx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: encode_token_match
static int encode_token_type(name_context *ctx, int ntok,
                             enum name_type type) {
    int id = ntok<<4;

    if (descriptor_grow(&ctx->desc[id], 1) < 0) return -1;

    ctx->desc[id].buf[ctx->desc[id].buf_l++] = type;

    return 0;
}

// Assembly:
pushq %rbx
shll $0x4, %esi
movslq %esi, %rax
leaq (%rax,%rax,4), %rax
leaq (%rdi,%rax,8), %rbx
addq $0x20, %rbx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x7dce8
testl %eax, %eax
js 0x7daf9
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rbx)
movb $0xa, (%rax,%rcx)
xorl %eax, %eax
jmp 0x7dafe
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: encode_token_alpha
static int encode_token_alpha(name_context *ctx, int ntok,
                              char *str, int len) {
    int id = (ntok<<4) | N_ALPHA;

    if (encode_token_type(ctx, ntok, N_ALPHA) < 0)  return -1;
    if (descriptor_grow(&ctx->desc[id], len+1) < 0) return -1;
    memcpy(&ctx->desc[id].buf[ctx->desc[id].buf_l], str, len);
    ctx->desc[id].buf[ctx->desc[id].buf_l+len] = 0;
    ctx->desc[id].buf_l += len+1;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdx, %rbx
movl %esi, %r12d
movq %rdi, %r15
shll $0x4, %r12d
movslq %r12d, %rax
leaq (%rax,%rax,4), %rax
leaq (%rdi,%rax,8), %r13
addq $0x20, %r13
movq %r13, %rdi
movl $0x1, %esi
callq 0x7dce8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7dba4
addq $0x20, %r15
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r13)
movb $0x1, (%rax,%rcx)
orl $0x1, %r12d
movslq %r12d, %rax
leaq (%rax,%rax,4), %rax
leaq (%r15,%rax,8), %r15
leal 0x1(%r14), %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x7dce8
testl %eax, %eax
js 0x7dba4
movq (%r15), %rdi
addq 0x10(%r15), %rdi
movslq %r14d, %r14
movq %rbx, %rsi
movq %r14, %rdx
callq 0x43c0
movq (%r15), %rax
addq 0x10(%r15), %rax
movb $0x0, (%r14,%rax)
movslq %r12d, %rax
addq %rax, 0x10(%r15)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: encode_token_int1
static int encode_token_int1(name_context *ctx, int ntok,
                             enum name_type type, uint32_t val) {
    int id = (ntok<<4) | type;

    if (encode_token_type(ctx, ntok, type) < 0) return -1;
    if (descriptor_grow(&ctx->desc[id], 1) < 0) return -1;

    ctx->desc[id].buf[ctx->desc[id].buf_l++] = val;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %r12d
movl %esi, %r15d
movq %rdi, %r14
shll $0x4, %r15d
movslq %r15d, %rax
leaq (%rax,%rax,4), %rax
leaq (%rdi,%rax,8), %r13
addq $0x20, %r13
movq %r13, %rdi
movl $0x1, %esi
callq 0x7dce8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7dc3f
addq $0x20, %r14
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r13)
movb %r12b, (%rax,%rcx)
orl %r12d, %r15d
movslq %r15d, %rax
leaq (%rax,%rax,4), %rax
leaq (%r14,%rax,8), %r14
movq %r14, %rdi
movl $0x1, %esi
callq 0x7dce8
testl %eax, %eax
js 0x7dc3f
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r14)
movb %bl, (%rax,%rcx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: encode_token_int
static int encode_token_int(name_context *ctx, int ntok,
                            enum name_type type, uint32_t val) {
    int id = (ntok<<4) | type;

    if (encode_token_type(ctx, ntok, type) < 0) return -1;
    if (descriptor_grow(&ctx->desc[id], 4) < 0) return -1;

    uint8_t *cp = &ctx->desc[id].buf[ctx->desc[id].buf_l];
    cp[0] = (val >>  0) & 0xff;
    cp[1] = (val >>  8) & 0xff;
    cp[2] = (val >> 16) & 0xff;
    cp[3] = (val >> 24) & 0xff;
    ctx->desc[id].buf_l += 4;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %r12d
movl %esi, %r15d
movq %rdi, %r14
shll $0x4, %r15d
movslq %r15d, %rax
leaq (%rax,%rax,4), %rax
leaq (%rdi,%rax,8), %r13
addq $0x20, %r13
movq %r13, %rdi
movl $0x1, %esi
callq 0x7dce8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7dcd7
addq $0x20, %r14
movq (%r13), %rax
movq 0x10(%r13), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r13)
movb %r12b, (%rax,%rcx)
orl %r12d, %r15d
movslq %r15d, %rax
leaq (%rax,%rax,4), %rax
leaq (%r14,%rax,8), %r14
movq %r14, %rdi
movl $0x4, %esi
callq 0x7dce8
testl %eax, %eax
js 0x7dcd7
movq (%r14), %rax
movq 0x10(%r14), %rcx
movl %ebx, (%rax,%rcx)
addq $0x4, 0x10(%r14)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: descriptor_grow
static int descriptor_grow(descriptor *fd, uint32_t sz) {
    while (fd->buf_l + sz > fd->buf_a) {
        size_t buf_a = fd->buf_a ? fd->buf_a*2 : 65536;
        unsigned char *buf = realloc(fd->buf, buf_a);
        if (!buf)
            return -1;
        fd->buf = buf;
        fd->buf_a = buf_a;
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %r12d
movq 0x10(%rdi), %rax
addq %r12, %rax
movq 0x8(%rdi), %r15
xorl %ebx, %ebx
cmpq %r15, %rax
jbe 0x7dd47
movq %rdi, %r14
movq (%rdi), %rax
movl $0x10000, %r13d         # imm = 0x10000
testq %r15, %r15
leaq (%r15,%r15), %r15
cmoveq %r13, %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x7dd42
movq %rax, (%r14)
movq %r15, 0x8(%r14)
movq 0x10(%r14), %rcx
addq %r12, %rcx
cmpq %r15, %rcx
ja 0x7dd12
jmp 0x7dd47
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: decode_token_alpha
static int decode_token_alpha(name_context *ctx, int ntok, char *str, int max_len) {
    int id = (ntok<<4) | N_ALPHA;
    char c;
    int len = 0;
    if (ctx->desc[id].buf_l  >= ctx->desc[id].buf_a)
        return -1;
    do {
        c = ctx->desc[id].buf[ctx->desc[id].buf_l++];
        str[len++] = c;
    } while(c && len < max_len && ctx->desc[id].buf_l < ctx->desc[id].buf_a);

    return len-1;
}

// Assembly:
shll $0x4, %esi
incl %esi
movslq %esi, %rax
leaq (%rax,%rax,4), %rsi
movq 0x30(%rdi,%rsi,8), %r8
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq 0x28(%rdi,%rsi,8), %r8
jae 0x7ddab
leaq (%rdi,%rsi,8), %rsi
addq $0x20, %rsi
movslq %ecx, %rcx
xorl %edi, %edi
movq %rdi, %rax
movq (%rsi), %rdi
leaq 0x1(%r8), %r9
movq %r9, 0x10(%rsi)
movb (%rdi,%r8), %dil
movb %dil, (%rdx,%rax)
testb %dil, %dil
je 0x7ddab
leaq 0x1(%rax), %rdi
cmpq %rcx, %rdi
jge 0x7ddab
movq 0x10(%rsi), %r8
cmpq 0x8(%rsi), %r8
jb 0x7dd7d
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/utils.c
// Function: htscodecs_tls_alloc
void *htscodecs_tls_alloc(size_t size) {
    int i;

    int err = pthread_once(&rans_once, htscodecs_tls_init);
    if (err != 0) {
        fprintf(stderr, "Initialising TLS data failed: pthread_once: %s\n",
                strerror(err));
        return NULL;
    }

    // Initialise tls_pool on first usage
    tls_pool *tls = pthread_getspecific(rans_key);
    if (!tls) {
        if (!(tls = calloc(1, sizeof(*tls))))
            return NULL;
        pthread_setspecific(rans_key, tls);
    }

    // Query pool for size
    int avail = -1;
    for (i = 0; i < MAX_TLS_BUFS; i++) {
        if (!tls->used[i]) {
            if (size <= tls->sizes[i]) {
                tls->used[i] = 1;
#ifdef TLS_DEBUG
                fprintf(stderr, "Reuse %d: %ld/%ld = %p\n",
                        i, size, tls->sizes[i], tls->bufs[i]);
#endif
                return tls->bufs[i];
            } else if (avail == -1) {
                avail = i;
            }
        }
    }

    if (i == MAX_TLS_BUFS && avail == -1) {
        // Shouldn't happen given our very limited use of this function
        fprintf(stderr, "Error: out of rans_tls_alloc slots\n");
        return NULL;
    }

    if (tls->bufs[avail])
        free(tls->bufs[avail]);
    if (!(tls->bufs[avail] = calloc(1, size)))
        return NULL;
#ifdef TLS_DEBUG
    fprintf(stderr, "Alloc %d: %ld = %p\n", avail, size, tls->bufs[avail]);
#endif
    tls->sizes[avail] = size;
    tls->used[avail] = 1;

    return tls->bufs[avail];
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x38fc5(%rip), %rdi     # 0xb7118
leaq 0xd8(%rip), %rsi        # 0x7e232
callq 0x4470
testl %eax, %eax
jne 0x7e21c
movl 0x38faf(%rip), %edi     # 0xb711c
callq 0x47b0
movq %rax, %r14
testq %rax, %rax
jne 0x7e1a3
movl $0x1, %edi
movl $0xc8, %esi
callq 0x4300
testq %rax, %rax
je 0x7e22a
movq %rax, %r14
movl 0x38f81(%rip), %edi     # 0xb711c
movq %rax, %rsi
callq 0x40d0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpl $0x0, 0xa0(%r14,%rcx,4)
jne 0x7e1c2
cmpq %rbx, 0x50(%r14,%rcx,8)
jae 0x7e20a
cmpl $-0x1, %eax
cmovel %ecx, %eax
incq %rcx
cmpq $0xa, %rcx
jne 0x7e1aa
cmpl $-0x1, %eax
je 0x7e225
movslq %eax, %r15
movq (%r14,%r15,8), %rdi
testq %rdi, %rdi
je 0x7e1e1
callq 0x45c0
movl $0x1, %edi
movq %rbx, %rsi
callq 0x4300
movq %rax, (%r14,%r15,8)
testq %rax, %rax
je 0x7e22a
movq %rbx, 0x50(%r14,%r15,8)
movl $0x1, 0xa0(%r14,%r15,4)
jmp 0x7e22c
movl $0x1, 0xa0(%r14,%rcx,4)
movq (%r14,%rcx,8), %rax
jmp 0x7e22c
movl %eax, %edi
callq 0x4ae4
jmp 0x7e22a
callq 0x4b09
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/utils.c
// Function: htscodecs_tls_calloc
void *htscodecs_tls_calloc(size_t nmemb, size_t size) {
#ifdef TLS_DEBUG
    fprintf(stderr, "htscodecs_tls_calloc(%ld)\n", nmemb*size);
#endif
    void *ptr = htscodecs_tls_alloc(nmemb * size);
    if (ptr)
        memset(ptr, 0, nmemb * size);
    return ptr;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
imulq %rsi, %rbx
movq %rbx, %rdi
callq 0x7e144
testq %rax, %rax
je 0x7e268
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
popq %rbx
jmp 0x4260
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/utils.c
// Function: htscodecs_tls_free_all
static void htscodecs_tls_free_all(void *ptr) {
    tls_pool *tls = (tls_pool *)ptr;
    if (!tls)
        return;

    int i;
    for (i = 0; i < MAX_TLS_BUFS; i++) {
#ifdef TLS_DEBUG
        if (tls->bufs[i])
            fprintf(stderr, "Free %ld = %p\n", tls->sizes[i], tls->bufs[i]);
#endif
        if (tls->used[i]) {
            fprintf(stderr, "Closing thread while TLS data is in use\n");
        }
        free(tls->bufs[i]);
    }

    free(tls);
}

// Assembly:
testq %rdi, %rdi
je 0x7e2f7
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
cmpl $0x0, 0xa0(%rbx,%r14,4)
jne 0x7e2e1
movq (%rbx,%r14,8), %rdi
callq 0x45c0
incq %r14
cmpq $0xa, %r14
jne 0x7e2c2
jmp 0x7e2e8
callq 0x4b5d
jmp 0x7e2cd
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: vhopen_libcurl
static hFILE *vhopen_libcurl(const char *url, const char *modes, va_list args)
{
    hFILE *fp = NULL;
    http_headers headers = { .fail_on_error = 1 };

    if (parse_va_list(&headers, args) == 0) {
        fp = libcurl_open(url, modes, &headers);
    }

    if (!fp) {
        free_headers(&headers.fixed, 1);
    }
    return fp;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movq %rsp, %rdi
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movl $0x1, 0x58(%rdi)
movq %rdx, %rsi
callq 0x80fb8
testl %eax, %eax
je 0x7e541
movq %rsp, %rdi
movl $0x1, %esi
callq 0x7fb64
xorl %eax, %eax
jmp 0x7e554
movq %rsp, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7e7ac
testq %rax, %rax
je 0x7e530
addq $0x68, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: libcurl_exit
static void libcurl_exit(void)
{
    if (curl_share_cleanup(curl.share) == CURLSHE_OK)
        curl.share = NULL;

    free(curl.useragent.s);
    curl.useragent.l = curl.useragent.m = 0; curl.useragent.s = NULL;

    free(curl.auth_path);
    curl.auth_path = NULL;

    if (curl.auth_map) {
        khiter_t i;
        for (i = kh_begin(curl.auth_map); i != kh_end(curl.auth_map); ++i) {
            if (kh_exist(curl.auth_map, i)) {
                free_auth(kh_value(curl.auth_map, i));
                kh_key(curl.auth_map, i) = NULL;
                kh_value(curl.auth_map, i) = NULL;
            }
        }
        kh_destroy(auth_map, curl.auth_map);
        curl.auth_map = NULL;
    }

    curl_global_cleanup();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x38a88(%rip), %rdi     # 0xb7138
callq 0x4910
testl %eax, %eax
jne 0x7e6c4
movq $0x0, 0x38a74(%rip) # 0xb7138
movq 0x38a65(%rip), %rdi     # 0xb7130
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, 0x38a57(%rip)     # 0xb7130
xorps %xmm0, %xmm0
movups %xmm0, 0x38a3d(%rip)    # 0xb7120
movq 0x38a56(%rip), %rdi     # 0xb7140
callq 0x45c0
movq %rbx, 0x38a4a(%rip)     # 0xb7140
movq 0x38a4b(%rip), %rbx     # 0xb7148
testq %rbx, %rbx
je 0x7e79d
movl (%rbx), %eax
testl %eax, %eax
je 0x7e76f
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x10(%rbx), %rcx
movl %r15d, %edx
shrl $0x4, %edx
movl (%rcx,%rdx,4), %edx
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %edx
testb $0x3, %dl
jne 0x7e764
movq 0x20(%rbx), %rax
movl %r15d, %ebx
movq (%rax,%rbx,8), %rdi
callq 0x7fecd
movq 0x38a04(%rip), %rax     # 0xb7148
movq 0x18(%rax), %rax
movq %r14, (%rax,%rbx,8)
movq 0x389f5(%rip), %rax     # 0xb7148
movq 0x20(%rax), %rax
movq %r14, (%rax,%rbx,8)
movq 0x389e6(%rip), %rbx     # 0xb7148
movl (%rbx), %eax
incl %r15d
addl $0x2, %ebp
cmpl %eax, %r15d
jne 0x7e714
movq 0x18(%rbx), %rdi
callq 0x45c0
movq 0x10(%rbx), %rdi
callq 0x45c0
movq 0x20(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
callq 0x45c0
movq $0x0, 0x389ab(%rip) # 0xb7148
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x41a0
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: recv_callback
static size_t recv_callback(char *ptr, size_t size, size_t nmemb, void *fpv)
{
    hFILE_libcurl *fp = (hFILE_libcurl *) fpv;
    size_t n = size * nmemb;

    if (n > fp->buffer.len) {
        fp->paused = 1;
        return CURL_WRITEFUNC_PAUSE;
    }
    else if (n == 0) return 0;

    memcpy(fp->buffer.ptr.rd, ptr, n);
    fp->buffer.ptr.rd += n;
    fp->buffer.len -= n;
    return n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rsi, %rbx
imulq %rdx, %rbx
cmpq 0x58(%rcx), %rbx
jbe 0x7f23d
orb $0x1, 0x64(%r14)
movl $0x10000001, %ebx       # imm = 0x10000001
jmp 0x7f25d
testq %rbx, %rbx
je 0x7f25b
movq %rdi, %rsi
movq 0x50(%r14), %rdi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x50(%r14)
subq %rbx, 0x58(%r14)
jmp 0x7f25d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: send_callback
static size_t send_callback(char *ptr, size_t size, size_t nmemb, void *fpv)
{
    hFILE_libcurl *fp = (hFILE_libcurl *) fpv;
    size_t n = size * nmemb;

    if (fp->buffer.len == 0) {
        // Send buffer is empty; normally pause, or signal EOF if we're closing
        if (fp->closing) return 0;
        else { fp->paused = 1; return CURL_READFUNC_PAUSE; }
    }

    if (n > fp->buffer.len) n = fp->buffer.len;
    memcpy(ptr, fp->buffer.ptr.wr, n);
    fp->buffer.ptr.wr += n;
    fp->buffer.len -= n;
    return n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movq 0x58(%rcx), %rax
testq %rax, %rax
je 0x7f29c
movq %rdx, %rbx
imulq %rsi, %rbx
cmpq %rax, %rbx
cmovaeq %rax, %rbx
movq 0x50(%r14), %rsi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x50(%r14)
subq %rbx, 0x58(%r14)
jmp 0x7f2b3
movb 0x64(%r14), %al
testb $0x2, %al
jne 0x7f2b1
orb $0x1, %al
movb %al, 0x64(%r14)
movl $0x10000001, %ebx       # imm = 0x10000001
jmp 0x7f2b3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: append_header
static int append_header(hdrlist *hdrs, const char *data, int dup) {
    if (hdrs->num == hdrs->size) {
        unsigned int new_sz = hdrs->size ? hdrs->size * 2 : 4, i;
        struct curl_slist *new_list = realloc(hdrs->list,
                                              new_sz * sizeof(*new_list));
        if (!new_list) return -1;
        hdrs->size = new_sz;
        hdrs->list = new_list;
        for (i = 1; i < hdrs->num; i++) hdrs->list[i-1].next = &hdrs->list[i];
    }
    // Annoyingly, libcurl doesn't declare the char * as const...
    hdrs->list[hdrs->num].data = dup ? strdup(data) : (char *) data;
    if (!hdrs->list[hdrs->num].data) return -1;
    if (hdrs->num > 0) hdrs->list[hdrs->num - 1].next = &hdrs->list[hdrs->num];
    hdrs->list[hdrs->num].next = NULL;
    hdrs->num++;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rdi), %r15d
cmpl 0xc(%rdi), %r15d
jne 0x7f3b2
leal (%r15,%r15), %eax
testl %r15d, %r15d
movl $0x4, %r15d
cmovnel %eax, %r15d
movq (%rbx), %rdi
movq %r15, %rsi
shlq $0x4, %rsi
callq 0x4840
testq %rax, %rax
je 0x7f3fe
movl %r15d, 0xc(%rbx)
movq %rax, (%rbx)
movl 0x8(%rbx), %r15d
cmpq $0x2, %r15
jb 0x7f3b2
movl %r15d, %ecx
andl $-0x2, %ecx
movq %r15, %rdx
addq $-0x2, %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
addq $0x10, %rax
xorl %edx, %edx
movdqa 0x15542(%rip), %xmm1    # 0x94880
movdqa 0x1554a(%rip), %xmm2    # 0x94890
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movq %rdx, %xmm4
pshufd $0x44, %xmm4, %xmm4     # xmm4 = xmm4[0,1,0,1]
por %xmm1, %xmm4
pxor %xmm2, %xmm4
movdqa %xmm4, %xmm5
pcmpgtd %xmm0, %xmm5
pcmpeqd %xmm0, %xmm4
pshufd $0xf5, %xmm4, %xmm6     # xmm6 = xmm4[1,1,3,3]
pand %xmm5, %xmm6
pshufd $0xf5, %xmm5, %xmm4     # xmm4 = xmm5[1,1,3,3]
por %xmm6, %xmm4
movd %xmm4, %esi
notl %esi
testb $0x1, %sil
je 0x7f38e
movq %rax, -0x8(%rax)
pxor %xmm3, %xmm4
pextrw $0x4, %xmm4, %esi
testb $0x1, %sil
je 0x7f3a5
leaq 0x10(%rax), %rsi
movq %rsi, 0x8(%rax)
addq $0x2, %rdx
addq $0x20, %rax
cmpq %rdx, %rcx
jne 0x7f34e
testl %ebp, %ebp
je 0x7f3c1
movq %r14, %rdi
callq 0x4930
movq %rax, %r14
movq (%rbx), %rax
movl %r15d, %ecx
shlq $0x4, %rcx
movq %r14, (%rax,%rcx)
testq %r14, %r14
je 0x7f3fe
testl %r15d, %r15d
je 0x7f3ea
leaq (%rax,%rcx), %rdx
leal -0x1(%r15), %esi
shlq $0x4, %rsi
movq %rdx, 0x8(%rax,%rsi)
movq $0x0, 0x8(%rax,%rcx)
incl %r15d
movl %r15d, 0x8(%rbx)
xorl %eax, %eax
jmp 0x7f403
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: add_callback_headers
static int add_callback_headers(hFILE_libcurl *fp) {
    char **hdrs = NULL, **hdr;

    if (!fp->headers.callback)
        return 0;

    // Get the headers from the callback
    if (fp->headers.callback(fp->headers.callback_data, &hdrs) != 0) {
        return -1;
    }

    if (!hdrs) // No change
        return 0;

    // Remove any old callback headers
    if (fp->headers.fixed.num > 0) {
        // Unlink lists
        fp->headers.fixed.list[fp->headers.fixed.num - 1].next = NULL;
    }
    free_headers(&fp->headers.extra, 0);

    if (fp->headers.auth_hdr_num > 0 || fp->headers.auth_hdr_num == -2)
        fp->headers.auth_hdr_num = 0; // Just removed it...

    // Convert to libcurl-suitable form
    for (hdr = hdrs; *hdr; hdr++) {
        if (append_header(&fp->headers.extra, *hdr, 0) < 0) {
            goto cleanup;
        }
        if (is_authorization(*hdr) && !fp->headers.auth_hdr_num)
            fp->headers.auth_hdr_num = -2;
    }
    for (hdr = hdrs; *hdr; hdr++) *hdr = NULL;

    if (fp->headers.fixed.num > 0 && fp->headers.extra.num > 0) {
        // Relink lists
        fp->headers.fixed.list[fp->headers.fixed.num - 1].next
            = &fp->headers.extra.list[0];
    }
    return 0;

 cleanup:
    while (hdr && *hdr) {
        free(*hdr);
        *hdr = NULL;
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq $0x0, 0x8(%rsp)
movq 0x90(%rdi), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x7f44b
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
leaq 0x8(%rsp), %rsi
callq *%rax
testl %eax, %eax
je 0x7f45a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x8(%rsp)
je 0x7f44b
movl 0x78(%rbx), %eax
testl %eax, %eax
je 0x7f47c
movq 0x70(%rbx), %rcx
decl %eax
shlq $0x4, %rax
movq $0x0, 0x8(%rcx,%rax)
leaq 0x80(%rbx), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x7fb64
movl 0xa8(%rbx), %eax
testl %eax, %eax
setle %cl
cmpl $-0x2, %eax
setne %al
testb %al, %cl
jne 0x7f4ac
movl $0x0, 0xa8(%rbx)
movq 0x8(%rsp), %r12
movq (%r12), %rsi
testq %rsi, %rsi
je 0x7f52a
leaq 0x21e37(%rip), %r15     # 0xa12f8
movq %r14, %rdi
xorl %edx, %edx
callq 0x7f2be
movq (%r12), %rsi
testl %eax, %eax
js 0x7f55f
movl $0xe, %edx
movq %r15, %rdi
callq 0x4650
testl %eax, %eax
jne 0x7f4fb
cmpl $0x0, 0xa8(%rbx)
jne 0x7f4fb
movl $0xfffffffe, 0xa8(%rbx) # imm = 0xFFFFFFFE
movq 0x8(%r12), %rsi
addq $0x8, %r12
testq %rsi, %rsi
jne 0x7f4c1
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x7f52a
addq $0x8, %rax
movq $0x0, -0x8(%rax)
cmpq $0x0, (%rax)
leaq 0x8(%rax), %rax
jne 0x7f518
movl 0x78(%rbx), %eax
xorl %ebp, %ebp
testl %eax, %eax
je 0x7f44b
cmpl $0x0, 0x88(%rbx)
je 0x7f44b
movq 0x70(%rbx), %rcx
movq 0x80(%rbx), %rdx
decl %eax
shlq $0x4, %rax
movq %rdx, 0x8(%rcx,%rax)
jmp 0x7f44b
testq %rsi, %rsi
je 0x7f446
movq %rsi, %rdi
callq 0x45c0
movq $0x0, (%r12)
jmp 0x7f446
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: header_callback
static size_t header_callback(void *contents, size_t size, size_t nmemb,
                              void *userp)
{
    size_t realsize = size * nmemb;
    kstring_t *resp = (kstring_t *)userp;

    if (kputsn((const char *)contents, realsize, resp) == EOF) {
        return 0;
    }

    return realsize;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
imulq %rdx, %rbx
movq (%rcx), %rdi
leaq (%rbx,%rdi), %rax
addq $0x2, %rax
cmpq %rdi, %rax
jbe 0x7f5e0
movq %rcx, %r14
cmpq %rax, 0x8(%rcx)
jae 0x7f5ed
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r12d, %r12d
testq %rcx, %rcx
cmoveq %rdx, %r12
addq %rax, %r12
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x7f615
movq %rax, 0x10(%r14)
movq %r12, 0x8(%r14)
movq (%r14), %rdi
jmp 0x7f5f1
callq 0x4050
movl $0x4b, (%rax)
jmp 0x7f615
movq 0x10(%r14), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x43c0
movq (%r14), %rax
addq %rbx, %rax
movq %rax, (%r14)
movq 0x10(%r14), %rcx
movb $0x0, (%rcx,%rax)
cmpl $-0x1, %ebx
jne 0x7f617
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: free_headers
static void free_headers(hdrlist *hdrs, int completely) {
    unsigned int i;
    for (i = 0; i < hdrs->num; i++) {
        free(hdrs->list[i].data);
        hdrs->list[i].data = NULL;
        hdrs->list[i].next = NULL;
    }
    hdrs->num = 0;
    if (completely) {
        free(hdrs->list);
        hdrs->size = 0;
        hdrs->list = NULL;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
cmpl $0x0, 0x8(%rdi)
je 0x7fba2
movq (%rbx), %rax
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rax,%r14), %rdi
callq 0x45c0
movq (%rbx), %rax
incq %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%r14)
movl 0x8(%rbx), %ecx
addq $0x10, %r14
cmpq %rcx, %r15
jb 0x7fb7f
movl $0x0, 0x8(%rbx)
testl %ebp, %ebp
je 0x7fbc3
movq (%rbx), %rdi
callq 0x45c0
movl $0x0, 0xc(%rbx)
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: free_auth
static void free_auth(auth_token *tok) {
    if (!tok) return;
    if (pthread_mutex_destroy(&tok->lock)) abort();
    free(tok->path);
    free(tok->token);
    free(tok);
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x7fefd
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x4590
testl %eax, %eax
jne 0x7feff
movq (%rbx), %rdi
callq 0x45c0
movq 0x8(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
popq %rbx
retq
callq 0x4270
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hfile_libcurl.c
// Function: libcurl_write
static ssize_t libcurl_write(hFILE *fpv, const void *bufferv, size_t nbytes)
{
    hFILE_libcurl *fp = (hFILE_libcurl *) fpv;
    const char *buffer = (const char *) bufferv;
    CURLcode err;

    fp->buffer.ptr.wr = buffer;
    fp->buffer.len = nbytes;
    fp->paused = 0;
    err = curl_easy_pause(fp->easy, CURLPAUSE_CONT);
    if (err != CURLE_OK) { errno = easy_errno(fp->easy, err); return -1; }

    while (! fp->paused && ! fp->finished)
        if (wait_perform(fp) < 0) return -1;

    nbytes = fp->buffer.ptr.wr - buffer;
    fp->buffer.ptr.wr = NULL;
    fp->buffer.len = 0;

    if (fp->finished && fp->final_result != CURLE_OK) {
        errno = easy_errno(fp->easy, fp->final_result);
        return -1;
    }

    return nbytes;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, 0x50(%rdi)
movq %rdx, 0x58(%rdi)
andb $-0x2, 0x64(%rdi)
movq 0x38(%rdi), %rdi
xorl %esi, %esi
callq 0x4970
movl %eax, %esi
testl %eax, %eax
je 0x80ce7
movq 0x38(%rbx), %rdi
callq 0x7e55c
movl %eax, %ebx
callq 0x4050
movl %ebx, (%rax)
jmp 0x80cff
leaq 0x50(%rbx), %r15
movb 0x64(%rbx), %cl
testb $0x5, %cl
jne 0x80d0c
movq %rbx, %rdi
callq 0x7f676
testl %eax, %eax
jns 0x80ceb
movq $-0x1, %rax
popq %rbx
popq %r14
popq %r15
retq
movq (%r15), %rax
subq %r14, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
testb $0x4, %cl
je 0x80d06
movl 0x60(%rbx), %esi
testl %esi, %esi
jne 0x80cd3
jmp 0x80d06