LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/htscodecs/htscodecs/fqzcomp_qual.c
// Function: fqz_create_models
static int fqz_create_models(fqz_model *m, fqz_gparams *gp) {
    int i;

    if (!(m->qual = htscodecs_tls_alloc(sizeof(*m->qual) * CTX_SIZE)))
        return -1;

    for (i = 0; i < CTX_SIZE; i++)
        SIMPLE_MODEL(QMAX,_init)(&m->qual[i], gp->max_sym+1);

    for (i = 0; i < 4; i++)
        SIMPLE_MODEL(256,_init)(&m->len[i],256);

    SIMPLE_MODEL(2,_init)(&m->revcomp,2);
    SIMPLE_MODEL(2,_init)(&m->dup,2);
    if (gp->max_sel > 0)
        SIMPLE_MODEL(256,_init)(&m->sel, gp->max_sel+1);

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x4100000, %edi        # imm = 0x4100000
callq 0x8060c
movq %rax, (%rbx)
testq %rax, %rax
je 0x63bde
movl 0x410(%r14), %ecx
leal 0x1(%rcx), %edx
leaq 0xa(%rax), %rsi
xorl %edi, %edi
movl $0xffef, %r8d           # imm = 0xFFEF
movl $0x0, %r9d
testl %ecx, %ecx
js 0x63a36
xorl %r9d, %r9d
movw %r9w, (%rsi,%r9,4)
movw $0x1, -0x2(%rsi,%r9,4)
incq %r9
cmpq %r9, %rdx
jne 0x63a21
cmpl $0xff, %r9d
ja 0x63a5b
movl %r9d, %r9d
movw %r9w, (%rsi,%r9,4)
movw $0x0, -0x2(%rsi,%r9,4)
incq %r9
cmpq $0x100, %r9             # imm = 0x100
jne 0x63a42
imulq $0x410, %rdi, %r9       # imm = 0x410
addq %rax, %r9
movl %edx, (%r9)
movl %r8d, 0x4(%r9)
movl %r8d, 0x40c(%r9)
movw $0x0, 0x408(%r9)
incq %rdi
addq $0x410, %rsi            # imm = 0x410
cmpq $0x10000, %rdi          # imm = 0x10000
jne 0x63a14
leaq 0x8(%rbx), %rax
leaq 0x12(%rbx), %rcx
xorl %edx, %edx
movabsq $0xffef00000100, %rsi   # imm = 0xFFEF00000100
imulq $0x410, %rdx, %rdi      # imm = 0x410
addq %rax, %rdi
xorl %r8d, %r8d
movw %r8w, (%rcx,%r8,4)
movw $0x1, -0x2(%rcx,%r8,4)
incq %r8
cmpq $0x100, %r8             # imm = 0x100
jne 0x63ab1
movq %rsi, (%rdi)
movl $0xffef, 0x40c(%rdi)    # imm = 0xFFEF
movw $0x0, 0x408(%rdi)
incq %rdx
addq $0x410, %rcx            # imm = 0x410
cmpq $0x4, %rdx
jne 0x63aa4
xorl %eax, %eax
movw %ax, 0x1052(%rbx,%rax,4)
movw $0x1, 0x1050(%rbx,%rax,4)
incq %rax
cmpq $0x1, %rax
je 0x63af2
movabsq $0xffef00000002, %rax   # imm = 0xFFEF00000002
movq %rax, 0x1048(%rbx)
movl $0xffef, 0x105c(%rbx)   # imm = 0xFFEF
movw $0x0, 0x1058(%rbx)
xorl %ecx, %ecx
movw %cx, 0x147a(%rbx,%rcx,4)
movw $0x1, 0x1478(%rbx,%rcx,4)
incq %rcx
cmpq $0x1, %rcx
je 0x63b33
movq %rax, 0x1470(%rbx)
movl $0xffef, 0x1484(%rbx)   # imm = 0xFFEF
movw $0x0, 0x1480(%rbx)
movl 0xc(%r14), %eax
testl %eax, %eax
jle 0x63bda
incq %rax
xorl %ecx, %ecx
movw %cx, 0x106a(%rbx,%rcx,4)
movw $0x1, 0x1068(%rbx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x63b75
leaq -0x1(%rcx), %rdx
cmpq $0xfe, %rdx
ja 0x63bba
movw %cx, 0x106a(%rbx,%rcx,4)
movw $0x0, 0x1068(%rbx,%rcx,4)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x63b9c
movl %eax, 0x1060(%rbx)
movl $0xffef, %eax           # imm = 0xFFEF
movl %eax, 0x1064(%rbx)
movl %eax, 0x146c(%rbx)
movw $0x0, 0x1468(%rbx)
xorl %eax, %eax
jmp 0x63be3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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:
pushq %rbp
pushq %rbx
subq $0x788, %rsp            # imm = 0x788
testl %edx, %edx
setg %r10b
jle 0x63c6a
movl %edx, %ecx
xorl %r11d, %r11d
movl $0xff, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
movslq %r11d, %rbx
leal 0x1(%rbx), %r10d
cmpl %r10d, %edx
cmovgl %edx, %r10d
cmpl %r9d, (%rsi,%rbx,4)
jne 0x63c2a
incq %rbx
cmpq %rcx, %rbx
jl 0x63c1a
jmp 0x63c2d
movl %ebx, %r10d
movl %r10d, %ebx
subl %r11d, %ebx
cltq
movl %ebx, %r11d
cmpl %r8d, %ebx
movl $0xff, %ebp
cmovll %ebx, %ebp
movb %bpl, -0x80(%rsp,%rax)
incq %rax
subl %ebp, %r11d
cmpl $0xfe, %ebx
movl %r11d, %ebx
jg 0x63c38
incl %r9d
movl %r10d, %r11d
cmpl %edx, %r10d
setl %r10b
jl 0x63c0c
jmp 0x63c6c
xorl %eax, %eax
testb %r10b, %r10b
je 0x63c88
movslq %eax, %rcx
addq %rsp, %rcx
addq $-0x80, %rcx
movb $0x0, (%rcx)
incq %rcx
incl %eax
testb %r10b, %r10b
jne 0x63c7b
testl %eax, %eax
jle 0x63cec
movl %eax, %ecx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %eax, %eax
xorl %esi, %esi
movslq %esi, %r8
incl %esi
movzbl -0x80(%rsp,%r8), %r9d
movslq %eax, %r8
movb %r9b, (%rdi,%r8)
cmpl %r9d, %edx
jne 0x63ce1
movl %esi, %eax
cmpl %ecx, %esi
jge 0x63ccc
movslq %esi, %rax
movzbl -0x80(%rsp,%rax), %r9d
cmpl %r9d, %edx
jne 0x63ccc
incq %rax
cmpq %rax, %rcx
jne 0x63cb7
movl %ecx, %eax
movl %eax, %r9d
subl %esi, %r9d
movb %r9b, 0x1(%rdi,%r8)
incq %r8
movl %eax, %esi
movl %r8d, %eax
jmp 0x63ce4
movl %r9d, %edx
incl %eax
cmpl %ecx, %esi
jl 0x63c97
jmp 0x63cee
xorl %eax, %eax
addq $0x788, %rsp            # imm = 0x788
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x64278
movzbl (%rdi), %r9d
testl %r9d, %r9d
movl $0x100, %edx            # imm = 0x100
cmovnel %r9d, %edx
cmpl $0x2, %edx
jb 0x6426e
movl $0x8, %eax
je 0x6426e
movl $0x4, %eax
cmpl $0x5, %edx
jb 0x6426e
movl $0x2, %eax
cmpl $0x11, %edx
jae 0x642a4
movl %eax, (%r8)
cmpl $0x1, %esi
jne 0x64279
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 0x6429b
cmpq %rax, %rsi
jb 0x64282
xorl %eax, %eax
cmpq %rdx, %r8
cmovael %esi, %eax
retq
movl $0x1, (%r8)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x646a3
cmpl $0x1, %r8d
jne 0x646f8
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
movzbl (%r9,%r8), %r10d
shll $0x8, %r10d
xorl %r11d, %r11d
movzbl (%r9,%r11), %ebx
orl %r10d, %ebx
movw %bx, (%rdi,%r11,2)
incq %r11
cmpq $0x10, %r11
jne 0x646c2
incq %r8
addq $0x20, %rdi
cmpq $0x10, %r8
jne 0x646b6
leaq 0x1(%rcx), %rdi
shrq %rdi
cmpq %rax, %rdi
jbe 0x646ff
xorl %edx, %edx
jmp 0x64786
xorl %edx, %edx
jmp 0x64791
movq %rcx, %rax
andq $-0x2, %rax
movq %rcx, %r8
sarq %r8
cmpq $0x5, %r8
jl 0x6474e
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 0x64722
leaq 0x4(%rdi), %rbx
addq $0x4, %r11
addq $0x8, %r10
cmpq %r8, %rbx
jl 0x6471d
jmp 0x64750
xorl %edi, %edi
leaq (%rdi,%rdi), %r8
cmpq %rax, %r8
jge 0x64772
movzbl (%rsi,%rdi), %r10d
incq %rdi
movzwl -0x80(%rsp,%r10,2), %r10d
movw %r10w, (%rdx,%r8)
addq $0x2, %r8
jmp 0x64754
cmpq %rcx, %rax
je 0x64786
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
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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 0x39407(%rip), %xmm0    # 0x9dbb0
testb %al, %al
je 0x647bd
addsd 0x3a05b(%rip), %xmm0    # 0x9e810
addsd 0x393bb(%rip), %xmm0    # 0x9db78
addsd 0x3a053(%rip), %xmm0    # 0x9e818
addsd 0x393ab(%rip), %xmm0    # 0x9db78
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 0x3a34c(%rip), %xmm0    # 0x9eb60
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_O1/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 0x67c95
leaq 0x524de(%rip), %rdi     # 0xba114
leaq -0x20fd(%rip), %rsi     # 0x65b40
callq 0x4470
testl %eax, %eax
jne 0x67ce9
movl 0x51b40(%rip), %eax     # 0xb9790
btl $0xa, %eax
setae %sil
movl %eax, %ecx
shll $0x16, %ecx
sarl $0x1f, %ecx
andl 0x524a6(%rip), %ecx     # 0xba10c
shll $0x17, %eax
sarl $0x1f, %eax
andl 0x52496(%rip), %eax     # 0xba108
cmpl $0x0, 0x52497(%rip)     # 0xba110
sete %dl
orb %sil, %dl
testb $0x1, %bl
jne 0x67cac
testb %dl, %dl
je 0x67cbd
testl %ecx, %ecx
je 0x67ccf
leaq 0x32bf(%rip), %rax      # 0x6af52
jmp 0x67ccd
testb $0x1, %bl
leaq -0x291a(%rip), %rcx     # 0x65385
leaq 0x10db(%rip), %rax      # 0x68d81
cmoveq %rcx, %rax
jmp 0x67ccd
testb %dl, %dl
je 0x67cc6
testl %ecx, %ecx
je 0x67cdc
leaq 0x4f05(%rip), %rax      # 0x6cbc0
jmp 0x67ccd
leaq 0x803a(%rip), %rax      # 0x6fcfe
jmp 0x67ccd
leaq 0xa8a8(%rip), %rax      # 0x72575
popq %rbx
retq
testl %eax, %eax
jne 0x67cf5
leaq 0x10061(%rip), %rax     # 0x77d3b
jmp 0x67ccd
testl %eax, %eax
jne 0x67cfe
leaq 0x1174e(%rip), %rax     # 0x79435
jmp 0x67ccd
movl %eax, %edi
callq 0x4a9d
jmp 0x67c4a
leaq 0xbf04(%rip), %rax      # 0x73c00
jmp 0x67ccd
leaq 0xcab4(%rip), %rax      # 0x747b9
jmp 0x67ccd
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/htscodecs/htscodecs/rANS_static32x16pr_avx512.c
// Function: mm512_i32gather_epi32x
static inline __m512i _mm512_i32gather_epi32x(__m512i idx, void *v, int size) {
    uint32_t *b = (uint32_t *)v;

#ifndef __clang__
    volatile
#endif
    int c[16] __attribute__((aligned(32)));

    //_mm512_store_si512((__m512i *)c, idx); // equivalent, but slower
    _mm256_store_si256((__m256i *)(c),   _mm512_castsi512_si256(idx));
    _mm256_store_si256((__m256i *)(c+8), _mm512_extracti64x4_epi64(idx, 1));

    __m128i x0 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[0]]), b[c[1]], 1);
    __m128i x1 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[2]]), b[c[3]], 1);
    __m128i x2 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[4]]), b[c[5]], 1);
    __m128i x3 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[6]]), b[c[7]], 1);

    __m128i x01 = _mm_unpacklo_epi64(x0, x1);
    __m128i x23 = _mm_unpacklo_epi64(x2, x3);
    __m256i y0 =_mm256_castsi128_si256(x01);

    __m128i x4 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[ 8]]), b[c[ 9]], 1);
    __m128i x5 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[10]]), b[c[11]], 1);
    __m128i x6 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[12]]), b[c[13]], 1);
    __m128i x7 = _mm_insert_epi32(_mm_cvtsi32_si128(b[c[14]]), b[c[15]], 1);

    __m128i x45 = _mm_unpacklo_epi64(x4, x5);
    __m128i x67 = _mm_unpacklo_epi64(x6, x7);
    __m256i y1 =_mm256_castsi128_si256(x45);

    y0 = _mm256_inserti128_si256(y0, x23, 1);
    y1 = _mm256_inserti128_si256(y1, x67, 1);

    return _mm512_inserti64x4(_mm512_castsi256_si512(y0), y1, 1);
}

// Assembly:
vextracti128 $0x1, %ymm0, %xmm1
vextracti32x4 $0x2, %zmm0, %xmm3
vextracti32x4 $0x3, %zmm0, %xmm2
vmovd %xmm2, %eax
cltq
vpextrd $0x1, %xmm2, %ecx
movslq %ecx, %rcx
vmovd (%rdi,%rax,4), %xmm4
vpextrd $0x2, %xmm2, %eax
vpinsrd $0x1, (%rdi,%rcx,4), %xmm4, %xmm4
vmovd %xmm3, %ecx
cltq
vpinsrd $0x2, (%rdi,%rax,4), %xmm4, %xmm4
movslq %ecx, %rax
vpextrd $0x3, %xmm2, %ecx
movslq %ecx, %rcx
vpinsrd $0x3, (%rdi,%rcx,4), %xmm4, %xmm2
vpextrd $0x1, %xmm3, %ecx
movslq %ecx, %rcx
vmovd (%rdi,%rax,4), %xmm4
vpinsrd $0x1, (%rdi,%rcx,4), %xmm4, %xmm4
vmovd %xmm1, %eax
vpextrd $0x2, %xmm3, %ecx
movslq %ecx, %rcx
vpinsrd $0x2, (%rdi,%rcx,4), %xmm4, %xmm4
vpextrd $0x3, %xmm3, %ecx
cltq
movslq %ecx, %rcx
vpinsrd $0x3, (%rdi,%rcx,4), %xmm4, %xmm3
vpextrd $0x1, %xmm1, %ecx
movslq %ecx, %rcx
vmovd (%rdi,%rax,4), %xmm4
vpextrd $0x2, %xmm1, %eax
vpinsrd $0x1, (%rdi,%rcx,4), %xmm4, %xmm4
vmovd %xmm0, %ecx
cltq
vpinsrd $0x2, (%rdi,%rax,4), %xmm4, %xmm4
movslq %ecx, %rax
vpextrd $0x3, %xmm1, %ecx
movslq %ecx, %rcx
vpinsrd $0x3, (%rdi,%rcx,4), %xmm4, %xmm1
vpextrd $0x1, %xmm0, %ecx
vmovd (%rdi,%rax,4), %xmm4
movslq %ecx, %rax
vpinsrd $0x1, (%rdi,%rax,4), %xmm4, %xmm4
vpextrd $0x2, %xmm0, %eax
cltq
vpinsrd $0x2, (%rdi,%rax,4), %xmm4, %xmm4
vpextrd $0x3, %xmm0, %eax
cltq
vpinsrd $0x3, (%rdi,%rax,4), %xmm4, %xmm0
vinserti128 $0x1, %xmm2, %ymm3, %ymm2
vinserti128 $0x1, %xmm1, %ymm0, %ymm0
vinserti64x4 $0x1, %ymm2, %zmm0, %zmm0
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x7ecf9
movl %edi, %r12d
cmpl $0x989681, %edi         # imm = 0x989681
jae 0x7ecf4
leal 0x8(,%r12,8), %eax
leal (%rax,%rax,2), %r14d
leaq 0x14428(%r14), %rdi
callq 0x8060c
xorl %ebx, %ebx
testq %rax, %rax
je 0x7ecfb
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 0x7ecfb
callq 0x4ae0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x7ed23
callq 0x45c0
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x7ed64
cmpq $0x0, 0x8(%r14)
je 0x7ed53
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 0x7ed39
movq 0x10(%r14), %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
cmpl $0x0, 0x14420(%rbx)
jle 0x7ed93
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 0x7ed74
cmpl $0x0, 0x14424(%rbx)
jle 0x7edc4
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 0x7eda5
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x80732
// File: /workspace/github_c_makefile_star2_O1/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 0x801d2
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x7ff9d
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 0x801d2
testl %eax, %eax
js 0x7ff9d
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_O1/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 0x801d2
testl %eax, %eax
js 0x7ffe3
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%rbx)
movb $0xa, (%rax,%rcx)
xorl %eax, %eax
jmp 0x7ffe8
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x801d2
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x8008e
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 0x801d2
testl %eax, %eax
js 0x8008e
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_O1/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 0x801d2
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x80129
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 0x801d2
testl %eax, %eax
js 0x80129
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_O1/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 0x801d2
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x801c1
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 0x801d2
testl %eax, %eax
js 0x801c1
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_O1/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 0x8022e
movq %rdi, %r14
movl $0x10000, %r13d         # imm = 0x10000
testq %r15, %r15
leaq (%r15,%r15), %r15
cmoveq %r13, %r15
movq (%r14), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x80229
movq %rax, (%r14)
movq %r15, 0x8(%r14)
movq 0x10(%r14), %rax
addq %r12, %rax
cmpq %r15, %rax
ja 0x801f9
jmp 0x8022e
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_O1/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: decode_token_int
static int decode_token_int(name_context *ctx, int ntok,
                            enum name_type type, uint32_t *val) {
    int id = (ntok<<4) | type;

    if (ctx->desc[id].buf_l + 4 > ctx->desc[id].buf_a)
        return -1;

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

    return 0;
}

// Assembly:
shll $0x4, %esi
orl %edx, %esi
movslq %esi, %rax
leaq (%rax,%rax,4), %r8
movq 0x30(%rdi,%r8,8), %rsi
leaq 0x4(%rsi), %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq 0x28(%rdi,%r8,8), %rdx
ja 0x80271
leaq (%rdi,%r8,8), %rax
addq $0x20, %rax
movq (%rax), %rdi
movl (%rdi,%rsi), %esi
movl %esi, (%rcx)
movq %rdx, 0x10(%rax)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: append_uint32_fixed
static int append_uint32_fixed(char *cp, uint32_t i, uint8_t l) {
    switch (l) {
    case 9:*cp++ = i / 100000000 + '0', i %= 100000000; // fall-through
    case 8:*cp++ = i / 10000000  + '0', i %= 10000000;  // fall-through
    case 7:*cp++ = i / 1000000   + '0', i %= 1000000;   // fall-through
    case 6:*cp++ = i / 100000    + '0', i %= 100000;    // fall-through
    case 5:*cp++ = i / 10000     + '0', i %= 10000;     // fall-through
    case 4:*cp++ = i / 1000      + '0', i %= 1000;      // fall-through
    case 3:*cp++ = i / 100       + '0', i %= 100;       // fall-through
    case 2:*cp++ = i / 10        + '0', i %= 10;        // fall-through
    case 1:*cp++ = i             + '0';                 // fall-throuhg
    case 0:break;
    }
    return l;
}

// Assembly:
movl %edx, %eax
decl %eax
cmpl $0x8, %eax
ja 0x80381
leaq 0x22ed2(%rip), %rcx     # 0xa3158
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %esi, %eax
imulq $0x55e63b89, %rax, %rax # imm = 0x55E63B89
shrq $0x39, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rdi)
incq %rdi
imull $0x5f5e100, %eax, %eax  # imm = 0x5F5E100
subl %eax, %esi
movl %esi, %eax
imulq $0x6b5fca6b, %rax, %rax # imm = 0x6B5FCA6B
shrq $0x36, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rdi)
incq %rdi
imull $0x989680, %eax, %eax   # imm = 0x989680
subl %eax, %esi
movl %esi, %eax
imulq $0x431bde83, %rax, %rax # imm = 0x431BDE83
shrq $0x32, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rdi)
incq %rdi
imull $0xf4240, %eax, %eax    # imm = 0xF4240
subl %eax, %esi
movl %esi, %eax
shrl $0x5, %eax
imulq $0xa7c5ac5, %rax, %rax  # imm = 0xA7C5AC5
shrq $0x27, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rdi)
incq %rdi
imull $0x186a0, %eax, %eax    # imm = 0x186A0
subl %eax, %esi
movl %esi, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
imulq %rax, %rcx
shrq $0x2d, %rcx
leal 0x30(%rcx), %eax
movb %al, (%rdi)
incq %rdi
imull $0x2710, %ecx, %eax     # imm = 0x2710
subl %eax, %esi
movl %esi, %eax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
shrq $0x26, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rdi)
incq %rdi
imull $0x3e8, %eax, %eax      # imm = 0x3E8
subl %eax, %esi
movl %esi, %eax
imulq $0x51eb851f, %rax, %rax # imm = 0x51EB851F
shrq $0x25, %rax
leal 0x30(%rax), %ecx
movb %cl, (%rdi)
incq %rdi
imull $0x64, %eax, %eax
subl %eax, %esi
movl %esi, %eax
movl $0xcccccccd, %ecx       # imm = 0xCCCCCCCD
imulq %rax, %rcx
shrq $0x23, %rcx
leal 0x30(%rcx), %eax
movb %al, (%rdi)
incq %rdi
addl %ecx, %ecx
leal (%rcx,%rcx,4), %eax
subl %eax, %esi
addb $0x30, %sil
movb %sil, (%rdi)
movzbl %dl, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x39afd(%rip), %rdi     # 0xba118
leaq 0xd8(%rip), %rsi        # 0x806fa
callq 0x4470
testl %eax, %eax
jne 0x806e4
movl 0x39ae7(%rip), %edi     # 0xba11c
callq 0x47b0
movq %rax, %r14
testq %rax, %rax
jne 0x8066b
movl $0x1, %edi
movl $0xc8, %esi
callq 0x4300
testq %rax, %rax
je 0x806f2
movq %rax, %r14
movl 0x39ab9(%rip), %edi     # 0xba11c
movq %rax, %rsi
callq 0x40d0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
cmpl $0x0, 0xa0(%r14,%rcx,4)
jne 0x8068a
cmpq %rbx, 0x50(%r14,%rcx,8)
jae 0x806d2
cmpl $-0x1, %eax
cmovel %ecx, %eax
incq %rcx
cmpq $0xa, %rcx
jne 0x80672
cmpl $-0x1, %eax
je 0x806ed
movslq %eax, %r15
movq (%r14,%r15,8), %rdi
testq %rdi, %rdi
je 0x806a9
callq 0x45c0
movl $0x1, %edi
movq %rbx, %rsi
callq 0x4300
movq %rax, (%r14,%r15,8)
testq %rax, %rax
je 0x806f2
movq %rbx, 0x50(%r14,%r15,8)
movl $0x1, 0xa0(%r14,%r15,4)
jmp 0x806f4
movl $0x1, 0xa0(%r14,%rcx,4)
movq (%r14,%rcx,8), %rax
jmp 0x806f4
movl %eax, %edi
callq 0x4afc
jmp 0x806f2
callq 0x4b21
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x8060c
testq %rax, %rax
je 0x80730
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
popq %rbx
jmp 0x4260
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/htscodecs/htscodecs/utils.c
// Function: htscodecs_tls_free
void htscodecs_tls_free(void *ptr) {
    if (!ptr)
        return;

    tls_pool *tls = pthread_getspecific(rans_key);

    int i;
    for (i = 0; i < MAX_TLS_BUFS; i++) {
        if (tls->bufs[i] == ptr)
            break;
    }
#ifdef TLS_DEBUG
    fprintf(stderr, "Fake free %d size %ld ptr %p\n",
            i, tls->sizes[i], tls->bufs[i]);
#endif
    if (i == MAX_TLS_BUFS) {
        fprintf(stderr, "Attempt to htscodecs_tls_free a buffer not allocated"
                " with htscodecs_tls_alloc\n");
        return;
    }
    if (!tls->used[i]) {
        fprintf(stderr, "Attempt to htscodecs_tls_free a buffer twice\n");
        return;
    }
    tls->used[i] = 0;
}

// Assembly:
testq %rdi, %rdi
je 0x80779
pushq %rbx
movq %rdi, %rbx
movl 0x399db(%rip), %edi     # 0xba11c
callq 0x47b0
xorl %ecx, %ecx
cmpq %rbx, (%rax,%rcx,8)
je 0x8075c
incq %rcx
cmpq $0xa, %rcx
jne 0x80748
movl $0xa, %ecx
cmpl $0xa, %ecx
je 0x8077a
movl %ecx, %ecx
cmpl $0x0, 0xa0(%rax,%rcx,4)
je 0x80781
movl $0x0, 0xa0(%rax,%rcx,4)
popq %rbx
retq
callq 0x4b59
jmp 0x80778
callq 0x4b3d
jmp 0x80778
// File: /workspace/github_c_makefile_star2_O1/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 0x807cc
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
cmpl $0x0, 0xa0(%rbx,%r14,4)
jne 0x807b6
movq (%rbx,%r14,8), %rdi
callq 0x45c0
incq %r14
cmpq $0xa, %r14
jne 0x80797
jmp 0x807bd
callq 0x4b75
jmp 0x807a2
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x45c0
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/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 0x834c7
testl %eax, %eax
je 0x80a27
xorl %ebx, %ebx
jmp 0x80a38
movq %rsp, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x80ca5
movq %rax, %rbx
testq %rbx, %rbx
jne 0x80a4a
movq %rsp, %rdi
movl $0x1, %esi
callq 0x82091
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x3958f(%rip), %rdi     # 0xba138
callq 0x4910
testl %eax, %eax
jne 0x80bbd
movq $0x0, 0x3957b(%rip) # 0xba138
movq 0x3956c(%rip), %rdi     # 0xba130
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, 0x3955e(%rip)     # 0xba130
xorps %xmm0, %xmm0
movups %xmm0, 0x39544(%rip)    # 0xba120
movq 0x3955d(%rip), %rdi     # 0xba140
callq 0x45c0
movq %rbx, 0x39551(%rip)     # 0xba140
cmpq %rbx, 0x39552(%rip)     # 0xba148
je 0x80c96
movq 0x39545(%rip), %rbx     # 0xba148
cmpl $0x0, (%rbx)
je 0x80c68
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
movl %r15d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x80c56
movq 0x20(%rbx), %rax
movl %r15d, %ebx
movq (%rax,%rbx,8), %rdi
callq 0x823db
movq 0x39509(%rip), %rax     # 0xba148
movq 0x18(%rax), %rax
movq %r14, (%rax,%rbx,8)
movq 0x394fa(%rip), %rax     # 0xba148
movq 0x20(%rax), %rax
movq %r14, (%rax,%rbx,8)
incl %r15d
movq 0x394e8(%rip), %rbx     # 0xba148
addl $0x2, %ebp
cmpl (%rbx), %r15d
jne 0x80c10
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, 0x394b2(%rip) # 0xba148
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x41a0
// File: /workspace/github_c_makefile_star2_O1/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 0x81802
orb $0x1, 0x64(%r14)
movl $0x10000001, %ebx       # imm = 0x10000001
jmp 0x81822
testq %rbx, %rbx
je 0x81820
movq %rdi, %rsi
movq 0x50(%r14), %rdi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x50(%r14)
subq %rbx, 0x58(%r14)
jmp 0x81822
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x81861
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 0x81878
movb 0x64(%r14), %al
testb $0x2, %al
jne 0x81876
orb $0x1, %al
movb %al, 0x64(%r14)
movl $0x10000001, %ebx       # imm = 0x10000001
jmp 0x81878
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xc(%rdi), %eax
cmpl %eax, 0x8(%rdi)
jne 0x818ee
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x4, %r15d
cmovnel %ecx, %r15d
movq (%rbx), %rdi
movq %r15, %rsi
shlq $0x4, %rsi
callq 0x4840
movq %rax, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rcx, %rcx
je 0x8193f
movl %r15d, 0xc(%rbx)
movq %rcx, (%rbx)
movl 0x8(%rbx), %edx
cmpq $0x2, %rdx
jb 0x818e9
leaq 0x10(%rcx), %rsi
decq %rdx
movq %rsi, -0x8(%rsi)
addq $0x10, %rsi
decq %rdx
jne 0x818dc
testq %rcx, %rcx
je 0x8193f
testl %ebp, %ebp
je 0x818fd
movq %r14, %rdi
callq 0x4930
movq %rax, %r14
movq (%rbx), %rcx
movl 0x8(%rbx), %eax
movq %rax, %rdx
shlq $0x4, %rdx
movq %r14, (%rcx,%rdx)
testq %r14, %r14
je 0x8193a
testq %rax, %rax
je 0x81928
leaq (%rcx,%rdx), %rsi
leal -0x1(%rax), %edi
shlq $0x4, %rdi
movq %rsi, 0x8(%rcx,%rdi)
movq $0x0, 0x8(%rcx,%rdx)
incl %eax
movl %eax, 0x8(%rbx)
xorl %eax, %eax
jmp 0x8193f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x81987
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
leaq 0x8(%rsp), %rsi
callq *%rax
testl %eax, %eax
je 0x81996
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 0x81987
movl 0x78(%rbx), %eax
testl %eax, %eax
je 0x819b8
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 0x82091
movl 0xa8(%rbx), %eax
testl %eax, %eax
setle %cl
cmpl $-0x2, %eax
setne %al
testb %al, %cl
jne 0x819e8
movl $0x0, 0xa8(%rbx)
movq 0x8(%rsp), %r12
movq (%r12), %rsi
testq %rsi, %rsi
je 0x81a45
leaq 0x2216b(%rip), %r15     # 0xa3b68
movq %r14, %rdi
xorl %edx, %edx
callq 0x81883
movq (%r12), %rsi
testl %eax, %eax
js 0x81a9b
movl $0xe, %edx
movq %r15, %rdi
callq 0x4650
testl %eax, %eax
jne 0x81a37
cmpl $0x0, 0xa8(%rbx)
jne 0x81a37
movl $0xfffffffe, 0xa8(%rbx) # imm = 0xFFFFFFFE
movq 0x8(%r12), %rsi
addq $0x8, %r12
testq %rsi, %rsi
jne 0x819fd
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x81a66
addq $0x8, %rax
movq $0x0, -0x8(%rax)
cmpq $0x0, (%rax)
leaq 0x8(%rax), %rax
jne 0x81a54
movl 0x78(%rbx), %eax
xorl %ebp, %ebp
testl %eax, %eax
je 0x81987
cmpl $0x0, 0x88(%rbx)
je 0x81987
movq 0x70(%rbx), %rcx
movq 0x80(%rbx), %rdx
decl %eax
shlq $0x4, %rax
movq %rdx, 0x8(%rcx,%rax)
jmp 0x81987
testq %rsi, %rsi
je 0x81982
movq %rsi, %rdi
callq 0x45c0
movq $0x0, (%r12)
jmp 0x81982