LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
testl %edi, %edi
jns 0x689a
movq (%rbx), %rcx
leaq 0x3(%rcx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x6888
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r15d, %r15d
testq %rcx, %rcx
cmoveq %rdx, %r15
addq %rax, %r15
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x69e4
movq %rax, 0x10(%rbx)
movq %r15, 0x8(%rbx)
movq (%rbx), %rcx
jmp 0x688c
movq 0x10(%rbx), %rax
negl %r14d
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movb $0x2d, (%rax,%rcx)
cmpl $0x9, %r14d
ja 0x68ed
movq (%rbx), %rcx
leaq 0x2(%rcx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x6966
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r15d, %r15d
testq %rcx, %rcx
cmoveq %rdx, %r15
addq %rax, %r15
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x69e4
movq %rax, 0x10(%rbx)
movq %r15, 0x8(%rbx)
movq (%rbx), %rcx
jmp 0x696a
bsrl %r14d, %eax
xorl $0x1f, %eax
shll $0x2, %eax
leaq 0x8c7b2(%rip), %rcx     # 0x930b0
movl (%rax,%rcx), %r13d
leaq 0x8c827(%rip), %rcx     # 0x93130
xorl %ebp, %ebp
cmpl %r14d, (%rax,%rcx)
seta %bpl
movl %r13d, %r12d
subl %ebp, %r12d
movq (%rbx), %rcx
leaq (%rcx,%r12), %rax
addq $0x2, %rax
cmpq %rax, 0x8(%rbx)
jae 0x6982
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r15d, %r15d
testq %rcx, %rcx
cmoveq %rdx, %r15
addq %rax, %r15
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0x4840
testq %rax, %rax
je 0x69e4
movq %rax, 0x10(%rbx)
movq %r15, 0x8(%rbx)
movq (%rbx), %rcx
jmp 0x6986
movq 0x10(%rbx), %rax
orb $0x30, %r14b
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
movb %r14b, (%rax,%rcx)
movq 0x10(%rbx), %r12
addq (%rbx), %r12
jmp 0x69df
movq 0x10(%rbx), %rax
addq %rax, %rcx
negl %ebp
leal -0x2(%r13,%rbp), %eax
leaq 0x8ddf9(%rip), %rdx     # 0x94790
movl %r14d, %esi
movl %r14d, %edi
imulq $0x51eb851f, %rdi, %r14 # imm = 0x51EB851F
shrq $0x25, %r14
imull $0x64, %r14d, %edi
movl %esi, %r8d
subl %edi, %r8d
movl %eax, %edi
movzwl (%rdx,%r8,2), %r8d
movw %r8w, (%rcx,%rdi)
addl $-0x2, %eax
cmpl $0x3e7, %esi            # imm = 0x3E7
ja 0x6997
cmpl $-0x1, %eax
jne 0x69d5
orb $0x30, %r14b
movb %r14b, (%rcx)
addq (%rbx), %r12
movq %r12, (%rbx)
addq 0x10(%rbx), %r12
movb $0x0, (%r12)
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/./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 0x6bf3
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebx
movq %rsi, %r13
movq %rdi, %r14
movl 0x8(%rdi), %eax
cmpl 0xc(%rdi), %eax
jb 0x6a3d
movl (%r14), %esi
movl 0x4(%r14), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x6a2b
decl %esi
jmp 0x6a2d
incl %esi
movq %r14, %rdi
callq 0x913b
testl %eax, %eax
js 0x6be5
movl (%r14), %r12d
leal -0x1(%r12), %edx
movb (%r13), %cl
testb %cl, %cl
je 0x6a6f
leaq 0x1(%r13), %rax
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r15d, %ecx
imull $0x1000193, %ecx, %r15d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x6a57
jmp 0x6a75
movl $0x811c9dc5, %r15d      # imm = 0x811C9DC5
andl %edx, %r15d
movq 0x10(%r14), %rsi
movl %r15d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %eax
leal (%r15,%r15), %ecx
shrl %cl, %eax
testb $0x2, %al
je 0x6a97
movl %r15d, %r12d
jmp 0x6b6d
movq %r13, 0x10(%rsp)
movq %r14, 0x18(%rsp)
movl %ebx, 0xc(%rsp)
movl $0x1, %ebx
movl %r15d, %r13d
movq %r12, 0x28(%rsp)
movq %rsi, 0x30(%rsp)
movl %edx, 0x24(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r14d
leal (,%r13,2), %ebp
andl $0x1e, %ebp
movl %r14d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x6b39
testb $0x1, %al
jne 0x6b06
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq 0x10(%rsp), %rsi
callq 0x46c0
movl 0x24(%rsp), %edx
movq 0x30(%rsp), %rsi
testl %eax, %eax
je 0x6b39
btl %ebp, %r14d
cmovbl %r13d, %r12d
addl %ebx, %r13d
andl %edx, %r13d
incl %ebx
cmpl %r15d, %r13d
jne 0x6abb
movb $0x1, %al
movq 0x28(%rsp), %rdx
movl %edx, %ecx
cmpl %edx, %r12d
movl 0xc(%rsp), %ebx
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r13
je 0x6b5e
jmp 0x6b6d
movl %ebp, %ecx
shrl %cl, %r14d
testb $0x2, %r14b
sete %al
movl %r12d, %ecx
movl %r13d, %r15d
movl 0xc(%rsp), %ebx
movq 0x18(%rsp), %r14
movq 0x10(%rsp), %r13
movq 0x28(%rsp), %rdx
cmpl %edx, %ecx
cmovel %r15d, %ecx
testb %al, %al
cmovnel %r15d, %ecx
movl %ecx, %r12d
movl %r12d, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %edx
leal (%r12,%r12), %ecx
andl $0x1e, %ecx
shrl %cl, %edx
testb $0x2, %dl
jne 0x6b8e
testb $0x1, %dl
jne 0x6bbf
movl %r12d, %edx
jmp 0x6bde
movq 0x18(%r14), %rsi
movl %r12d, %edx
movq %r13, (%rsi,%rdx,8)
movl $0x3, %esi
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 0x6bde
movq 0x18(%r14), %rsi
movl %r12d, %edx
movq %r13, (%rsi,%rdx,8)
movl $0x3, %esi
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_O3/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 $0x48, %rsp
movl %r8d, 0x8(%rsp)
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, 0x10(%rsp)
movl (%rdx), %r14d
leaq (,%r14,4), %r12
movq %r12, %rdi
callq 0x4680
movq %rax, (%rbx)
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x71c3
testq %r14, %r14
je 0x719e
movq (%r13), %rax
movq %rax, (%rsp)
movq 0x8(%r15), %rax
movq %rax, 0x28(%rsp)
xorl %ecx, %ecx
movq %r14, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rcx, 0x38(%rsp)
movq (%rax,%rcx,8), %rbx
cmpq $0x0, (%rsp)
je 0x7161
movq (%rsp), %rax
movl (%rax), %edx
testl %edx, %edx
je 0x70bf
movb (%rbx), %cl
testb %cl, %cl
je 0x70c7
leaq 0x1(%rbx), %rax
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
movzbl %cl, %ecx
xorl %r14d, %ecx
imull $0x1000193, %ecx, %r14d # imm = 0x1000193
movb (%rax), %cl
incq %rax
testb %cl, %cl
jne 0x70a7
jmp 0x70cd
xorl %r13d, %r13d
jmp 0x715c
movl $0x811c9dc5, %r14d      # imm = 0x811C9DC5
movq %rdx, 0x18(%rsp)
decl %edx
andl %edx, %r14d
movq (%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x1, %ebp
movl %r14d, %r13d
movl %edx, 0xc(%rsp)
movq %rdi, 0x40(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%rdi,%rax,4), %r15d
leal (,%r13,2), %r12d
andl $0x1e, %r12d
movl %r15d, %eax
movl %r12d, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x7149
testb $0x1, %al
jne 0x713a
movq (%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rbx, %rsi
callq 0x46c0
movq 0x40(%rsp), %rdi
movl 0xc(%rsp), %edx
testl %eax, %eax
je 0x7149
addl %ebp, %r13d
andl %edx, %r13d
incl %ebp
cmpl %r14d, %r13d
jne 0x70f0
jmp 0x7161
movl %r12d, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
movq 0x18(%rsp), %rdx
cmovnel %edx, %r13d
cmpl %edx, %r13d
jne 0x716f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x0, 0x8(%rsp)
jne 0x717d
jmp 0x71ad
movq (%rsp), %rax
movq 0x20(%rax), %rax
movl %r13d, %ecx
movl (%rax,%rcx,4), %eax
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
movl %eax, (%rcx,%rdx,4)
movq %rdx, %rcx
incq %rcx
movq 0x20(%rsp), %r14
cmpq %r14, %rcx
jne 0x7074
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8c1ee(%rip), %rdi     # 0x933a2
movq %rbx, %rsi
movq 0x10(%rsp), %rdx
xorl %eax, %eax
callq 0x5edc
leaq 0x8bfe6(%rip), %rdi     # 0x931b0
movq %r12, %rsi
xorl %eax, %eax
callq 0x5edc
// File: /workspace/github_c_makefile_star2_O3/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 0x722b
xorl %ecx, %ecx
cmpl $0x30, %eax
je 0x7214
cmpl $0x31, %eax
jne 0x729f
movl $0x1, %ecx
movzbl 0x1(%r12), %eax
cmpl $0x30, %eax
je 0x727d
cmpl $0x31, %eax
jne 0x729f
movl $0x1, %ebp
jmp 0x728a
movl $0x1, %ebp
cmpl $0x4, %r13d
jl 0x7281
movl %r13d, %r15d
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
leaq (%r14,%r15), %rsi
addq $-0x4, %rsi
leaq 0x8c18f(%rip), %rdi     # 0x933de
callq 0x4520
testl %eax, %eax
je 0x7288
cmpl $0x7, %r13d
jb 0x7281
addq %r15, %r14
addq $-0x7, %r14
leaq 0x8c177(%rip), %rdi     # 0x933e3
movq %r14, %rsi
callq 0x4520
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
jmp 0x728a
xorl %ebp, %ebp
jmp 0x728a
movl $0x1, %ecx
jmp 0x728a
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 0x8c113(%rip), %rdi     # 0x933c0
xorl %eax, %eax
callq 0x5edc
// File: /workspace/github_c_makefile_star2_O3/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 0x7bbf
movq %rdi, %rbx
leaq 0x80(%rdi), %r14
movq 0x98(%rdi), %rdi
movl $0x2, %esi
movq %r14, %rdx
callq 0x15732
testl %eax, %eax
jle 0x7bb6
movl (%r14), %eax
jmp 0x7bbf
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x2, %ecx
jle 0x7bc7
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq (%rbx), %rsi
leaq 0x8bbf8(%rip), %rdi     # 0x937c9
xorl %eax, %eax
callq 0x5edc
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %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 0x9983
cmpb $0x67, 0x1(%r14)
jne 0x9983
cmpb $0x0, 0x2(%r14)
je 0x9a73
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x9995
movq (%rbx), %rax
movq 0x8(%rbx), %r12
jmp 0x99c6
movl $0x40, %r12d
movl $0x40, %edi
callq 0x4680
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x9a6c
movq %rax, %rdi
movq $0x40, 0x8(%rbx)
movq $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, %rsi
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
movq %rdx, %rdi
subq %rcx, %rdi
cmpq %rsi, %rdi
jae 0x9a61
cltq
addq %rcx, %rax
addq $0x2, %rax
cmpq %rax, %rdx
jae 0x9a33
movq %rax, %rcx
shrq $0x3e, %rcx
movq %rax, %rdx
shrq %rdx
xorl %r12d, %r12d
testq %rcx, %rcx
cmoveq %rdx, %r12
addq %rax, %r12
movq 0x10(%rbx), %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0x9a6c
movq %rax, 0x10(%rbx)
movq %r12, 0x8(%rbx)
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)
jmp 0x9aab
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x9aab
movl 0x4(%rsp), %ecx
cmpq $0xa0, %rcx
ja 0x9a91
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x10, %ecx
movl %ecx, 0x4(%rsp)
jmp 0x9a9f
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movsd (%rax), %xmm0
movq %rbx, %rdi
callq 0x93f8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x9ba3
testq %rbx, %rbx
je 0x9bbf
movl $0x0, 0x24(%r14)
movzbl (%rsi), %eax
testl %eax, %eax
je 0x9bac
cmpb $0x0, 0x1(%rsi)
je 0x9bac
movl $0xffffffff, 0x20(%r14) # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movups %xmm0, 0x10(%r14)
movb (%rsi), %cl
testb %cl, %cl
je 0x9bb0
incq %rsi
movl %ecx, %eax
shrb $0x3, %al
movl $0x1, %edx
shlq %cl, %rdx
movzbl %al, %eax
andl $0x18, %eax
orq %rdx, (%r14,%rax)
movb (%rsi), %cl
incq %rsi
testb %cl, %cl
jne 0x9b81
jmp 0x9bb0
cmpl $0x0, 0x24(%r14)
jne 0x9bc6
jmp 0x9bb0
movl %eax, 0x20(%r14)
testq %rbx, %rbx
je 0x9bca
movl $0x0, 0x24(%r14)
jmp 0x9bd1
cmpl $0x0, 0x24(%r14)
je 0x9b4f
xorl %ebx, %ebx
jmp 0x9c30
movq 0x28(%r14), %rbx
incq %rbx
movl 0x20(%r14), %esi
testl %esi, %esi
js 0x9bf3
movq %rbx, %rdi
callq 0x4190
testq %rax, %rax
jne 0x9c1f
movq %rbx, %rdi
callq 0x41d0
addq %rbx, %rax
jmp 0x9c1f
movb (%rbx), %cl
movq %rbx, %rax
testb %cl, %cl
je 0x9c1f
movq %rbx, %rax
movzbl %cl, %edx
shrb $0x3, %cl
movzbl %cl, %ecx
andl $0x18, %ecx
movq (%r14,%rcx), %rcx
btq %rdx, %rcx
jb 0x9c1f
movb 0x1(%rax), %cl
incq %rax
testb %cl, %cl
jne 0x9bff
movq %rax, 0x28(%r14)
cmpb $0x0, (%rax)
jne 0x9c30
movl $0x1, 0x24(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/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), %rbp
movq 0x10(%rdi), %r12
movq %rbp, %rdi
cmpq %rbp, %rdi
je 0x9e37
cmpb $0xa, -0x1(%r12,%rdi)
je 0x9ed0
movq 0x8(%rbx), %rax
movq %rax, %r13
subq %rdi, %r13
cmpq $-0xc9, %rax
ja 0x9e9e
cmpq $0xc7, %r13
ja 0x9e9e
leaq 0xc8(%rax), %rcx
shrq %rcx
movabsq $0x3fffffffffffff37, %rdx # imm = 0x3FFFFFFFFFFFFF37
cmpq %rdx, %rax
movl $0x0, %edx
cmovaq %rdx, %rcx
leaq (%rcx,%rax), %r13
addq $0xc8, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x4840
testq %rax, %rax
je 0x9f0c
movq %rax, %r12
movq %rax, 0x10(%rbx)
movq %r13, 0x8(%rbx)
movq (%rbx), %rdi
subq %rdi, %r13
addq %r12, %rdi
movl %r13d, %esi
movq %r14, %rdx
callq *%r15
movq (%rbx), %r13
testq %rax, %rax
je 0x9ecd
movq 0x10(%rbx), %r12
leaq (%r12,%r13), %rdi
callq 0x41d0
movq %rax, %rdi
addq %r13, %rdi
movq %rdi, (%rbx)
jmp 0x9e26
movq %r13, %rdi
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rbp, %rdi
je 0x9f11
movq 0x10(%rbx), %rax
jbe 0x9f01
cmpb $0xa, -0x1(%rax,%rdi)
jne 0x9f01
leaq -0x1(%rdi), %rcx
movq %rcx, (%rbx)
cmpq %rbp, %rcx
jbe 0x9f04
cmpb $0xd, -0x2(%rax,%rdi)
jne 0x9f04
addq $-0x2, %rdi
movq %rdi, (%rbx)
movq %rdi, %rcx
movb $0x0, (%rax,%rcx)
xorl %eax, %eax
jmp 0x9f11
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
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/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %r13
movabsq $0x3fffffffffffff37, %rbp # imm = 0x3FFFFFFFFFFFFF37
movq %r13, %rdi
movq 0x10(%rbx), %rax
cmpq %r13, %rdi
je 0x9f54
cmpb $0xa, -0x1(%rax,%rdi)
je 0x9fce
movq 0x8(%rbx), %rcx
movq %rcx, %r12
subq %rdi, %r12
cmpq $-0xc9, %rcx
ja 0x9faf
cmpq $0xc7, %r12
ja 0x9faf
leaq 0xc8(%rcx), %rdx
shrq %rdx
cmpq %rbp, %rcx
movl $0x0, %esi
cmovaq %rsi, %rdx
leaq (%rdx,%rcx), %r12
addq $0xc8, %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x4840
testq %rax, %rax
je 0xa00a
movq %rax, 0x10(%rbx)
movq %r12, 0x8(%rbx)
movq (%rbx), %rdi
subq %rdi, %r12
addq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *%r14
movq (%rbx), %rdi
testq %rax, %rax
jle 0x9fce
addq %rax, %rdi
movq %rdi, (%rbx)
jmp 0x9f44
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %r13, %rdi
je 0xa01e
movq 0x10(%rbx), %rax
jbe 0x9fff
cmpb $0xa, -0x1(%rax,%rdi)
jne 0x9fff
leaq -0x1(%rdi), %rcx
movq %rcx, (%rbx)
cmpq %r13, %rcx
jbe 0xa002
cmpb $0xd, -0x2(%rax,%rdi)
jne 0xa002
addq $-0x2, %rdi
movq %rdi, (%rbx)
movq %rdi, %rcx
movb $0x0, (%rax,%rcx)
xorl %eax, %eax
jmp 0xa01e
movq 0x10(%rbx), %rdi
addq (%rbx), %rdi
xorl %esi, %esi
movq %r15, %rdx
callq *%r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
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/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 0xa488
movl %eax, 0x4(%rsp)
movq %r9, 0x10(%rsp)
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x168d9
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
js 0xa532
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 0xa4ad
movq 0x128(%rbp), %rax
jmp 0xa4e9
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 0x1699a
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x400, %ebx            # imm = 0x400
cmovnel %ecx, %ebx
movq 0x128(%rbp), %rdi
movslq %ebx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,4), %rsi
callq 0x4840
testq %rax, %rax
je 0xa544
movq %rax, 0x128(%rbp)
movl %ebx, 0x124(%rbp)
movl 0x120(%rbp), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x120(%rbp)
movslq %ecx, %rcx
leaq (%rcx,%rcx,4), %rcx
movl %r12d, 0x10(%rax,%rcx,8)
movq %r15, (%rax,%rcx,8)
movq %r14, 0x8(%rax,%rcx,8)
movl 0x4(%rsp), %edx
movl %edx, 0x14(%rax,%rcx,8)
movzwl 0x10(%rsp), %edx
movq %rdx, 0x18(%rax,%rcx,8)
movq 0x110(%rbp), %rdx
movq %rdx, 0x20(%rax,%rcx,8)
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 0xa532
// File: /workspace/github_c_makefile_star2_O3/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
movq %rsi, %rdi
movl $0x72, %esi
callq 0x4190
testq %rax, %rax
je 0xa5a1
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xfe44
testq %rax, %rax
je 0xa603
movq %rax, %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0xa612
testq %rax, %rax
jne 0xa5e9
movq %r12, %rdi
callq 0xf53f
jmp 0xa601
movq %r15, %rdi
movl $0x77, %esi
callq 0x4190
testq %rax, %rax
jne 0xa5c5
movq %r15, %rdi
movl $0x61, %esi
callq 0x4190
testq %rax, %rax
je 0xa5f6
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0xfe44
testq %rax, %rax
je 0xa603
movq %rax, %r12
movq %r15, %rdi
callq 0xa8f0
testq %rax, %rax
je 0xa601
movq %rax, %rbx
movq %r12, 0x40(%rax)
andb $-0x9, 0x2(%rax)
jmp 0xa603
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_O3/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
movq %rsi, %rdi
movl $0x72, %esi
callq 0x4190
testq %rax, %rax
je 0xab0d
movl %ebp, %edi
movq %rbx, %rsi
callq 0xf570
testq %rax, %rax
je 0xab65
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
callq 0xa612
testq %rax, %rax
jne 0xab50
movq %r14, %rdi
callq 0xf53f
jmp 0xab65
movq %rbx, %rdi
movl $0x77, %esi
callq 0x4190
testq %rax, %rax
jne 0xab31
movq %rbx, %rdi
movl $0x61, %esi
callq 0x4190
testq %rax, %rax
je 0xab5a
movl %ebp, %edi
movq %rbx, %rsi
callq 0xf570
testq %rax, %rax
je 0xab65
movq %rax, %r14
movq %rbx, %rdi
callq 0xa8f0
testq %rax, %rax
je 0xab65
movq %r14, 0x40(%rax)
andb $-0x9, 0x2(%rax)
jmp 0xab67
callq 0x4050
movl $0x16, (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
movq %rsi, %rdi
movl $0x72, %esi
callq 0x4190
testq %rax, %rax
je 0xab9c
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa612
testq %rax, %rax
jne 0xabcd
jmp 0xabe8
movq %r14, %rdi
movl $0x77, %esi
callq 0x4190
testq %rax, %rax
jne 0xabc0
movq %r14, %rdi
movl $0x61, %esi
callq 0x4190
testq %rax, %rax
je 0xabda
movq %r14, %rdi
callq 0xa8f0
testq %rax, %rax
je 0xabe5
movq %rax, %r14
movq %rbx, 0x40(%rax)
andb $-0x9, 0x2(%rax)
jmp 0xabe8
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_O3/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 0xaddf
movq 0x30(%rsi), %rbx
testq %rbx, %rbx
je 0xaddf
movq %rbx, %rax
popq %rbx
retq
leal 0x6(%rcx), %eax
cmpl $0x8, %eax
ja 0xae00
leaq 0x89b32(%rip), %rdx     # 0x94920
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
leaq 0x8a404(%rip), %rbx     # 0x95202
jmp 0xadda
leaq 0xab9a9(%rip), %rbx     # 0xb67b0
leaq 0x8a431(%rip), %rdx     # 0x9523f
movl $0x20, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4800
jmp 0xadda
callq 0x4050
movl (%rax), %edi
popq %rbx
jmp 0x4150
leaq 0x8a38a(%rip), %rbx     # 0x951bd
jmp 0xadda
leaq 0x8a3dc(%rip), %rbx     # 0x95218
jmp 0xadda
leaq 0x8a36a(%rip), %rbx     # 0x951af
jmp 0xadda
leaq 0x8a348(%rip), %rbx     # 0x95196
jmp 0xadda
leaq 0x8a2fd(%rip), %rbx     # 0x95154
jmp 0xadda
// File: /workspace/github_c_makefile_star2_O3/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 0x36d54
movq %r15, %rdi
callq 0x4340
movq 0x20(%rbx), %rdi
callq 0x36155
movl %eax, %ebp
movq 0x20(%rbx), %rdi
callq 0x35f44
leaq 0x8(%rsp), %r12
movq $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 0xb6b4
movq (%rbx), %rdi
callq 0x57e84
cmpl $0x0, 0x14(%rbx)
je 0xb6c3
movq 0x18(%rbx), %rdi
callq 0x36efb
movq (%rbx), %rdi
callq 0x57d65
movq 0x128(%rbx), %rdi
testq %rdi, %rdi
je 0xb6dc
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 0xaa8da(%rip), %rax     # 0xb5fd8
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_O3/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 0xb72f
movq 0x8(%rcx), %rax
jmp 0xb781
testl %eax, %eax
js 0xb75f
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 0xb79e
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
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0xb79c
// File: /workspace/github_c_makefile_star2_O3/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 0xb7d5
addq $0x30, %rdi
callq 0x4750
movslq 0xc(%r14), %rbx
addq 0x18(%r14), %rbx
movq 0x48(%r14), %rdi
addq $0x30, %rdi
callq 0x4340
jmp 0xb7e4
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_O3/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 0xb831
testb $0x2, 0x30(%r15)
jne 0xb83e
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 0xf129
// File: /workspace/github_c_makefile_star2_O3/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 0xbb41
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
movl $0x1, %ebp
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 0xbb36
testb $0x1, %r15b
jne 0xbb25
movq 0x18(%rdx), %r15
movl %r8d, %r12d
cmpq %rsi, (%r15,%r12,8)
je 0xbb36
addl %ebp, %r8d
andl %r9d, %r8d
incl %ebp
cmpl %r10d, %r8d
jne 0xbaf5
xorl %eax, %eax
jmp 0xbb90
shrl %cl, %r14d
testb $0x3, %r14b
cmovnel %edi, %r8d
cmpl %edi, %r8d
je 0xbb90
movl %r8d, %eax
leaq (%rax,%rax,2), %r14
shlq $0x3, %r14
addq 0x20(%rdx), %r14
cmpl $0x0, 0x8(%rbx)
je 0xbb62
movl $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 0xf3b3
testq %rax, %rax
js 0xbb99
movl (%r14), %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %rcx
leaq 0x8970c(%rip), %rsi     # 0x952b0
leaq 0x8971b(%rip), %rdx     # 0x952c6
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
movl $0x1, %edi
callq 0x45e0
// File: /workspace/github_c_makefile_star2_O3/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:
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpb $0x1f, (%rdi)
jne 0xbc01
cmpb $-0x75, 0x1(%rdi)
jne 0xbc01
cmpb $0x8, 0x2(%rdi)
jne 0xbc01
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb $0x4, 0x3(%rdi)
je 0xbc01
cmpw $0x6, 0xa(%rdi)
jne 0xbc01
cmpb $0x42, 0xc(%rdi)
jne 0xbc01
cmpb $0x43, 0xd(%rdi)
jne 0xbc01
xorl %eax, %eax
cmpw $0x2, 0xe(%rdi)
setne %al
negl %eax
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/bgzf.c
// Function: inflate_block
static int inflate_block(BGZF* fp, int block_length)
{
    size_t dlen = BGZF_MAX_BLOCK_SIZE;
    uint32_t crc = le_to_u32((uint8_t *)fp->compressed_block + block_length-8);
    int ret = bgzf_uncompress(fp->uncompressed_block, &dlen,
                              (Bytef*)fp->compressed_block + 18,
                              block_length - 18, crc);
    if (ret < 0) {
        if (ret == -2)
            fp->errcode |= BGZF_ERR_CRC;
        else
            fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }

    return dlen;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rax
movq $0x10000, (%rax)        # imm = 0x10000
movq 0x28(%rdi), %rdi
movq 0x30(%rbx), %rdx
movl %esi, %ecx
movl -0x8(%rdx,%rcx), %r8d
addq $0x12, %rdx
leal -0x12(%rsi), %ecx
movq %rax, %rsi
callq 0xe65e
testl %eax, %eax
js 0xbc3e
movl 0x8(%rsp), %eax
jmp 0xbc55
cmpl $-0x2, %eax
movl $0x20, %eax
movl $0x1, %ecx
cmovel %eax, %ecx
orl %ecx, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/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), %edx
movl 0x10(%rdi), %ecx
cmpl %ecx, %edx
jg 0xc04a
movq %rbx, %rdi
callq 0xae59
testl %eax, %eax
js 0xc060
movl 0x8(%rbx), %edx
movl 0x10(%rbx), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %edx
je 0xc087
movq 0x28(%rbx), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
jmp 0xc087
movzwl (%rbx), %ecx
leaq 0x88c60(%rip), %rsi     # 0x94cca
leaq 0x88c63(%rip), %rdx     # 0x94cd4
movl $0x1, %edi
xorl %eax, %eax
callq 0x13de5
movw $0x1, (%rbx)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/bgzf.c
// Function: bgzf_thread_pool
int bgzf_thread_pool(BGZF *fp, hts_tpool *pool, int qsize) {
    // No gain from multi-threading when not compressed
    if (!fp->is_compressed)
        return 0;

    mtaux_t *mt;
    mt = (mtaux_t*)calloc(1, sizeof(mtaux_t));
    if (!mt) return -1;
    fp->mt = mt;

    mt->pool = pool;
    mt->n_threads = hts_tpool_size(pool);
    if (!qsize)
        qsize = mt->n_threads*2;
    if (!(mt->out_queue = hts_tpool_process_init(mt->pool, qsize, 0)))
        goto err;
    hts_tpool_process_ref_incr(mt->out_queue);

    mt->job_pool = pool_create(sizeof(bgzf_job));
    if (!mt->job_pool)
        goto err;

    pthread_mutex_init(&mt->job_pool_m, NULL);
    pthread_mutex_init(&mt->command_m, NULL);
    pthread_mutex_init(&mt->idx_m, NULL);
    pthread_cond_init(&mt->command_c, NULL);
    mt->flush_pending = 0;
    mt->jobs_pending = 0;
    mt->free_block = fp->uncompressed_block; // currently in-use block
    mt->block_address = fp->block_address;
    pthread_create(&mt->io_task, NULL,
                   fp->is_write ? bgzf_mt_writer : bgzf_mt_reader, fp);

    return 0;

 err:
    free(mt);
    fp->mt = NULL;
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testb $0x40, 0x3(%rdi)
je 0xc37f
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %r14
movl $0x1, %edi
movl $0x130, %esi            # imm = 0x130
callq 0x4300
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0xc37f
movq %rax, %r15
movq %rax, 0x48(%r14)
movq %r12, 0x18(%rax)
movq %r12, %rdi
callq 0x36af4
movl %eax, 0x10(%r15)
leal (%rax,%rax), %esi
testl %ebp, %ebp
cmovnel %ebp, %esi
movq 0x18(%r15), %rdi
xorl %edx, %edx
callq 0x361a9
movq %rax, 0x20(%r15)
testq %rax, %rax
je 0xc36f
movq %rax, %rdi
callq 0x36033
movl $0x20030, %edi          # imm = 0x20030
callq 0x57cec
movq %rax, (%r15)
testq %rax, %rax
je 0xc36f
leaq 0x30(%r15), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x4780
leaq 0x80(%r15), %rdi
xorl %esi, %esi
callq 0x4780
leaq 0xe0(%r15), %rdi
xorl %esi, %esi
callq 0x4780
leaq 0xa8(%r15), %rdi
xorl %esi, %esi
callq 0x45d0
movq $0x0, 0x58(%r15)
movq 0x28(%r14), %rax
movq %rax, 0x60(%r15)
movq 0x18(%r14), %rax
movq %rax, 0x70(%r15)
addq $0x28, %r15
btl $0x11, (%r14)
leaq 0x4b3(%rip), %rax       # 0xc808
leaq 0x2e(%rip), %rdx        # 0xc38a
cmovaeq %rax, %rdx
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rcx
callq 0x4920
jmp 0xc37f
movq %r15, %rdi
callq 0x45c0
movq $0x0, 0x48(%r14)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/bgzf.c
// Function: bgzf_mt
int bgzf_mt(BGZF *fp, int n_threads, int n_sub_blks)
{
    // No gain from multi-threading when not compressed
    if (!fp->is_compressed || fp->is_gzip)
        return 0;

    if (n_threads < 1) return -1;
    hts_tpool *p = hts_tpool_init(n_threads);
    if (!p)
        return -1;

    if (bgzf_thread_pool(fp, p, 0) != 0) {
        hts_tpool_destroy(p);
        return -1;
    }

    fp->mt->own_pool = 1;

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl $0xc0000000, %eax       # imm = 0xC0000000
andl (%rdi), %eax
xorl %ebx, %ebx
cmpl $0x40000000, %eax       # imm = 0x40000000
jne 0xcb7d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %esi, %esi
jle 0xcb7d
movq %rdi, %r14
movl %esi, %edi
callq 0x364c9
testq %rax, %rax
je 0xcb7d
movq %rax, %r15
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0xc26c
testl %eax, %eax
je 0xcb70
movq %r15, %rdi
callq 0x36efb
jmp 0xcb7d
movq 0x48(%r14), %rax
movl $0x1, 0x14(%rax)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/bgzf.c
// Function: mt_queue
static int mt_queue(BGZF *fp)
{
    mtaux_t *mt = fp->mt;

    mt->block_number++;

    // Also updated by writer thread
    pthread_mutex_lock(&mt->job_pool_m);
    bgzf_job *j = pool_alloc(mt->job_pool);
    if (j) mt->jobs_pending++;
    pthread_mutex_unlock(&mt->job_pool_m);
    if (!j) return -1;

    j->fp = fp;
    j->errcode = 0;
    j->uncomp_len  = fp->block_offset;
    if (fp->compress_level == 0) {
        memcpy(j->comp_data + BLOCK_HEADER_LENGTH + 5, fp->uncompressed_block,
               j->uncomp_len);
        if (hts_tpool_dispatch3(mt->pool, mt->out_queue,
                                bgzf_encode_level0_func, j,
                                job_cleanup, job_cleanup, 0) < 0) {
            goto fail;
        }
    } else {
        memcpy(j->uncomp_data, fp->uncompressed_block, j->uncomp_len);

        // Need non-block vers & job_pending?
        if (hts_tpool_dispatch3(mt->pool, mt->out_queue, bgzf_encode_func, j,
                                job_cleanup, job_cleanup, 0) < 0) {
            goto fail;
        }
    }

    fp->block_offset = 0;
    return 0;

 fail:
    job_cleanup(j);
    pthread_mutex_lock(&mt->job_pool_m);
    mt->jobs_pending--;
    pthread_mutex_unlock(&mt->job_pool_m);
    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x48(%rdi), %r12
incq 0x110(%r12)
leaq 0x30(%r12), %rbx
movq %rbx, %rdi
callq 0x4750
movq (%r12), %rdi
callq 0x57daa
testq %rax, %rax
je 0xcec5
movq %rax, %r15
incl 0x58(%r12)
movq %rbx, %rdi
callq 0x4340
movq %r14, (%r15)
movl $0x0, 0x20018(%r15)
movslq 0x10(%r14), %rdx
movq %rdx, 0x20010(%r15)
movzwl 0x2(%r14), %eax
movq 0x28(%r14), %rsi
movq %r15, %rdi
testl $0x1ff0, %eax           # imm = 0x1FF0
je 0xce6d
addq $0x10010, %rdi          # imm = 0x10010
callq 0x43c0
movq 0x18(%r12), %rdi
movq 0x20(%r12), %rsi
movl $0x0, (%rsp)
leaq 0x1e0a(%rip), %rdx      # 0xec75
jmp 0xce8e
addq $0x1f, %rdi
callq 0x43c0
movq 0x18(%r12), %rdi
movq 0x20(%r12), %rsi
movl $0x0, (%rsp)
leaq 0x1d8b(%rip), %rdx      # 0xec19
leaq 0x1c94(%rip), %r8       # 0xeb29
movq %r15, %rcx
movq %r8, %r9
callq 0x36b0d
testl %eax, %eax
js 0xceb0
movl $0x0, 0x10(%r14)
xorl %eax, %eax
jmp 0xced2
movq %r15, %rdi
callq 0xeb29
movq %rbx, %rdi
callq 0x4750
decl 0x58(%r12)
movq %rbx, %rdi
callq 0x4340
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq