LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 0x88e53
movq %r8, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movq %r9, (%rsp)
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x88e47
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x85b55
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x88e53
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x88e53
movb (%r14), %cl
movq (%rsp), %rsi
movq 0x8(%rax), %r15
cmpb %cl, (%r15)
jne 0x88e3d
movb 0x1(%r15), %dl
cmpb 0x1(%r14), %dl
je 0x88e6a
movq (%rax), %rax
testq %rax, %rax
jne 0x88e2a
jmp 0x88e53
movq %rbx, %rdi
callq 0x8413e
testl %eax, %eax
je 0x88e64
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rbx), %rdi
jmp 0x88e02
movl 0x10(%rax), %r14d
cmpl $0x4, %r14d
jl 0x88e53
movq $0x0, (%rsi)
addl $-0x3, %r14d
leaq 0x2(%r14), %rax
cmpq %rax, 0x8(%rsi)
jae 0x88ebc
movq %rax, %rbx
shrq %rbx
addq %rax, %rbx
movq 0x10(%rsi), %rdi
movq %rbx, %rsi
callq 0x4840
movq (%rsp), %rcx
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rax, %rax
je 0x88e53
movq %rax, 0x10(%rcx)
movq %rbx, 0x8(%rcx)
movq (%rcx), %rdi
movq %rcx, %rbx
jmp 0x88ec5
movq 0x10(%rsi), %rax
xorl %edi, %edi
movq %rsi, %rbx
addq %rax, %rdi
addq $0x3, %r15
movq %r15, %rsi
movq %r14, %rdx
callq 0x43c0
addq (%rbx), %r14
movq %r14, (%rbx)
movq 0x10(%rbx), %rax
movb $0x0, (%rax,%r14)
xorl %ebp, %ebp
jmp 0x88e53
// File: /workspace/github_c_makefile_star2_O3/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 0x88f77
movq %r8, %rbx
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r13
movq 0x38(%rdi), %rdi
testq %rdi, %rdi
je 0x88f6b
movq %r12, %rsi
movl %r15d, %edx
callq 0x86074
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x88f77
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x88f77
movb (%r14), %cl
movq 0x8(%rax), %r15
cmpb %cl, (%r15)
jne 0x88f61
movb 0x1(%r15), %dl
cmpb 0x1(%r14), %dl
je 0x88f8e
movq (%rax), %rax
testq %rax, %rax
jne 0x88f4e
jmp 0x88f77
movq %r13, %rdi
callq 0x8413e
testl %eax, %eax
je 0x88f88
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r13), %rdi
jmp 0x88f2d
movl 0x10(%rax), %r14d
cmpl $0x4, %r14d
jl 0x88f77
movq $0x0, (%rbx)
addl $-0x3, %r14d
leaq 0x2(%r14), %rax
cmpq %rax, 0x8(%rbx)
jae 0x88fd9
movq %rax, %r12
shrq %r12
addq %rax, %r12
movq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0x4840
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
testq %rax, %rax
je 0x88f77
movq %rax, 0x10(%rbx)
movq %r12, 0x8(%rbx)
movq (%rbx), %rdi
jmp 0x88fdf
movq 0x10(%rbx), %rax
xorl %edi, %edi
addq %rax, %rdi
addq $0x3, %r15
movq %r15, %rsi
movq %r14, %rdx
callq 0x43c0
addq (%rbx), %r14
movq %r14, (%rbx)
movq 0x10(%rbx), %rax
movb $0x0, (%rax,%r14)
xorl %ebp, %ebp
jmp 0x88f77
// File: /workspace/github_c_makefile_star2_O3/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, %r12
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %dl
orb %al, %dl
testq %r8, %r8
sete %al
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
orb %dl, %al
jne 0x89091
movq %r8, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x38(%rdi), %r13
testq %r13, %r13
je 0x89081
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x85b55
testq %rax, %rax
je 0x89091
movq %r13, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x890ac
movl %eax, %ebp
testl %eax, %eax
jne 0x89091
xorl %ebp, %ebp
cmpl $0x0, 0x90(%r13)
je 0x89091
movq %rbx, %rdi
callq 0x853ed
jmp 0x89091
movq %rcx, (%rsp)
movq %rbx, %rdi
callq 0x8413e
testl %eax, %eax
je 0x890a2
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rbx), %r13
movq (%rsp), %rcx
jmp 0x89044
// File: /workspace/github_c_makefile_star2_O3/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 0x89360
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 0x89366
movq 0x38(%rax), %rdx
testq %rdx, %rdx
je 0x89400
movl (%rdx), %ecx
testl %ecx, %ecx
je 0x89383
movq %rcx, 0x10(%rsp)
leal -0x1(%rcx), %esi
movb (%rbx), %cl
testb %cl, %cl
movq %rbx, 0x20(%rsp)
je 0x8938b
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 0x89348
jmp 0x89391
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movq %r14, %rdi
callq 0x8413e
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
jne 0x8942d
movq 0x38(%r14), %rax
jmp 0x89318
xorl %r15d, %r15d
jmp 0x89419
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 0x89407
testb $0x1, %al
jne 0x893f2
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 0x89407
addl %r14d, %r15d
andl %esi, %r15d
incl %r14d
cmpl %r13d, %r15d
jne 0x893aa
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x8942d
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 0x8942d
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_O3/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 0x8947b
movq 0x38(%rdi), %rcx
testq %rcx, %rcx
je 0x89469
cmpl %esi, 0x28(%rcx)
jle 0x89469
movl %esi, %eax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
addq 0x30(%rcx), %rax
jmp 0x89477
cmpl %esi, (%rdi)
jle 0x8947b
movl %esi, %eax
shlq $0x3, %rax
addq 0x20(%rdi), %rax
movq (%rax), %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x89490
xorl %eax, %eax
retq
pushq %rbx
movq 0x38(%rdi), %rax
testq %rax, %rax
je 0x894b0
cmpl %esi, 0x28(%rax)
jle 0x894b0
movq 0x30(%rax), %rax
movl %esi, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%rax,%rcx,8), %rax
jmp 0x894f9
cmpl %esi, (%rdi)
jle 0x894f7
movq 0x10(%rdi), %rax
movl %esi, %ecx
movl (%rax,%rcx,4), %eax
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpq %rdx, %rax
jne 0x894f9
movq 0x30(%rdi), %rbx
testq %rbx, %rbx
je 0x894f9
movq 0x20(%rdi), %rax
movq (%rax,%rcx,8), %rsi
movq %rbx, %rdi
callq 0x10e38
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl (%rbx), %ecx
jae 0x894f9
movq 0x20(%rbx), %rax
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
jmp 0x894f9
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8a0b3
movq %rsi, %r14
movq %rax, 0x10(%rsp)
leal -0x1(%rax), %edx
movb (%rsi), %cl
testb %cl, %cl
movq %rdi, 0x18(%rsp)
je 0x8a0bb
leaq 0x1(%r14), %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 0x8a09b
jmp 0x8a0c1
xorl %r15d, %r15d
jmp 0x8a145
movl $0x811c9dc5, %r13d      # imm = 0x811C9DC5
andl %edx, %r13d
movq (%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %r12d
movl %r13d, %r15d
movl %edx, 0xc(%rsp)
movq %rdi, 0x20(%rsp)
movl %r15d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %ebx
leal (%r15,%r15), %ebp
andl $0x1e, %ebp
movl %ebx, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x8a130
testb $0x1, %al
jne 0x8a120
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r15d, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x46c0
movq 0x20(%rsp), %rdi
movl 0xc(%rsp), %edx
testl %eax, %eax
je 0x8a130
addl %r12d, %r15d
andl %edx, %r15d
incl %r12d
cmpl %r13d, %r15d
jne 0x8a0de
jmp 0x8a14a
movl %ebp, %ecx
shrl %cl, %ebx
testb $0x3, %bl
movq 0x10(%rsp), %rax
cmovnel %eax, %r15d
movq 0x18(%rsp), %rdi
cmpl %eax, %r15d
jne 0x8a14e
xorl %eax, %eax
jmp 0x8a169
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r15d, %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_O3/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 0x8a1f8
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 0x8a1ec
testb $0x1, %bl
jne 0x8a1d5
movq 0x18(%rax), %rbx
movl %esi, %r14d
cmpl $0x4844, (%rbx,%r14,4)  # imm = 0x4844
je 0x8a1ec
addl %r10d, %esi
andl %edi, %esi
incl %r10d
cmpl %r8d, %esi
jne 0x8a1a6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x8a2c3
shrl %cl, %r11d
testb $0x3, %r11b
cmovnel %edx, %esi
jmp 0x8a1fa
xorl %esi, %esi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl %edx, %esi
je 0x8a2c3
movq 0x20(%rax), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %r13
testq %r13, %r13
je 0x8a2c3
leaq 0x17efc(%rip), %r14     # 0xa2121
leaq 0x17efe(%rip), %r15     # 0xa212a
leaq 0x17f01(%rip), %r12     # 0xa2134
movq 0x8(%r13), %rbp
cmpb $0x53, (%rbp)
jne 0x8a2b6
cmpb $0x4f, 0x1(%rbp)
jne 0x8a2b6
addq $0x3, %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8a2a6
movq %rbp, %rdi
movq %r15, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8a2aa
movq %rbp, %rdi
movq %r12, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8a2b1
movq %rbp, %rdi
leaq 0xafc6(%rip), %rsi      # 0x95244
callq 0x46c0
testl %eax, %eax
je 0x8a2b6
movl $0x1, %edi
leaq 0x17eac(%rip), %rsi     # 0xa213f
leaq 0x17eba(%rip), %rdx     # 0xa2154
movq %rbp, %rcx
xorl %eax, %eax
callq 0x13de5
jmp 0x8a2b6
xorl %ebx, %ebx
jmp 0x8a2b6
movl $0x1, %ebx
jmp 0x8a2b6
movl $0x2, %ebx
movq (%r13), %r13
testq %r13, %r13
jne 0x8a233
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_O3/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 0x8a354
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 0x8a348
testb $0x1, %bl
jne 0x8a331
movq 0x18(%rax), %rbx
movl %esi, %r14d
cmpl $0x4844, (%rbx,%r14,4)  # imm = 0x4844
je 0x8a348
addl %r10d, %esi
andl %edi, %esi
incl %r10d
cmpl %r8d, %esi
jne 0x8a302
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x8a3c8
shrl %cl, %r11d
testb $0x3, %r11b
cmovnel %edx, %esi
jmp 0x8a356
xorl %esi, %esi
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl %edx, %esi
je 0x8a3c8
movq 0x20(%rax), %rax
movl %esi, %ecx
movq (%rax,%rcx,8), %rax
movq 0x20(%rax), %r13
testq %r13, %r13
je 0x8a3c8
leaq 0xdd91(%rip), %r14      # 0x9810a
leaq 0x113ac(%rip), %r15     # 0x9b72c
movl $0x1, %ebp
movq 0x8(%r13), %r12
cmpb $0x47, (%r12)
jne 0x8a3bf
cmpb $0x4f, 0x1(%r12)
jne 0x8a3bf
addq $0x3, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x46c0
testl %eax, %eax
je 0x8a3bd
movq %r12, %rdi
movq %r15, %rsi
callq 0x46c0
testl %eax, %eax
cmovel %ebp, %ebx
jmp 0x8a3bf
xorl %ebx, %ebx
movq (%r13), %r13
testq %r13, %r13
jne 0x8a385
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_O3/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 0x8a8b8
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 0xeb23(%rip), %rsi      # 0x99402
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x85555
addq $0xd8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8a922
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x8a90f
movq %r14, %rdi
callq 0x8a8f0
movq 0x20(%r14), %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x57e84
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8ad1d
movl %esi, %ebx
movq %rdi, %r14
leaq 0xd256(%rip), %rsi      # 0x97ecb
leaq 0x8(%rsp), %rax
movq %rdx, %rdi
movq %rax, %rdx
callq 0x9b3b
testq %rax, %rax
je 0x8ad1d
leaq 0x8(%rsp), %r15
leaq 0x4(%rsp), %r12
movq 0x30(%rsp), %rdx
subq %rax, %rdx
je 0x8ad05
movq 0x10(%r14), %rdi
movq %rax, %rsi
callq 0x5801b
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x8ad1d
movq %rax, %rbp
movq 0x38(%r14), %rdi
movq %rax, %rsi
movq %r12, %rdx
callq 0x8732d
cmpl $0x0, 0x4(%rsp)
js 0x8ad1d
movq 0x38(%r14), %rcx
movq 0x20(%rcx), %rcx
movl %eax, %eax
je 0x8ace3
movl %ebx, (%rcx,%rax,4)
jmp 0x8ad05
cmpl %ebx, (%rcx,%rax,4)
je 0x8ad05
movl $0x3, %edi
leaq 0x179f4(%rip), %rsi     # 0xa26e8
leaq 0x17a08(%rip), %rdx     # 0xa2703
movq %rbp, %rcx
xorl %eax, %eax
callq 0x13de5
xorl %r13d, %r13d
xorl %edi, %edi
xorl %esi, %esi
movq %r15, %rdx
callq 0x9b3b
testq %rax, %rax
jne 0x8ac98
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_O3/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 %rdi, %rbx
movl (%rdi), %eax
leal (%rdx,%rax), %ecx
andl $0x1fffffff, %ecx       # imm = 0x1FFFFFFF
movl %ecx, (%rdi)
movq %rdx, %rdi
shrq $0x1d, %rdi
cmpl %eax, %ecx
adcl %edi, 0x4(%rbx)
movq %rsi, %r14
andq $0x3f, %rax
je 0x8ad95
movl $0x40, %r12d
subq %rax, %r12
movq %rdx, %r15
leaq (%rbx,%rax), %rdi
addq $0x18, %rdi
subq %r12, %r15
jae 0x8ad9a
movq %r14, %rsi
jmp 0x8ade8
movq %rdx, %r15
jmp 0x8adbc
leaq 0x18(%rbx), %r13
movq %r14, %rsi
movq %r12, %rdx
callq 0x43c0
addq %r12, %r14
movl $0x40, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8adf6
cmpq $0x40, %r15
jb 0x8addb
movq %r15, %rdx
andq $-0x40, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8adf6
movq %rax, %r14
andl $0x3f, %r15d
addq $0x18, %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x43c0
// File: /workspace/github_c_makefile_star2_O3/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 0x8b79f
movabsq $0x1032547698badcfe, %rcx # imm = 0x1032547698BADCFE
movq %rcx, 0x10(%rax)
movaps 0x17064(%rip), %xmm0    # 0xa2800
movups %xmm0, (%rax)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/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 0xdd60(%rip), %rcx      # 0x99514
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 0x8b7b4
movb $0x0, 0x20(%rdi)
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/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
setb %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
setne %r8b
testb %r8b, %dl
je 0x8b81d
movq (%rcx,%rax,8), %r13
testq %r13, %r13
jne 0x8b852
jmp 0x8b8d0
testq %rcx, %rcx
je 0x8b8a0
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 0x8b8a0
cmpl %eax, 0xc(%r13)
jne 0x8b8a0
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 0x8b8d2
movq (%rdi), %rcx
movslq 0x28(%rcx), %rcx
testq %rcx, %rcx
jle 0x8b8d0
movq 0x10(%rdi), %rdx
xorl %edi, %edi
movq (%rdx,%rdi,8), %r13
testq %r13, %r13
je 0x8b8c8
cmpl $0x4, 0x8(%r13)
jne 0x8b8c8
cmpl %eax, 0xc(%r13)
je 0x8b852
incq %rdi
cmpq %rdi, %rcx
jne 0x8b8b2
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_O3/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
setb %sil
movq 0x18(%rdi), %rdx
testq %rdx, %rdx
setne %r9b
testb %r9b, %sil
je 0x8ba18
movq (%rdx,%rax,8), %rdx
testq %rdx, %rdx
jne 0x8ba4c
jmp 0x8bab9
testq %rdx, %rdx
je 0x8ba8a
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 0x8ba8a
cmpl %eax, 0xc(%rdx)
jne 0x8ba8a
movq 0x20(%rdx), %rsi
movslq 0x1c(%rdx), %rax
movl (%r8), %edi
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 0x8bac0
xorl %ebx, %ebx
testq %rcx, %rcx
je 0x8bac0
addq %rax, %rsi
movslq (%r8), %rdx
movq %rcx, %rdi
callq 0x43c0
jmp 0x8bac0
movq (%rdi), %rdx
movslq 0x28(%rdx), %rsi
testq %rsi, %rsi
jle 0x8bab9
movq 0x10(%rdi), %rdi
xorl %r9d, %r9d
movq (%rdi,%r9,8), %rdx
testq %rdx, %rdx
je 0x8bab1
cmpl $0x4, 0x8(%rdx)
jne 0x8bab1
cmpl %eax, 0xc(%rdx)
je 0x8ba4c
incq %r9
cmpq %r9, %rsi
jne 0x8ba9d
xorl %ebx, %ebx
cmpl (%r8), %ebx
sbbl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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), %ecx
cmpq $0x100, %rcx            # imm = 0x100
setb %dl
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %sil
testb %sil, %dl
je 0x8bafa
movq (%rax,%rcx,8), %rsi
testq %rsi, %rsi
jne 0x8bb2b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
testq %rax, %rax
je 0x8bb2f
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rcx, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %ecx, %esi
subl %edx, %esi
shll $0x3, %esi
movq 0x800(%rax,%rsi), %rsi
testq %rsi, %rsi
je 0x8bb2f
cmpl %ecx, 0xc(%rsi)
jne 0x8bb2f
movl 0x14(%rsi), %eax
retq
movq (%rdi), %rax
movslq 0x28(%rax), %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdx, %rdx
jle 0x8bb63
movq 0x10(%rdi), %rdi
xorl %r8d, %r8d
movq (%rdi,%r8,8), %rsi
testq %rsi, %rsi
je 0x8bb5b
cmpl $0x4, 0x8(%rsi)
jne 0x8bb5b
cmpl %ecx, 0xc(%rsi)
je 0x8bb2b
incq %r8
cmpq %r8, %rdx
jne 0x8bb47
retq
// File: /workspace/github_c_makefile_star2_O3/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
setb %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
setne %sil
testb %sil, %dl
je 0x8bd71
movq (%rcx,%rax,8), %rcx
testq %rcx, %rcx
jne 0x8bdae
jmp 0x8be74
testq %rcx, %rcx
je 0x8be42
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 0x8be42
cmpl %eax, 0xc(%rcx)
jne 0x8be42
movq 0x20(%rcx), %r14
movslq 0x1c(%rcx), %r13
movl (%r8), %eax
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 0x8be7b
movslq (%r8), %r15
movq 0x30(%rbx), %r12
addq %r15, %r12
movq 0x28(%rbx), %rax
cmpq %r12, %rax
ja 0x8be1f
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 0x8be7b
movq %r12, 0x28(%rbx)
movq %rax, 0x20(%rbx)
xorl %ebp, %ebp
testl %r15d, %r15d
je 0x8be7b
addq %r13, %r14
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x43c0
addq %r15, 0x30(%rbx)
jmp 0x8be7b
movq (%rdi), %rcx
movslq 0x28(%rcx), %rdx
testq %rdx, %rdx
jle 0x8be74
movq 0x10(%rdi), %rsi
xorl %edi, %edi
movq (%rsi,%rdi,8), %rcx
testq %rcx, %rcx
je 0x8be6c
cmpl $0x4, 0x8(%rcx)
jne 0x8be6c
cmpl %eax, 0xc(%rcx)
je 0x8bdae
incq %rdi
cmpq %rdi, %rdx
jne 0x8be54
xorl %ebp, %ebp
cmpl (%r8), %ebp
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_O3/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 0x8bf37
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 0x8bf5a
movq %r15, 0x28(%r12)
movq %rax, 0x20(%r12)
xorl %r15d, %r15d
testl %ebp, %ebp
je 0x8bf60
movq 0x20(%r12), %rdi
addq 0x30(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x43c0
addq %rbx, 0x30(%r12)
jmp 0x8bf60
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_O3/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, %r15
testq %rdx, %rdx
je 0x8c008
movq %rdx, %r12
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r14
movq 0x30(%rbx), %r13
addq %rax, %r13
movq 0x28(%rbx), %rax
cmpq %r13, %rax
ja 0x8bfe5
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 0x8c0c0
movq %r13, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testq %r14, %r14
je 0x8c001
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x43c0
addq %r14, 0x30(%rbx)
movq %r14, 0x8(%rsp)
jmp 0x8c011
movq $0x0, 0x8(%rsp)
leaq 0x73(%rsp), %rsi
movq 0x10(%r15), %rax
movl 0x60(%r15), %edx
leaq 0x10(%rsp), %rdi
callq *0x38(%rax)
movl %eax, %ebp
movslq %eax, %r13
movq 0x10(%r15), %rax
movl (%r15), %esi
movq %rbx, %rdi
callq *0x58(%rax)
movl %eax, %r12d
movq 0x10(%r15), %rax
movq %rbx, %rdi
movl %r13d, %esi
callq *0x58(%rax)
movl %eax, %r15d
movq 0x30(%rbx), %r14
addq %r13, %r14
movq 0x28(%rbx), %rax
cmpq %r14, %rax
ja 0x8c08f
leaq 0x320(%rax), %rcx
shrq $0x2, %rcx
addq %rcx, %rax
addq $0x320, %rax            # imm = 0x320
cmpq %r14, %rax
cmovaq %rax, %r14
movq 0x20(%rbx), %rdi
movq %r14, %rsi
callq 0x4840
testq %rax, %rax
je 0x8c0c0
movq %r14, 0x28(%rbx)
movq %rax, 0x20(%rbx)
testl %ebp, %ebp
je 0x8c0ac
movq 0x20(%rbx), %rdi
addq 0x30(%rbx), %rdi
leaq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0x43c0
addq %r13, 0x30(%rbx)
movl %r15d, %eax
orl %r12d, %eax
jle 0x8c0c0
addl 0x8(%rsp), %ebp
addl %r12d, %ebp
addl %r15d, %ebp
jmp 0x8c0c5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x8c125
movl $0x1, (%rax)
leaq -0x198(%rip), %rcx      # 0x8bf6c
movq %rcx, 0x20(%rax)
cmpl $0x400, %r15d           # imm = 0x400
jl 0x8c129
cmpl $0x1, %r14d
setne %cl
addl $-0x5, %ebp
cmpl $-0x2, %ebp
setb %dl
orb %cl, %dl
je 0x8c14d
xorl %eax, %eax
jmp 0x8c16e
cmpl $0x1, %ebp
je 0x8c13c
cmpl $0x2, %ebp
jne 0x8c145
leaq -0x288(%rip), %rcx      # 0x8beb2
jmp 0x8c154
leaq -0x2b7(%rip), %rcx      # 0x8be8c
jmp 0x8c154
addl $-0x3, %ebp
cmpl $0x2, %ebp
jae 0x8c179
leaq -0x27a(%rip), %rcx      # 0x8beda
movq %rcx, 0x30(%rax)
leaq -0x1e9(%rip), %rcx      # 0x8bf76
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
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_int
int cram_varint_decode_int(cram_slice *slice, cram_codec *c,
                           cram_block *in, char *out, int *out_size) {
    char *cp;
    cram_block *b;

    /* Find the data block */
    b = cram_get_block_by_id(slice, c->u.varint.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) + c->u.varint.offset;
    b->idx = cp - (char *)b->data;
    *out_size = 1;

    return err ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setb %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
setne %sil
testb %sil, %dl
je 0x8c1bf
movq (%rcx,%rax,8), %rbp
testq %rbp, %rbp
jne 0x8c1f0
jmp 0x8c270
testq %rcx, %rcx
je 0x8c242
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), %rbp
testq %rbp, %rbp
je 0x8c242
cmpl %eax, 0xc(%rbp)
jne 0x8c242
movq 0x20(%rbp), %rax
movslq 0x1c(%rbp), %rcx
addq %rax, %rcx
leaq 0x10(%rsp), %r12
movq %rcx, (%r12)
leaq 0xc(%rsp), %r13
movl $0x0, (%r13)
movq 0x10(%r15), %rcx
movslq 0x14(%rbp), %rsi
addq %rax, %rsi
movq %r12, %rdi
movq %r13, %rdx
callq *0x18(%rcx)
addl 0x68(%r15), %eax
movl %eax, (%r14)
movl (%r12), %eax
subl 0x20(%rbp), %eax
movl %eax, 0x1c(%rbp)
movl $0x1, (%rbx)
movl (%r13), %ecx
jmp 0x8c272
movq (%rdi), %rcx
movslq 0x28(%rcx), %rcx
testq %rcx, %rcx
jle 0x8c270
movq 0x10(%rdi), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rbp
testq %rbp, %rbp
je 0x8c268
cmpl $0x4, 0x8(%rbp)
jne 0x8c268
cmpl %eax, 0xc(%rbp)
je 0x8c1f0
incq %rsi
cmpq %rsi, %rcx
jne 0x8c254
movl (%rbx), %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_slong
int cram_varint_decode_slong(cram_slice *slice, cram_codec *c,
                             cram_block *in, char *out, int *out_size) {
    char *cp;
    cram_block *b;

    /* Find the data block */
    b = cram_get_block_by_id(slice, c->u.varint.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;
    *(int64_t *)out = c->vv->varint_get64s(&cp,
                                           (char *)b->data + b->uncomp_size,
                                           &err) + c->u.varint.offset;
    b->idx = cp - (char *)b->data;
    *out_size = 1;

    return err ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movl 0x60(%rsi), %eax
cmpq $0x100, %rax            # imm = 0x100
setb %dl
movq 0x18(%rdi), %rcx
testq %rcx, %rcx
setne %sil
testb %sil, %dl
je 0x8c4da
movq (%rcx,%rax,8), %rbp
testq %rbp, %rbp
jne 0x8c50b
jmp 0x8c58b
testq %rcx, %rcx
je 0x8c55d
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), %rbp
testq %rbp, %rbp
je 0x8c55d
cmpl %eax, 0xc(%rbp)
jne 0x8c55d
movq 0x20(%rbp), %rax
movslq 0x1c(%rbp), %rcx
addq %rax, %rcx
leaq 0x10(%rsp), %r12
movq %rcx, (%r12)
leaq 0xc(%rsp), %r13
movl $0x0, (%r13)
movq 0x10(%r15), %rcx
movslq 0x14(%rbp), %rsi
addq %rax, %rsi
movq %r12, %rdi
movq %r13, %rdx
callq *0x30(%rcx)
addq 0x68(%r15), %rax
movq %rax, (%r14)
movl (%r12), %eax
subl 0x20(%rbp), %eax
movl %eax, 0x1c(%rbp)
movl $0x1, (%rbx)
movl (%r13), %ecx
jmp 0x8c58d
movq (%rdi), %rcx
movslq 0x28(%rcx), %rcx
testq %rcx, %rcx
jle 0x8c58b
movq 0x10(%rdi), %rdx
xorl %esi, %esi
movq (%rdx,%rsi,8), %rbp
testq %rbp, %rbp
je 0x8c583
cmpl $0x4, 0x8(%rbp)
jne 0x8c583
cmpl %eax, 0xc(%rbp)
je 0x8c50b
incq %rsi
cmpq %rsi, %rcx
jne 0x8c56f
movl (%rbx), %ecx
xorl %eax, %eax
negl %ecx
sbbl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_size
int cram_varint_decode_size(cram_slice *slice, cram_codec *c) {
    cram_block *b;

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

    return b->uncomp_size;
}

// Assembly:
movl 0x60(%rsi), %ecx
cmpq $0x100, %rcx            # imm = 0x100
setb %dl
movq 0x18(%rdi), %rax
testq %rax, %rax
setne %sil
testb %sil, %dl
je 0x8c5d8
movq (%rax,%rcx,8), %rsi
testq %rsi, %rsi
jne 0x8c609
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
testq %rax, %rax
je 0x8c60d
movl $0x828cbfbf, %edx       # imm = 0x828CBFBF
imulq %rcx, %rdx
shrq $0x27, %rdx
imull $0xfb, %edx, %edx
movl %ecx, %esi
subl %edx, %esi
shll $0x3, %esi
movq 0x800(%rax,%rsi), %rsi
testq %rsi, %rsi
je 0x8c60d
cmpl %ecx, 0xc(%rsi)
jne 0x8c60d
movl 0x14(%rsi), %eax
retq
movq (%rdi), %rax
movslq 0x28(%rax), %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testq %rdx, %rdx
jle 0x8c641
movq 0x10(%rdi), %rdi
xorl %r8d, %r8d
movq (%rdi,%r8,8), %rsi
testq %rsi, %rsi
je 0x8c639
cmpl $0x4, 0x8(%rsi)
jne 0x8c639
cmpl %ecx, 0xc(%rsi)
je 0x8c609
incq %r8
cmpq %r8, %rdx
jne 0x8c625
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_describe
int cram_varint_describe(cram_codec *c, kstring_t *ks) {
    return ksprintf(ks, "VARINT(id=%d,offset=%"PRId64",type=%d)",
                    c->u.varint.content_id,
                    c->u.varint.offset,
                    c->u.varint.type)
        < 0 ? -1 : 0;
}

// Assembly:
pushq %rax
movq %rsi, %rax
movl 0x60(%rdi), %edx
movq 0x68(%rdi), %rcx
movl 0x70(%rdi), %r8d
leaq 0x1626b(%rip), %rsi     # 0xa2947
movq %rax, %rdi
xorl %eax, %eax
callq 0x9ab7
sarl $0x1f, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_codecs.c
// Function: cram_varint_decode_init
cram_codec *cram_varint_decode_init(cram_block_compression_hdr *hdr,
                                    char *data, int size,
                                    enum cram_encoding codec,
                                    enum cram_external_type option,
                                    int version, varint_vec *vv) {
    cram_codec *c;
    char *cp = data, *cp_end = data+size;

    if (!(c = malloc(sizeof(*c))))
        return NULL;

    c->codec  = codec;

    // Function pointer choice is theoretically by codec type.
    // Given we have some vars as int32 and some as int64 we
    // use option too for sizing, although on disk format
    // does not change.
    switch(codec) {
    case E_VARINT_UNSIGNED:
        c->decode = (option == E_INT)
            ? cram_varint_decode_int
            : cram_varint_decode_long;
        break;
    case E_VARINT_SIGNED:
        c->decode = (option == E_INT)
            ? cram_varint_decode_sint
            : cram_varint_decode_slong;
        break;
    default:
        return NULL;
    }

    c->free   = cram_varint_decode_free;
    c->size   = cram_varint_decode_size;
    c->get_block = cram_varint_get_block;
    c->describe = cram_varint_describe;

    c->u.varint.content_id = vv->varint_get32 (&cp, cp_end, NULL);
    c->u.varint.offset     = vv->varint_get64s(&cp, cp_end, NULL);

    if (cp - data != size) {
        fprintf(stderr, "Malformed varint header stream\n");
        free(c);
        return NULL;
    }

    c->u.varint.type = option;

    return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %r15d
movq %rsi, %r14
movq %rsi, (%rsp)
movl $0x880, %edi            # imm = 0x880
callq 0x4680
testq %rax, %rax
je 0x8c7d1
movq %rax, %rbx
movl %r12d, (%rax)
cmpl $0x2a, %r12d
je 0x8c742
cmpl $0x29, %r12d
jne 0x8c7d1
cmpl $0x1, %ebp
leaq -0x5bb(%rip), %rcx      # 0x8c17e
leaq -0x3b0(%rip), %rax      # 0x8c390
jmp 0x8c753
cmpl $0x1, %ebp
leaq -0x4c5(%rip), %rcx      # 0x8c287
leaq -0x2ba(%rip), %rax      # 0x8c499
cmoveq %rcx, %rax
movslq %r15d, %r13
leaq (%r14,%r13), %r15
movq %rax, 0x28(%rbx)
leaq -0x1c7(%rip), %rax      # 0x8c5a2
movq %rax, 0x20(%rbx)
leaq -0x1c8(%rip), %rax      # 0x8c5ac
movq %rax, 0x40(%rbx)
leaq -0x13d(%rip), %rax      # 0x8c642
movq %rax, 0x50(%rbx)
leaq -0xc4(%rip), %rax       # 0x8c6c6
movq %rax, 0x58(%rbx)
movq %rsp, %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq 0x40(%rsp), %rax
callq *0x18(%rax)
movl %eax, 0x60(%rbx)
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq 0x40(%rsp), %rax
callq *0x30(%rax)
movq %rax, 0x68(%rbx)
movq (%r12), %rax
subq %r14, %rax
cmpq %r13, %rax
jne 0x8c7c9
movl %ebp, 0x70(%rbx)
jmp 0x8c7d3
movq %rbx, %rdi
callq 0x4b79
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq