LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/kstring.h
// Function: kputw
static inline int kputw(int c, kstring_t *s)
{
    unsigned int x = c;
    if (c < 0) {
        x = -x;
        if (ks_resize(s, s->l + 3) < 0)
            return EOF;
        s->s[s->l++] = '-';
    }

    return kputuw(x, s);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
testl %edi, %edi
jns 0x6468
movq (%rbx), %rsi
addq $0x3, %rsi
movq %rbx, %rdi
callq 0x7d98
testl %eax, %eax
js 0x653c
negl %ebp
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movb $0x2d, (%rcx,%rax)
cmpl $0x9, %ebp
ja 0x64a6
movq (%rbx), %rsi
addq $0x2, %rsi
movq %rbx, %rdi
callq 0x7d98
testl %eax, %eax
js 0x653c
orb $0x30, %bpl
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movb %bpl, (%rcx,%rax)
movq 0x10(%rbx), %r14
addq (%rbx), %r14
jmp 0x6538
bsrl %ebp, %eax
xorl $0x1f, %eax
shll $0x2, %eax
leaq 0x6ebfa(%rip), %rcx     # 0x750b0
movl (%rax,%rcx), %r15d
leaq 0x6ec6f(%rip), %rcx     # 0x75130
xorl %r12d, %r12d
cmpl %ebp, (%rax,%rcx)
seta %r12b
movl %r15d, %r14d
subl %r12d, %r14d
movq (%rbx), %rax
leaq (%rax,%r14), %rsi
addq $0x2, %rsi
movq %rbx, %rdi
callq 0x7d98
testl %eax, %eax
js 0x653c
movq 0x10(%rbx), %rcx
addq (%rbx), %rcx
negl %r12d
leal (%r15,%r12), %esi
addl $-0x2, %esi
pushq $0x64
popq %rdi
leaq 0x7028d(%rip), %r8      # 0x76790
cmpl $0xa, %ebp
jb 0x6522
movl %ebp, %eax
xorl %edx, %edx
divl %edi
movl %esi, %r9d
movzwl (%r8,%rdx,2), %edx
movw %dx, (%rcx,%r9)
addl $-0x2, %esi
movl %eax, %ebp
jmp 0x6503
cmpl $-0x1, %esi
jne 0x652e
orb $0x30, %bpl
movb %bpl, (%rcx)
addq (%rbx), %r14
movq %r14, (%rbx)
addq 0x10(%rbx), %r14
movb $0x0, (%r14)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/khash_str2int.h
// Function: khash_str2int_set
static inline int khash_str2int_set(void *_hash, const char *str, int value)
{
    khint_t k;
    int ret;
    khash_t(str2int) *hash = (khash_t(str2int)*)_hash;
    if ( !hash ) return -1;
    k = kh_put(str2int, hash, str, &ret);
    if (ret < 0) return -1;
    kh_val(hash,k) = value;
    return k;
}

// Assembly:
testq %rdi, %rdi
je 0x6739
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
jb 0x65b3
movl (%r14), %esi
movl 0x4(%r14), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x65a1
decl %esi
jmp 0x65a3
incl %esi
movq %r14, %rdi
callq 0x83e6
testl %eax, %eax
js 0x672b
movl (%r14), %r12d
leal -0x1(%r12), %r13d
movq %r15, %rdi
callq 0x8668
movl %eax, %edi
andl %r13d, %edi
movq 0x10(%r14), %rdx
movl %edi, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %eax
leal (%rdi,%rdi), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x65e5
movl %edi, %r12d
jmp 0x66b7
movq %r15, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movl %ebx, 0xc(%rsp)
pushq $0x1
popq %r15
movl %edi, %ebx
movq %r12, 0x28(%rsp)
movq %rdi, 0x30(%rsp)
movl %r13d, 0x24(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %r14d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r14d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x6686
testb $0x1, %al
jne 0x6653
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
movq %rdx, %r13
callq 0x46c0
movq 0x30(%rsp), %rdi
movq %r13, %rdx
movl 0x24(%rsp), %r13d
testl %eax, %eax
je 0x6686
btl %ebp, %r14d
cmovbl %ebx, %r12d
addl %r15d, %ebx
andl %r13d, %ebx
incl %r15d
cmpl %edi, %ebx
jne 0x6608
movb $0x1, %al
movq 0x28(%rsp), %rsi
movl %esi, %ecx
cmpl %esi, %r12d
movl 0xc(%rsp), %ebx
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r15
je 0x66aa
jmp 0x66b7
movl %ebp, %ecx
shrl %cl, %r14d
testb $0x2, %r14b
sete %al
movl %r12d, %ecx
movl %ebx, %edi
movl 0xc(%rsp), %ebx
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r15
movq 0x28(%rsp), %rsi
cmpl %esi, %ecx
cmovel %edi, %ecx
testb %al, %al
cmovnel %edi, %ecx
movl %ecx, %r12d
movl %r12d, %eax
shrl $0x4, %eax
movl (%rdx,%rax,4), %edx
leal (%r12,%r12), %ecx
andl $0x1e, %ecx
shrl %cl, %edx
testb $0x2, %dl
jne 0x66d8
testb $0x1, %dl
jne 0x6707
movl %r12d, %edx
jmp 0x6724
movq 0x18(%r14), %rsi
movl %r12d, %edx
movq %r15, (%rsi,%rdx,8)
pushq $0x3
popq %rsi
shll %cl, %esi
notl %esi
movq 0x10(%r14), %rcx
andl %esi, (%rcx,%rax,4)
movq 0x4(%r14), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, 0x4(%r14)
jmp 0x6724
movq 0x18(%r14), %rsi
movl %r12d, %edx
movq %r15, (%rsi,%rdx,8)
pushq $0x3
popq %rsi
shll %cl, %esi
notl %esi
movq 0x10(%r14), %rcx
andl %esi, (%rcx,%rax,4)
incl 0x4(%r14)
movq 0x20(%r14), %rax
movl %ebx, (%rax,%rdx,4)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/annot-tsv.c
// Function: write_header
void write_header(args_t *args, dat_t *dat)
{
    if ( dat->hdr.dummy ) return;
    if ( args->no_write_hdr>1 ) return;
    int i;
    kstring_t str = {0,0,0};
    kputc('#', &str);
    for (i=0; i<dat->hdr.cols->n; i++)
    {
        if ( i>0 ) kputc(dat->delim, &str);
        if ( !args->no_write_hdr ) ksprintf(&str,"[%d]", i+1);
        kputs(dat->hdr.cols->off[i], &str);
    }
    if ( dat->hdr.annots )
    {
        for (i=0; i<dat->hdr.annots->n; i++)
        {
            if ( str.l > 1 ) kputc(dat->delim, &str);
            kputs(dat->hdr.annots->off[i], &str);
        }
    }
    kputc('\n',&str);
    if ( bgzf_write(args->out_fp, str.s, str.l) != str.l ) error("Failed to write %zd bytes\n", str.l);
    free(str.s);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
cmpl $0x0, 0x20(%rsi)
jne 0x6852
movq %rdi, %rbx
cmpl $0x1, 0x1a4(%rdi)
jg 0x6852
movq %rsi, %r14
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
pushq $0x23
popq %rdi
movq %r15, %rsi
callq 0x63ed
leaq 0x6ebfd(%rip), %r12     # 0x75382
xorl %r13d, %r13d
movq 0x10(%r14), %rax
movl (%rax), %eax
cmpq %rax, %r13
jae 0x67d8
testq %r13, %r13
je 0x67a5
movsbl 0x78(%r14), %edi
movq %r15, %rsi
callq 0x63ed
cmpl $0x0, 0x1a4(%rbx)
jne 0x67bf
leal 0x1(%r13), %edx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x8c78
movq 0x10(%r14), %rax
movq 0x8(%rax), %rax
movq (%rax,%r13,8), %rdi
movq %r15, %rsi
callq 0x686e
incq %r13
jmp 0x6788
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x681f
xorl %r12d, %r12d
movq %rsp, %r15
movl (%rax), %ecx
cmpq %rcx, %r12
jae 0x681f
cmpq $0x2, (%rsp)
jb 0x6806
movsbl 0x78(%r14), %edi
movq %r15, %rsi
callq 0x63ed
movq 0x18(%r14), %rax
movq 0x8(%rax), %rax
movq (%rax,%r12,8), %rdi
movq %r15, %rsi
callq 0x686e
incq %r12
movq 0x18(%r14), %rax
jmp 0x67e7
pushq $0xa
popq %rdi
movq %rsp, %r14
movq %r14, %rsi
callq 0x63ed
movq 0x190(%rbx), %rdi
movq (%r14), %rdx
movq 0x10(%r14), %rsi
callq 0xba64
movq (%r14), %rsi
cmpq %rsi, %rax
jne 0x6860
movq 0x10(%rsp), %rdi
callq 0x45c0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x6eb20(%rip), %rdi     # 0x75387
xorl %eax, %eax
callq 0x5b9e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/annot-tsv.c
// Function: sanity_check_columns
void sanity_check_columns(char *fname, hdr_t *hdr, cols_t *cols, int **col2idx, int force)
{
    *col2idx = (int*)malloc(sizeof(int)*cols->n);
    if ( !*col2idx ) error("Out of memory, failed to allocate %zu bytes\n",sizeof(int)*cols->n);
    int i, idx;
    for (i=0; i<cols->n; i++)
    {
        if ( khash_str2int_get(hdr->name2idx, cols->off[i], &idx) < 0 )
        {
            if ( !force ) error("The key \"%s\" not found in %s\n", cols->off[i],fname);
            idx = -1;
        }
        (*col2idx)[i] = idx;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0x4(%rsp)
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
movl (%rdx), %ebp
leaq (,%rbp,4), %rbx
movq %rbx, %rdi
callq 0x4680
movq %rax, (%r13)
testq %rax, %rax
je 0x69da
movq %rax, %r12
xorl %r15d, %r15d
cmpq %r15, %rbp
je 0x69b5
movq 0x10(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%r14), %rax
movq (%rax,%r15,8), %r13
testq %rbx, %rbx
je 0x6997
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8682
cmpl (%rbx), %eax
jne 0x69a3
pushq $-0x1
popq %rax
cmpl $0x0, 0x4(%rsp)
jne 0x69ac
jmp 0x69c4
movq 0x20(%rbx), %rcx
movl %eax, %eax
movl (%rcx,%rax,4), %eax
movl %eax, (%r12,%r15,4)
incq %r15
jmp 0x696e
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6e9d7(%rip), %rdi     # 0x753a2
movq %r13, %rsi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x5b9e
leaq 0x6e7cf(%rip), %rdi     # 0x751b0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5b9e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/annot-tsv.c
// Function: parse_coor_base
void parse_coor_base(args_t *args, char *str, dat_t *dat)
{
    int len = strlen(dat->fname);
    int beg = 1, end = 1;
    if ( *str )
    {
        if ( str[0]=='0' ) beg = 0;
        else if ( str[0]=='1' ) beg = 1;
        else error("Could not parse: --coords %s\n",args->coords_str);

        if ( str[1]=='0' ) end = 0;
        else if ( str[1]=='1' ) end = 1;
        else error("Could not parse: --coords %s\n",args->coords_str);
    }
    else if ( len>=4 && !strcasecmp(".bed",dat->fname+len-4) ) beg = 0;
    else if ( len>=7 && !strcasecmp(".bed.gz",dat->fname+len-7) ) beg = 0;
    dat->coor_base[0] = beg;
    dat->coor_base[1] = end;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
movq (%rdx), %r14
movq %r14, %rdi
callq 0x41d0
movq %rax, %r13
movzbl (%r12), %eax
testl %eax, %eax
je 0x6a3e
xorl %ecx, %ecx
cmpl $0x30, %eax
je 0x6a29
cmpl $0x31, %eax
jne 0x6aad
pushq $0x1
popq %rcx
movzbl 0x1(%r12), %eax
cmpl $0x30, %eax
je 0x6a8e
cmpl $0x31, %eax
jne 0x6aad
pushq $0x1
popq %rbp
jmp 0x6a98
pushq $0x1
popq %rbp
cmpl $0x4, %r13d
jl 0x6a92
movl %r13d, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
leaq (%r14,%r15), %rsi
addq $-0x4, %rsi
leaq 0x6e97e(%rip), %rdi     # 0x753de
callq 0x4520
testl %eax, %eax
je 0x6a96
cmpl $0x7, %r13d
jb 0x6a92
addq %r15, %r14
addq $-0x7, %r14
leaq 0x6e966(%rip), %rdi     # 0x753e3
movq %r14, %rsi
callq 0x4520
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
jmp 0x6a98
xorl %ebp, %ebp
jmp 0x6a98
movl %ebp, %ecx
jmp 0x6a98
xorl %ecx, %ecx
movl %ecx, 0x70(%rbx)
movl %ebp, 0x74(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x150(%r15), %rsi
leaq 0x6e905(%rip), %rdi     # 0x753c0
xorl %eax, %eax
callq 0x5b9e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/annot-tsv.c
// Function: read_next_line
static int read_next_line(dat_t *dat)
{
    if ( dat->line.l ) return dat->line.l;
    int ret = hts_getline(dat->fp, KS_SEP_LINE, &dat->line);
    if ( ret > 0 ) return dat->line.l;
    if ( ret < -1 ) error("Error encountered while reading %s\n",dat->fname);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x80(%rdi), %rax
testq %rax, %rax
jne 0x734c
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
movq 0x98(%rdi), %rdi
pushq $0x2
popq %rsi
movq %r14, %rdx
callq 0x12938
testl %eax, %eax
jle 0x7343
movl (%r14), %eax
jmp 0x734c
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x2, %ecx
jle 0x7354
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq (%rbx), %rsi
leaq 0x6e46b(%rip), %rdi     # 0x757c9
xorl %eax, %eax
callq 0x5b9e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/annot-tsv.c
// Function: write_annots
static void write_annots(args_t *args)
{
    if ( !args->dst.annots ) return;

    args->tmp_kstr.l = 0;
    int i;
    hts_pos_t len = nbp_length(args->nbp);
    for (i=0; i<args->dst.annots->n; i++)
    {
        if ( args->dst.annots_idx[i]==ANN_NBP )
        {
            kputc(args->dst.delim,&args->tmp_kstr);
            kputw(len,&args->tmp_kstr);
        }
        else if ( args->dst.annots_idx[i]==ANN_FRAC )
        {
            kputc(args->dst.delim,&args->tmp_kstr);
            kputd((double)len/(args->nbp->end - args->nbp->beg + 1),&args->tmp_kstr);
        }
        else if ( args->dst.annots_idx[i]==ANN_CNT )
        {
            kputc(args->dst.delim,&args->tmp_kstr);
            kputw(args->nbp->n/2,&args->tmp_kstr);
        }
    }
    write_string(args, args->tmp_kstr.s, args->tmp_kstr.l);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x48(%rdi)
je 0x7d6d
movq %rdi, %rbx
andq $0x0, 0x1d0(%rdi)
leaq 0x1d0(%rdi), %r14
movq (%rdi), %r12
movq (%r12), %rsi
movq 0x10(%r12), %rdi
leaq 0xaf5(%rip), %rcx       # 0x8743
pushq $0x8
popq %rdx
callq 0x4990
movq (%r12), %rax
xorl %ecx, %ecx
xorl %esi, %esi
xorl %edx, %edx
xorl %r15d, %r15d
cmpq %rcx, %rax
je 0x7ca8
movq 0x10(%r12), %rdi
movq (%rdi,%rcx,8), %rdi
testb $0x1, %dil
jne 0x7c84
sarq %rdi
testl %esi, %esi
cmoveq %rdi, %rdx
incl %esi
jmp 0x7ca3
testl %esi, %esi
jle 0x7d79
decl %esi
jne 0x7ca3
testq %rdx, %rdx
jle 0x7ca3
sarq %rdi
subq %rdx, %r15
addq %rdi, %r15
incq %r15
xorl %esi, %esi
incq %rcx
jmp 0x7c63
cvtsi2sd %r15, %xmm0
movsd %xmm0, (%rsp)
xorl %r12d, %r12d
movq 0x48(%rbx), %rax
movl (%rax), %eax
cmpq %rax, %r12
jae 0x7d4c
movq 0x68(%rbx), %rax
movl (%rax,%r12,4), %eax
cmpl $0x4, %eax
je 0x7d24
cmpl $0x2, %eax
je 0x7cef
cmpl $0x1, %eax
jne 0x7d44
movsbl 0x80(%rbx), %edi
movq %r14, %rsi
callq 0x63ed
movl %r15d, %edi
jmp 0x7d3c
movsbl 0x80(%rbx), %edi
movq %r14, %rsi
callq 0x63ed
movq (%rbx), %rax
movq 0x20(%rax), %rcx
subq 0x18(%rax), %rcx
incq %rcx
cvtsi2sd %rcx, %xmm1
movsd (%rsp), %xmm0
divsd %xmm1, %xmm0
movq %r14, %rdi
callq 0x8758
jmp 0x7d44
movsbl 0x80(%rbx), %edi
movq %r14, %rsi
callq 0x63ed
movq (%rbx), %rax
movq (%rax), %rdi
shrq %rdi
movq %r14, %rsi
callq 0x642c
incq %r12
jmp 0x7cb5
movq 0x1d0(%rbx), %rdx
movq 0x1e0(%rbx), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x7bb4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x6da6d(%rip), %rdi     # 0x757ed
leaq 0x6d597(%rip), %rsi     # 0x7531e
leaq 0x6da68(%rip), %rcx     # 0x757f6
movl $0xb5, %edx
callq 0x42f0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/kstring.h
// Function: ks_resize
static inline int ks_resize(kstring_t *s, size_t size)
{
	if (s->m < size) {
	    char *tmp;
	    size = (size > (SIZE_MAX>>2)) ? size : size + (size >> 1);
	    tmp = (char*)realloc(s->s, size);
	    if (!tmp)
	        return -1;
	    s->s = tmp;
	    s->m = size;
	}
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
xorl %ebx, %ebx
cmpq %rsi, 0x8(%rdi)
jae 0x7de5
movq %rdi, %r14
movq %rsi, %rax
shrq $0x3e, %rax
movq %rsi, %rcx
shrq %rcx
xorl %ebx, %ebx
testq %rax, %rax
movl $0x0, %r15d
cmoveq %rcx, %r15
addq %rsi, %r15
movq 0x10(%rdi), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x7de2
movq %rax, 0x10(%r14)
movq %r15, 0x8(%r14)
jmp 0x7de5
pushq $-0x1
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/kstring.h
// Function: kputsn
static inline int kputsn(const char *p, size_t l, kstring_t *s)
{
	size_t new_sz = s->l + l + 2;
	if (new_sz <= s->l) { errno = EOVERFLOW; return EOF; }
	if (ks_resize(s, new_sz) < 0) return EOF;
	memcpy(s->s + s->l, p, l);
	s->l += l;
	s->s[s->l] = 0;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movq (%rdx), %rdi
leaq (%rsi,%rdi), %rax
addq $0x2, %rax
cmpq %rdi, %rax
jbe 0xe65e
movq %rdx, %r14
movq %rsi, %rbx
cmpq %rax, 0x8(%rdx)
jae 0xe66e
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(%r14), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0xe669
movq %rax, 0x10(%r14)
movq %r12, 0x8(%r14)
movq (%r14), %rdi
jmp 0xe672
callq 0x4050
movl $0x4b, (%rax)
pushq $-0x1
popq %rbx
jmp 0xe691
movq 0x10(%r14), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x43c0
movq (%r14), %rax
addq %rbx, %rax
movq %rax, (%r14)
movq 0x10(%r14), %rcx
movb $0x0, (%rcx,%rax)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/kstring.c
// Function: kvsprintf
int kvsprintf(kstring_t *s, const char *fmt, va_list ap)
{
	va_list args;
	int l;
	va_copy(args, ap);

	if (fmt[0] == '%' && fmt[1] == 'g' && fmt[2] == 0) {
		double d = va_arg(args, double);
		l = kputd(d, s);
		va_end(args);
		return l;
	}

	if (!s->s) {
		const size_t sz = 64;
		s->s = malloc(sz);
		if (!s->s)
			return -1;
		s->m = sz;
		s->l = 0;
	}

	l = vsnprintf(s->s + s->l, s->m - s->l, fmt, args); // This line does not work with glibc 2.0. See `man snprintf'.
	va_end(args);
	if (l + 1 > s->m - s->l) {
		if (ks_resize(s, s->l + l + 2) < 0)
			return -1;
		va_copy(args, ap);
		l = vsnprintf(s->s + s->l, s->m - s->l, fmt, args);
		va_end(args);
	}
	s->l += l;
	return l;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rdx), %rax
movq %rax, 0x10(%rsp)
movups (%rdx), %xmm0
movaps %xmm0, (%rsp)
cmpb $0x25, (%rsi)
jne 0x8b76
cmpb $0x67, 0x1(%r14)
jne 0x8b76
cmpb $0x0, 0x2(%r14)
je 0x8c3c
movq 0x10(%rbx), %rdi
pushq $-0x1
popq %rbp
testq %rdi, %rdi
je 0x8b8b
movq (%rbx), %rax
movq 0x8(%rbx), %r12
jmp 0x8bb5
pushq $0x40
popq %r12
movq %r12, %rdi
callq 0x4680
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x8c2d
movq %rax, %rdi
movq $0x40, 0x8(%rbx)
andq $0x0, (%rbx)
xorl %eax, %eax
addq %rax, %rdi
subq %rax, %r12
movq %rsp, %rcx
movq %r12, %rsi
movq %r14, %rdx
callq 0x42d0
leal 0x1(%rax), %ecx
movslq %ecx, %rdx
movq (%rbx), %rcx
movq 0x8(%rbx), %rsi
subq %rcx, %rsi
cmpq %rdx, %rsi
jae 0x8c22
cltq
leaq (%rax,%rcx), %rsi
addq $0x2, %rsi
movq %rbx, %rdi
callq 0x8ae5
testl %eax, %eax
js 0x8c2d
movq 0x10(%r15), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
movups (%r15), %xmm0
movaps %xmm0, (%rcx)
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdi
addq %rax, %rdi
subq %rax, %rsi
movq %r14, %rdx
callq 0x42d0
movq (%rbx), %rcx
movslq %eax, %rdx
addq %rcx, %rdx
movq %rdx, (%rbx)
movl %eax, %ebp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%rsp), %ecx
cmpq $0xa0, %rcx
ja 0x8c5a
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x8c68
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movsd (%rax), %xmm0
movq %rbx, %rdi
callq 0x8758
movl %eax, %ebp
jmp 0x8c2d
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/kstring.c
// Function: kstrtok
char *kstrtok(const char *str, const char *sep_in, ks_tokaux_t *aux)
{
	const unsigned char *p, *start, *sep = (unsigned char *) sep_in;
	if (sep) { // set up the table
		if (str == 0 && aux->finished) return 0; // no need to set up if we have finished
		aux->finished = 0;
		if (sep[0] && sep[1]) {
			aux->sep = -1;
			aux->tab[0] = aux->tab[1] = aux->tab[2] = aux->tab[3] = 0;
			for (p = sep; *p; ++p) aux->tab[*p>>6] |= 1ull<<(*p&0x3f);
		} else aux->sep = sep[0];
	}
	if (aux->finished) return 0;
	else if (str) start = (unsigned char *) str, aux->finished = 0;
	else start = (unsigned char *) aux->p + 1;
	if (aux->sep < 0) {
		for (p = start; *p; ++p)
			if (aux->tab[*p>>6]>>(*p&0x3f)&1) break;
	} else {
		// Using strchr is fast for next token, but slower for
		// last token due to extra pass from strlen.  Overall
		// on a VCF parse this func was 146% faster with // strchr.
		// Equiv to:
		// for (p = start; *p; ++p) if (*p == aux->sep) break;

		// NB: We could use strchrnul() here from glibc if detected,
		// which is ~40% faster again, but it's not so portable.
		// i.e.   p = (uint8_t *)strchrnul((char *)start, aux->sep);
		uint8_t *p2 = (uint8_t *)strchr((char *)start, aux->sep);
		p = p2 ? p2 : start + strlen((char *)start);
	}
	aux->p = (const char *) p; // end of token
	if (*p == 0) aux->finished = 1; // no more tokens
	return (char*)start;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
testq %rsi, %rsi
je 0x8d50
testq %rbx, %rbx
je 0x8d69
andl $0x0, 0x24(%r14)
movzbl (%rsi), %eax
testl %eax, %eax
je 0x8d59
cmpb $0x0, 0x1(%rsi)
je 0x8d59
orl $-0x1, 0x20(%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movups %xmm0, 0x10(%r14)
pushq $0x1
popq %rax
movzbl (%rsi), %ecx
testq %rcx, %rcx
je 0x8d5d
movq %rax, %rdx
shlq %cl, %rdx
shrl $0x6, %ecx
orq %rdx, (%r14,%rcx,8)
incq %rsi
jmp 0x8d36
cmpl $0x0, 0x24(%r14)
jne 0x8d70
jmp 0x8d5d
movl %eax, 0x20(%r14)
testq %rbx, %rbx
je 0x8d74
andl $0x0, 0x24(%r14)
jmp 0x8d7b
cmpl $0x0, 0x24(%r14)
je 0x8d10
xorl %ebx, %ebx
jmp 0x8dac
movq 0x28(%r14), %rbx
incq %rbx
movl 0x20(%r14), %esi
testl %esi, %esi
js 0x8db7
movq %rbx, %rdi
callq 0x4190
testq %rax, %rax
jne 0x8d9b
movq %rbx, %rdi
callq 0x41d0
addq %rbx, %rax
movq %rax, 0x28(%r14)
cmpb $0x0, (%rax)
jne 0x8dac
movl $0x1, 0x24(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rax
movzbl (%rax), %ecx
testq %rcx, %rcx
je 0x8d9b
movl %ecx, %edx
shrl $0x6, %edx
movq (%r14,%rdx,8), %rdx
btq %rcx, %rdx
jb 0x8d9b
incq %rax
jmp 0x8dba
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/kstring.c
// Function: kgetline
int kgetline(kstring_t *s, kgets_func *fgets_fn, void *fp)
{
	size_t l0 = s->l;

	while (s->l == l0 || s->s[s->l-1] != '\n') {
		if (s->m - s->l < 200) {
			if (ks_resize(s, s->m + 200) < 0)
				return EOF;
		}
		if (fgets_fn(s->s + s->l, s->m - s->l, fp) == NULL) break;
		s->l += strlen(s->s + s->l);
	}

	if (s->l == l0) return EOF;

	if (s->l > l0 && s->s[s->l-1] == '\n') {
		s->l--;
		if (s->l > l0 && s->s[s->l-1] == '\r') s->l--;
	}
	s->s[s->l] = '\0';
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r12
pushq $-0x1
popq %rbp
movq %r12, %rdi
cmpq %r12, %rdi
je 0x8ff0
movq 0x10(%rbx), %rax
cmpb $0xa, -0x1(%rax,%rdi)
je 0x904e
movq 0x8(%rbx), %rax
movq %rax, %rsi
subq %rdi, %rsi
cmpq $0xc7, %rsi
ja 0x9022
addq $0xc8, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8ae5
testl %eax, %eax
js 0x9083
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
subq %rdi, %rsi
addq 0x10(%rbx), %rdi
movq %r14, %rdx
callq *%r15
movq (%rbx), %r13
testq %rax, %rax
je 0x904b
movq 0x10(%rbx), %rdi
addq %r13, %rdi
callq 0x41d0
movq %rax, %rdi
addq %r13, %rdi
movq %rdi, (%rbx)
jmp 0x8fe0
movq %r13, %rdi
cmpq %r12, %rdi
je 0x9083
movq 0x10(%rbx), %rax
jbe 0x907a
cmpb $0xa, -0x1(%rax,%rdi)
jne 0x907a
leaq -0x1(%rdi), %rcx
movq %rcx, (%rbx)
cmpq %r12, %rcx
jbe 0x907d
cmpb $0xd, -0x2(%rax,%rdi)
jne 0x907d
addq $-0x2, %rdi
movq %rdi, (%rbx)
movq %rdi, %rcx
movb $0x0, (%rax,%rcx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/kstring.c
// Function: kgetline2
int kgetline2(kstring_t *s, kgets_func2 *fgets_fn, void *fp)
{
	size_t l0 = s->l;

	while (s->l == l0 || s->s[s->l-1] != '\n') {
		if (s->m - s->l < 200) {
			// We return EOF for both EOF and error and the caller
			// needs to check for errors in fp, and we haven't
			// even got there yet.
			//
			// The only way of propagating memory errors is to
			// deliberately call something that we know triggers
			// and error so fp is also set.  This works for
			// hgets, but not for gets where reading <= 0 bytes
			// isn't an error.
			if (ks_resize(s, s->m + 200) < 0) {
				fgets_fn(s->s + s->l, 0, fp);
				return EOF;
			}
		}
		ssize_t len = fgets_fn(s->s + s->l, s->m - s->l, fp);
		if (len <= 0) break;
		s->l += len;
	}

	if (s->l == l0) return EOF;

	if (s->l > l0 && s->s[s->l-1] == '\n') {
		s->l--;
		if (s->l > l0 && s->s[s->l-1] == '\r') s->l--;
	}
	s->s[s->l] = '\0';
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r12
movq %r12, %rdi
cmpq %r12, %rdi
je 0x90bb
movq 0x10(%rbx), %rax
cmpb $0xa, -0x1(%rax,%rdi)
je 0x9107
movq 0x8(%rbx), %rax
movq %rax, %rsi
subq %rdi, %rsi
cmpq $0xc7, %rsi
ja 0x90ed
addq $0xc8, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8ae5
movq (%rbx), %rdi
testl %eax, %eax
js 0x913e
movq 0x8(%rbx), %rsi
subq %rdi, %rsi
addq 0x10(%rbx), %rdi
movq %r15, %rdx
callq *%r14
movq (%rbx), %rdi
testq %rax, %rax
jle 0x9107
addq %rax, %rdi
movq %rdi, (%rbx)
jmp 0x90ab
cmpq %r12, %rdi
je 0x914a
movq 0x10(%rbx), %rax
jbe 0x9133
cmpb $0xa, -0x1(%rax,%rdi)
jne 0x9133
leaq -0x1(%rdi), %rcx
movq %rcx, (%rbx)
cmpq %r12, %rcx
jbe 0x9136
cmpb $0xd, -0x2(%rax,%rdi)
jne 0x9136
addq $-0x2, %rdi
movq %rdi, (%rbx)
movq %rdi, %rcx
movb $0x0, (%rax,%rcx)
xorl %eax, %eax
jmp 0x914d
addq 0x10(%rbx), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq *%r14
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_idx_push
int bgzf_idx_push(BGZF *fp, hts_idx_t *hidx, int tid, hts_pos_t beg, hts_pos_t end, uint64_t offset, int is_mapped) {
    hts_idx_cache_entry *e;
    mtaux_t *mt = fp->mt;

    if (!mt)
        return hts_idx_push(hidx, tid, beg, end, offset, is_mapped);

    // Early check for out of range positions which would fail in hts_idx_push()
    if (hts_idx_check_range(hidx, tid, beg, end) < 0)
        return -1;

    pthread_mutex_lock(&mt->idx_m);

    mt->hts_idx = hidx;
    hts_idx_cache_t *ic = &mt->idx_cache;

    if (ic->nentries >= ic->mentries) {
        int new_sz = ic->mentries ? ic->mentries*2 : 1024;
        if (!(e = realloc(ic->e, new_sz * sizeof(*ic->e)))) {
            pthread_mutex_unlock(&mt->idx_m);
            return -1;
        }
        ic->e = e;
        ic->mentries = new_sz;
    }

    e = &ic->e[ic->nentries++];
    e->tid = tid;
    e->beg = beg;
    e->end = end;
    e->is_mapped = is_mapped;
    e->offset = offset & 0xffff;
    e->block_number = mt->block_number;

    pthread_mutex_unlock(&mt->idx_m);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movq %rcx, %r15
movl %edx, %r12d
movq %rsi, %rbx
movl 0x50(%rsp), %eax
movq 0x48(%rdi), %rbp
testq %rbp, %rbp
je 0x94d2
movl %eax, 0x4(%rsp)
movq %r9, 0x10(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x13858
pushq $-0x1
popq %r13
testl %eax, %eax
js 0x9578
leaq 0xe0(%rbp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x4750
movq %rbx, 0x108(%rbp)
movl 0x120(%rbp), %ecx
movl 0x124(%rbp), %eax
cmpl %eax, %ecx
jge 0x94f7
movq 0x128(%rbp), %rax
jmp 0x952f
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
movq %r14, %rcx
movq %r9, %r8
movl %eax, %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1390f
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x400, %ebx            # imm = 0x400
cmovnel %ecx, %ebx
movq 0x128(%rbp), %rdi
movslq %ebx, %rax
imulq $0x28, %rax, %rsi
callq 0x4840
testq %rax, %rax
je 0x958a
movq %rax, 0x128(%rbp)
movl %ebx, 0x124(%rbp)
movl 0x120(%rbp), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x120(%rbp)
movslq %ecx, %rcx
imulq $0x28, %rcx, %rcx
movl %r12d, 0x10(%rax,%rcx)
movq %r15, (%rax,%rcx)
movq %r14, 0x8(%rax,%rcx)
movl 0x4(%rsp), %edx
movl %edx, 0x14(%rax,%rcx)
movzwl 0x10(%rsp), %edx
movq %rdx, 0x18(%rax,%rcx)
movq 0x110(%rbp), %rdx
movq %rdx, 0x20(%rax,%rcx)
movq 0x8(%rsp), %rdi
callq 0x4340
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rdi
callq 0x4340
jmp 0x9578
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_open
BGZF *bgzf_open(const char *path, const char *mode)
{
    BGZF *fp = 0;
    if (strchr(mode, 'r')) {
        hFILE *fpr;
        if ((fpr = hopen(path, mode)) == 0) return 0;
        fp = bgzf_read_init(fpr, path);
        if (fp == 0) { hclose_abruptly(fpr); return NULL; }
        fp->fp = fpr;
    } else if (strchr(mode, 'w') || strchr(mode, 'a')) {
        hFILE *fpw;
        if ((fpw = hopen(path, mode)) == 0) return 0;
        fp = bgzf_write_init(mode);
        if (fp == NULL) return NULL;
        fp->fp = fpw;
    }
    else { errno = EINVAL; return 0; }

    fp->is_be = ed_is_big();
    return fp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
pushq $0x72
popq %rsi
movq %r15, %rdi
callq 0x4190
testq %rax, %rax
je 0x95e5
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe19b
testq %rax, %rax
je 0x9643
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x9652
testq %rax, %rax
jne 0x9629
movq %r12, %rdi
callq 0xd94c
jmp 0x9641
pushq $0x77
popq %rsi
movq %r15, %rdi
callq 0x4190
testq %rax, %rax
jne 0x9605
pushq $0x61
popq %rsi
movq %r15, %rdi
callq 0x4190
testq %rax, %rax
je 0x9636
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xe19b
testq %rax, %rax
je 0x9643
movq %rax, %r12
movq %r15, %rdi
callq 0x9866
testq %rax, %rax
je 0x9641
movq %rax, %rbx
movq %r12, 0x40(%rax)
andb $-0x9, 0x2(%rax)
jmp 0x9643
callq 0x4050
movl $0x16, (%rax)
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_dopen
BGZF *bgzf_dopen(int fd, const char *mode)
{
    BGZF *fp = 0;
    if (strchr(mode, 'r')) {
        hFILE *fpr;
        if ((fpr = hdopen(fd, mode)) == 0) return 0;
        fp = bgzf_read_init(fpr, NULL);
        if (fp == 0) { hclose_abruptly(fpr); return NULL; } // FIXME this closes fd
        fp->fp = fpr;
    } else if (strchr(mode, 'w') || strchr(mode, 'a')) {
        hFILE *fpw;
        if ((fpw = hdopen(fd, mode)) == 0) return 0;
        fp = bgzf_write_init(mode);
        if (fp == NULL) return NULL;
        fp->fp = fpw;
    }
    else { errno = EINVAL; return 0; }

    fp->is_be = ed_is_big();
    return fp;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x4190
testq %rax, %rax
je 0x9a68
movl %ebp, %edi
movq %rbx, %rsi
callq 0xd97d
testq %rax, %rax
je 0x9abc
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0x9652
testq %rax, %rax
jne 0x9aa7
movq %r14, %rdi
callq 0xd94c
jmp 0x9abc
pushq $0x77
popq %rsi
movq %rbx, %rdi
callq 0x4190
testq %rax, %rax
jne 0x9a88
pushq $0x61
popq %rsi
movq %rbx, %rdi
callq 0x4190
testq %rax, %rax
je 0x9ab1
movl %ebp, %edi
movq %rbx, %rsi
callq 0xd97d
testq %rax, %rax
je 0x9abc
movq %rax, %r14
movq %rbx, %rdi
callq 0x9866
testq %rax, %rax
je 0x9abc
movq %r14, 0x40(%rax)
andb $-0x9, 0x2(%rax)
jmp 0x9abe
callq 0x4050
movl $0x16, (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_hopen
BGZF *bgzf_hopen(hFILE *hfp, const char *mode)
{
    BGZF *fp = NULL;
    if (strchr(mode, 'r')) {
        fp = bgzf_read_init(hfp, NULL);
        if (fp == NULL) return NULL;
    } else if (strchr(mode, 'w') || strchr(mode, 'a')) {
        fp = bgzf_write_init(mode);
        if (fp == NULL) return NULL;
    }
    else { errno = EINVAL; return 0; }

    fp->fp = hfp;
    fp->is_be = ed_is_big();
    return fp;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x72
popq %rsi
movq %r14, %rdi
callq 0x4190
testq %rax, %rax
je 0x9af1
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9652
testq %rax, %rax
jne 0x9b1e
jmp 0x9b39
pushq $0x77
popq %rsi
movq %r14, %rdi
callq 0x4190
testq %rax, %rax
jne 0x9b11
pushq $0x61
popq %rsi
movq %r14, %rdi
callq 0x4190
testq %rax, %rax
je 0x9b2b
movq %r14, %rdi
callq 0x9866
testq %rax, %rax
je 0x9b36
movq %rax, %r14
movq %rbx, 0x40(%rax)
andb $-0x9, 0x2(%rax)
jmp 0x9b39
callq 0x4050
movl $0x16, (%rax)
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_zerr
static const char *bgzf_zerr(int errnum, z_stream *zs)
{
    static char buffer[32];

    /* Return zs->msg if available.
       zlib doesn't set this very reliably.  Looking at the source suggests
       that it may get set to a useful message for deflateInit2, inflateInit2
       and inflate when it returns Z_DATA_ERROR. For inflate with other
       return codes, deflate, deflateEnd and inflateEnd it doesn't appear
       to be useful.  For the likely non-useful cases, the caller should
       pass NULL into zs. */

    if (zs && zs->msg) return zs->msg;

    // gzerror OF((gzFile file, int *errnum)
    switch (errnum) {
    case Z_ERRNO:
        return strerror(errno);
    case Z_STREAM_ERROR:
        return "invalid parameter/compression level, or inconsistent stream state";
    case Z_DATA_ERROR:
        return "invalid or incomplete IO";
    case Z_MEM_ERROR:
        return "out of memory";
    case Z_BUF_ERROR:
        return "progress temporarily not possible, or in() / out() returned an error";
    case Z_VERSION_ERROR:
        return "zlib version mismatch";
    case Z_NEED_DICT:
        return "data was compressed using a dictionary";
    case Z_OK: // 0: maybe gzgets error Z_NULL
    default:
        snprintf(buffer, sizeof(buffer), "[%d] unknown", errnum);
        return buffer;  // FIXME: Not thread-safe.
    }
}

// Assembly:
pushq %rbx
movl %edi, %ecx
testq %rsi, %rsi
je 0x9d0c
movq 0x30(%rsi), %rbx
testq %rbx, %rbx
je 0x9d0c
movq %rbx, %rax
popq %rbx
retq
leal 0x6(%rcx), %eax
cmpl $0x8, %eax
ja 0x9d2d
leaq 0x6cbd5(%rip), %rdx     # 0x768f0
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x6d487(%rip), %rbx     # 0x771b2
jmp 0x9d07
leaq 0x94a7c(%rip), %rbx     # 0x9e7b0
leaq 0x6d4b4(%rip), %rdx     # 0x771ef
pushq $0x20
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4800
jmp 0x9d07
callq 0x4050
movl (%rax), %edi
popq %rbx
jmp 0x4150
leaq 0x6d40f(%rip), %rbx     # 0x7716d
jmp 0x9d07
leaq 0x6d461(%rip), %rbx     # 0x771c8
jmp 0x9d07
leaq 0x6d3ef(%rip), %rbx     # 0x7715f
jmp 0x9d07
leaq 0x6d3cd(%rip), %rbx     # 0x77146
jmp 0x9d07
leaq 0x6d382(%rip), %rbx     # 0x77104
jmp 0x9d07
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: mt_destroy
static int mt_destroy(mtaux_t *mt)
{
    int ret = 0;

    // Tell the reader to shut down
    pthread_mutex_lock(&mt->command_m);
    mt->command = CLOSE;
    pthread_cond_signal(&mt->command_c);
    hts_tpool_wake_dispatch(mt->out_queue); // unstick the reader
    pthread_mutex_unlock(&mt->command_m);

    // Check for thread worker failure, indicated by is_shutdown returning 2
    // It's possible really late errors might be missed, but we can live with
    // that.
    ret = -(hts_tpool_process_is_shutdown(mt->out_queue) > 1);
    // Destroying the queue first forces the writer to exit.
    // mt->out_queue is reference counted, so destroy gets called in both
    // this and the IO threads.  The last to do it will clean up.
    hts_tpool_process_destroy(mt->out_queue);

    // IO thread will now exit.  Wait for it and perform final clean-up.
    // If it returned non-NULL, it was not happy.
    void *retval = NULL;
    pthread_join(mt->io_task, &retval);
    ret = retval != NULL ? -1 : ret;

    pthread_mutex_destroy(&mt->job_pool_m);
    pthread_mutex_destroy(&mt->command_m);
    pthread_mutex_destroy(&mt->idx_m);
    pthread_cond_destroy(&mt->command_c);
    if (mt->curr_job)
        pool_free(mt->job_pool, mt->curr_job);

    if (mt->own_pool)
        hts_tpool_destroy(mt->pool);

    pool_destroy(mt->job_pool);

    if (mt->idx_cache.e)
        free(mt->idx_cache.e);

    free(mt);
    fflush(stderr);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x80(%rdi), %r15
movq %r15, %rdi
callq 0x4750
movl $0x5, 0xd8(%rbx)
leaq 0xa8(%rbx), %r14
movq %r14, %rdi
callq 0x4040
movq 0x20(%rbx), %rdi
callq 0x2caef
movq %r15, %rdi
callq 0x4340
movq 0x20(%rbx), %rdi
callq 0x2bf78
movl %eax, %ebp
movq 0x20(%rbx), %rdi
callq 0x2bd67
leaq 0x8(%rsp), %r12
andq $0x0, (%r12)
movq 0x28(%rbx), %rdi
movq %r12, %rsi
callq 0x4410
movq (%r12), %r12
leaq 0x30(%rbx), %rdi
callq 0x4590
movq %r15, %rdi
callq 0x4590
leaq 0xe0(%rbx), %rdi
callq 0x4590
movq %r14, %rdi
callq 0x49a0
movq 0x8(%rbx), %rsi
testq %rsi, %rsi
je 0xa6fb
movq (%rbx), %rdi
callq 0x4924e
cmpl $0x0, 0x14(%rbx)
je 0xa70a
movq 0x18(%rbx), %rdi
callq 0x2cc8f
movq (%rbx), %rdi
callq 0x49138
movq 0x128(%rbx), %rdi
callq 0x45c0
testq %r12, %r12
setne %al
cmpl $0x2, %ebp
setge %cl
orb %al, %cl
movzbl %cl, %ebp
negl %ebp
movq %rbx, %rdi
callq 0x45c0
movq 0x93898(%rip), %rax     # 0x9dfd8
movq (%rax), %rdi
callq 0x45a0
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_index_add_block
int bgzf_index_add_block(BGZF *fp)
{
    fp->idx->noffs++;
    if ( fp->idx->noffs > fp->idx->moffs )
    {
        fp->idx->moffs = fp->idx->noffs;
        kroundup32(fp->idx->moffs);
        fp->idx->offs = (bgzidx1_t*) realloc(fp->idx->offs, fp->idx->moffs*sizeof(bgzidx1_t));
        if ( !fp->idx->offs ) return -1;
    }
    fp->idx->offs[ fp->idx->noffs-1 ].uaddr = fp->idx->ublock_addr;
    fp->idx->offs[ fp->idx->noffs-1 ].caddr = fp->block_address;
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x50(%rdi), %rcx
movl (%rcx), %eax
leal 0x1(%rax), %edx
movl %edx, (%rcx)
cmpl 0x4(%rcx), %eax
jge 0xa771
movq 0x8(%rcx), %rax
jmp 0xa7c3
testl %eax, %eax
js 0xa7a1
movl %eax, %edx
shrl %edx
orl %eax, %edx
movl %edx, %esi
shrl $0x2, %esi
orl %edx, %esi
movl %esi, %edx
shrl $0x4, %edx
orl %esi, %edx
movl %edx, %esi
shrl $0x8, %esi
orl %edx, %esi
movl %esi, %edx
shrl $0x10, %edx
orl %esi, %edx
shrl $0x1e, %eax
xorl $0x1, %eax
addl %edx, %eax
movl %eax, %edx
movl %edx, 0x4(%rcx)
movq 0x8(%rcx), %rdi
movslq %edx, %rsi
shlq $0x4, %rsi
callq 0x4840
movq 0x50(%rbx), %rcx
movq %rax, 0x8(%rcx)
testq %rax, %rax
je 0xa7e0
movl (%rcx), %edx
movq 0x10(%rcx), %rcx
movslq %edx, %rdx
shlq $0x4, %rdx
movq %rcx, -0x10(%rax,%rdx)
movq 0x18(%rbx), %rcx
movq %rcx, -0x8(%rax,%rdx)
xorl %eax, %eax
popq %rbx
retq
pushq $-0x1
popq %rax
jmp 0xa7de
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_htell
static off_t bgzf_htell(BGZF *fp) {
    if (fp->mt) {
        pthread_mutex_lock(&fp->mt->job_pool_m);
        off_t pos = fp->block_address + fp->block_clength;
        pthread_mutex_unlock(&fp->mt->job_pool_m);
        return pos;
    } else {
        return htell(fp->fp);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x48(%rdi), %rdi
testq %rdi, %rdi
je 0xa815
addq $0x30, %rdi
callq 0x4750
movslq 0xc(%r14), %rbx
addq 0x18(%r14), %rbx
movq 0x48(%r14), %rdi
addq $0x30, %rdi
callq 0x4340
jmp 0xa824
movq 0x40(%r14), %rax
movq 0x28(%rax), %rbx
addq 0x8(%rax), %rbx
subq (%rax), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/./htslib/hfile.h
// Function: hread
static inline ssize_t HTS_RESULT_USED
hread(hFILE *fp, void *buffer, size_t nbytes)
{
    HTSLIB_EXPORT
    extern ssize_t hread2(hFILE *, void *, size_t, size_t);

    size_t n = fp->end - fp->begin;
    if (n > nbytes) n = nbytes;
    memcpy(buffer, fp->begin, n);
    fp->begin += n;
    return (n == nbytes || !fp->mobile)? (ssize_t) n : hread2(fp, buffer, nbytes, n);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %r13
subq %rsi, %r13
cmpq %rdx, %r13
movq %rdx, %r12
cmovbq %r13, %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x43c0
addq %r12, 0x8(%r15)
cmpq %rbx, %r13
jae 0xa871
testb $0x2, 0x30(%r15)
jne 0xa87e
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r12, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xd55e
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: load_block_from_cache
static int load_block_from_cache(BGZF *fp, int64_t block_address)
{
    khint_t k;
    cache_t *p;

    khash_t(cache) *h = fp->cache->h;
    k = kh_get(cache, h, block_address);
    if (k == kh_end(h)) return 0;
    p = &kh_val(h, k);
    if (fp->block_length != 0) fp->block_offset = 0;
    fp->block_address = block_address;
    fp->block_length = p->size;
    memcpy(fp->uncompressed_block, p->block, p->size);
    if ( hseek(fp->fp, p->end_offset, SEEK_SET) < 0 )
    {
        // todo: move the error up
        hts_log_error("Could not hseek to %" PRId64, p->end_offset);
        exit(1);
    }
    return p->size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x38(%rdi), %rax
movq (%rax), %rdx
movl (%rdx), %edi
xorl %eax, %eax
movl $0x0, %r8d
testl %edi, %edi
je 0xaae2
leal -0x1(%rdi), %r9d
movq %rsi, %r10
shrq $0x21, %r10
movl %esi, %ecx
shll $0xb, %ecx
xorl %ecx, %r10d
xorl %esi, %r10d
andl %r9d, %r10d
movq 0x10(%rdx), %r11
pushq $0x1
popq %rbp
movl %r10d, %r8d
movl %r8d, %ecx
shrl $0x4, %ecx
movl (%r11,%rcx,4), %r14d
leal (%r8,%r8), %ecx
andl $0x1e, %ecx
movl %r14d, %r15d
shrl %cl, %r15d
testb $0x2, %r15b
jne 0xaad7
testb $0x1, %r15b
jne 0xaac6
movq 0x18(%rdx), %r15
movl %r8d, %r12d
cmpq %rsi, (%r15,%r12,8)
je 0xaad7
addl %ebp, %r8d
andl %r9d, %r8d
incl %ebp
cmpl %r10d, %r8d
jne 0xaa96
xorl %eax, %eax
jmp 0xab2a
shrl %cl, %r14d
testb $0x3, %r14b
cmovnel %edi, %r8d
cmpl %edi, %r8d
je 0xab2a
movl %r8d, %eax
imulq $0x18, %rax, %r14
addq 0x20(%rdx), %r14
cmpl $0x0, 0x8(%rbx)
je 0xaafc
andl $0x0, 0x10(%rbx)
movq %rsi, 0x18(%rbx)
movslq (%r14), %rdx
movl %edx, 0x8(%rbx)
movq 0x28(%rbx), %rdi
movq 0x8(%r14), %rsi
callq 0x43c0
movq 0x40(%rbx), %rdi
movq 0x10(%r14), %rsi
xorl %edx, %edx
callq 0xd7cb
testq %rax, %rax
js 0xab33
movl (%r14), %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %rcx
leaq 0x6c722(%rip), %rsi     # 0x77260
leaq 0x6c731(%rip), %rdx     # 0x77276
pushq $0x1
popq %rbx
movl %ebx, %edi
xorl %eax, %eax
callq 0x110c6
movl %ebx, %edi
callq 0x45e0
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: check_header
static int check_header(const uint8_t *header)
{
    if ( header[0] != 31 || header[1] != 139 || header[2] != 8 ) return -2;
    return ((header[3] & 4) != 0
            && unpackInt16((uint8_t*)&header[10]) == 6
            && header[12] == 'B' && header[13] == 'C'
            && unpackInt16((uint8_t*)&header[14]) == 2) ? 0 : -1;
}

// Assembly:
pushq $-0x2
popq %rax
cmpb $0x1f, (%rdi)
jne 0xab94
cmpb $-0x75, 0x1(%rdi)
jne 0xab94
cmpb $0x8, 0x2(%rdi)
jne 0xab94
pushq $-0x1
popq %rax
testb $0x4, 0x3(%rdi)
je 0xab94
cmpw $0x6, 0xa(%rdi)
jne 0xab94
cmpb $0x42, 0xc(%rdi)
jne 0xab94
cmpb $0x43, 0xd(%rdi)
jne 0xab94
xorl %eax, %eax
cmpw $0x2, 0xe(%rdi)
setne %al
negl %eax
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_peek
int bgzf_peek(BGZF *fp) {
    int available = fp->block_length - fp->block_offset;
    if (available <= 0) {
        if (bgzf_read_block(fp) < 0) {
            hts_log_error("Read block operation failed with error %d", fp->errcode);
            fp->errcode = BGZF_ERR_ZLIB;
            return -2;
        }
    }
    available = fp->block_length - fp->block_offset;
    if (available)
        return ((unsigned char *)fp->uncompressed_block)[fp->block_offset];

    return -1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %ecx
movl 0x10(%rdi), %eax
cmpl %eax, %ecx
jg 0xacdb
movq %rbx, %rdi
callq 0x9d84
testl %eax, %eax
js 0xacef
movl 0x8(%rbx), %ecx
movl 0x10(%rbx), %eax
cmpl %eax, %ecx
jne 0xace3
pushq $-0x1
jmp 0xad11
movq 0x28(%rbx), %rcx
cltq
movzbl (%rcx,%rax), %eax
jmp 0xad12
movzwl (%rbx), %ecx
leaq 0x6bf81(%rip), %rsi     # 0x76c7a
leaq 0x6bf84(%rip), %rdx     # 0x76c84
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x110c6
movw $0x1, (%rbx)
pushq $-0x2
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/bgzf.c
// Function: bgzf_mt_read_block
int bgzf_mt_read_block(BGZF *fp, bgzf_job *j)
{
    uint8_t header[BLOCK_HEADER_LENGTH], *compressed_block;
    int count, block_length, remaining;

    // NOTE: Guaranteed to be compressed as we block multi-threading in
    // uncompressed mode.  However it may be gzip compression instead
    // of bgzf.

    // Reading compressed file
    int64_t block_address;
    block_address = htell(fp->fp);

    j->block_address = block_address;  // in case we exit with j->errcode

    if (fp->cache_size && load_block_from_cache(fp, block_address)) return 0;
    count = hpeek(fp->fp, header, sizeof(header));
    if (count == 0) // no data read
        return -1;
    int ret;
    if ( count != sizeof(header) || (ret=check_header(header))==-2 )
    {
        j->errcode |= BGZF_ERR_HEADER;
        return -1;
    }
    if (ret == -1) {
        j->errcode |= BGZF_ERR_MT;
        return -1;
    }

    count = hread(fp->fp, header, sizeof(header));
    if (count != sizeof(header)) // no data read
        return -1;

    block_length = unpackInt16((uint8_t*)&header[16]) + 1; // +1 because when writing this number, we used "-1"
    if (block_length < BLOCK_HEADER_LENGTH) {
        j->errcode |= BGZF_ERR_HEADER;
        return -1;
    }
    compressed_block = (uint8_t*)j->comp_data;
    memcpy(compressed_block, header, BLOCK_HEADER_LENGTH);
    remaining = block_length - BLOCK_HEADER_LENGTH;
    count = hread(fp->fp, &compressed_block[BLOCK_HEADER_LENGTH], remaining);
    if (count != remaining) {
        j->errcode |= BGZF_ERR_IO;
        return -1;
    }
    j->comp_len = block_length;
    j->uncomp_len = BGZF_MAX_BLOCK_SIZE;
    j->block_address = block_address;
    j->fp = fp;
    j->errcode = 0;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rdi
movq 0x28(%rdi), %r15
addq 0x8(%rdi), %r15
subq (%rdi), %r15
movq %rsi, %r14
movq %r15, 0x20020(%rsi)
cmpl $0x0, 0x4(%rbx)
je 0xad70
movq %rbx, %rdi
movq %r15, %rsi
callq 0xaa53
xorl %ebp, %ebp
testl %eax, %eax
jne 0xada1
movq 0x40(%rbx), %rdi
movq %rsp, %rsi
pushq $0x12
popq %rdx
callq 0xd4e0
pushq $-0x1
popq %rbp
testl %eax, %eax
je 0xada1
cmpl $0x12, %eax
jne 0xad99
movq %rsp, %rdi
callq 0xab58
cmpl $-0x1, %eax
je 0xadb2
cmpl $-0x2, %eax
jne 0xadbc
orb $0x2, 0x20018(%r14)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orb $0x10, 0x20018(%r14)
jmp 0xada1
movq 0x40(%rbx), %rdi
movq %rsp, %rsi
pushq $0x12
popq %rdx
callq 0xa82f
cmpl $0x12, %eax
jne 0xada1
movzwl 0x10(%rsp), %r13d
cmpl $0x10, %r13d
jbe 0xad99
movzwl 0x10(%rsp), %eax
movw %ax, 0x18(%r14)
movaps (%rsp), %xmm0
movups %xmm0, 0x8(%r14)
leal -0x11(%r13), %r12d
movq 0x40(%rbx), %rdi
leaq 0x1a(%r14), %rsi
movq %r12, %rdx
callq 0xa82f
cmpl %eax, %r12d
jne 0xae36
incq %r13
movq %r13, 0x10008(%r14)
movq $0x10000, 0x20010(%r14) # imm = 0x10000
movq %r15, 0x20020(%r14)
movq %rbx, (%r14)
andl $0x0, 0x20018(%r14)
xorl %ebp, %ebp
jmp 0xada1
orb $0x4, 0x20018(%r14)
jmp 0xada1