LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/rANS_static32x16pr_avx512.c
// Function: mm512_i32gather_epi32x1
static inline __m512i _mm512_i32gather_epi32x1(__m512i idx, void *v) {
    uint8_t *b = (uint8_t *)v;
    volatile 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));

    return _mm512_set_epi32(b[c[15]], b[c[14]], b[c[13]], b[c[12]],
                            b[c[11]], b[c[10]], b[c[9]], b[c[8]],
                            b[c[7]], b[c[6]], b[c[5]], b[c[4]],
                            b[c[3]], b[c[2]], b[c[1]], b[c[0]]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
andq $-0x20, %rsp
subq $0x80, %rsp
vmovaps %ymm0, 0x40(%rsp)
vextractf64x4 $0x1, %zmm0, 0x20(%rsp)
movslq 0x3c(%rsp), %rax
movzbl (%rdi,%rax), %eax
movl %eax, 0x1c(%rsp)
movslq 0x38(%rsp), %rcx
movzbl (%rdi,%rcx), %eax
movl %eax, 0x18(%rsp)
movslq 0x34(%rsp), %rdx
movzbl (%rdi,%rdx), %eax
movl %eax, 0x14(%rsp)
movslq 0x30(%rsp), %rsi
movzbl (%rdi,%rsi), %esi
movslq 0x2c(%rsp), %r8
movzbl (%rdi,%r8), %r8d
movslq 0x28(%rsp), %r9
movzbl (%rdi,%r9), %r9d
movslq 0x24(%rsp), %r10
movzbl (%rdi,%r10), %r10d
movslq 0x20(%rsp), %r11
movzbl (%rdi,%r11), %r11d
movslq 0x5c(%rsp), %rbx
movzbl (%rdi,%rbx), %ebx
movslq 0x58(%rsp), %r14
movzbl (%rdi,%r14), %r14d
movslq 0x54(%rsp), %r15
movzbl (%rdi,%r15), %r15d
movslq 0x50(%rsp), %r12
movzbl (%rdi,%r12), %r12d
movslq 0x4c(%rsp), %r13
movzbl (%rdi,%r13), %r13d
movslq 0x48(%rsp), %rax
movzbl (%rdi,%rax), %eax
movslq 0x44(%rsp), %rcx
movzbl (%rdi,%rcx), %ecx
movslq 0x40(%rsp), %rdx
movzbl (%rdi,%rdx), %edx
vmovd %edx, %xmm0
vpinsrb $0x1, %ecx, %xmm0, %xmm0
vpinsrb $0x2, %eax, %xmm0, %xmm0
vpinsrb $0x3, %r13d, %xmm0, %xmm0
vpinsrb $0x4, %r12d, %xmm0, %xmm0
vpinsrb $0x5, %r15d, %xmm0, %xmm0
vpinsrb $0x6, %r14d, %xmm0, %xmm0
vpinsrb $0x7, %ebx, %xmm0, %xmm0
vpinsrb $0x8, %r11d, %xmm0, %xmm0
vpinsrb $0x9, %r10d, %xmm0, %xmm0
vpinsrb $0xa, %r9d, %xmm0, %xmm0
vpinsrb $0xb, %r8d, %xmm0, %xmm0
vpinsrb $0xc, %esi, %xmm0, %xmm0
vpinsrb $0xd, 0x14(%rsp), %xmm0, %xmm0
vpinsrb $0xe, 0x18(%rsp), %xmm0, %xmm0
vpinsrb $0xf, 0x1c(%rsp), %xmm0, %xmm0
vpmovzxbd %xmm0, %zmm0    # zmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero,xmm0[8],zero,zero,zero,xmm0[9],zero,zero,zero,xmm0[10],zero,zero,zero,xmm0[11],zero,zero,zero,xmm0[12],zero,zero,zero,xmm0[13],zero,zero,zero,xmm0[14],zero,zero,zero,xmm0[15],zero,zero,zero
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/rANS_byte.h
// Function: RansEncPutSymbol
static inline void RansEncPutSymbol(RansState* r, uint8_t** pptr, RansEncSymbol const* sym)
{
    RansAssert(sym->x_max != 0); // can't encode symbol with freq=0

    // renormalize
    uint32_t x = *r;
    uint32_t x_max = sym->x_max;

    // This is better for 40-qual illumina (3.7% quicker overall CRAM).
    // The old method was better for low complexity data such as NovaSeq
    // quals (2.6% quicker overall CRAM).
    int o = x >= x_max;
    uint8_t* ptr = *pptr;
    ptr[-1] = x & 0xff;
    ptr -= o;
    x >>= o*8;

    if (unlikely(x >= x_max)) {
        *--ptr = (uint8_t) (x & 0xff);
        x >>= 8;
    }
    *pptr = ptr;

    //uint32_t q = (uint32_t) (((uint64_t)x * sym->rcp_freq) >> sym->rcp_shift);
    //*r = q * sym->cmpl_freq + x + sym->bias;

    // x = C(s,x)
    // NOTE: written this way so we get a 32-bit "multiply high" when
    // available. If you're on a 64-bit platform with cheap multiplies
    // (e.g. x64), just bake the +32 into rcp_shift.
    //uint32_t q = (uint32_t) (((uint64_t)x * sym->rcp_freq) >> 32) >> sym->rcp_shift;

    // The extra >>32 has already been added to RansEncSymbolInit
    uint32_t q = (uint32_t) (((uint64_t)x * sym->rcp_freq) >> sym->rcp_shift);
    *r = q * sym->cmpl_freq + x + sym->bias;
}

// Assembly:
movl (%rdx), %r9d
testl %r9d, %r9d
je 0x60fd8
movl (%rdi), %eax
xorl %ecx, %ecx
cmpl %r9d, %eax
setae %cl
movq (%rsi), %r8
movb %al, -0x1(%r8)
subq %rcx, %r8
shlb $0x3, %cl
shrl %cl, %eax
cmpl %r9d, %eax
jae 0x60fcc
movq %r8, (%rsi)
movl %eax, %ecx
movl 0x4(%rdx), %esi
imulq %rcx, %rsi
movb 0xe(%rdx), %cl
shrq %cl, %rsi
movzwl 0xc(%rdx), %ecx
imull %esi, %ecx
addl 0x8(%rdx), %eax
addl %ecx, %eax
movl %eax, (%rdi)
retq
movb %al, -0x1(%r8)
decq %r8
shrl $0x8, %eax
jmp 0x60fab
pushq %rax
leaq 0x20ffe(%rip), %rdi     # 0x81fde
leaq 0x20fd7(%rip), %rsi     # 0x81fbe
leaq 0x21000(%rip), %rcx     # 0x81fee
movl $0x11d, %edx            # imm = 0x11D
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/rANS_byte.h
// Function: RansDecRenormSafe
static inline void RansDecRenormSafe(RansState* r, uint8_t** pptr, uint8_t *ptr_end)
{
    uint32_t x = *r;
    uint8_t* ptr = *pptr;
    if (x >= RANS_BYTE_L || ptr >= ptr_end) return;
    x = (x << 8) | *ptr++;
    if (x < RANS_BYTE_L && ptr < ptr_end)
        x = (x << 8) | *ptr++;
    *pptr = ptr;
    *r = x;
}

// Assembly:
movl (%rdi), %r9d
movq (%rsi), %rax
cmpl $0x800000, %r9d         # imm = 0x800000
setb %cl
cmpq %rdx, %rax
setb %r8b
andb %cl, %r8b
cmpb $0x1, %r8b
jne 0x61057
movl %r9d, %r10d
shll $0x8, %r10d
leaq 0x1(%rax), %r8
movzbl (%rax), %ecx
orl %r10d, %ecx
cmpl $0x8000, %r9d           # imm = 0x8000
setb %r9b
cmpq %rdx, %r8
setb %dl
andb %r9b, %dl
cmpb $0x1, %dl
jne 0x61052
shll $0x8, %ecx
movq %rax, %r8
addq $0x2, %r8
movzbl 0x1(%rax), %eax
orl %eax, %ecx
movq %r8, (%rsi)
movl %ecx, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testl %edi, %edi
jle 0x62c70
movl %edi, %ebp
cmpl $0x989681, %edi         # imm = 0x989681
jae 0x62c54
incl %ebp
imull $0x18, %ebp, %r14d
leaq 0x14428(%r14), %rdi
callq 0x6412c
testq %rax, %rax
je 0x62c70
movq %rax, %rbx
movl %ebp, 0x14424(%rax)
andl $0x0, 0x8(%rax)
andq $0x0, 0x10(%rax)
leaq 0x14428(%rax), %r15
movq %r15, (%rax)
movq %rax, %rdi
andl $0x0, 0x14020(%rax)
addq $0x18, %rdi
andl $0x0, 0x14220(%rax)
movl $0x508, %edx            # imm = 0x508
xorl %esi, %esi
callq 0x4260
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x4260
movl $0x1, 0x14420(%rbx)
andl $0x0, 0x14430(%rbx)
jmp 0x62c72
movq 0x3b37d(%rip), %rax     # 0x9dfd8
movq (%rax), %rcx
leaq 0x1fcb7(%rip), %rdi     # 0x8291c
pushq $0x32
popq %rsi
pushq $0x1
popq %rdx
callq 0x49b0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
callq 0x45c0
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x62ccc
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0x10(%r14), %rdi
cmpq 0x8(%r14), %r12
jae 0x62cbf
movq (%rdi,%r15), %rdi
callq 0x45c0
incq %r12
addq $0x10, %r15
jmp 0x62ca3
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
leaq 0x20(%rbx), %r14
xorl %r15d, %r15d
movslq 0x14420(%rbx), %rax
shlq $0x4, %rax
cmpq %rax, %r15
jge 0x62cf4
movq (%r14), %rdi
callq 0x45c0
incq %r15
addq $0x28, %r14
jmp 0x62cd3
pushq $0x10
popq %r14
xorl %r15d, %r15d
movslq 0x14424(%rbx), %rax
cmpq %rax, %r15
jge 0x62d1c
movq (%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x45c0
incq %r15
addq $0x18, %r14
jmp 0x62cfb
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x64291
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r14
pushq $0x2
popq %rdx
callq 0x63bb5
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x63a14
shll $0x4, %r15d
orl $0x2, %r15d
movslq %r15d, %rax
imulq $0x28, %rax, %rax
addq %rax, %r14
addq $0x20, %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x63bfd
testl %eax, %eax
js 0x63a14
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 %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movl %ecx, %r14d
movq %rdx, %rbx
movl %esi, %r12d
movq %rdi, %r15
pushq $0x1
popq %rdx
callq 0x63bb5
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x63a9e
shll $0x4, %r12d
incl %r12d
movslq %r12d, %rax
imulq $0x28, %rax, %rax
addq %rax, %r15
addq $0x20, %r15
leal 0x1(%r14), %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x63bfd
testl %eax, %eax
js 0x63a9e
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
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r14
callq 0x63bb5
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x63b00
shll $0x4, %r12d
orl %r15d, %r12d
movslq %r12d, %rax
imulq $0x28, %rax, %rax
addq %rax, %r14
addq $0x20, %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x63bfd
testl %eax, %eax
js 0x63b00
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_O2/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 (descriptor_grow(&ctx->desc[id], 1) < 0) return -1;

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

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
shll $0x4, %esi
orl $0x4, %esi
movslq %esi, %rax
imulq $0x28, %rax, %rax
leaq (%rdi,%rax), %r14
addq $0x20, %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x63bfd
testl %eax, %eax
js 0x63b4b
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r14)
movb %bl, (%rax,%rcx)
xorl %eax, %eax
jmp 0x63b4e
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %r14
callq 0x63bb5
pushq $-0x1
popq %rbp
testl %eax, %eax
js 0x63baa
shll $0x4, %r12d
orl %r15d, %r12d
movslq %r12d, %rax
imulq $0x28, %rax, %rax
addq %rax, %r14
addq $0x20, %r14
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x63bfd
testl %eax, %eax
js 0x63baa
movq (%r14), %rax
movq 0x10(%r14), %rcx
movl %ebx, (%rax,%rcx)
addq $0x4, 0x10(%r14)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/tokenise_name3.c
// Function: encode_token_type
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 %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
shll $0x4, %esi
movslq %esi, %rax
imulq $0x28, %rax, %rax
leaq (%rdi,%rax), %r14
addq $0x20, %r14
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x63bfd
testl %eax, %eax
js 0x63bf2
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x10(%r14)
movb %bl, (%rax,%rcx)
xorl %eax, %eax
jmp 0x63bf5
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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
movq %rdi, %r14
movl %esi, %r12d
movq 0x8(%rdi), %r15
movl $0x10000, %r13d         # imm = 0x10000
pushq $-0x1
popq %rbx
movq 0x10(%r14), %rax
addq %r12, %rax
cmpq %r15, %rax
jbe 0x63c49
testq %r15, %r15
leaq (%r15,%r15), %r15
cmoveq %r13, %r15
movq (%r14), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x63c4b
movq %rax, (%r14)
movq %r15, 0x8(%r14)
jmp 0x63c19
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
imulq $0x28, %rax, %rsi
movq 0x30(%rdi,%rsi), %rdx
leaq 0x4(%rdx), %rax
cmpq 0x28(%rdi,%rsi), %rax
jbe 0x63e1f
pushq $-0x1
popq %rax
retq
addq %rdi, %rsi
addq $0x20, %rsi
movq (%rsi), %rdi
movl (%rdi,%rdx), %edx
movl %edx, (%rcx)
movq %rax, 0x10(%rsi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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, %ecx
movl %edx, %eax
decl %eax
cmpl $0x8, %eax
ja 0x63f1e
movl %esi, %edx
leaq 0x1e354(%rip), %rsi     # 0x821d8
movslq (%rsi,%rax,4), %rax
addq %rsi, %rax
jmpq *%rax
movl $0x5f5e100, %esi        # imm = 0x5F5E100
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
movl $0x989680, %esi         # imm = 0x989680
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
movl $0xf4240, %esi          # imm = 0xF4240
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
movl $0x186a0, %esi          # imm = 0x186A0
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
movl $0x2710, %esi           # imm = 0x2710
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
movl $0x3e8, %esi            # imm = 0x3E8
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
pushq $0x64
popq %rsi
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
pushq $0xa
popq %rsi
movl %edx, %eax
xorl %edx, %edx
divl %esi
addb $0x30, %al
movb %al, (%rdi)
incq %rdi
addb $0x30, %dl
movb %dl, (%rdi)
movzbl %cl, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x3afda(%rip), %rdi     # 0x9f118
leaq 0x114(%rip), %rsi       # 0x64259
callq 0x4470
testl %eax, %eax
jne 0x64201
movl 0x3afc4(%rip), %edi     # 0x9f11c
callq 0x47b0
movq %rax, %r14
testq %rax, %rax
jne 0x6418c
pushq $0x1
popq %rdi
movl $0xc8, %esi
callq 0x4300
testq %rax, %rax
je 0x64247
movq %rax, %r14
movl 0x3af98(%rip), %edi     # 0x9f11c
movq %rax, %rsi
callq 0x40d0
pushq $-0x1
popq %rax
xorl %ecx, %ecx
cmpq $0xa, %rcx
je 0x641b4
cmpl $0x0, 0xa0(%r14,%rcx,4)
jne 0x641af
cmpq %rbx, 0x50(%r14,%rcx,8)
jae 0x641ef
cmpl $-0x1, %eax
cmovel %ecx, %eax
incq %rcx
jmp 0x64191
cmpl $-0x1, %eax
je 0x6422b
movslq %eax, %r12
movq (%r14,%r12,8), %rdi
callq 0x45c0
pushq $0x1
popq %rdi
movq %rbx, %rsi
callq 0x4300
movq %rax, (%r14,%r12,8)
testq %rax, %rax
je 0x64247
movq %rax, %r15
movq %rbx, 0x50(%r14,%r12,8)
movl $0x1, 0xa0(%r14,%r12,4)
jmp 0x6424a
movl $0x1, 0xa0(%r14,%rcx,4)
movq (%r14,%rcx,8), %r15
jmp 0x6424a
movq 0x39dd0(%rip), %rcx     # 0x9dfd8
movq (%rcx), %rbx
movl %eax, %edi
callq 0x4150
leaq 0x19a5c(%rip), %rsi     # 0x7dc75
xorl %r15d, %r15d
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x4700
jmp 0x6424a
movq 0x39da6(%rip), %rax     # 0x9dfd8
movq (%rax), %rcx
leaq 0x1e713(%rip), %rdi     # 0x8294f
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0x49b0
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x6412c
testq %rax, %rax
je 0x6428f
movq %rax, %rdi
xorl %esi, %esi
movq %rbx, %rdx
popq %rbx
jmp 0x4260
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbx
testq %rdi, %rdi
je 0x642c7
movq %rdi, %rbx
movl 0x3ae7c(%rip), %edi     # 0x9f11c
callq 0x47b0
pushq $0x28
popq %rcx
cmpq $0x32, %rcx
je 0x642c9
cmpq %rbx, -0x140(%rax,%rcx,8)
je 0x642bd
incq %rcx
jmp 0x642a8
cmpl $0x0, (%rax,%rcx,4)
je 0x642de
andl $0x0, (%rax,%rcx,4)
popq %rbx
retq
movq 0x39d08(%rip), %rax     # 0x9dfd8
movq (%rax), %rcx
leaq 0x1e699(%rip), %rdi     # 0x82973
pushq $0x4e
jmp 0x642f1
movq 0x39cf3(%rip), %rax     # 0x9dfd8
movq (%rax), %rcx
leaq 0x1e6d3(%rip), %rdi     # 0x829c2
pushq $0x2d
popq %rsi
pushq $0x1
popq %rdx
popq %rbx
jmp 0x49b0
// File: /workspace/github_c_makefile_star2_O2/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 0x64370
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r13d, %r13d
movq 0x39cc0(%rip), %rbp     # 0x9dfd8
leaq 0x1e6d1(%rip), %r14     # 0x829f0
pushq $0x28
popq %r15
pushq $0x1
popq %r12
cmpq $0xa, %r13
je 0x6435a
cmpl $0x0, 0xa0(%rbx,%r13,4)
jne 0x64346
movq (%rbx,%r13,8), %rdi
callq 0x45c0
incq %r13
jmp 0x64327
movq (%rbp), %rcx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x49b0
jmp 0x64338
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x45c0
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/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 0x66ac3
testl %eax, %eax
je 0x64594
movq %rsp, %rdi
pushq $0x1
popq %rsi
callq 0x65a9f
xorl %eax, %eax
jmp 0x645a7
movq %rsp, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x647ed
testq %rax, %rax
je 0x64585
addq $0x68, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
movq 0x3aa0d(%rip), %rdi     # 0x9f138
callq 0x4910
testl %eax, %eax
jne 0x6473c
andq $0x0, 0x3a9fc(%rip)     # 0x9f138
movq 0x3a9ed(%rip), %rdi     # 0x9f130
callq 0x45c0
xorps %xmm0, %xmm0
movups %xmm0, 0x3a9ce(%rip)    # 0x9f120
andq $0x0, 0x3a9d6(%rip)     # 0x9f130
movq 0x3a9df(%rip), %rdi     # 0x9f140
callq 0x45c0
andq $0x0, 0x3a9d2(%rip)     # 0x9f140
movq 0x3a9d3(%rip), %rdi     # 0x9f148
testq %rdi, %rdi
je 0x647e4
xorl %ebx, %ebx
xorl %ebp, %ebp
cmpl (%rdi), %ebp
je 0x647d7
movq 0x10(%rdi), %rax
movl %ebp, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebx, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x647d0
movq 0x20(%rdi), %rax
movl %ebp, %r14d
movq (%rax,%r14,8), %rdi
callq 0x65bb2
movq 0x3a998(%rip), %rax     # 0x9f148
movq 0x18(%rax), %rax
andq $0x0, (%rax,%r14,8)
movq 0x3a988(%rip), %rax     # 0x9f148
movq 0x20(%rax), %rax
andq $0x0, (%rax,%r14,8)
movq 0x3a978(%rip), %rdi     # 0x9f148
incl %ebp
addl $0x2, %ebx
jmp 0x6477e
callq 0x646f2
andq $0x0, 0x3a964(%rip)     # 0x9f148
popq %rbx
popq %r14
popq %rbp
jmp 0x41a0
// File: /workspace/github_c_makefile_star2_O2/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 0x6533d
orb $0x1, 0x64(%r14)
movl $0x10000001, %ebx       # imm = 0x10000001
jmp 0x6535d
testq %rbx, %rbx
je 0x6535b
movq %rdi, %rsi
movq 0x50(%r14), %rdi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x50(%r14)
subq %rbx, 0x58(%r14)
jmp 0x6535d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x6539c
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 0x653b3
movb 0x64(%r14), %al
testb $0x2, %al
jne 0x653b1
orb $0x1, %al
movb %al, 0x64(%r14)
movl $0x10000001, %ebx       # imm = 0x10000001
jmp 0x653b3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rdi), %r12d
pushq $-0x1
popq %rbp
cmpl 0xc(%rdi), %r12d
jne 0x65423
leal (%r12,%r12), %eax
testl %r12d, %r12d
pushq $0x4
popq %r12
cmovnel %eax, %r12d
movq (%rbx), %rdi
movq %r12, %rsi
shlq $0x4, %rsi
callq 0x4840
testq %rax, %rax
je 0x6546c
movl %r12d, 0xc(%rbx)
movq %rax, (%rbx)
movl 0x8(%rbx), %r12d
addq $0x10, %rax
pushq $0x1
popq %rcx
cmpq %r12, %rcx
jae 0x65423
movq %rax, -0x8(%rax)
incq %rcx
addq $0x10, %rax
jmp 0x65411
testl %r15d, %r15d
je 0x65433
movq %r14, %rdi
callq 0x4930
movq %rax, %r14
movq (%rbx), %rax
movl %r12d, %ecx
shlq $0x4, %rcx
movq %r14, (%rax,%rcx)
testq %r14, %r14
je 0x6546c
testl %r12d, %r12d
je 0x6545d
leaq (%rax,%rcx), %rdx
leal -0x1(%r12), %esi
shlq $0x4, %rsi
movq %rdx, 0x8(%rax,%rsi)
andq $0x0, 0x8(%rax,%rcx)
incl %r12d
movl %r12d, 0x8(%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0x8(%rsp)
movq 0x90(%rdi), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x654b3
movq %rdi, %rbx
movq 0x98(%rdi), %rdi
leaq 0x8(%rsp), %rsi
callq *%rax
pushq $-0x1
popq %r15
testl %eax, %eax
je 0x654c2
movl %r15d, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x8(%rsp)
je 0x654b3
movl 0x78(%rbx), %eax
testl %eax, %eax
je 0x654e1
movq 0x70(%rbx), %rcx
decl %eax
shlq $0x4, %rax
andq $0x0, 0x8(%rcx,%rax)
leaq 0x80(%rbx), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x65a9f
movl 0xa8(%rbx), %eax
testl %eax, %eax
setle %cl
cmpl $-0x2, %eax
setne %al
testb %al, %cl
jne 0x6550e
andl $0x0, 0xa8(%rbx)
movq 0x8(%rsp), %r12
movq (%r12), %rsi
testq %rsi, %rsi
je 0x65566
movq %r14, %rdi
xorl %edx, %edx
callq 0x653be
movq (%r12), %rdi
testl %eax, %eax
js 0x6555c
callq 0x65afc
testl %eax, %eax
je 0x6554a
cmpl $0x0, 0xa8(%rbx)
jne 0x6554a
movl $0xfffffffe, 0xa8(%rbx) # imm = 0xFFFFFFFE
addq $0x8, %r12
jmp 0x65513
callq 0x45c0
andq $0x0, (%r12)
xorl %edi, %edi
testq %rdi, %rdi
jne 0x65550
jmp 0x654b0
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
je 0x6557b
andq $0x0, (%rax)
addq $0x8, %rax
jmp 0x6556b
movl 0x78(%rbx), %eax
xorl %ebp, %ebp
testl %eax, %eax
je 0x654b3
cmpl $0x0, 0x88(%rbx)
je 0x654b3
movq 0x70(%rbx), %rcx
movq 0x80(%rbx), %rdx
decl %eax
shlq $0x4, %rax
movq %rdx, 0x8(%rcx,%rax)
jmp 0x654b3
// File: /workspace/github_c_makefile_star2_O2/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
xorl %r14d, %r14d
xorl %r15d, %r15d
movl 0x8(%rbx), %eax
cmpq %rax, %r15
jae 0x65ad9
movq (%rbx), %rax
movq (%rax,%r14), %rdi
callq 0x45c0
movq (%rbx), %rax
incq %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%r14)
addq $0x10, %r14
jmp 0x65ab1
andl $0x0, 0x8(%rbx)
testl %ebp, %ebp
je 0x65af1
movq (%rbx), %rdi
callq 0x45c0
andl $0x0, 0xc(%rbx)
andq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x65be2
movq %rdi, %rbx
addq $0x20, %rdi
callq 0x4590
testl %eax, %eax
jne 0x65be4
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_O2/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 %r12
pushq %rbx
pushq %rax
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
pushq $-0x1
popq %r15
testl %eax, %eax
je 0x667fd
movq 0x38(%rbx), %rdi
callq 0x645af
movl %eax, %ebx
callq 0x4050
movl %ebx, (%rax)
jmp 0x66815
leaq 0x50(%rbx), %r12
movb 0x64(%rbx), %cl
testb $0x5, %cl
jne 0x66824
movq %rbx, %rdi
callq 0x6561b
testl %eax, %eax
jns 0x66801
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%r12), %rax
subq %r14, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
testb $0x4, %cl
je 0x66818
movl 0x60(%rbx), %esi
testl %esi, %esi
jne 0x667e9
jmp 0x66818
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hfile_libcurl.c
// Function: libcurl_close
static int libcurl_close(hFILE *fpv)
{
    hFILE_libcurl *fp = (hFILE_libcurl *) fpv;
    CURLcode err;
    CURLMcode errm;
    int save_errno = 0;

    // Before closing the file, unpause it and perform on it so that uploads
    // have the opportunity to signal EOF to the server -- see send_callback().

    fp->buffer.len = 0;
    fp->closing = 1;
    fp->paused = 0;
    if (!fp->finished) {
        err = curl_easy_pause(fp->easy, CURLPAUSE_CONT);
        if (err != CURLE_OK) save_errno = easy_errno(fp->easy, err);
    }

    while (save_errno == 0 && ! fp->paused && ! fp->finished)
        if (wait_perform(fp) < 0) save_errno = errno;

    if (fp->finished && fp->final_result != CURLE_OK)
        save_errno = easy_errno(fp->easy, fp->final_result);

    errm = curl_multi_remove_handle(fp->multi, fp->easy);
    if (errm != CURLM_OK && save_errno == 0) save_errno = multi_errno(errm);
    fp->nrunning--;

    curl_easy_cleanup(fp->easy);
    curl_multi_cleanup(fp->multi);

    if (fp->headers.callback) // Tell callback to free any data it needs to
        fp->headers.callback(fp->headers.callback_data, NULL);
    free_headers(&fp->headers.fixed, 1);
    free_headers(&fp->headers.extra, 1);

    free(fp->preserved);

    if (save_errno) { errno = save_errno; return -1; }
    else return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, 0x58(%rdi)
movb 0x64(%rdi), %al
movl %eax, %ecx
andb $-0x4, %cl
orb $0x2, %cl
movb %cl, 0x64(%rdi)
xorl %ebp, %ebp
testb $0x4, %al
jne 0x66a11
movq 0x38(%rbx), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x4970
testl %eax, %eax
je 0x66a11
movq 0x38(%rbx), %rdi
movl %eax, %esi
callq 0x645af
movl %eax, %ebp
jmp 0x66a11
movl %eax, %ecx
andb $0x5, %cl
jne 0x66a18
movq %rbx, %rdi
callq 0x6561b
xorl %ebp, %ebp
testl %eax, %eax
jns 0x66a11
callq 0x4050
movl (%rax), %ebp
movb 0x64(%rbx), %al
testl %ebp, %ebp
je 0x669f5
testb $0x4, %al
je 0x66a2e
movl 0x60(%rbx), %esi
testl %esi, %esi
je 0x66a2e
movq 0x38(%rbx), %rdi
callq 0x645af
movl %eax, %ebp
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdi
callq 0x4160
testl %eax, %eax
je 0x66a4c
testl %ebp, %ebp
jne 0x66a4c
movl %eax, %edi
callq 0x655d1
movl %eax, %ebp
decl 0x68(%rbx)
movq 0x38(%rbx), %rdi
callq 0x4620
movq 0x40(%rbx), %rdi
callq 0x4850
leaq 0x70(%rbx), %r14
movq 0x90(%rbx), %rax
testq %rax, %rax
je 0x66a7c
movq 0x98(%rbx), %rdi
xorl %esi, %esi
callq *%rax
pushq $0x1
popq %r15
movq %r14, %rdi
movl %r15d, %esi
callq 0x65a9f
leaq 0x80(%rbx), %rdi
movl %r15d, %esi
callq 0x65a9f
movq 0xe0(%rbx), %rdi
callq 0x45c0
testl %ebp, %ebp
je 0x66ab6
callq 0x4050
movl %ebp, (%rax)
pushq $-0x1
popq %rax
jmp 0x66ab8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/faidx.c
// Function: fai_destroy
void fai_destroy(faidx_t *fai)
{
    int i;
    if (!fai) return;
    for (i = 0; i < fai->n; ++i) free(fai->name[i]);
    free(fai->name);
    kh_destroy(s, fai->hash);
    if (fai->bgzf) bgzf_close(fai->bgzf);
    free(fai);
}

// Assembly:
testq %rdi, %rdi
je 0x66f33
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x8(%rbx), %rax
movq 0x10(%rbx), %rdi
cmpq %rax, %r14
jge 0x66ee6
movq (%rdi,%r14,8), %rdi
callq 0x45c0
incq %r14
jmp 0x66ecb
callq 0x45c0
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x66f17
movq 0x18(%r14), %rdi
callq 0x45c0
movq 0x10(%r14), %rdi
callq 0x45c0
movq 0x20(%r14), %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x66f24
callq 0xbc96
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/faidx.c
// Function: fai_get_val
static int fai_get_val(const faidx_t *fai, const char *str,
                       hts_pos_t *len, faidx1_t *val, hts_pos_t *fbeg, hts_pos_t *fend) {
    khiter_t iter;
    khash_t(s) *h;
    int id;
    hts_pos_t beg, end;

    if (!fai_parse_region(fai, str, &id, &beg, &end, 0)) {
        hts_log_warning("Reference %s not found in FASTA file, returning empty sequence", str);
        *len = -2;
        return 1;
    }

    h = fai->hash;
    iter = kh_get(s, h, faidx_iseq(fai, id));
    if (iter >= kh_end(h)) {
        // should have already been caught above
        abort();
    }
    *val = kh_value(h, iter);

    if (beg >= val->len) beg = val->len;
    if (end >= val->len) end = val->len;
    if (beg > end) beg = end;

    *fbeg = beg;
    *fend = end;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
leaq 0x4(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
xorl %r9d, %r9d
callq 0x68879
testq %rax, %rax
je 0x68124
movq 0x10(%rbp), %rax
movq 0x18(%rbp), %r12
movslq 0x4(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
movq %r12, %rdi
callq 0x684a5
cmpl (%r12), %eax
jae 0x68159
movq 0x20(%r12), %rcx
movl %eax, %eax
imulq $0x28, %rax, %rax
movq 0x20(%rcx,%rax), %rdx
movq %rdx, 0x20(%r15)
movups (%rcx,%rax), %xmm0
movups 0x10(%rcx,%rax), %xmm1
movups %xmm1, 0x10(%r15)
movups %xmm0, (%r15)
movq 0x10(%rsp), %rax
movq 0x10(%r15), %rcx
cmpq %rcx, %rax
cmovaeq %rcx, %rax
movq 0x8(%rsp), %rdx
cmpq %rcx, %rdx
cmovbq %rdx, %rcx
cmpq %rcx, %rax
cmovgeq %rcx, %rax
movq %rax, (%r14)
movq %rcx, (%rbx)
xorl %eax, %eax
jmp 0x6814a
leaq 0x1b394(%rip), %rsi     # 0x834bf
leaq 0x1b399(%rip), %rdx     # 0x834cb
pushq $0x3
popq %rdi
movq %r13, %rcx
xorl %eax, %eax
callq 0x110c6
movq $-0x2, (%r12)
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x4270
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/faidx.c
// Function: fai_fetchqual64
char *fai_fetchqual64(const faidx_t *fai, const char *str, hts_pos_t *len) {
    faidx1_t val;
    int64_t beg, end;

    if (fai_get_val(fai, str, len, &val, &beg, &end)) {
        return NULL;
    }

    // now retrieve the sequence
    return fai_retrieve(fai, &val, val.qual_offset, beg, end, len);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rsp, %r9
callq 0x68072
testl %eax, %eax
je 0x6841a
xorl %eax, %eax
jmp 0x68437
leaq 0x10(%rsp), %rsi
movq 0x20(%rsi), %rdx
movq 0x8(%rsp), %rcx
movq (%rsp), %r8
movq %r14, %rdi
movq %rbx, %r9
callq 0x681aa
addq $0x38, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/faidx.c
// Function: fai_fetchqual
char *fai_fetchqual(const faidx_t *fai, const char *str, int *len) {
    hts_pos_t len64;
    char *ret = fai_fetchqual64(fai, str, &len64);
    *len = len64 < INT_MAX ? len64 : INT_MAX; // trunc
    return ret;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsp, %r14
movq %r14, %rdx
callq 0x683f3
movq (%r14), %rcx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmpq %rdx, %rcx
cmovlq %rcx, %rdx
movl %edx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/faidx.c
// Function: fai_adjust_region
int fai_adjust_region(const faidx_t *fai, int tid,
                      hts_pos_t *beg, hts_pos_t *end)
{
    hts_pos_t orig_beg, orig_end;

    if (!fai || !beg || !end || tid < 0 || tid >= fai->n)
        return -1;

    orig_beg = *beg;
    orig_end = *end;
    if (faidx_adjust_position(fai, 0, NULL, fai->name[tid], beg, end, NULL) != 0) {
        hts_log_error("Inconsistent faidx internal state - couldn't find \"%s\"",
                      fai->name[tid]);
        return -1;
    }

    return ((orig_beg != *beg ? 1 : 0) |
            (orig_end != *end && orig_end < HTS_POS_MAX ? 2 : 0));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
pushq $-0x1
popq %rbx
testl %esi, %esi
js 0x6863d
movq %rdi, %r12
testq %rdi, %rdi
je 0x6863d
movq %rdx, %r15
testq %rdx, %rdx
je 0x6863d
movq %rcx, %r14
testq %rcx, %rcx
je 0x6863d
cmpl %esi, 0x8(%r12)
jle 0x6863d
movq (%r15), %rax
movq %rax, 0x10(%rsp)
movq (%r14), %r13
movq 0x10(%r12), %rax
movl %esi, %ebp
movq (%rax,%rbp,8), %rcx
andq $0x0, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r15, %r8
movq %r14, %r9
callq 0x6864e
testl %eax, %eax
je 0x68612
movq 0x10(%r12), %rax
movq (%rax,%rbp,8), %rcx
leaq 0x1a7d9(%rip), %rsi     # 0x82dd8
leaq 0x1a7e4(%rip), %rdx     # 0x82dea
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0x6863d
xorl %eax, %eax
movq 0x10(%rsp), %rcx
cmpq (%r15), %rcx
setne %al
cmpq (%r14), %r13
setne %cl
movabsq $0x7fffffff7fffffff, %rdx # imm = 0x7FFFFFFF7FFFFFFF
cmpq %rdx, %r13
setl %dl
andb %cl, %dl
movzbl %dl, %ecx
leal (%rax,%rcx,2), %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq