LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/faidx.c
// Function: faidx_adjust_position
static int faidx_adjust_position(const faidx_t *fai, int end_adjust,
                                 faidx1_t *val_out, const char *c_name,
                                 hts_pos_t *p_beg_i, hts_pos_t *p_end_i,
                                 hts_pos_t *len) {
    khiter_t iter;
    faidx1_t *val;

    // Adjust position
    iter = kh_get(s, fai->hash, c_name);

    if (iter == kh_end(fai->hash)) {
        if (len)
            *len = -2;
        hts_log_error("The sequence \"%s\" was not found", c_name);
        return 1;
    }

    val = &kh_value(fai->hash, iter);

    if (val_out)
        *val_out = *val;

    if(*p_end_i < *p_beg_i)
        *p_beg_i = *p_end_i;

    if(*p_beg_i < 0)
        *p_beg_i = 0;
    else if(val->len <= *p_beg_i)
        *p_beg_i = val->len;

    if(*p_end_i < 0)
        *p_end_i = 0;
    else if(val->len <= *p_end_i)
        *p_end_i = val->len - end_adjust;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq 0x18(%rdi), %r13
movq %r13, %rdi
movq %rcx, %rsi
callq 0x684a5
cmpl (%r13), %eax
jne 0x686ae
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x6868d
movq $-0x2, (%rax)
leaq 0x1af4d(%rip), %rsi     # 0x835e1
leaq 0x1af5c(%rip), %rdx     # 0x835f7
pushq $0x1
popq %r14
movl %r14d, %edi
movq %r15, %rcx
xorl %eax, %eax
callq 0x110c6
jmp 0x68723
movl %eax, %eax
imulq $0x28, %rax, %rax
addq 0x20(%r13), %rax
testq %r12, %r12
je 0x686d8
movq 0x20(%rax), %rcx
movq %rcx, 0x20(%r12)
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq (%rbx), %rdx
movq (%r14), %rcx
cmpq %rcx, %rdx
jge 0x686e9
movq %rdx, (%r14)
movq %rdx, %rcx
testq %rcx, %rcx
js 0x686f9
movq 0x10(%rax), %rdx
cmpq %rcx, %rdx
jbe 0x686fb
jmp 0x686fe
xorl %edx, %edx
movq %rdx, (%r14)
movq (%rbx), %rcx
testq %rcx, %rcx
js 0x6871c
movq 0x10(%rax), %rax
xorl %r14d, %r14d
cmpq %rcx, %rax
ja 0x68723
movl %ebp, %ecx
subq %rcx, %rax
movq %rax, (%rbx)
jmp 0x68723
andq $0x0, (%rbx)
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/faidx.c
// Function: fai_path
char *fai_path(const char *fa) {
    char *fai = NULL;
    if (!fa) {
        hts_log_error("No reference file specified");
    } else {
        char *fai_tmp = strstr(fa, HTS_IDX_DELIM);
        if (fai_tmp) {
            fai_tmp += strlen(HTS_IDX_DELIM);
            fai = strdup(fai_tmp);
            if (!fai)
                hts_log_error("Failed to allocate memory");
        } else {
            if (hisremote(fa)) {
                fai = hts_idx_locatefn(fa, ".fai");       // get the remote fai file name, if any, but do not download the file
                if (!fai)
                    hts_log_error("Failed to locate index file for remote reference file '%s'", fa);
            } else{
                if (hts_idx_check_local(fa, HTS_FMT_FAI, &fai) == 0 && fai) {
                    if (fai_build3(fa, fai, NULL) == -1) {      // create local fai file by indexing local fasta
                        hts_log_error("Failed to build index file for reference file '%s'", fa);
                        free(fai);
                        fai = NULL;
                    }
                }
            }
        }
    }

    return fai;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
andq $0x0, (%rsp)
testq %rdi, %rdi
je 0x68919
movq %rdi, %r14
leaq 0xf5e3(%rip), %rsi      # 0x77ed1
callq 0x40e0
testq %rax, %rax
je 0x68935
addq $0x7, %rax
movq %rax, %rdi
callq 0x4930
testq %rax, %rax
jne 0x68955
leaq 0x1a511(%rip), %rsi     # 0x82e21
leaq 0x1a52f(%rip), %rdx     # 0x82e46
jmp 0x68927
leaq 0x1a501(%rip), %rsi     # 0x82e21
leaq 0x1a503(%rip), %rdx     # 0x82e2a
xorl %ebx, %ebx
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0x68958
movq %r14, %rdi
callq 0xe4f2
testl %eax, %eax
je 0x68963
leaq 0x14a70(%rip), %rsi     # 0x7d3b8
movq %r14, %rdi
callq 0x173ad
testq %rax, %rax
je 0x689a1
movq %rax, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x4
popq %rsi
movq %rsp, %rbx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x16f81
testl %eax, %eax
sete %al
movq (%rbx), %rbx
testq %rbx, %rbx
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x68958
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x66f36
cmpl $-0x1, %eax
je 0x689c0
movq (%rsp), %rbx
jmp 0x68958
leaq 0x1a479(%rip), %rsi     # 0x82e21
leaq 0x1a4b1(%rip), %rdx     # 0x82e60
xorl %ebx, %ebx
pushq $0x1
popq %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x110c6
jmp 0x68958
leaq 0x1a45a(%rip), %rsi     # 0x82e21
leaq 0x1a4cd(%rip), %rdx     # 0x82e9b
xorl %ebx, %ebx
pushq $0x1
popq %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x110c6
movq (%rsp), %rdi
callq 0x45c0
jmp 0x68958
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/hfile.h
// Function: hputs
static inline int hputs(const char *text, hFILE *fp)
{
    HTSLIB_EXPORT
    extern int hputs2(const char *, size_t, size_t, hFILE *);

    size_t nbytes = strlen(text), n = fp->limit - fp->begin;
    if (n > nbytes) n = nbytes;
    memcpy(fp->begin, text, n);
    fp->begin += n;
    return (n == nbytes)? 0 : hputs2(text, nbytes, n, fp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
callq 0x41d0
movq %rax, %r15
movq 0x8(%rbx), %rdi
movq 0x18(%rbx), %r13
subq %rdi, %r13
cmpq %rax, %r13
movq %rax, %r12
cmovbq %r13, %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, 0x8(%rbx)
cmpq %r13, %r15
jbe 0x690d3
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xd7b0
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hrecs_new
sam_hrecs_t *sam_hrecs_new(void) {
    sam_hrecs_t *hrecs = calloc(1, sizeof(*hrecs));

    if (!hrecs)
        return NULL;

    hrecs->h = kh_init(sam_hrecs_t);
    if (!hrecs->h)
        goto err;

    hrecs->ID_cnt = 1;

    hrecs->nref = 0;
    hrecs->ref_sz = 0;
    hrecs->ref  = NULL;
    if (!(hrecs->ref_hash = kh_init(m_s2i)))
        goto err;
    hrecs->refs_changed = -1;

    hrecs->nrg = 0;
    hrecs->rg_sz = 0;
    hrecs->rg  = NULL;
    if (!(hrecs->rg_hash = kh_init(m_s2i)))
        goto err;

    hrecs->npg = 0;
    hrecs->pg_sz = 0;
    hrecs->pg  = NULL;
    hrecs->npg_end = hrecs->npg_end_alloc = 0;
    hrecs->pg_end = NULL;
    if (!(hrecs->pg_hash = kh_init(m_s2i)))
        goto err;

    if (!(hrecs->tag_pool = pool_create(sizeof(sam_hrec_tag_t))))
        goto err;

    if (!(hrecs->type_pool = pool_create(sizeof(sam_hrec_type_t))))
        goto err;

    if (!(hrecs->str_pool = string_pool_create(65536)))
        goto err;

    if (sam_hrecs_init_type_order(hrecs, NULL))
        goto err;

    return hrecs;

err:
    if (hrecs->h)
        kh_destroy(sam_hrecs_t, hrecs->h);

    if (hrecs->tag_pool)
        pool_destroy(hrecs->tag_pool);

    if (hrecs->type_pool)
        pool_destroy(hrecs->type_pool);

    if (hrecs->str_pool)
        string_pool_destroy(hrecs->str_pool);

    free(hrecs);

    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
pushq $0x1
popq %rdi
movl $0xa8, %esi
callq 0x4300
testq %rax, %rax
je 0x69783
movq %rax, %rbx
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x4300
movq %rax, (%rbx)
testq %rax, %rax
je 0x6976d
movq %rax, %r14
movl $0x1, 0x8c(%rbx)
callq 0x6d5bb
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x69741
orl $-0x1, 0x94(%rbx)
callq 0x6d5bb
movq %rax, 0x50(%rbx)
testq %rax, %rax
je 0x69741
callq 0x6d5bb
movq %rax, 0x70(%rbx)
testq %rax, %rax
je 0x69741
pushq $0x18
popq %rdi
callq 0x490b0
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x69741
movq %rax, %r12
pushq $0x30
popq %rdi
callq 0x490b0
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0x69794
movq %rax, %r15
movl $0x10000, %edi          # imm = 0x10000
callq 0x4925c
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x69747
movl $0x5, 0x9c(%rbx)
pushq $0x5
popq %rdi
pushq $0x3
popq %rsi
callq 0x4300
movq %rax, 0xa0(%rbx)
testq %rax, %rax
je 0x69747
movw $0x4448, (%rax)         # imm = 0x4448
movw $0x5153, 0x3(%rax)      # imm = 0x5153
movw $0x4752, 0x6(%rax)      # imm = 0x4752
movw $0x4750, 0x9(%rax)      # imm = 0x4750
movw $0x4f43, 0xc(%rax)      # imm = 0x4F43
jmp 0x69785
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x6d5c6
testq %r12, %r12
je 0x69760
movq %r12, %rdi
callq 0x49138
movq 0x18(%rbx), %r15
testq %r15, %r15
je 0x6976d
movq %r15, %rdi
callq 0x49138
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x6977b
callq 0x4928e
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorl %r15d, %r15d
jmp 0x69747
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hrecs_free
void sam_hrecs_free(sam_hrecs_t *hrecs) {
    if (!hrecs)
        return;

    if (hrecs->h)
        kh_destroy(sam_hrecs_t, hrecs->h);

    if (hrecs->ref_hash)
        kh_destroy(m_s2i, hrecs->ref_hash);

    if (hrecs->ref)
        free(hrecs->ref);

    if (hrecs->rg_hash)
        kh_destroy(m_s2i, hrecs->rg_hash);

    if (hrecs->rg)
        free(hrecs->rg);

    if (hrecs->pg_hash)
        kh_destroy(m_s2i, hrecs->pg_hash);

    if (hrecs->pg)
        free(hrecs->pg);

    if (hrecs->pg_end)
        free(hrecs->pg_end);

    if (hrecs->type_pool)
        pool_destroy(hrecs->type_pool);

    if (hrecs->tag_pool)
        pool_destroy(hrecs->tag_pool);

    if (hrecs->str_pool)
        string_pool_destroy(hrecs->str_pool);

    if (hrecs->type_order)
        free(hrecs->type_order);

    if (hrecs->ID_buf)
        free(hrecs->ID_buf);

    free(hrecs);
}

// Assembly:
testq %rdi, %rdi
je 0x6984c
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x697b3
callq 0x6d5c6
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0x697c1
callq 0x6d5ee
movq 0x30(%rbx), %rdi
callq 0x45c0
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x697d8
callq 0x6d5ee
movq 0x48(%rbx), %rdi
callq 0x45c0
movq 0x70(%rbx), %rdi
testq %rdi, %rdi
je 0x697ef
callq 0x6d5ee
movq 0x68(%rbx), %rdi
callq 0x45c0
movq 0x78(%rbx), %rdi
callq 0x45c0
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x6980f
callq 0x49138
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x6981d
callq 0x49138
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x6982b
callq 0x4928e
movq 0xa0(%rbx), %rdi
callq 0x45c0
movq 0x80(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
jmp 0x45c0
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: rebuild_target_arrays
static int rebuild_target_arrays(sam_hdr_t *bh) {
    if (!bh || !bh->hrecs)
        return -1;

    sam_hrecs_t *hrecs = bh->hrecs;
    if (hrecs->refs_changed < 0)
        return 0;

    if (sam_hdr_update_target_arrays(bh, hrecs, hrecs->refs_changed) != 0)
        return -1;

    hrecs->refs_changed = -1;
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x69cb7
movq 0x38(%rdi), %r14
testq %r14, %r14
je 0x69cb7
movl 0x94(%r14), %edx
testl %edx, %edx
js 0x69cb5
movq %r14, %rsi
callq 0x69130
testl %eax, %eax
jne 0x69cb7
orl $-0x1, 0x94(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_rebuild
int sam_hdr_rebuild(sam_hdr_t *bh) {
    sam_hrecs_t *hrecs;
    if (!bh)
        return -1;

    if (!(hrecs = bh->hrecs))
        return bh->text ? 0 : -1;

    if (hrecs->refs_changed >= 0) {
        if (rebuild_target_arrays(bh) < 0) {
            hts_log_error("Header target array rebuild has failed");
            return -1;
        }
    }

    /* If header text wasn't changed or header is empty, don't rebuild it. */
    if (!hrecs->dirty)
        return 0;

    if (hrecs->pgs_changed && sam_hdr_link_pg(bh) < 0) {
        hts_log_error("Linking @PG lines has failed");
        return -1;
    }

    kstring_t ks = KS_INITIALIZE;
    if (sam_hrecs_rebuild_text(hrecs, &ks) != 0) {
        ks_free(&ks);
        hts_log_error("Header text rebuild has failed");
        return -1;
    }

    hrecs->dirty = 0;

    /* Sync */
    free(bh->text);
    bh->l_text = ks_len(&ks);
    bh->text = ks_release(&ks);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
pushq $-0x1
popq %rbx
testq %rdi, %rdi
je 0x69de2
movq %rdi, %r14
movq 0x38(%rdi), %r15
testq %r15, %r15
je 0x69d89
cmpl $0x0, 0x94(%r15)
js 0x69d20
movq %r14, %rdi
callq 0x69c81
testl %eax, %eax
js 0x69d94
cmpl $0x0, 0x90(%r15)
je 0x69dc6
cmpl $0x0, 0x98(%r15)
je 0x69d48
movq %r14, %rdi
callq 0x69e29
testl %eax, %eax
js 0x69dca
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movq %r15, %rdi
callq 0x6a067
testl %eax, %eax
je 0x69da4
movq 0x10(%rsp), %rdi
callq 0x45c0
leaq 0x198a4(%rip), %rsi     # 0x83617
leaq 0x198f1(%rip), %rdx     # 0x8366b
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
pushq $-0x1
popq %rbx
jmp 0x69de2
xorl %ebx, %ebx
cmpq $0x1, 0x28(%r14)
sbbl %ebx, %ebx
jmp 0x69de2
leaq 0x1987c(%rip), %rsi     # 0x83617
leaq 0x19885(%rip), %rdx     # 0x83627
jmp 0x69dd8
andl $0x0, 0x90(%r15)
movq 0x28(%r14), %rdi
callq 0x45c0
movq (%rsp), %rax
movq %rax, 0x8(%r14)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%r14)
xorl %ebx, %ebx
jmp 0x69de2
leaq 0x19846(%rip), %rsi     # 0x83617
leaq 0x19876(%rip), %rdx     # 0x8364e
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hrecs_rebuild_text
int sam_hrecs_rebuild_text(const sam_hrecs_t *hrecs, kstring_t *ks) {
    ks->l = 0;

    if (!hrecs->h || !hrecs->h->size) {
        return kputsn("", 0, ks) >= 0 ? 0 : -1;
    }
    if (sam_hrecs_rebuild_lines(hrecs, ks) != 0)
        return -1;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
andq $0x0, (%rsi)
movq (%rdi), %rax
testq %rax, %rax
je 0x6a0dc
cmpl $0x0, 0x4(%rax)
je 0x6a0dc
movq 0x8(%rdi), %r15
testq %r15, %r15
je 0x6a0f4
pushq $-0x1
popq %rbp
movq %r15, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6aabb
testl %eax, %eax
jne 0x6a110
movq (%rbx), %rsi
addq $0x2, %rsi
movq %rbx, %rdi
callq 0x6ddfe
testl %eax, %eax
js 0x6a110
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movb $0xa, (%rcx,%rax)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
movq 0x10(%r14), %r14
cmpq %r15, %r14
jne 0x6a092
jmp 0x6a109
leaq 0xdc73(%rip), %rdi      # 0x77d56
xorl %esi, %esi
movq %rbx, %rdx
callq 0x6cc3e
movl %eax, %ebp
sarl $0x1f, %ebp
jmp 0x6a110
leaq 0xdc5b(%rip), %rdi      # 0x77d56
xorl %esi, %esi
movq %rbx, %rdx
callq 0x6cc3e
testl %eax, %eax
js 0x6a10d
xorl %ebp, %ebp
jmp 0x6a110
pushq $-0x1
popq %rbp
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/header.c
// Function: sam_hdr_add_lines
int sam_hdr_add_lines(sam_hdr_t *bh, const char *lines, size_t len) {
    sam_hrecs_t *hrecs;

    if (!bh || !lines)
        return -1;

    if (len == 0 && *lines == '\0')
        return 0;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -1;
        hrecs = bh->hrecs;
    }

    if (sam_hrecs_parse_lines(hrecs, lines, len) != 0)
        return -1;

    if (hrecs->refs_changed >= 0 && rebuild_target_arrays(bh) != 0)
        return -1;

    hrecs->dirty = 1;
    redact_header_text(bh);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x1
popq %rbx
orb %al, %cl
jne 0x6a1a2
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
testq %rdx, %rdx
jne 0x6a14e
cmpb $0x0, (%r12)
je 0x6a192
movq 0x38(%r14), %r13
testq %r13, %r13
je 0x6a196
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x6984d
testl %eax, %eax
jne 0x6a1a2
cmpl $0x0, 0x94(%r13)
js 0x6a17f
movq %r14, %rdi
callq 0x69c81
testl %eax, %eax
jne 0x6a1a2
movl $0x1, 0x90(%r13)
movq %r14, %rdi
callq 0x6a1b4
xorl %ebx, %ebx
jmp 0x6a1a2
movq %r14, %rdi
callq 0x6933d
testl %eax, %eax
je 0x6a1ae
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x38(%r14), %r13
jmp 0x6a157
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: redact_header_text
static void redact_header_text(sam_hdr_t *bh) {
    assert(bh->hrecs && bh->hrecs->dirty);
    bh->l_text = 0;
    free(bh->text);
    bh->text = NULL;
}

// Assembly:
pushq %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x6a1df
cmpl $0x0, 0x90(%rax)
je 0x6a1df
movq %rdi, %rbx
andq $0x0, 0x8(%rdi)
movq 0x28(%rdi), %rdi
callq 0x45c0
andq $0x0, 0x28(%rbx)
popq %rbx
retq
leaq 0x19a3a(%rip), %rdi     # 0x83c20
leaq 0x1956e(%rip), %rsi     # 0x8375b
leaq 0x19a4a(%rip), %rcx     # 0x83c3e
movl $0x492, %edx            # imm = 0x492
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_add_line
int sam_hdr_add_line(sam_hdr_t *bh, const char *type, ...) {
    va_list args;
    sam_hrecs_t *hrecs;

    if (!bh || !type)
        return -1;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -1;
        hrecs = bh->hrecs;
    }

    va_start(args, type);
    int ret = sam_hrecs_vadd(hrecs, type, args, NULL);
    va_end(args);

    if (ret == 0) {
        if (hrecs->refs_changed >= 0 && rebuild_target_arrays(bh) != 0)
            return -1;

        if (hrecs->dirty)
            redact_header_text(bh);
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x6a25c
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x1
popq %r12
orb %al, %cl
jne 0x6a2f8
movq %rsi, %r15
movq %rdi, %rbx
movq 0x38(%rdi), %r14
testq %r14, %r14
je 0x6a2ec
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0x100(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x6a316
movl %eax, %ebp
testl %eax, %eax
jne 0x6a2fb
cmpl $0x0, 0x94(%r14)
js 0x6a2d6
movq %rbx, %rdi
callq 0x69c81
movl %r12d, %ebp
testl %eax, %eax
jne 0x6a2fb
xorl %ebp, %ebp
cmpl $0x0, 0x90(%r14)
je 0x6a2fb
movq %rbx, %rdi
callq 0x6a1b4
jmp 0x6a2fb
movq %rbx, %rdi
callq 0x6933d
testl %eax, %eax
je 0x6a30d
movl %r12d, %ebp
movl %ebp, %eax
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rbx), %r14
jmp 0x6a283
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_find_line_id
int sam_hdr_find_line_id(sam_hdr_t *bh, const char *type,
                      const char *ID_key, const char *ID_val, kstring_t *ks) {
    sam_hrecs_t *hrecs;
    if (!bh || !type)
        return -2;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -2;
        hrecs = bh->hrecs;
    }

    sam_hrec_type_t *ty = sam_hrecs_find_type_id(hrecs, type, ID_key, ID_val);
    if (!ty)
        return -1;

    ks->l = 0;
    if (build_header_line(ty, ks) < 0) {
        return -2;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x2
popq %rbp
orb %al, %cl
jne 0x6a8ec
movq %r8, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x6a8d7
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x6a8fd
testq %rax, %rax
je 0x6a8e9
andq $0x0, (%rbx)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x6aabb
xorl %ebp, %ebp
jmp 0x6a8ec
movq %r13, %rdi
callq 0x6933d
testl %eax, %eax
jne 0x6a8ec
movq 0x38(%r13), %rdi
jmp 0x6a8b1
pushq $-0x1
popq %rbp
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_O2/samtools[P]htslib/header.c
// Function: build_header_line
static int build_header_line(const sam_hrec_type_t *ty, kstring_t *ks) {
    sam_hrec_tag_t *tag;
    int r = 0;
    char c[2]= { ty->type >> 8, ty->type & 0xff };

    r |= (kputc_('@', ks) == EOF);
    r |= (kputsn(c, 2, ks) == EOF);
    for (tag = ty->tag; tag; tag = tag->next) {
        r |= (kputc_('\t', ks) == EOF);
        r |= (kputsn(tag->str, tag->len, ks) == EOF);
    }

    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movzwl 0x28(%rdi), %eax
rolw $0x8, %ax
leaq 0xe(%rsp), %r15
movw %ax, (%r15)
pushq $0x40
popq %rdi
callq 0x6ddc3
cmpl $-0x1, %eax
sete %bpl
pushq $0x2
popq %rsi
movq %r15, %rdi
movq %rbx, %rdx
callq 0x6cc3e
cmpl $-0x1, %eax
sete %al
orb %bpl, %al
movzbl %al, %ebp
addq $0x20, %r14
pushq $0x9
popq %r15
movq (%r14), %r14
testq %r14, %r14
je 0x6ab49
movl %r15d, %edi
movq %rbx, %rsi
callq 0x6ddc3
cmpl $-0x1, %eax
sete %r12b
movq 0x8(%r14), %rdi
movslq 0x10(%r14), %rsi
movq %rbx, %rdx
callq 0x6cc3e
cmpl $-0x1, %eax
sete %al
orb %r12b, %al
movzbl %al, %eax
orl %eax, %ebp
jmp 0x6ab0f
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_find_line_pos
int sam_hdr_find_line_pos(sam_hdr_t *bh, const char *type,
                          int pos, kstring_t *ks) {
    sam_hrecs_t *hrecs;
    if (!bh || !type)
        return -2;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -2;
        hrecs = bh->hrecs;
    }

    sam_hrec_type_t *ty = sam_hrecs_find_type_pos(hrecs, type, pos);
    if (!ty)
        return -1;

    ks->l = 0;
    if (build_header_line(ty, ks) < 0) {
        return -2;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x2
popq %r15
orb %al, %cl
jne 0x6abc2
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r12
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x6abab
movq %r14, %rsi
movl %ebp, %edx
callq 0x6abce
testq %rax, %rax
je 0x6abbe
andq $0x0, (%rbx)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x6aabb
xorl %r15d, %r15d
jmp 0x6abc2
movq %r12, %rdi
callq 0x6933d
testl %eax, %eax
jne 0x6abc2
movq 0x38(%r12), %rdi
jmp 0x6ab88
pushq $-0x1
popq %r15
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hrecs_find_type_pos
static sam_hrec_type_t *sam_hrecs_find_type_pos(sam_hrecs_t *hrecs,
                                                const char *type, int idx) {
    sam_hrec_type_t *first, *itr;

    if (idx < 0)
        return NULL;

    if (type[0] == 'S' && type[1] == 'Q')
        return idx < hrecs->nref ? hrecs->ref[idx].ty : NULL;

    if (type[0] == 'R' && type[1] == 'G')
        return idx < hrecs->nrg ? hrecs->rg[idx].ty : NULL;

    if (type[0] == 'P' && type[1] == 'G')
        return idx < hrecs->npg ? hrecs->pg[idx].ty : NULL;

    first = itr = sam_hrecs_find_type_id(hrecs, type, NULL, NULL);
    if (!first)
        return NULL;

    while (idx > 0) {
        itr = itr->next;
        if (itr == first)
            break;
        --idx;
    }

    return idx == 0 ? itr : NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testl %edx, %edx
js 0x6ac68
movl %edx, %ebx
movzbl (%rsi), %eax
cmpl $0x50, %eax
je 0x6ac23
cmpl $0x52, %eax
je 0x6ac0c
cmpl $0x53, %eax
jne 0x6ac44
cmpb $0x51, 0x1(%rsi)
jne 0x6ac44
cmpl %ebx, 0x28(%rdi)
jle 0x6ac68
movq 0x30(%rdi), %rax
movl %ebx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
jmp 0x6ac3f
cmpb $0x47, 0x1(%rsi)
jne 0x6ac44
cmpl %ebx, 0x40(%rdi)
jle 0x6ac68
movq 0x48(%rdi), %rax
movl %ebx, %ecx
imulq $0x18, %rcx, %rcx
jmp 0x6ac38
cmpb $0x47, 0x1(%rsi)
jne 0x6ac44
cmpl %ebx, 0x58(%rdi)
jle 0x6ac68
movq 0x68(%rdi), %rax
movl %ebx, %ecx
shlq $0x5, %rcx
addq %rcx, %rax
addq $0x8, %rax
movq (%rax), %r14
jmp 0x6ac6b
xorl %r14d, %r14d
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x6a8fd
testq %rax, %rax
je 0x6ac6b
incl %ebx
movq %rax, %r14
decl %ebx
testl %ebx, %ebx
jle 0x6ac6b
movq (%r14), %r14
cmpq %rax, %r14
jne 0x6ac5a
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_remove_line_id
int sam_hdr_remove_line_id(sam_hdr_t *bh, const char *type, const char *ID_key, const char *ID_value) {
    sam_hrecs_t *hrecs;
    if (!bh || !type)
        return -1;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -1;
        hrecs = bh->hrecs;
    }

    if (!strncmp(type, "PG", 2)) {
        hts_log_warning("Removing PG lines is not supported!");
        return -1;
    }

    sam_hrec_type_t *type_found = sam_hrecs_find_type_id(hrecs, type, ID_key, ID_value);
    if (!type_found)
        return 0;

    int ret = sam_hrecs_remove_line(hrecs, type, type_found, 1);
    if (ret == 0) {
        if (hrecs->refs_changed >= 0 && rebuild_target_arrays(bh) != 0)
            return -1;

        if (hrecs->dirty)
            redact_header_text(bh);
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x1
popq %rbx
orb %al, %cl
jne 0x6ad3d
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %r14
movq 0x38(%rdi), %r15
testq %r15, %r15
je 0x6ad31
cmpb $0x50, (%r12)
jne 0x6acda
cmpb $0x47, 0x1(%r12)
jne 0x6acda
leaq 0x189c6(%rip), %rsi     # 0x8368d
leaq 0x189d6(%rip), %rdx     # 0x836a4
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0x6ad3d
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x6a8fd
testq %rax, %rax
je 0x6ad2d
pushq $0x1
popq %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x6ad57
testl %eax, %eax
jne 0x6ad3d
cmpl $0x0, 0x94(%r15)
js 0x6ad1b
movq %r14, %rdi
callq 0x69c81
testl %eax, %eax
jne 0x6ad3d
cmpl $0x0, 0x90(%r15)
je 0x6ad2d
movq %r14, %rdi
callq 0x6a1b4
xorl %ebx, %ebx
jmp 0x6ad3d
movq %r14, %rdi
callq 0x6933d
testl %eax, %eax
je 0x6ad4e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r14), %r15
jmp 0x6acb1
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_remove_line_pos
int sam_hdr_remove_line_pos(sam_hdr_t *bh, const char *type, int position) {
    sam_hrecs_t *hrecs;
    if (!bh || !type || position < 0)
        return -1;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -1;
        hrecs = bh->hrecs;
    }

    if (!strncmp(type, "PG", 2)) {
        hts_log_warning("Removing PG lines is not supported!");
        return -1;
    }

    sam_hrec_type_t *type_found = sam_hrecs_find_type_pos(hrecs, type,
                                                          position);
    if (!type_found)
        return -1;

    int ret = sam_hrecs_remove_line(hrecs, type, type_found, 1);
    if (ret == 0) {
        if (hrecs->refs_changed >= 0 && rebuild_target_arrays(bh) != 0)
            return -1;

        if (hrecs->dirty)
            redact_header_text(bh);
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testl %edx, %edx
sets %al
orb %cl, %al
pushq $-0x1
popq %rbx
je 0x6b14b
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
movq 0x38(%rdi), %r12
testq %r12, %r12
je 0x6b1e7
cmpb $0x50, (%r15)
jne 0x6b187
cmpb $0x47, 0x1(%r15)
jne 0x6b187
leaq 0x18554(%rip), %rsi     # 0x836c8
leaq 0x18529(%rip), %rdx     # 0x836a4
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x110c6
jmp 0x6b140
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x6abce
testq %rax, %rax
je 0x6b140
pushq $0x1
popq %rcx
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x6ad57
testl %eax, %eax
jne 0x6b140
cmpl $0x0, 0x94(%r12)
js 0x6b1c9
movq %r14, %rdi
callq 0x69c81
testl %eax, %eax
jne 0x6b140
xorl %ebx, %ebx
cmpl $0x0, 0x90(%r12)
je 0x6b140
movq %r14, %rdi
callq 0x6a1b4
jmp 0x6b140
movq %r14, %rdi
callq 0x6933d
testl %eax, %eax
jne 0x6b140
movq 0x38(%r14), %r12
jmp 0x6b160
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hrecs_vupdate
int sam_hrecs_vupdate(sam_hrecs_t *hrecs, sam_hrec_type_t *type, va_list ap) {
    if (!hrecs)
        return -1;

    for (;;) {
        char *k, *v, *str;
        sam_hrec_tag_t *tag, *prev = NULL;

        if (!(k = (char *)va_arg(ap, char *)))
            break;
        if (!(v = va_arg(ap, char *)))
            v = "";

        tag = sam_hrecs_find_key(type, k, &prev);
        if (!tag) {
            if (!(tag = pool_alloc(hrecs->tag_pool)))
                return -1;
            if (prev)
                prev->next = tag;
            else
                type->tag = tag;

            tag->next = NULL;
        }

        tag->len = 3 + strlen(v);
        str = string_alloc(hrecs->str_pool, tag->len+1);
        if (!str)
            return -1;

        if (snprintf(str, tag->len+1, "%2.2s:%s", k, v) < 0)
            return -1;

        tag->str = str;
    }

    hrecs->dirty = 1; //mark text as dirty and force a rebuild

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
pushq $-0x1
popq %rax
movq %rdi, (%rsp)
testq %rdi, %rdi
je 0x6b86e
movq %rdx, %r14
leaq 0x20(%rsi), %rax
movq %rax, 0x10(%rsp)
andq $0x0, 0x8(%rsp)
movl (%r14), %eax
cmpq $0x28, %rax
ja 0x6b773
movq %rax, %rcx
addq 0x10(%r14), %rcx
addl $0x8, %eax
movl %eax, (%r14)
jmp 0x6b77f
movq 0x8(%r14), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x8(%r14)
movq (%rcx), %rbx
testq %rbx, %rbx
je 0x6b85e
cmpl $0x28, %eax
ja 0x6b79e
movl %eax, %ecx
addq 0x10(%r14), %rcx
addl $0x8, %eax
movl %eax, (%r14)
jmp 0x6b7aa
movq 0x8(%r14), %rcx
leaq 0x8(%rcx), %rax
movq %rax, 0x8(%r14)
movq (%rcx), %rbp
testq %rbp, %rbp
leaq 0xc59f(%rip), %rax      # 0x77d56
cmoveq %rax, %rbp
movq %rsi, %r15
movq %rsi, %rdi
movq %rbx, %rsi
leaq 0x8(%rsp), %rdx
callq 0x6b93e
movq %rax, %r13
testq %rax, %rax
jne 0x6b801
movq (%rsp), %rax
movq 0x20(%rax), %rdi
callq 0x49174
testq %rax, %rax
je 0x6b859
movq %rax, %r13
movq 0x8(%rsp), %rax
testq %rax, %rax
cmoveq 0x10(%rsp), %rax
movq %r13, (%rax)
andq $0x0, (%r13)
movq %rbp, %rdi
callq 0x41d0
leal 0x3(%rax), %ecx
movl %ecx, 0x10(%r13)
movq (%rsp), %rcx
movq 0x10(%rcx), %rdi
addl $0x4, %eax
movslq %eax, %rsi
callq 0x492ca
testq %rax, %rax
je 0x6b859
movq %rax, %r12
movslq 0x10(%r13), %rsi
incq %rsi
movq %rax, %rdi
leaq 0x18504(%rip), %rdx     # 0x83d40
movq %rbx, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x4800
testl %eax, %eax
js 0x6b859
movq %r12, 0x8(%r13)
movq %r15, %rsi
jmp 0x6b755
pushq $-0x1
popq %rax
jmp 0x6b86e
movq (%rsp), %rax
movl $0x1, 0x90(%rax)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hrecs_find_key
sam_hrec_tag_t *sam_hrecs_find_key(sam_hrec_type_t *type,
                                   const char *key,
                                   sam_hrec_tag_t **prev) {
    sam_hrec_tag_t *tag, *p = NULL;
    if (!type)
        return NULL;

    for (tag = type->tag; tag; p = tag, tag = tag->next) {
        if (tag->str[0] == key[0] && tag->str[1] == key[1]) {
            if (prev)
                *prev = p;
            return tag;
        }
    }

    if (prev)
        *prev = p;

    return NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x6b980
movq %rdi, %rax
addq $0x20, %rax
xorl %edi, %edi
movq %rdi, %rcx
movq (%rax), %rax
testq %rax, %rax
je 0x6b975
movq 0x8(%rax), %r8
movb (%r8), %r9b
movq %rax, %rdi
cmpb (%rsi), %r9b
jne 0x6b94c
movb 0x1(%r8), %r8b
movq %rax, %rdi
cmpb 0x1(%rsi), %r8b
jne 0x6b94c
jmp 0x6b977
xorl %eax, %eax
testq %rdx, %rdx
je 0x6b982
movq %rcx, (%rdx)
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: rebuild_hash
static int rebuild_hash(sam_hrecs_t *hrecs, const char *type) {
    sam_hrec_type_t *head, *step;
    khiter_t k;

    if (strncmp(type, "SQ", 2) == 0) {
        hrecs->nref = 0;
        kh_clear(m_s2i, hrecs->ref_hash);
    } else if (strncmp(type, "RG", 2) == 0) {
        hrecs->nrg = 0;
        kh_clear(m_s2i, hrecs->rg_hash);
    }

    k = kh_get(sam_hrecs_t, hrecs->h, TYPEKEY(type));

    if (k != kh_end(hrecs->h)) { // something to rebuild
        head = kh_val(hrecs->h, k);
        step = head;

        do {
            if (sam_hrecs_update_hashes(hrecs, TYPEKEY(type), step) == -1) {
                hts_log_error("Unable to rebuild hashes");
                return -1;
            }

            step = step->next;
        } while (step != head);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movzbl (%rsi), %eax
cmpl $0x52, %eax
je 0x6c5e6
cmpl $0x53, %eax
jne 0x6c600
cmpb $0x51, 0x1(%rbx)
jne 0x6c600
pushq $0x38
popq %rax
pushq $0x28
jmp 0x6c5f1
cmpb $0x47, 0x1(%rbx)
jne 0x6c600
pushq $0x50
popq %rax
pushq $0x40
popq %rcx
andl $0x0, (%r14,%rcx)
movq (%r14,%rax), %rdi
callq 0x6e26c
movq (%r14), %r15
movzwl (%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
movq %r15, %rdi
callq 0x6c54d
xorl %ebp, %ebp
cmpl (%r15), %eax
je 0x6c668
movq 0x20(%r15), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %r12
movq %r12, %r15
movzwl (%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x6bb9a
cmpl $-0x1, %eax
je 0x6c64d
movq (%r15), %r15
cmpq %r12, %r15
jne 0x6c629
jmp 0x6c668
leaq 0x179c5(%rip), %rsi     # 0x84019
leaq 0x179cb(%rip), %rdx     # 0x84026
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
pushq $-0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: kh_get_rm
KHASH_SET_INIT_STR(rm)
// Used for long refs in SAM files
KHASH_DECLARE(s2i, kh_cstr_t, int64_t)

typedef khash_t(rm) rmhash_t;

static int sam_hdr_link_pg(sam_hdr_t *bh);

static int sam_hrecs_vupdate(sam_hrecs_t *hrecs, sam_hrec_type_t *type, va_list ap);
static int sam_hrecs_update(sam_hrecs_t *hrecs, sam_hrec_type_t *type, ...);


#define MAX_ERROR_QUOTE 320 // Prevent over-long error messages
static void sam_hrecs_error(const char *msg, const char *line, size_t len, size_t lno) {
    int j;

    if (len > MAX_ERROR_QUOTE)
        len = MAX_ERROR_QUOTE;
    for (j = 0; j < len && line[j] != '\n'; j++)
        ;
    hts_log_error("%s at line %zd: \"%.*s\"", msg, lno, j, line);
}

// Assembly:
movl (%rdi), %eax
testl %eax, %eax
je 0x6c939
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %r14d
movq %rsi, 0x20(%rsp)
movq %rsi, %rdi
callq 0x6de86
movl %eax, %ebp
movl %r14d, 0xc(%rsp)
andl %r14d, %ebp
movq %rbx, 0x18(%rsp)
movq 0x10(%rbx), %r14
pushq $0x1
popq %r15
movl %ebp, %ebx
movl %ebx, %eax
shrl $0x4, %eax
movl (%r14,%rax,4), %r13d
leal (%rbx,%rbx), %r12d
andl $0x1e, %r12d
movl %r13d, %eax
movl %r12d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x6c918
testb $0x1, %al
jne 0x6c903
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
callq 0x46c0
testl %eax, %eax
je 0x6c918
addl %r15d, %ebx
andl 0xc(%rsp), %ebx
incl %r15d
cmpl %ebp, %ebx
jne 0x6c8c5
movq 0x10(%rsp), %rax
jmp 0x6c92a
movl %r12d, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x10(%rsp), %rax
cmovel %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_count_lines
int sam_hdr_count_lines(sam_hdr_t *bh, const char *type) {
    int count;
    sam_hrec_type_t *first_ty, *itr_ty;

    if (!bh || !type)
        return -1;

    if (!bh->hrecs) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -1;
    }

    // Deal with types that have counts
    switch (type[0]) {
    case 'S':
        if (type[1] == 'Q')
            return bh->hrecs->nref;
        break;
    case 'R':
        if (type[1] == 'G')
            return bh->hrecs->nrg;
        break;
    case 'P':
        if (type[1] == 'G')
            return bh->hrecs->npg;
        break;
    default:
        break;
    }

    first_ty = sam_hrecs_find_type_id(bh->hrecs, type, NULL, NULL);
    if (!first_ty)
        return 0;

    count = 1;
    for (itr_ty = first_ty->next;
         itr_ty && itr_ty != first_ty; itr_ty = itr_ty->next) {
        count++;
    }

    return count;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
pushq $-0x1
popq %r14
orb %al, %cl
jne 0x6c9e7
movq %rsi, %rbx
movq %rdi, %r15
cmpq $0x0, 0x38(%rdi)
je 0x6c988
movzbl (%rbx), %eax
cmpl $0x50, %eax
je 0x6c9a6
cmpl $0x52, %eax
je 0x6c996
cmpl $0x53, %eax
jne 0x6c9b9
cmpb $0x51, 0x1(%rbx)
movq 0x38(%r15), %rdi
jne 0x6c9bd
addq $0x28, %rdi
jmp 0x6c9b4
movq %r15, %rdi
callq 0x6933d
testl %eax, %eax
jne 0x6c9e7
jmp 0x6c966
cmpb $0x47, 0x1(%rbx)
movq 0x38(%r15), %rdi
jne 0x6c9bd
addq $0x40, %rdi
jmp 0x6c9b4
cmpb $0x47, 0x1(%rbx)
movq 0x38(%r15), %rdi
jne 0x6c9bd
addq $0x58, %rdi
movl (%rdi), %r14d
jmp 0x6c9e7
movq 0x38(%r15), %rdi
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x6a8fd
testq %rax, %rax
je 0x6c9e7
xorl %r14d, %r14d
movq %rax, %rcx
movq (%rcx), %rcx
incl %r14d
testq %rcx, %rcx
je 0x6c9e7
cmpq %rax, %rcx
jne 0x6c9d7
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_line_index
int sam_hdr_line_index(sam_hdr_t *bh,
                       const char *type,
                       const char *key) {
    sam_hrecs_t *hrecs;
    if (!bh || !type || !key)
        return -2;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -2;
        hrecs = bh->hrecs;
    }

    khint_t k;
    int idx = -1;
    switch (type[0]) {
    case 'S':
        if (type[1] == 'Q') {
            k = kh_get(m_s2i, hrecs->ref_hash, key);
            if (k != kh_end(hrecs->ref_hash))
                idx = kh_val(hrecs->ref_hash, k);
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    case 'R':
        if (type[1] == 'G') {
            k = kh_get(m_s2i, hrecs->rg_hash, key);
            if (k != kh_end(hrecs->rg_hash))
                idx = kh_val(hrecs->rg_hash, k);
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    case 'P':
        if (type[1] == 'G') {
            k = kh_get(m_s2i, hrecs->pg_hash, key);
            if (k != kh_end(hrecs->pg_hash))
                idx = kh_val(hrecs->pg_hash, k);
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    default:
        hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
    }

    return idx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %rdx, %rdx
sete %al
pushq $-0x2
popq %rbp
orb %cl, %al
jne 0x6caa6
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x6ca46
movzbl (%rbx), %ecx
cmpl $0x50, %ecx
je 0x6ca64
cmpl $0x52, %ecx
je 0x6ca58
cmpl $0x53, %ecx
jne 0x6ca88
cmpb $0x51, 0x1(%rbx)
jne 0x6ca88
movq 0x38(%rax), %rbx
jmp 0x6ca6e
movq %r15, %rdi
callq 0x6933d
testl %eax, %eax
jne 0x6caa6
movq 0x38(%r15), %rax
jmp 0x6ca28
cmpb $0x47, 0x1(%rbx)
jne 0x6ca88
movq 0x50(%rax), %rbx
jmp 0x6ca6e
cmpb $0x47, 0x1(%rbx)
jne 0x6ca88
movq 0x70(%rax), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6b87d
cmpl (%rbx), %eax
je 0x6caa3
movq 0x20(%rbx), %rcx
movl %eax, %eax
movl (%rcx,%rax,4), %ebp
jmp 0x6caa6
leaq 0x16de0(%rip), %rsi     # 0x8386f
leaq 0x16dec(%rip), %rdx     # 0x83882
pushq $0x3
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x110c6
pushq $-0x1
popq %rbp
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/header.c
// Function: sam_hdr_line_name
const char *sam_hdr_line_name(sam_hdr_t *bh,
                              const char *type,
                              int pos) {
    sam_hrecs_t *hrecs;
    if (!bh || !type || pos < 0)
        return NULL;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return NULL;
        hrecs = bh->hrecs;
    }

    switch (type[0]) {
    case 'S':
        if (type[1] == 'Q') {
            if (pos < hrecs->nref)
                return hrecs->ref[pos].name;
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    case 'R':
        if (type[1] == 'G') {
            if (pos < hrecs->nrg)
                return hrecs->rg[pos].name;
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    case 'P':
        if (type[1] == 'G') {
            if (pos < hrecs->npg)
                return hrecs->pg[pos].name;
        } else {
            hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
        }
        break;
    default:
        hts_log_warning("Type '%s' not supported. Only @SQ, @RG and @PG lines are indexed", type);
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testl %edx, %edx
sets %al
orb %cl, %al
je 0x6cad6
xorl %r14d, %r14d
jmp 0x6cb6c
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x6cb0a
movzbl (%rbx), %ecx
cmpl $0x50, %ecx
je 0x6cb33
cmpl $0x52, %ecx
je 0x6cb1c
cmpl $0x53, %ecx
jne 0x6cb4e
cmpb $0x51, 0x1(%rbx)
jne 0x6cb4e
cmpl %ebp, 0x28(%rax)
jle 0x6cace
movq 0x30(%rax), %rax
jmp 0x6cb2b
movq %r14, %rdi
callq 0x6933d
testl %eax, %eax
jne 0x6cace
movq 0x38(%r14), %rax
jmp 0x6cae7
cmpb $0x47, 0x1(%rbx)
jne 0x6cb4e
cmpl %ebp, 0x40(%rax)
jle 0x6cace
movq 0x48(%rax), %rax
movl %ebp, %ecx
imulq $0x18, %rcx, %rcx
jmp 0x6cb48
cmpb $0x47, 0x1(%rbx)
jne 0x6cb4e
cmpl %ebp, 0x58(%rax)
jle 0x6cace
movq 0x68(%rax), %rax
movl %ebp, %ecx
shlq $0x5, %rcx
movq (%rax,%rcx), %r14
jmp 0x6cb6c
leaq 0x16d6e(%rip), %rsi     # 0x838c3
leaq 0x16d26(%rip), %rdx     # 0x83882
xorl %r14d, %r14d
pushq $0x3
popq %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x110c6
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_find_tag_id
int sam_hdr_find_tag_id(sam_hdr_t *bh,
                     const char *type,
                     const char *ID_key,
                     const char *ID_value,
                     const char *key,
                     kstring_t *ks) {
    sam_hrecs_t *hrecs;
    if (!bh || !type || !key)
        return -2;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -2;
        hrecs = bh->hrecs;
    }

    sam_hrec_type_t *ty = sam_hrecs_find_type_id(hrecs, type, ID_key, ID_value);
    if (!ty)
        return -1;

    sam_hrec_tag_t *tag = sam_hrecs_find_key(ty, key, NULL);
    if (!tag || !tag->str || tag->len < 4)
        return -1;

    ks->l = 0;
    if (kputsn(tag->str+3, tag->len-3, ks) == EOF) {
        return -2;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %r8, %r8
sete %al
pushq $-0x2
popq %rbp
orb %cl, %al
jne 0x6cc24
movq %r8, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movq %r9, (%rsp)
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x6cc18
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x6a8fd
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x6cc24
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6b93e
testq %rax, %rax
je 0x6cc24
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x6cc24
movl 0x10(%rax), %esi
cmpl $0x4, %esi
jl 0x6cc24
movq (%rsp), %rdx
andq $0x0, (%rdx)
addq $0x3, %rdi
addl $-0x3, %esi
callq 0x6cc3e
xorl %ecx, %ecx
cmpl $-0x1, %eax
setne %cl
leal -0x2(,%rcx,2), %ebp
jmp 0x6cc24
movq %rbx, %rdi
callq 0x6933d
testl %eax, %eax
je 0x6cc35
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rbx), %rdi
jmp 0x6cbba
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/header.c
// Function: sam_hdr_find_tag_pos
int sam_hdr_find_tag_pos(sam_hdr_t *bh,
                     const char *type,
                     int pos,
                     const char *key,
                     kstring_t *ks) {
    sam_hrecs_t *hrecs;
    if (!bh || !type || !key)
        return -2;

    if (!(hrecs = bh->hrecs)) {
        if (sam_hdr_fill_hrecs(bh) != 0)
            return -2;
        hrecs = bh->hrecs;
    }

    sam_hrec_type_t *ty = sam_hrecs_find_type_pos(hrecs, type, pos);
    if (!ty)
        return -1;

    sam_hrec_tag_t *tag = sam_hrecs_find_key(ty, key, NULL);
    if (!tag || !tag->str || tag->len < 4)
        return -1;

    ks->l = 0;
    if (kputsn(tag->str+3, tag->len-3, ks) == EOF) {
        return -2;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
testq %r14, %r14
sete %al
pushq $-0x2
popq %rbp
orb %cl, %al
jne 0x6cd46
movq %r8, %rbx
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r13
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x6cd3a
movq %r12, %rsi
movl %r15d, %edx
callq 0x6abce
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x6cd46
movq %rax, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6b93e
testq %rax, %rax
je 0x6cd46
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x6cd46
movl 0x10(%rax), %esi
cmpl $0x4, %esi
jl 0x6cd46
andq $0x0, (%rbx)
addq $0x3, %rdi
addl $-0x3, %esi
movq %rbx, %rdx
callq 0x6cc3e
xorl %ecx, %ecx
cmpl $-0x1, %eax
setne %cl
leal -0x2(,%rcx,2), %ebp
jmp 0x6cd46
movq %r13, %rdi
callq 0x6933d
testl %eax, %eax
je 0x6cd57
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r13), %rdi
jmp 0x6cce0