LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/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
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
orb %al, %cl
jne 0x8b1e6
movq %rsi, %rbx
movq %rdi, %r15
cmpq $0x0, 0x38(%rdi)
je 0x8b1be
movzbl (%rbx), %eax
cmpl $0x50, %eax
je 0x8b1d3
cmpl $0x52, %eax
je 0x8b1cc
cmpl $0x53, %eax
jne 0x8b18e
movl $0x28, %eax
cmpb $0x51, 0x1(%rbx)
je 0x8b1de
movq 0x38(%r15), %rdi
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x881f0
testq %rax, %rax
je 0x8b1e6
xorl %r14d, %r14d
movq %rax, %rcx
movq (%rcx), %rcx
incl %r14d
testq %rcx, %rcx
je 0x8b1e6
cmpq %rax, %rcx
jne 0x8b1ac
jmp 0x8b1e6
movq %r15, %rdi
callq 0x866a8
testl %eax, %eax
jne 0x8b1e6
jmp 0x8b171
movl $0x40, %eax
jmp 0x8b1d8
movl $0x58, %eax
cmpb $0x47, 0x1(%rbx)
jne 0x8b18e
movq 0x38(%r15), %rcx
movl (%rcx,%rax), %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x8b57c
xorl %r14d, %r14d
jmp 0x8b618
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x8b5b0
movzbl (%rbx), %ecx
cmpl $0x50, %ecx
je 0x8b5dd
cmpl $0x52, %ecx
je 0x8b5c2
cmpl $0x53, %ecx
jne 0x8b5f8
cmpb $0x51, 0x1(%rbx)
jne 0x8b5f8
cmpl %ebp, 0x28(%rax)
jle 0x8b574
movq 0x30(%rax), %rax
jmp 0x8b5d1
movq %r14, %rdi
callq 0x866a8
testl %eax, %eax
jne 0x8b574
movq 0x38(%r14), %rax
jmp 0x8b58d
cmpb $0x47, 0x1(%rbx)
jne 0x8b5f8
cmpl %ebp, 0x40(%rax)
jle 0x8b574
movq 0x48(%rax), %rax
movl %ebp, %ecx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx,8), %r14
jmp 0x8b618
cmpb $0x47, 0x1(%rbx)
jne 0x8b5f8
cmpl %ebp, 0x58(%rax)
jle 0x8b574
movq 0x68(%rax), %rax
movl %ebp, %ecx
shlq $0x5, %rcx
movq (%rax,%rcx), %r14
jmp 0x8b618
leaq 0x19255(%rip), %rsi     # 0xa4854
leaq 0x1920d(%rip), %rdx     # 0xa4813
xorl %r14d, %r14d
movl $0x3, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x14378
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
orb %cl, %al
jne 0x8b795
movq %r8, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movq %r9, (%rsp)
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x8b6b1
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x881f0
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x8b795
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x8b6c7
movb (%r14), %cl
movq (%rsp), %r8
movq 0x8(%rax), %rdx
cmpb %cl, (%rdx)
jne 0x8b6a5
movb 0x1(%rdx), %dl
cmpb 0x1(%r14), %dl
je 0x8b6cd
movq (%rax), %rax
testq %rax, %rax
jne 0x8b694
xorl %eax, %eax
jmp 0x8b6cd
movq %rbx, %rdi
callq 0x866a8
testl %eax, %eax
jne 0x8b795
movq 0x38(%rbx), %rdi
jmp 0x8b668
xorl %eax, %eax
movq (%rsp), %r8
testq %rax, %rax
je 0x8b795
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x8b795
movslq 0x10(%rax), %r14
cmpq $0x4, %r14
jl 0x8b795
movq $0x0, (%r8)
movq %r14, %rax
decq %rax
je 0x8b785
cmpq %rax, 0x8(%r8)
jae 0x8b745
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %ebx, %ebx
testq %rcx, %rcx
cmoveq %rdx, %rbx
addq %rax, %rbx
movq 0x10(%r8), %rdi
movq %rbx, %rsi
callq 0x4840
movq (%rsp), %r8
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rax, %rax
je 0x8b795
movq %rax, 0x10(%r8)
movq %rbx, 0x8(%r8)
addq $0x3, %r15
addq $-0x3, %r14
movq 0x10(%r8), %rdi
addq (%r8), %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %r8, %rbx
callq 0x43c0
movq %r14, %rax
addq (%rbx), %rax
movq %rax, (%rbx)
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
xorl %eax, %eax
cmpl $-0x1, %r14d
setne %al
leal -0x2(,%rax,2), %ebp
jmp 0x8b795
callq 0x4050
movl $0x4b, (%rax)
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/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
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
orb %cl, %al
jne 0x8b8ec
movq %r8, %rbx
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r13
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x8b8e0
movq %r12, %rsi
movl %r15d, %edx
callq 0x88700
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x8b8ec
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x8b82c
movb (%r14), %cl
movq 0x8(%rax), %rdx
cmpb %cl, (%rdx)
jne 0x8b824
movb 0x1(%rdx), %dl
cmpb 0x1(%r14), %dl
je 0x8b82e
movq (%rax), %rax
testq %rax, %rax
jne 0x8b813
xorl %eax, %eax
testq %rax, %rax
je 0x8b8ec
movq 0x8(%rax), %r15
testq %r15, %r15
je 0x8b8ec
movslq 0x10(%rax), %r14
cmpq $0x4, %r14
jl 0x8b8ec
movq $0x0, (%rbx)
movq %r14, %rax
decq %rax
je 0x8b906
cmpq %rax, 0x8(%rbx)
jae 0x8b8a3
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r12d, %r12d
testq %rcx, %rcx
cmoveq %rdx, %r12
addq %rax, %r12
movq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0x4840
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rax, %rax
je 0x8b8ec
movq %rax, 0x10(%rbx)
movq %r12, 0x8(%rbx)
addq $0x3, %r15
addq $-0x3, %r14
movq 0x10(%rbx), %rdi
addq (%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x43c0
movq %r14, %rax
addq (%rbx), %rax
movq %rax, (%rbx)
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
xorl %eax, %eax
cmpl $-0x1, %r14d
setne %al
leal -0x2(,%rax,2), %ebp
jmp 0x8b8ec
movq %r13, %rdi
callq 0x866a8
testl %eax, %eax
je 0x8b8fd
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r13), %rdi
jmp 0x8b7ee
callq 0x4050
movl $0x4b, (%rax)
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
jmp 0x8b8ec
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hdr_remove_tag_id
int sam_hdr_remove_tag_id(sam_hdr_t *bh,
        const char *type,
        const char *ID_key,
        const char *ID_value,
        const char *key) {
    sam_hrecs_t *hrecs;
    if (!bh || !type || !key)
        return -1;

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

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

    int ret = sam_hrecs_remove_key(hrecs, ty, key);
    if (!ret && hrecs->dirty)
        redact_header_text(bh);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r13
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %dl
orb %al, %dl
testq %r8, %r8
sete %al
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
orb %dl, %al
jne 0x8b9a1
movq %r8, %r15
movq %rsi, %rbp
movq %rdi, %r14
movq 0x38(%rdi), %r12
testq %r12, %r12
je 0x8b991
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x881f0
testq %rax, %rax
je 0x8b9a1
movq %r12, %rdi
movq %rax, %rsi
movq %r15, %rdx
callq 0x8b9bc
movl %eax, %ebx
testl %eax, %eax
jne 0x8b9a1
cmpl $0x0, 0x90(%r12)
je 0x8b9a1
movq %r14, %rdi
callq 0x879db
jmp 0x8b9a1
movq %rcx, (%rsp)
movq %r14, %rdi
callq 0x866a8
testl %eax, %eax
je 0x8b9b2
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r14), %r12
movq (%rsp), %rcx
jmp 0x8b955
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hdr_name2tid
int sam_hdr_name2tid(sam_hdr_t *bh, const char *ref) {
    sam_hrecs_t *hrecs;
    khint_t k;

    if (!bh)
        return -1;

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

    if (!hrecs->ref_hash)
        return -1;

    k = kh_get(m_s2i, hrecs->ref_hash, ref);
    return k == kh_end(hrecs->ref_hash) ? -1 : kh_val(hrecs->ref_hash, k);
}

// Assembly:
testq %rdi, %rdi
je 0x8bc98
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x8bc9e
movq 0x38(%rax), %rdx
testq %rdx, %rdx
je 0x8bcbb
movl (%rdx), %ecx
testl %ecx, %ecx
je 0x8bcc5
movq %rcx, 0x10(%rsp)
leal -0x1(%rcx), %esi
movb (%rbx), %cl
testb %cl, %cl
movq %rbx, 0x20(%rsp)
je 0x8bccd
leaq 0x1(%rbx), %rax
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r13d, %ecx
imull $0x1000193, %ecx, %r13d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x8bc80
jmp 0x8bcd3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movq %r14, %rdi
callq 0x866a8
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
jne 0x8bd72
movq 0x38(%r14), %rax
jmp 0x8bc54
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x8bd72
xorl %r15d, %r15d
jmp 0x8bd5e
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
andl %esi, %r13d
movq 0x10(%rdx), %rdi
movl $0x1, %r14d
movl %r13d, %r15d
movl %esi, 0xc(%rsp)
movq %rdi, 0x18(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r12d
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %r12d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x8bd4c
testb $0x1, %al
jne 0x8bd34
movq 0x18(%rdx), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x20(%rsp), %rsi
movq %rdx, %rbx
callq 0x46c0
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
movq %rbx, %rdx
testl %eax, %eax
je 0x8bd4c
addl %r14d, %r15d
andl %esi, %r15d
incl %r14d
cmpl %r13d, %r15d
jne 0x8bcec
movq 0x10(%rsp), %rcx
movl %ecx, %r15d
jmp 0x8bd5e
movl %ebp, %ecx
shrl %cl, %r12d
testb $0x3, %r12b
movq 0x10(%rsp), %rcx
cmovnel %ecx, %r15d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %r15d
je 0x8bd72
movq 0x20(%rdx), %rax
movl %r15d, %ecx
movl (%rax,%rcx,4), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hdr_tid2name
const char *sam_hdr_tid2name(const sam_hdr_t *h, int tid) {
    sam_hrecs_t *hrecs;

    if (!h || tid < 0)
        return NULL;

    if ((hrecs = h->hrecs) != NULL && tid < hrecs->nref) {
        return hrecs->ref[tid].name;
    } else {
        if (tid < h->n_targets)
            return h->target_name[tid];
    }

    return NULL;
}

// Assembly:
testq %rdi, %rdi
sete %al
testl %esi, %esi
sets %cl
orb %al, %cl
jne 0x8bdc0
movq 0x38(%rdi), %rcx
testq %rcx, %rcx
je 0x8bdae
cmpl %esi, 0x28(%rcx)
jle 0x8bdae
movl %esi, %eax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x30(%rcx), %rax
jmp 0x8bdbc
cmpl %esi, (%rdi)
jle 0x8bdc0
movl %esi, %eax
shlq $0x3, %rax
addq 0x20(%rdi), %rax
movq (%rax), %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hdr_tid2len
hts_pos_t sam_hdr_tid2len(const sam_hdr_t *h, int tid) {
    sam_hrecs_t *hrecs;

    if (!h || tid < 0)
        return 0;

    if ((hrecs = h->hrecs) != NULL && tid < hrecs->nref) {
        return hrecs->ref[tid].len;
    } else {
        if (tid < h->n_targets) {
            if (h->target_len[tid] < UINT32_MAX || !h->sdict) {
                return h->target_len[tid];
            } else {
                khash_t(s2i) *long_refs = (khash_t(s2i) *) h->sdict;
                khint_t k = kh_get(s2i, long_refs, h->target_name[tid]);
                if (k < kh_end(long_refs)) {
                    return kh_val(long_refs, k);
                } else {
                    return UINT32_MAX;
                }
            }
        }
    }

    return 0;
}

// Assembly:
testq %rdi, %rdi
sete %al
testl %esi, %esi
sets %cl
orb %al, %cl
je 0x8bdd5
xorl %eax, %eax
retq
pushq %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x8bdf5
cmpl %esi, 0x28(%rax)
jle 0x8bdf5
movq 0x30(%rax), %rax
movl %esi, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%rax,%rcx,8), %rax
jmp 0x8be3e
cmpl %esi, (%rdi)
jle 0x8be3c
movq 0x10(%rdi), %rax
movl %esi, %ecx
movl (%rax,%rcx,4), %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rdx, %rax
jne 0x8be3e
movq 0x30(%rdi), %rbx
testq %rbx, %rbx
je 0x8be3e
movq 0x20(%rdi), %rax
movq (%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x11074
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl (%rbx), %ecx
jae 0x8be3e
movq 0x20(%rbx), %rax
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
jmp 0x8be3e
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hrecs_find_rg
sam_hrec_rg_t *sam_hrecs_find_rg(sam_hrecs_t *hrecs, const char *rg) {
    khint_t k = kh_get(m_s2i, hrecs->rg_hash, rg);
    return k == kh_end(hrecs->rg_hash)
        ? NULL
        : &hrecs->rg[kh_val(hrecs->rg_hash, k)];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x50(%rdi), %rax
movq %rax, (%rsp)
movl (%rax), %eax
testl %eax, %eax
je 0x8ca3c
movq %rsi, %r14
movq %rdi, 0x18(%rsp)
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %edx
movb (%rsi), %cl
testb %cl, %cl
je 0x8ca44
leaq 0x1(%r14), %rax
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %ebx, %ecx
imull $0x1000193, %ecx, %ebx  # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x8ca26
jmp 0x8ca49
xorl %r12d, %r12d
jmp 0x8cad8
movl $0x811c9dc5, %ebx       # imm = 0x811C9DC5
andl %edx, %ebx
movq (%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r15d
movl %ebx, %r12d
movl %edx, 0xc(%rsp)
movq %rdi, 0x20(%rsp)
movl %r12d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r13d
leal (%r12,%r12), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x8cac1
testb $0x1, %al
jne 0x8caa9
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x46c0
movq 0x20(%rsp), %rdi
movl 0xc(%rsp), %edx
testl %eax, %eax
je 0x8cac1
addl %r15d, %r12d
andl %edx, %r12d
incl %r15d
cmpl %ebx, %r12d
jne 0x8ca65
movq 0x10(%rsp), %rax
movl %eax, %r12d
jmp 0x8cad3
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x10(%rsp), %rax
cmovnel %eax, %r12d
movq 0x18(%rsp), %rdi
cmpl %eax, %r12d
jne 0x8cae1
xorl %eax, %eax
jmp 0x8cafc
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r12d, %ecx
movslq (%rax,%rcx,4), %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x48(%rdi), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hrecs_sort_order
enum sam_sort_order sam_hrecs_sort_order(sam_hrecs_t *hrecs) {
    khint_t k;
    enum sam_sort_order so;

    so = ORDER_UNKNOWN;
    k = kh_get(sam_hrecs_t, hrecs->h, TYPEKEY("HD"));
    if (k != kh_end(hrecs->h)) {
        sam_hrec_type_t *ty = kh_val(hrecs->h, k);
        sam_hrec_tag_t *tag;
        for (tag = ty->tag; tag; tag = tag->next) {
            if (tag->str[0] == 'S' && tag->str[1] == 'O') {
                if (strcmp(tag->str+3, "unsorted") == 0)
                    so = ORDER_UNSORTED;
                else if (strcmp(tag->str+3, "queryname") == 0)
                    so = ORDER_NAME;
                else if (strcmp(tag->str+3, "coordinate") == 0)
                    so = ORDER_COORD;
                else if (strcmp(tag->str+3, "unknown") != 0)
                    hts_log_error("Unknown sort order field: %s", tag->str+3);
            }
        }
    }

    return so;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rax
movl (%rax), %edx
testl %edx, %edx
je 0x8cb85
leal -0x1(%rdx), %edi
movl %edi, %r8d
andl $0x4844, %r8d           # imm = 0x4844
movq 0x10(%rax), %r9
movl $0x1, %r10d
movl %r8d, %esi
movl %esi, %ecx
shrl $0x4, %ecx
movl (%r9,%rcx,4), %r11d
leal (%rsi,%rsi), %ecx
andl $0x1e, %ecx
movl %r11d, %ebx
shrl %cl, %ebx
testb $0x2, %bl
jne 0x8cb79
testb $0x1, %bl
jne 0x8cb68
movq 0x18(%rax), %rbx
movl %esi, %r14d
cmpl $0x4844, (%rbx,%r14,4)  # imm = 0x4844
je 0x8cb79
addl %r10d, %esi
andl %edi, %esi
incl %r10d
cmpl %r8d, %esi
jne 0x8cb39
movl %edx, %esi
jmp 0x8cb87
shrl %cl, %r11d
testb $0x3, %r11b
cmovnel %edx, %esi
jmp 0x8cb87
xorl %esi, %esi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl %edx, %esi
je 0x8cc50
movq 0x20(%rax), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %r13
testq %r13, %r13
je 0x8cc50
leaq 0x17df0(%rip), %r14     # 0xa49a2
leaq 0x17df2(%rip), %r15     # 0xa49ab
leaq 0x17df5(%rip), %r12     # 0xa49b5
movq 0x8(%r13), %rbp
cmpb $0x53, (%rbp)
jne 0x8cc43
cmpb $0x4f, 0x1(%rbp)
jne 0x8cc43
addq $0x3, %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8cc33
movq %rbp, %rdi
movq %r15, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8cc37
movq %rbp, %rdi
movq %r12, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8cc3e
movq %rbp, %rdi
leaq 0xb5f9(%rip), %rsi      # 0x98204
callq 0x46c0
testl %eax, %eax
je 0x8cc43
movl $0x1, %edi
leaq 0x17da0(%rip), %rsi     # 0xa49c0
leaq 0x17dae(%rip), %rdx     # 0xa49d5
movq %rbp, %rcx
xorl %eax, %eax
callq 0x14378
jmp 0x8cc43
xorl %ebx, %ebx
jmp 0x8cc43
movl $0x1, %ebx
jmp 0x8cc43
movl $0x2, %ebx
movq (%r13), %r13
testq %r13, %r13
jne 0x8cbc0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hrecs_group_order
enum sam_group_order sam_hrecs_group_order(sam_hrecs_t *hrecs) {
    khint_t k;
    enum sam_group_order go;

    go = ORDER_NONE;
    k = kh_get(sam_hrecs_t, hrecs->h, TYPEKEY("HD"));
    if (k != kh_end(hrecs->h)) {
        sam_hrec_type_t *ty = kh_val(hrecs->h, k);
        sam_hrec_tag_t *tag;
        for (tag = ty->tag; tag; tag = tag->next) {
            if (tag->str[0] == 'G' && tag->str[1] == 'O') {
                if (strcmp(tag->str+3, "query") == 0)
                    go = ORDER_QUERY;
                else if (strcmp(tag->str+3, "reference") == 0)
                    go = ORDER_REFERENCE;
            }
        }
    }

    return go;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rax
movl (%rax), %edx
testl %edx, %edx
je 0x8ccdb
leal -0x1(%rdx), %edi
movl %edi, %r8d
andl $0x4844, %r8d           # imm = 0x4844
movq 0x10(%rax), %r9
movl $0x1, %r10d
movl %r8d, %esi
movl %esi, %ecx
shrl $0x4, %ecx
movl (%r9,%rcx,4), %r11d
leal (%rsi,%rsi), %ecx
andl $0x1e, %ecx
movl %r11d, %ebx
shrl %cl, %ebx
testb $0x2, %bl
jne 0x8cccf
testb $0x1, %bl
jne 0x8ccbe
movq 0x18(%rax), %rbx
movl %esi, %r14d
cmpl $0x4844, (%rbx,%r14,4)  # imm = 0x4844
je 0x8cccf
addl %r10d, %esi
andl %edi, %esi
incl %r10d
cmpl %r8d, %esi
jne 0x8cc8f
movl %edx, %esi
jmp 0x8ccdd
shrl %cl, %r11d
testb $0x3, %r11b
cmovnel %edx, %esi
jmp 0x8ccdd
xorl %esi, %esi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl %edx, %esi
je 0x8cd4f
movq 0x20(%rax), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %r13
testq %r13, %r13
je 0x8cd4f
leaq 0xe3f7(%rip), %r14      # 0x9b0f7
leaq 0x1182d(%rip), %r15     # 0x9e534
movl $0x1, %ebp
movq 0x8(%r13), %r12
cmpb $0x47, (%r12)
jne 0x8cd46
cmpb $0x4f, 0x1(%r12)
jne 0x8cd46
addq $0x3, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8cd44
movq %r12, %rdi
movq %r15, %rsi
callq 0x46c0
testl %eax, %eax
cmovel %ebp, %ebx
jmp 0x8cd46
xorl %ebx, %ebx
movq (%r13), %r13
testq %r13, %r13
jne 0x8cd0c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hrecs_add
static int sam_hrecs_add(sam_hrecs_t *hrecs, const char *type, ...) {
    va_list args;
    int res;
    va_start(args, type);
    res = sam_hrecs_vadd(hrecs, type, args, NULL);
    va_end(args);
    return res;
}

// Assembly:
subq $0xd8, %rsp
leaq 0x20(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x8d264
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)
movq %rsp, %rdx
movq %rsi, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
leaq 0xdf30(%rip), %rsi      # 0x9b1bb
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x87b3b
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hrecs_free_tags
static void sam_hrecs_free_tags(sam_hrecs_t *hrecs, sam_hrec_tag_t *tag) {
    if (!hrecs || !tag)
        return;
    if (tag->next)
        sam_hrecs_free_tags(hrecs, tag->next);

    pool_free(hrecs->tag_pool, tag);
}

// Assembly:
testq %rsi, %rsi
je 0x8d2ce
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x8d2bb
movq %r14, %rdi
callq 0x8d29c
movq 0x20(%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5a8fd
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/header.c
// Function: sam_hrecs_add_ref_altnames
static int sam_hrecs_add_ref_altnames(sam_hrecs_t *hrecs, int nref, const char *list) {
    const char *token;
    ks_tokaux_t aux;

    if (!list)
        return 0;

    for (token = kstrtok(list, ",", &aux); token; token = kstrtok(NULL, NULL, &aux)) {
        if (aux.p == token)
            continue;

        char *name = string_ndup(hrecs->str_pool, token, aux.p - token);
        if (!name)
            return -1;
        int r;
        khint_t k = kh_put(m_s2i, hrecs->ref_hash, name, &r);
        if (r < 0) return -1;

        if (r > 0)
            kh_val(hrecs->ref_hash, k) = nref;
        else if (kh_val(hrecs->ref_hash, k) != nref)
            hts_log_warning("Duplicate entry AN:\"%s\" in sam header", name);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %r13d, %r13d
testq %rdx, %rdx
je 0x8d704
movl %esi, %ebx
movq %rdi, %r14
leaq 0xd85c(%rip), %rsi      # 0x9aeb8
leaq 0x8(%rsp), %rax
movq %rdx, %rdi
movq %rax, %rdx
callq 0x9b2f
testq %rax, %rax
je 0x8d704
leaq 0x8(%rsp), %r15
leaq 0x4(%rsp), %r12
movq 0x30(%rsp), %rdx
subq %rax, %rdx
je 0x8d6ec
movq 0x10(%r14), %rdi
movq %rax, %rsi
callq 0x5aab0
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x8d704
movq %rax, %rbp
movq 0x38(%r14), %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x89a57
cmpl $0x0, 0x4(%rsp)
js 0x8d704
movq 0x38(%r14), %rcx
movq 0x20(%rcx), %rcx
movl %eax, %eax
je 0x8d6ca
movl %ebx, (%rcx,%rax,4)
jmp 0x8d6ec
cmpl %ebx, (%rcx,%rax,4)
je 0x8d6ec
movl $0x3, %edi
leaq 0x1788e(%rip), %rsi     # 0xa4f69
leaq 0x178a2(%rip), %rdx     # 0xa4f84
movq %rbp, %rcx
xorl %eax, %eax
callq 0x14378
xorl %r13d, %r13d
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
callq 0x9b2f
testq %rax, %rax
jne 0x8d67f
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/md5.c
// Function: hts_md5_update
void hts_md5_update(hts_md5_context *ctx, const void *data, unsigned long size)
{
	hts_md5_u32plus saved_lo;
	unsigned long used, available;

	saved_lo = ctx->lo;
	if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
		ctx->hi++;
	ctx->hi += size >> 29;

	used = saved_lo & 0x3f;

	if (used) {
		available = 64 - used;

		if (size < available) {
			memcpy(&ctx->buffer[used], data, size);
			return;
		}

		memcpy(&ctx->buffer[used], data, available);
		data = (const unsigned char *)data + available;
		size -= available;
		body(ctx, ctx->buffer, 64);
	}

	if (size >= 64) {
		data = body(ctx, data, size & ~(unsigned long)0x3f);
		size &= 0x3f;
	}

	memcpy(ctx->buffer, data, size);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl (%rdi), %eax
leal (%rdx,%rax), %ecx
andl $0x1fffffff, %ecx       # imm = 0x1FFFFFFF
movl %ecx, (%rdi)
cmpl %eax, %ecx
jae 0x8d74f
incl 0x4(%r14)
movq %rdx, %rcx
shrq $0x1d, %rcx
addl %ecx, 0x4(%r14)
andq $0x3f, %rax
je 0x8d77e
movl $0x40, %r12d
subq %rax, %r12
movq %rdx, %r15
leaq (%r14,%rax), %rdi
addq $0x18, %rdi
subq %r12, %r15
jae 0x8d783
movq %rbx, %rsi
jmp 0x8d7d1
movq %rdx, %r15
jmp 0x8d7a5
leaq 0x18(%r14), %r13
movq %rbx, %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, %rbx
movl $0x40, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x8d7df
cmpq $0x40, %r15
jb 0x8d7c4
movq %r15, %rdx
andq $-0x40, %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8d7df
movq %rax, %rbx
andl $0x3f, %r15d
addq $0x18, %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x43c0
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/md5.c
// Function: hts_md5_final
void hts_md5_final(unsigned char *result, hts_md5_context *ctx)
{
	unsigned long used, available;

	used = ctx->lo & 0x3f;

	ctx->buffer[used++] = 0x80;

	available = 64 - used;

	if (available < 8) {
		memset(&ctx->buffer[used], 0, available);
		body(ctx, ctx->buffer, 64);
		used = 0;
		available = 64;
	}

	memset(&ctx->buffer[used], 0, available - 8);

	ctx->lo <<= 3;
	ctx->buffer[56] = ctx->lo;
	ctx->buffer[57] = ctx->lo >> 8;
	ctx->buffer[58] = ctx->lo >> 16;
	ctx->buffer[59] = ctx->lo >> 24;
	ctx->buffer[60] = ctx->hi;
	ctx->buffer[61] = ctx->hi >> 8;
	ctx->buffer[62] = ctx->hi >> 16;
	ctx->buffer[63] = ctx->hi >> 24;

	body(ctx, ctx->buffer, 64);

	result[0] = ctx->a;
	result[1] = ctx->a >> 8;
	result[2] = ctx->a >> 16;
	result[3] = ctx->a >> 24;
	result[4] = ctx->b;
	result[5] = ctx->b >> 8;
	result[6] = ctx->b >> 16;
	result[7] = ctx->b >> 24;
	result[8] = ctx->c;
	result[9] = ctx->c >> 8;
	result[10] = ctx->c >> 16;
	result[11] = ctx->c >> 24;
	result[12] = ctx->d;
	result[13] = ctx->d >> 8;
	result[14] = ctx->d >> 16;
	result[15] = ctx->d >> 24;

	memset(ctx, 0, sizeof(*ctx));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %r12d
andl $0x3f, %r12d
leaq 0x18(%rsi), %r15
leaq 0x1(%r12), %rdi
movb $-0x80, 0x18(%rsi,%r12)
xorq $0x3f, %r12
cmpq $0x7, %r12
ja 0x8e08c
addq %r15, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x4260
movl $0x40, %r12d
movl $0x40, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8d7df
xorl %edi, %edi
addq %r15, %rdi
addq $-0x8, %r12
xorl %esi, %esi
movq %r12, %rdx
callq 0x4260
movl (%rbx), %eax
movl 0x4(%rbx), %ecx
leal (,%rax,8), %edx
movl %edx, (%rbx)
movb %dl, 0x50(%rbx)
movl %eax, %edx
shrl $0x5, %edx
movb %dl, 0x51(%rbx)
movl %eax, %edx
shrl $0xd, %edx
movb %dl, 0x52(%rbx)
shrl $0x15, %eax
movb %al, 0x53(%rbx)
movl %ecx, 0x54(%rbx)
movl $0x40, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x8d7df
movb 0x8(%rbx), %al
movb %al, (%r14)
movb 0x9(%rbx), %al
movb %al, 0x1(%r14)
movb 0xa(%rbx), %al
movb %al, 0x2(%r14)
movb 0xb(%rbx), %al
movb %al, 0x3(%r14)
movb 0xc(%rbx), %al
movb %al, 0x4(%r14)
movb 0xd(%rbx), %al
movb %al, 0x5(%r14)
movb 0xe(%rbx), %al
movb %al, 0x6(%r14)
movb 0xf(%rbx), %al
movb %al, 0x7(%r14)
movb 0x10(%rbx), %al
movb %al, 0x8(%r14)
movb 0x11(%rbx), %al
movb %al, 0x9(%r14)
movb 0x12(%rbx), %al
movb %al, 0xa(%r14)
movb 0x13(%rbx), %al
movb %al, 0xb(%r14)
movb 0x14(%rbx), %al
movb %al, 0xc(%r14)
movb 0x15(%rbx), %al
movb %al, 0xd(%r14)
movb 0x16(%rbx), %al
movb %al, 0xe(%r14)
movb 0x17(%rbx), %al
movb %al, 0xf(%r14)
movl $0x98, %edx
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4260
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/md5.c
// Function: hts_md5_init
hts_md5_context *hts_md5_init(void)
{
    hts_md5_context *ctx = malloc(sizeof(*ctx));
    if (!ctx)
        return NULL;

    hts_md5_reset(ctx);
    return ctx;
}

// Assembly:
pushq %rax
movl $0x98, %edi
callq 0x4680
testq %rax, %rax
je 0x8e184
movaps 0x16f09(%rip), %xmm0    # 0xa5080
movups %xmm0, 0x8(%rax)
movq $0x0, (%rax)
jmp 0x8e186
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/md5.c
// Function: hts_md5_hex
void hts_md5_hex(char *hex, const unsigned char *digest)
{
    int i;
    for (i = 0; i < 16; i++) {
        hex[i*2+0] = "0123456789abcdef"[(digest[i]>>4)&0xf];
        hex[i*2+1] = "0123456789abcdef"[digest[i]&0xf];
    }
    hex[32] = 0;
}

// Assembly:
xorl %eax, %eax
leaq 0xe2fd(%rip), %rcx      # 0x9c498
movzbl (%rsi,%rax), %edx
shrl $0x4, %edx
movb (%rdx,%rcx), %dl
movb %dl, (%rdi,%rax,2)
movzbl (%rsi,%rax), %edx
andl $0xf, %edx
movb (%rdx,%rcx), %dl
movb %dl, 0x1(%rdi,%rax,2)
incq %rax
cmpq $0x10, %rax
jne 0x8e19b
movb $0x0, 0x20(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_external_decode_int
int cram_external_decode_int(cram_slice *slice, cram_codec *c,
                             cram_block *in, char *out, int *out_size) {
    char *cp;
    cram_block *b;

    /* Find the external block */
    b = cram_get_block_by_id(slice, c->u.external.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = (char *)b->data + b->idx;
    // E_INT and E_LONG are guaranteed single item queries
    int err = 0;
    *(int32_t *)out = c->vv->varint_get32(&cp, (char *)b->data + b->uncomp_size, &err);
    b->idx = cp - (char *)b->data;
    *out_size = 1;

    return err ? -1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq %rcx, %r14
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setae %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
sete %r8b
orb %dl, %r8b
jne 0x8e1f9
movq (%rcx,%rax,8), %r13
jmp 0x8e271
testq %rcx, %rcx
je 0x8e22e
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rax, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %eax, %r8d
subl %edx, %r8d
shll $0x3, %r8d
movq 0x800(%rcx,%r8), %r13
testq %r13, %r13
je 0x8e22e
cmpl %eax, 0xc(%r13)
je 0x8e271
movq (%rdi), %rcx
movslq 0x28(%rcx), %rcx
testq %rcx, %rcx
jle 0x8e26e
movq 0x10(%rdi), %rdx
xorl %edi, %edi
movq (%rdx,%rdi,8), %r8
testq %r8, %r8
je 0x8e25e
cmpl $0x4, 0x8(%r8)
jne 0x8e25e
cmpl %eax, 0xc(%r8)
jne 0x8e25e
xorl %r9d, %r9d
movq %r8, %r13
jmp 0x8e261
movb $0x1, %r9b
testb %r9b, %r9b
je 0x8e271
incq %rdi
cmpq %rdi, %rcx
jne 0x8e240
xorl %r13d, %r13d
testq %r13, %r13
je 0x8e2c4
movq 0x20(%r13), %rax
movslq 0x1c(%r13), %rcx
addq %rax, %rcx
leaq 0x8(%rsp), %r15
movq %rcx, (%r15)
leaq 0x4(%rsp), %r12
movl $0x0, (%r12)
movq 0x10(%rsi), %rcx
movslq 0x14(%r13), %rsi
addq %rax, %rsi
movq %r15, %rdi
movq %r12, %rdx
callq *0x18(%rcx)
movl %eax, (%r14)
movl (%r15), %eax
subl 0x20(%r13), %eax
movl %eax, 0x1c(%r13)
movl $0x1, (%rbx)
movl (%r12), %ecx
jmp 0x8e2c6
movl (%rbx), %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_external_decode_char
int cram_external_decode_char(cram_slice *slice, cram_codec *c,
                              cram_block *in, char *out,
                              int *out_size) {
    char *cp;
    cram_block *b;

    /* Find the external block */
    b = cram_get_block_by_id(slice, c->u.external.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = cram_extract_block(b, *out_size);
    if (!cp)
        return -1;

    if (out)
        memcpy(out, cp, *out_size);
    return 0;
}

// Assembly:
pushq %rbx
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setae %sil
movq 0x18(%rdi), %rdx
testq %rdx, %rdx
sete %r9b
orb %sil, %r9b
jne 0x8e414
movq (%rdx,%rax,8), %rdx
jmp 0x8e48b
testq %rdx, %rdx
je 0x8e448
movl $0x828cbfbf, %esi       # imm = 0x828CBFBF
imulq %rax, %rsi
shrq $0x27, %rsi
imull $0xfb, %esi, %esi
movl %eax, %r9d
subl %esi, %r9d
shll $0x3, %r9d
movq 0x800(%rdx,%r9), %rdx
testq %rdx, %rdx
je 0x8e448
cmpl %eax, 0xc(%rdx)
je 0x8e48b
movq (%rdi), %rdx
movslq 0x28(%rdx), %rsi
testq %rsi, %rsi
jle 0x8e489
movq 0x10(%rdi), %rdi
xorl %r9d, %r9d
movq (%rdi,%r9,8), %r10
testq %r10, %r10
je 0x8e479
cmpl $0x4, 0x8(%r10)
jne 0x8e479
cmpl %eax, 0xc(%r10)
jne 0x8e479
xorl %r11d, %r11d
movq %r10, %rdx
jmp 0x8e47c
movb $0x1, %r11b
testb %r11b, %r11b
je 0x8e48b
incq %r9
cmpq %r9, %rsi
jne 0x8e45b
xorl %edx, %edx
movl (%r8), %edi
testq %rdx, %rdx
je 0x8e4ce
movq 0x20(%rdx), %rsi
movslq 0x1c(%rdx), %rax
addl %eax, %edi
movl %edi, 0x1c(%rdx)
cmpl 0x14(%rdx), %edi
setg %dl
testq %rsi, %rsi
sete %dil
orb %dl, %dil
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jne 0x8e4d4
xorl %ebx, %ebx
testq %rcx, %rcx
je 0x8e4d4
addq %rax, %rsi
movslq (%r8), %rdx
movq %rcx, %rdi
callq 0x43c0
jmp 0x8e4d4
xorl %ebx, %ebx
negl %edi
sbbl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_external_decode_size
int cram_external_decode_size(cram_slice *slice, cram_codec *c) {
    cram_block *b;

    /* Find the external block */
    b = cram_get_block_by_id(slice, c->u.external.content_id);
    if (!b)
        return -1;

    return b->uncomp_size;
}

// Assembly:
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setae %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
jne 0x8e504
movq (%rcx,%rax,8), %rcx
jmp 0x8e577
testq %rcx, %rcx
je 0x8e535
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rax, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %eax, %esi
subl %edx, %esi
shll $0x3, %esi
movq 0x800(%rcx,%rsi), %rcx
testq %rcx, %rcx
je 0x8e535
cmpl %eax, 0xc(%rcx)
je 0x8e577
movq (%rdi), %rcx
movslq 0x28(%rcx), %rdx
testq %rdx, %rdx
jle 0x8e575
movq 0x10(%rdi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %r8
testq %r8, %r8
je 0x8e565
cmpl $0x4, 0x8(%r8)
jne 0x8e565
cmpl %eax, 0xc(%r8)
jne 0x8e565
xorl %r9d, %r9d
movq %r8, %rcx
jmp 0x8e568
movb $0x1, %r9b
testb %r9b, %r9b
je 0x8e577
incq %rdi
cmpq %rdi, %rdx
jne 0x8e547
xorl %ecx, %ecx
testq %rcx, %rcx
je 0x8e580
movl 0x14(%rcx), %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_external_decode_block
static int cram_external_decode_block(cram_slice *slice, cram_codec *c,
                                      cram_block *in, char *out_,
                                      int *out_size) {
    char *cp;
    cram_block *out = (cram_block *)out_;
    cram_block *b = NULL;

    /* Find the external block */
    b = cram_get_block_by_id(slice, c->u.external.content_id);
    if (!b)
        return *out_size?-1:0;

    cp = cram_extract_block(b, *out_size);
    if (!cp)
        return -1;

    BLOCK_APPEND(out, cp, *out_size);
    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setae %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
jne 0x8e79e
movq (%rcx,%rax,8), %rcx
jmp 0x8e811
testq %rcx, %rcx
je 0x8e7cf
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rax, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %eax, %esi
subl %edx, %esi
shll $0x3, %esi
movq 0x800(%rcx,%rsi), %rcx
testq %rcx, %rcx
je 0x8e7cf
cmpl %eax, 0xc(%rcx)
je 0x8e811
movq (%rdi), %rcx
movslq 0x28(%rcx), %rdx
testq %rdx, %rdx
jle 0x8e80f
movq 0x10(%rdi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %r9
testq %r9, %r9
je 0x8e7ff
cmpl $0x4, 0x8(%r9)
jne 0x8e7ff
cmpl %eax, 0xc(%r9)
jne 0x8e7ff
xorl %r10d, %r10d
movq %r9, %rcx
jmp 0x8e802
movb $0x1, %r10b
testb %r10b, %r10b
je 0x8e811
incq %rdi
cmpq %rdi, %rdx
jne 0x8e7e1
xorl %ecx, %ecx
movl (%r8), %eax
testq %rcx, %rcx
je 0x8e8aa
movq 0x20(%rcx), %r14
movslq 0x1c(%rcx), %r13
addl %r13d, %eax
movl %eax, 0x1c(%rcx)
cmpl 0x14(%rcx), %eax
setg %al
testq %r14, %r14
sete %cl
orb %al, %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0x8e8b0
movslq (%r8), %r15
movq 0x30(%rbx), %r12
addq %r15, %r12
movq 0x28(%rbx), %rax
cmpq %r12, %rax
ja 0x8e887
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r12, %rax
cmovaq %rax, %r12
movq 0x20(%rbx), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x8e8b0
movq %r12, 0x28(%rbx)
movq %rax, 0x20(%rbx)
xorl %ebp, %ebp
testl %r15d, %r15d
je 0x8e8b0
addq %r13, %r14
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
jmp 0x8e8b0
xorl %ebp, %ebp
negl %eax
sbbl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_external_encode_char
int cram_external_encode_char(cram_slice *slice, cram_codec *c,
                              char *in, int in_size) {
    BLOCK_APPEND(c->out, in, in_size);
    return 0;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movq %rdx, %r14
movq 0x8(%rsi), %r12
movslq %ecx, %rbx
movq 0x30(%r12), %r15
addq %rbx, %r15
movq 0x28(%r12), %rax
cmpq %r15, %rax
ja 0x8e96c
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r15, %rax
cmovaq %rax, %r15
movq 0x20(%r12), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x8e98f
movq %r15, 0x28(%r12)
movq %rax, 0x20(%r12)
xorl %r15d, %r15d
testl %ebp, %ebp
je 0x8e995
movq 0x20(%r12), %rdi
addq 0x30(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x30(%r12)
jmp 0x8e995
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_external_encode_store
int cram_external_encode_store(cram_codec *c, cram_block *b, char *prefix,
                               int version) {
    char tmp[99], *tp = tmp, *tpend = tmp+99;
    int len = 0, r = 0, n;

    if (prefix) {
        size_t l = strlen(prefix);
        BLOCK_APPEND(b, prefix, l);
        len += l;
    }

    tp += c->vv->varint_put32(tp, tpend, c->u.e_external.content_id);
    len += (n = c->vv->varint_put32_blk(b, c->codec)); r |= n;
    len += (n = c->vv->varint_put32_blk(b, tp-tmp));   r |= n;
    BLOCK_APPEND(b, tmp, tp-tmp);
    len += tp-tmp;

    if (r > 0)
        return len;

 block_err:
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x8ea50
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8ea1e
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8eb28
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r15, %r15
je 0x8ea3a
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
xorl %ecx, %ecx
xorl %edx, %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %cl, %cl
cmovel %r15d, %edx
je 0x8ea52
jmp 0x8eb19
xorl %edx, %edx
movl %edx, 0xc(%rsp)
leaq 0x73(%rsp), %rsi
movq 0x10(%r14), %rax
movl 0x60(%r14), %edx
leaq 0x10(%rsp), %rdi
callq *0x38(%rax)
movl %eax, %ebp
movslq %eax, %r12
movq 0x10(%r14), %rax
movl (%r14), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, %r15d
movq 0x10(%r14), %rax
movq %rbx, %rdi
movl %r12d, %esi
callq *0x58(%rax)
movl %eax, %r14d
movq 0x30(%rbx), %r13
addq %r12, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8ead4
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r13, %rax
cmovaq %rax, %r13
movq 0x20(%rbx), %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x8eaf6
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
movb $0x1, %r13b
testl %ebp, %ebp
je 0x8eaf9
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, 0x30(%rbx)
jmp 0x8eaf9
xorl %r13d, %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %r13b, %r13b
je 0x8eb19
movl %r14d, %ecx
orl %r15d, %ecx
movl 0xc(%rsp), %ecx
jle 0x8eb19
addl %ecx, %ebp
addl %r15d, %ebp
addl %r14d, %ebp
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %cl
jmp 0x8ea3c
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_external_encode_init
cram_codec *cram_external_encode_init(cram_stats *st,
                                      enum cram_encoding codec,
                                      enum cram_external_type option,
                                      void *dat,
                                      int version, varint_vec *vv) {
    cram_codec *c;

    c = malloc(sizeof(*c));
    if (!c)
        return NULL;
    c->codec = E_EXTERNAL;
    c->free = cram_external_encode_free;
    if (CRAM_MAJOR_VERS(version) >= 4) {
        // Version 4 does not permit integer data to be encoded as a
        // series of bytes.  This is used purely for bytes, either
        // singular or declared as arrays
        switch (codec) {
        case E_EXTERNAL:
            if (option != E_BYTE && option != E_BYTE_ARRAY)
                return NULL;
            c->encode = cram_external_encode_char;
            break;
        default:
            return NULL;
        }
    } else {
        // CRAM 3 and earlier encodes integers as EXTERNAL.  We need
        // use the option field to indicate the input data format so
        // we know which serialisation format to use.
        if (option == E_INT)
            c->encode = cram_external_encode_int;
        else if (option == E_LONG)
            c->encode = cram_external_encode_long;
        else if (option == E_BYTE_ARRAY || option == E_BYTE)
            c->encode = cram_external_encode_char;
        else
            abort();
    }
    c->store = cram_external_encode_store;
    c->flush = NULL;

    c->u.e_external.content_id = (size_t)dat;

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %r15d
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x8eb7e
movl $0x1, (%rax)
leaq -0x1bc(%rip), %rcx      # 0x8e9a1
movq %rcx, 0x20(%rax)
cmpl $0x400, %r15d           # imm = 0x400
jl 0x8eb82
cmpl $0x1, %r14d
setne %cl
addl $-0x5, %ebp
cmpl $-0x2, %ebp
setb %dl
orb %cl, %dl
je 0x8eba6
xorl %eax, %eax
jmp 0x8ebc7
cmpl $0x1, %ebp
je 0x8eb95
cmpl $0x2, %ebp
jne 0x8eb9e
leaq -0x2ac(%rip), %rcx      # 0x8e8e7
jmp 0x8ebad
leaq -0x2db(%rip), %rcx      # 0x8e8c1
jmp 0x8ebad
addl $-0x3, %ebp
cmpl $0x2, %ebp
jae 0x8ebd2
leaq -0x29e(%rip), %rcx      # 0x8e90f
movq %rcx, 0x30(%rax)
leaq -0x20d(%rip), %rcx      # 0x8e9ab
movq %rcx, 0x38(%rax)
movq $0x0, 0x48(%rax)
movl %ebx, 0x60(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x4270