LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/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) ks_resize(s, s->m + 200);
		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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r12
movq (%rbx), %rcx
cmpq %r12, %rcx
je 0x66684
movq 0x10(%rbx), %rax
cmpb $0xa, -0x1(%rax,%rcx)
je 0x66729
movq 0x8(%rbx), %rax
movq %rax, %rdx
subq %rcx, %rdx
cmpq $0xc8, %rdx
setae %cl
cmpq $-0xc8, %rax
setae %dl
orb %cl, %dl
jne 0x666f5
addq $0xc7, %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x8(%rbx)
movq 0x10(%rbx), %rdi
callq 0x6c80
testq %rax, %rax
je 0x666f5
movq %rax, 0x10(%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rdi
addq %rax, %rdi
movl 0x8(%rbx), %esi
subl %eax, %esi
movq %r14, %rdx
callq *%r15
testq %rax, %rax
je 0x66729
movq (%rbx), %r13
movq 0x10(%rbx), %rdi
addq %r13, %rdi
callq 0x62d0
addq %r13, %rax
movq %rax, (%rbx)
jmp 0x6666d
movq (%rbx), %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %r12, %rcx
je 0x6676a
jbe 0x6675d
movq 0x10(%rbx), %rax
cmpb $0xa, -0x1(%rax,%rcx)
jne 0x6675d
leaq -0x1(%rcx), %rdx
movq %rdx, (%rbx)
cmpq %r12, %rdx
jbe 0x6675d
cmpb $0xd, -0x2(%rax,%rcx)
jne 0x6675d
addq $-0x2, %rcx
movq %rcx, (%rbx)
movq (%rbx), %rax
movq 0x10(%rbx), %rcx
movb $0x0, (%rcx,%rax)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_read_init
static BGZF *bgzf_read_init(hFILE *hfpr)
{
    BGZF *fp;
    uint8_t magic[18];
    ssize_t n = hpeek(hfpr, magic, 18);
    if (n < 0) return NULL;

    fp = (BGZF*)calloc(1, sizeof(BGZF));
    if (fp == NULL) return NULL;

    fp->is_write = 0;
    fp->is_compressed = (n==2 && magic[0]==0x1f && magic[1]==0x8b);
    fp->uncompressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->compressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->is_compressed = (n==18 && magic[0]==0x1f && magic[1]==0x8b) ? 1 : 0;
    fp->is_gzip = ( !fp->is_compressed || ((magic[3]&4) && memcmp(&magic[12], "BC\2\0",4)==0) ) ? 0 : 1;
#ifdef BGZF_CACHE
    fp->cache = kh_init(cache);
#endif
    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsp, %rsi
movl $0x12, %edx
callq 0x6afd3
testq %rax, %rax
js 0x66c01
movq %rax, %r14
movl $0x1, %edi
movl $0x60, %esi
callq 0x6470
xorl %r15d, %r15d
testq %rax, %rax
je 0x66c01
movq %rax, %rbx
movl (%rax), %ebp
movl %ebp, %eax
andl $0xfffcffff, %eax       # imm = 0xFFFCFFFF
xorl %r12d, %r12d
cmpb $-0x75, 0x1(%rsp)
sete %r12b
shll $0x1d, %r12d
cmpb $0x1f, (%rsp)
cmovnel %r15d, %r12d
cmpq $0x2, %r14
movl $0x0, %ecx
cmovel %r12d, %ecx
movl %eax, (%rbx)
andl $0x9ffcffff, %ebp       # imm = 0x9FFCFFFF
orl %ebp, %ecx
movl %ecx, (%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x20(%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
cmpq $0x12, %r14
cmovnel %r15d, %r12d
movq %rax, 0x28(%rbx)
orl %r12d, %ebp
movl %ebp, (%rbx)
testl %r12d, %r12d
je 0x66be1
movl $0x80000000, %r15d      # imm = 0x80000000
testb $0x4, 0x3(%rsp)
je 0x66be1
xorl %r15d, %r15d
cmpl $0x24342, 0xc(%rsp)     # imm = 0x24342
setne %r15b
shll $0x1f, %r15d
andl $0x3ffcffff, %ebp       # imm = 0x3FFCFFFF
orl %r15d, %ebp
movl %ebp, (%rbx)
movl $0x1, %edi
movl $0x28, %esi
callq 0x6470
movq %rax, 0x30(%rbx)
jmp 0x66c03
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_write_init
static BGZF *bgzf_write_init(const char *mode)
{
    BGZF *fp;
    fp = (BGZF*)calloc(1, sizeof(BGZF));
    fp->is_write = 1;
    int compress_level = mode2level(mode);
    if ( compress_level==-2 )
    {
        fp->is_compressed = 0;
        return fp;
    }
    fp->is_compressed = 1;
    fp->uncompressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->compressed_block = malloc(BGZF_MAX_BLOCK_SIZE);
    fp->compress_level = compress_level < 0? Z_DEFAULT_COMPRESSION : compress_level; // Z_DEFAULT_COMPRESSION==-1
    if (fp->compress_level > 9) fp->compress_level = Z_DEFAULT_COMPRESSION;
    if ( strchr(mode,'g') )
    {
        // gzip output
        fp->is_gzip = 1;
        fp->gz_stream = (z_stream*)calloc(1,sizeof(z_stream));
        fp->gz_stream->zalloc = NULL;
        fp->gz_stream->zfree  = NULL;
        if ( deflateInit2(fp->gz_stream, fp->compress_level, Z_DEFLATED, 15|16, 8, Z_DEFAULT_STRATEGY)!=Z_OK ) return NULL;
    }
    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r14
movl $0x1, %edi
movl $0x60, %esi
callq 0x6470
movq %rax, %rbx
movl $0xfffcffff, %ebp       # imm = 0xFFFCFFFF
andl (%rax), %ebp
orl $0x10000, %ebp          # imm = 0x10000
movl %ebp, (%rax)
movq %r14, %rax
movzbl (%rax), %r12d
testl %r12d, %r12d
je 0x66c58
leal -0x30(%r12), %ecx
incq %rax
cmpb $0x9, %cl
ja 0x66c42
xorl %r15d, %r15d
cmpl $0x1, %r12d
sbbl %r15d, %r15d
movq %r14, %rdi
movl $0x75, %esi
callq 0x6270
andl $0x9ffdffff, %ebp       # imm = 0x9FFDFFFF
testq %rax, %rax
jne 0x66d55
addl $-0x30, %r12d
orl %r12d, %r15d
cmpl $-0x2, %r15d
je 0x66d55
movl %ebp, %r12d
orl $0x20000000, %r12d      # imm = 0x20000000
movl %r12d, (%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x20(%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x28(%rbx)
testl %r15d, %r15d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnsl %r15d, %eax
shll $0x14, %eax
andl $0x1ff00000, %eax       # imm = 0x1FF00000
andl $0xa00dffff, %r12d      # imm = 0xA00DFFFF
orl %eax, %r12d
orl $0x3ff00000, %ebp       # imm = 0x3FF00000
cmpl $0xa, %r15d
cmovll %r12d, %ebp
movl %ebp, (%rbx)
movq %r14, %rdi
movl $0x67, %esi
callq 0x6270
testq %rax, %rax
je 0x66d57
movl %ebp, %eax
orl $0x80000000, %eax       # imm = 0x80000000
movl %eax, (%rbx)
movl $0x1, %edi
movl $0x70, %esi
callq 0x6470
movq %rax, 0x58(%rbx)
shll $0x3, %ebp
sarl $0x17, %ebp
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rax)
leaq 0x31a40(%rip), %r10     # 0x98768
movq %rax, %rdi
movl %ebp, %esi
movl $0x8, %edx
movl $0x1f, %ecx
movl $0x8, %r8d
xorl %r9d, %r9d
pushq $0x70
pushq %r10
callq 0x6090
addq $0x10, %rsp
testl %eax, %eax
je 0x66d57
xorl %ebx, %ebx
jmp 0x66d57
movl %ebp, (%rbx)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_hopen
BGZF *bgzf_hopen(hFILE *hfp, const char *mode)
{
    BGZF *fp = NULL;
    assert(compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE);
    if (strchr(mode, 'r')) {
        fp = bgzf_read_init(hfp);
        if (fp == NULL) return NULL;
    } else if (strchr(mode, 'w') || strchr(mode, 'a')) {
        fp = bgzf_write_init(mode);
    }
    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
movl $0xff00, %edi           # imm = 0xFF00
callq 0x6c10
cmpq $0x10000, %rax          # imm = 0x10000
jae 0x66ed7
movq %r14, %rdi
movl $0x72, %esi
callq 0x6270
testq %rax, %rax
je 0x66e8e
movq %rbx, %rdi
callq 0x66b16
testq %rax, %rax
jne 0x66eba
xorl %eax, %eax
jmp 0x66ec2
movq %r14, %rdi
movl $0x77, %esi
callq 0x6270
testq %rax, %rax
jne 0x66eb2
movq %r14, %rdi
movl $0x61, %esi
callq 0x6270
testq %rax, %rax
je 0x66eca
movq %r14, %rdi
callq 0x66c13
movq %rbx, 0x38(%rax)
andb $-0xd, 0x2(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x6060
movl $0x16, (%rax)
jmp 0x66e8a
leaq 0x32b62(%rip), %rdi     # 0x99a40
leaq 0x32b90(%rip), %rsi     # 0x99a75
leaq 0x32be0(%rip), %rcx     # 0x99acc
movl $0xda, %edx
callq 0x6460
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_compress
int bgzf_compress(void *_dst, size_t *dlen, const void *src, size_t slen, int level)
{
    uint32_t crc;
    z_stream zs;
    uint8_t *dst = (uint8_t*)_dst;

    // compress the body
    zs.zalloc = NULL; zs.zfree = NULL;
    zs.next_in  = (Bytef*)src;
    zs.avail_in = slen;
    zs.next_out = dst + BLOCK_HEADER_LENGTH;
    zs.avail_out = *dlen - BLOCK_HEADER_LENGTH - BLOCK_FOOTER_LENGTH;
    if (deflateInit2(&zs, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK) return -1; // -15 to disable zlib header/footer
    if (deflate(&zs, Z_FINISH) != Z_STREAM_END) return -1;
    if (deflateEnd(&zs) != Z_OK) return -1;
    *dlen = zs.total_out + BLOCK_HEADER_LENGTH + BLOCK_FOOTER_LENGTH;
    // write the header
    memcpy(dst, g_magic, BLOCK_HEADER_LENGTH); // the last two bytes are a place holder for the length of the block
    packInt16(&dst[16], *dlen - 1); // write the compressed length; -1 to fit 2 bytes
    // write the footer
    crc = crc32(crc32(0L, NULL, 0L), (Bytef*)src, slen);
    packInt32((uint8_t*)&dst[*dlen - 8], crc);
    packInt32((uint8_t*)&dst[*dlen - 4], slen);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movq %rsp, %rdi
movups %xmm0, 0x40(%rdi)
movq %rdx, (%rdi)
movl %ebx, 0x8(%rdi)
leaq 0x12(%r14), %rax
movq %rax, 0x18(%rdi)
movl (%rsi), %eax
addl $-0x1a, %eax
movl %eax, 0x20(%rdi)
leaq 0x31832(%rip), %rax     # 0x98768
movl %r8d, %esi
movl $0x8, %edx
movl $0xfffffff1, %ecx       # imm = 0xFFFFFFF1
movl $0x8, %r8d
xorl %r9d, %r9d
pushq $0x70
pushq %rax
callq 0x6090
addq $0x10, %rsp
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x66fd3
movq %rsp, %rdi
movl $0x4, %esi
callq 0x6310
cmpl $0x1, %eax
jne 0x66fd3
movq %rsp, %rdi
callq 0x6420
testl %eax, %eax
jne 0x66fd3
movq 0x28(%rsp), %rax
addq $0x1a, %rax
movq %rax, (%r15)
movaps 0x32cad(%rip), %xmm0    # 0x99c40
movups %xmm0, (%r14)
movw $0x0, 0x10(%r14)
movl (%r15), %eax
decl %eax
movw %ax, 0x10(%r14)
xorl %r13d, %r13d
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x64b0
movq %rax, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x64b0
movq (%r15), %rcx
movl %eax, -0x8(%r14,%rcx)
movq (%r15), %rax
movl %ebx, -0x4(%r14,%rax)
movl %r13d, %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: inflate_gzip_block
static int inflate_gzip_block(BGZF *fp, int cached)
{
    int ret = Z_OK;
    do
    {
        if ( !cached && fp->gz_stream->avail_out!=0 )
        {
            fp->gz_stream->avail_in = hread(fp->fp, fp->compressed_block, BGZF_BLOCK_SIZE);
            if ( fp->gz_stream->avail_in<=0 ) return fp->gz_stream->avail_in;
            if ( fp->gz_stream->avail_in==0 ) break;
            fp->gz_stream->next_in = fp->compressed_block;
        }
        else cached = 0;
        do
        {
            fp->gz_stream->next_out = (Bytef*)fp->uncompressed_block + fp->block_offset;
            fp->gz_stream->avail_out = BGZF_MAX_BLOCK_SIZE - fp->block_offset;
            ret = inflate(fp->gz_stream, Z_NO_FLUSH);
            if ( ret==Z_BUF_ERROR ) continue;   // non-critical error
            if ( ret<0 ) return -1;
            unsigned int have = BGZF_MAX_BLOCK_SIZE - fp->gz_stream->avail_out;
            if ( have ) return have;
        }
        while ( fp->gz_stream->avail_out == 0 );
    }
    while (ret != Z_STREAM_END);
    return BGZF_MAX_BLOCK_SIZE - fp->gz_stream->avail_out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
testl %esi, %esi
sete %dl
movl $0xff00, %r15d          # imm = 0xFF00
testb $0x1, %dl
je 0x6755a
movq 0x58(%r14), %rax
cmpl $0x0, 0x20(%rax)
je 0x6755a
movq 0x28(%r14), %r12
movq 0x38(%r14), %r13
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rbp
subq %rsi, %rbp
cmpq %r15, %rbp
movl $0xff00, %r15d          # imm = 0xFF00
cmovbq %rbp, %r15
movq %r12, %rdi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r13)
cmpq $0xfeff, %rbp           # imm = 0xFEFF
ja 0x6753c
movl $0xff00, %edx           # imm = 0xFF00
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rcx
callq 0x6b053
movq %rax, %r15
movq 0x58(%r14), %rax
movl %r15d, 0x8(%rax)
testl %r15d, %r15d
je 0x675d6
movq 0x28(%r14), %rcx
movq %rcx, (%rax)
movl $0xff00, %r15d          # imm = 0xFF00
movslq 0xc(%r14), %rax
movq %rax, %rcx
addq 0x20(%r14), %rcx
movl $0x10000, %edx          # imm = 0x10000
subl %eax, %edx
movq 0x58(%r14), %rdi
movq %rcx, 0x18(%rdi)
movl %edx, 0x20(%rdi)
xorl %esi, %esi
callq 0x6540
cmpl $-0x5, %eax
je 0x675a1
testl %eax, %eax
js 0x675c0
movq 0x58(%r14), %rcx
movl 0x20(%rcx), %ecx
leal -0x10000(%rcx), %edx
negl %edx
cmpl $0x10000, %ecx          # imm = 0x10000
cmovnel %edx, %ebx
jne 0x675c5
movq 0x58(%r14), %rcx
movl 0x20(%rcx), %ecx
testl %ecx, %ecx
je 0x6755a
movb $0x1, %dl
cmpl $0x1, %eax
jne 0x674df
movl $0x10000, %ebx          # imm = 0x10000
subl %ecx, %ebx
jmp 0x675c5
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x675c5
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: inflate_block
static int inflate_block(BGZF* fp, int block_length)
{
    z_stream zs;
    zs.zalloc = NULL;
    zs.zfree = NULL;
    zs.next_in = (Bytef*)fp->compressed_block + 18;
    zs.avail_in = block_length - 16;
    zs.next_out = (Bytef*)fp->uncompressed_block;
    zs.avail_out = BGZF_MAX_BLOCK_SIZE;

    if (inflateInit2(&zs, -15) != Z_OK) {
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if (inflate(&zs, Z_FINISH) != Z_STREAM_END) {
        inflateEnd(&zs);
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    if (inflateEnd(&zs) != Z_OK) {
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    return zs.total_out;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rdi
movups %xmm0, 0x40(%rdi)
movq 0x28(%rbx), %rax
addq $0x12, %rax
movq %rax, (%rdi)
addl $-0x10, %esi
movl %esi, 0x8(%rdi)
movq 0x20(%rbx), %rax
movq %rax, 0x18(%rdi)
movl $0x10000, 0x20(%rdi)    # imm = 0x10000
leaq 0x31152(%rip), %rdx     # 0x98768
movl $0xfffffff1, %esi       # imm = 0xFFFFFFF1
movl $0x70, %ecx
callq 0x65d0
testl %eax, %eax
jne 0x6764c
movq %rsp, %r14
movq %r14, %rdi
movl $0x4, %esi
callq 0x6540
movl %eax, %ebp
movq %r14, %rdi
callq 0x6730
cmpl $0x1, %ebp
jne 0x6764c
testl %eax, %eax
je 0x6765d
orb $0x1, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl 0x28(%rsp), %eax
jmp 0x67654
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_read
ssize_t bgzf_read(BGZF *fp, void *data, size_t length)
{
    ssize_t bytes_read = 0;
    uint8_t *output = (uint8_t*)data;
    if (length <= 0) return 0;
    assert(fp->is_write == 0);
    while (bytes_read < length) {
        int copy_length, available = fp->block_length - fp->block_offset;
        uint8_t *buffer;
        if (available <= 0) {
            if (bgzf_read_block(fp) != 0) return -1;
            available = fp->block_length - fp->block_offset;
            if (available <= 0) break;
        }
        copy_length = length - bytes_read < available? length - bytes_read : available;
        buffer = (uint8_t*)fp->uncompressed_block;
        memcpy(output, buffer + fp->block_offset, copy_length);
        fp->block_offset += copy_length;
        output += copy_length;
        bytes_read += copy_length;
    }
    if (fp->block_offset == fp->block_length) {
        fp->block_address = htell(fp->fp);
        fp->block_offset = fp->block_length = 0;
    }
    fp->uncompressed_address += bytes_read;
    return bytes_read;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x67a34
movq %rdi, %r14
testb $0x3, 0x2(%rdi)
jne 0x67a51
movq %rdx, %r15
movq %rsi, %r12
xorl %ebx, %ebx
movq %r15, %rbp
subq %rbx, %rbp
jbe 0x67a09
movl 0x8(%r14), %eax
subl 0xc(%r14), %eax
jle 0x679dc
movl %eax, %r13d
cmpq %r13, %rbp
cmovbq %rbp, %r13
movslq 0xc(%r14), %rsi
addq 0x20(%r14), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x6570
addl %r13d, 0xc(%r14)
addq %r13, %r12
addq %r13, %rbx
xorl %ecx, %ecx
jmp 0x679ed
movq %r14, %rdi
callq 0x66fe4
movl $0x1, %ecx
testl %eax, %eax
je 0x679f3
testl %ecx, %ecx
je 0x6799f
jmp 0x67a04
movl 0x8(%r14), %eax
subl 0xc(%r14), %eax
jg 0x679b1
movl $0x3, %ecx
jmp 0x679ed
cmpl $0x3, %ecx
jne 0x67a38
movl 0xc(%r14), %eax
cmpl 0x8(%r14), %eax
jne 0x67a2e
movq 0x38(%r14), %rax
movq 0x28(%rax), %rcx
addq 0x8(%rax), %rcx
subq (%rax), %rcx
movq %rcx, 0x10(%r14)
movq $0x0, 0x8(%r14)
addq %rbx, 0x18(%r14)
jmp 0x67a3f
xorl %ebx, %ebx
jmp 0x67a3f
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3209c(%rip), %rdi     # 0x99af4
leaq 0x32016(%rip), %rsi     # 0x99a75
leaq 0x320a0(%rip), %rcx     # 0x99b06
movl $0x229, %edx            # imm = 0x229
callq 0x6460
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_flush
int bgzf_flush(BGZF *fp)
{
    if (!fp->is_write) return 0;
#ifdef BGZF_MT
    if (fp->mt) {
        if (fp->block_offset) mt_queue(fp); // guaranteed that assertion does not fail
        return mt_flush_queue(fp);
    }
#endif
    while (fp->block_offset > 0) {
        if ( fp->idx_build_otf )
        {
            bgzf_index_add_block(fp);
            fp->idx->ublock_addr += fp->block_offset;
        }
        int block_length = deflate_block(fp, fp->block_offset);
        if (block_length < 0) return -1;
        if (hwrite(fp->fp, fp->compressed_block, block_length) != block_length) {
            fp->errcode |= BGZF_ERR_IO; // possibly truncated file
            return -1;
        }
        fp->block_address += block_length;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testb $0x3, 0x2(%rdi)
je 0x67d5a
movq %rdi, %rbx
cmpq $0x0, 0x40(%rdi)
movl 0xc(%rdi), %eax
je 0x67cc9
testl %eax, %eax
je 0x67cb3
movq %rbx, %rdi
callq 0x67d77
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x67de1
testl %eax, %eax
jle 0x67d5a
cmpl $0x0, 0x50(%rbx)
je 0x67ceb
movq %rbx, %rdi
callq 0x67663
movslq 0xc(%rbx), %rax
movq 0x48(%rbx), %rcx
addq %rax, 0x10(%rcx)
movl 0xc(%rbx), %esi
movq %rbx, %rdi
callq 0x67f21
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x67d5c
movq 0x28(%rbx), %r12
movq 0x38(%rbx), %r13
movl %eax, %r14d
movq 0x8(%r13), %rdi
movq 0x18(%r13), %rbp
subq %rdi, %rbp
cmpq %r14, %rbp
movq %r14, %r15
cmovbq %rbp, %r15
movq %r12, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r13)
cmpq %r14, %rbp
jae 0x67d47
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x6b222
movq %rax, %r15
cmpq %r14, %r15
jne 0x67d6d
addq %r14, 0x10(%rbx)
cmpl $0x0, 0xc(%rbx)
jg 0x67cd1
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
orb $0x4, (%rbx)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x67d5c
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: mt_queue
static void mt_queue(BGZF *fp)
{
    mtaux_t *mt = fp->mt;
    assert(mt->curr < mt->n_blks); // guaranteed by the caller
    memcpy(mt->blk[mt->curr], fp->uncompressed_block, fp->block_offset);
    mt->len[mt->curr] = fp->block_offset;
    fp->block_offset = 0;
    ++mt->curr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x40(%rdi), %r14
movslq 0x8(%r14), %rax
cmpl 0x4(%r14), %eax
jge 0x67dc2
movq %rdi, %rbx
movq 0x18(%r14), %rcx
movq (%rcx,%rax,8), %rdi
movq 0x20(%rbx), %rsi
movslq 0xc(%rbx), %rdx
callq 0x6570
movl 0xc(%rbx), %eax
movq 0x20(%r14), %rcx
movslq 0x8(%r14), %rdx
movl %eax, (%rcx,%rdx,4)
movl $0x0, 0xc(%rbx)
incl 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x31e44(%rip), %rdi     # 0x99c0d
leaq 0x31ca5(%rip), %rsi     # 0x99a75
leaq 0x31e4c(%rip), %rcx     # 0x99c23
movl $0x2aa, %edx            # imm = 0x2AA
callq 0x6460
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: mt_flush_queue
static int mt_flush_queue(BGZF *fp)
{
    int i;
    mtaux_t *mt = fp->mt;
    // signal all the workers to compress
    pthread_mutex_lock(&mt->lock);
    for (i = 0; i < mt->n_threads; ++i) mt->w[i].toproc = 1;
    mt->proc_cnt = 0;
    pthread_cond_broadcast(&mt->cv);
    pthread_mutex_unlock(&mt->lock);
    // worker 0 is doing things here
    worker_aux(&mt->w[0]);
    // wait for all the threads to complete
    while (mt->proc_cnt < mt->n_threads);
    // dump data to disk
    for (i = 0; i < mt->n_threads; ++i) fp->errcode |= mt->w[i].errcode;
    for (i = 0; i < mt->curr; ++i)
        if (hwrite(fp->fp, mt->blk[i], mt->len[i]) != mt->len[i]) {
            fp->errcode |= BGZF_ERR_IO;
            break;
        }
    mt->curr = 0;
    return (fp->errcode == 0)? 0 : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
movq 0x40(%rdi), %rbp
leaq 0x38(%rbp), %r14
movq %r14, %rdi
callq 0x6ae0
movslq (%rbp), %rax
testq %rax, %rax
jle 0x67e26
movq 0x28(%rbp), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movl $0x1, 0x18(%rcx,%rdx)
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x67e15
movl $0x0, 0x10(%rbp)
leaq 0x60(%rbp), %rdi
callq 0x6250
movq %r14, %rdi
callq 0x64f0
movq 0x28(%rbp), %rdi
callq 0x69211
movl (%rbp), %eax
movl 0x10(%rbp), %ecx
cmpl %eax, %ecx
jl 0x67e4a
cmpl $0x0, (%rbp)
jle 0x67e79
movl $0x14, %eax
xorl %ecx, %ecx
movq 0x28(%rbp), %rdx
movzwl (%rdx,%rax), %edx
orl %edx, (%r15)
incq %rcx
movslq (%rbp), %rdx
addq $0x20, %rax
cmpq %rdx, %rcx
jl 0x67e5e
cmpl $0x0, 0x8(%rbp)
jle 0x67f03
xorl %ebx, %ebx
movq %r15, 0x8(%rsp)
movq 0x38(%r15), %r15
movq 0x18(%rbp), %rax
movq 0x20(%rbp), %rcx
movq (%rax,%rbx,8), %rsi
movslq (%rcx,%rbx,4), %r13
movq 0x8(%r15), %rdi
movq 0x18(%r15), %r12
subq %rdi, %r12
cmpq %r13, %r12
movq %r13, %r14
cmovbq %r12, %r14
movq %rsi, 0x10(%rsp)
movq %r14, %rdx
callq 0x6570
addq %r14, 0x8(%r15)
cmpq %r13, %r12
jae 0x67edf
movq %r15, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
movq %r14, %rcx
callq 0x6b222
movq %rax, %r14
movq 0x20(%rbp), %rax
movslq (%rax,%rbx,4), %rax
cmpq %rax, %r14
movq 0x8(%rsp), %r15
jne 0x67eff
incq %rbx
movslq 0x8(%rbp), %rax
cmpq %rax, %rbx
jl 0x67e8a
jmp 0x67f03
orb $0x4, (%r15)
movl $0x0, 0x8(%rbp)
xorl %eax, %eax
cmpw (%r15), %ax
sbbl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: deflate_block
static int deflate_block(BGZF *fp, int block_length)
{
    size_t comp_size = BGZF_MAX_BLOCK_SIZE;
    int ret;
    if ( !fp->is_gzip )
        ret = bgzf_compress(fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);
    else
        ret = bgzf_gzip_compress(fp, fp->compressed_block, &comp_size, fp->uncompressed_block, block_length, fp->compress_level);

    if ( ret != 0 )
    {
        fp->errcode |= BGZF_ERR_ZLIB;
        return -1;
    }
    fp->block_offset = 0;
    return comp_size;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $0x10000, (%rsp)        # imm = 0x10000
movl (%rdi), %r8d
movq 0x28(%rdi), %rdi
movq 0x20(%rbx), %rdx
testl %r8d, %r8d
js 0x67f59
movslq %esi, %rcx
shll $0x3, %r8d
sarl $0x17, %r8d
movq %rsp, %rsi
callq 0x66ef6
testl %eax, %eax
jne 0x67f89
jmp 0x67fa3
movq 0x58(%rbx), %r14
xorl %eax, %eax
testl %esi, %esi
sete %al
shll $0x2, %eax
movq %rdx, (%r14)
movl %esi, 0x8(%r14)
movq %rdi, 0x18(%r14)
movl $0x10000, 0x20(%r14)    # imm = 0x10000
movq %r14, %rdi
movl %eax, %esi
callq 0x6310
cmpl $-0x2, %eax
jne 0x67f93
orb $0x1, (%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x67fad
movl 0x20(%r14), %eax
movl $0x10000, %ecx          # imm = 0x10000
subq %rax, %rcx
movq %rcx, (%rsp)
movl $0x0, 0xc(%rbx)
movl (%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: lazy_flush
static int lazy_flush(BGZF *fp)
{
    if (fp->mt) {
        if (fp->block_offset) mt_queue(fp);
        return (fp->mt->curr < fp->mt->n_blks)? 0 : mt_flush_queue(fp);
    }
    else return bgzf_flush(fp);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x40(%rdi)
je 0x67ff0
cmpl $0x0, 0xc(%rbx)
je 0x67fe0
movq %rbx, %rdi
callq 0x67d77
movq 0x40(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl 0x4(%rax), %ecx
jge 0x67ff9
xorl %eax, %eax
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x67c85
movq %rbx, %rdi
popq %rbx
jmp 0x67de1
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_write
ssize_t bgzf_write(BGZF *fp, const void *data, size_t length)
{
    if ( !fp->is_compressed )
        return hwrite(fp->fp, data, length);

    const uint8_t *input = (const uint8_t*)data;
    ssize_t remaining = length;
    assert(fp->is_write);
    while (remaining > 0) {
        uint8_t* buffer = (uint8_t*)fp->uncompressed_block;
        int copy_length = BGZF_BLOCK_SIZE - fp->block_offset;
        if (copy_length > remaining) copy_length = remaining;
        memcpy(buffer + fp->block_offset, input, copy_length);
        fp->block_offset += copy_length;
        input += copy_length;
        remaining -= copy_length;
        if (fp->block_offset == BGZF_BLOCK_SIZE) {
            if (lazy_flush(fp) != 0) return -1;
        }
    }
    return length - remaining;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl (%rdi), %eax
testl $0x60000000, %eax       # imm = 0x60000000
je 0x6808b
testl $0x30000, %eax          # imm = 0x30000
je 0x680e9
movq %rbx, %r13
testq %rbx, %rbx
jle 0x68083
movq %rbx, %r13
movslq 0xc(%r15), %rdi
movl $0xff00, %eax           # imm = 0xFF00
subq %rdi, %rax
cmpq %rax, %r13
movl %r13d, %ecx
cmovgel %eax, %ecx
addq 0x20(%r15), %rdi
movslq %ecx, %r12
movq %r14, %rsi
movq %r12, %rdx
callq 0x6570
movl 0xc(%r15), %eax
addl %r12d, %eax
movl %eax, 0xc(%r15)
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0x68078
movq %r15, %rdi
callq 0x67fc7
testl %eax, %eax
jne 0x680d5
addq %r12, %r14
subq %r12, %r13
testq %r13, %r13
jg 0x68033
subq %r13, %rbx
movq %rbx, %r15
jmp 0x680dc
movq 0x38(%r15), %r12
movq 0x8(%r12), %rdi
movq 0x18(%r12), %r13
subq %rdi, %r13
cmpq %rbx, %r13
movq %rbx, %r15
cmovbq %r13, %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r12)
cmpq %rbx, %r13
jae 0x680dc
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x6b222
movq $-0x1, %r15
movq %r15, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x31a40(%rip), %rdi     # 0x99b30
leaq 0x3197e(%rip), %rsi     # 0x99a75
leaq 0x31a3f(%rip), %rcx     # 0x99b3d
movl $0x308, %edx            # imm = 0x308
callq 0x6460
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_close
int bgzf_close(BGZF* fp)
{
    int ret, block_length;
    if (fp == 0) return -1;
    if (fp->is_write && fp->is_compressed) {
        if (bgzf_flush(fp) != 0) return -1;
        fp->compress_level = -1;
        block_length = deflate_block(fp, 0); // write an empty block
        if (hwrite(fp->fp, fp->compressed_block, block_length) < 0
            || hflush(fp->fp) != 0) {
            fp->errcode |= BGZF_ERR_IO;
            return -1;
        }
#ifdef BGZF_MT
        if (fp->mt) mt_destroy(fp->mt);
#endif
    }
    if ( fp->is_gzip )
    {
        if (!fp->is_write) (void)inflateEnd(fp->gz_stream);
        else (void)deflateEnd(fp->gz_stream);
        free(fp->gz_stream);
    }
    ret = hclose(fp->fp);
    if (ret != 0) return -1;
    bgzf_index_destroy(fp);
    free(fp->uncompressed_block);
    free(fp->compressed_block);
    free_cache(fp);
    free(fp);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x68300
movq %rdi, %rbx
movl (%rdi), %eax
testl $0x30000, %eax          # imm = 0x30000
sete %cl
testl $0x60000000, %eax       # imm = 0x60000000
sete %al
orb %cl, %al
je 0x681bd
movl (%rbx), %eax
testl %eax, %eax
jns 0x68253
movq 0x58(%rbx), %rdi
testl $0x30000, %eax          # imm = 0x30000
je 0x68245
callq 0x6420
jmp 0x6824a
movq %rbx, %rdi
callq 0x67c85
testl %eax, %eax
jne 0x68300
orl $0x1ff00000, (%rbx)     # imm = 0x1FF00000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x67f21
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %r13
movslq %eax, %r12
movq 0x8(%r13), %rdi
movq 0x18(%r13), %r15
subq %rdi, %r15
cmpq %r12, %r15
movq %r12, %r14
cmovbq %r15, %r14
movq %rsi, (%rsp)
movq %r14, %rdx
callq 0x6570
addq %r14, 0x8(%r13)
cmpq %r12, %r15
jae 0x68227
movq %r13, %rdi
movq (%rsp), %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x6b222
movq %rax, %r14
testq %r14, %r14
js 0x6823d
movq 0x38(%rbx), %rdi
callq 0x6b143
testl %eax, %eax
je 0x68311
orb $0x4, (%rbx)
jmp 0x68300
callq 0x6730
movq 0x58(%rbx), %rdi
callq 0x68a0
movq 0x38(%rbx), %rdi
callq 0x6b37e
testl %eax, %eax
jne 0x68300
movq %rbx, %rdi
callq 0x68418
movq 0x20(%rbx), %rdi
callq 0x68a0
movq 0x28(%rbx), %rdi
callq 0x68a0
testb $0x3, 0x2(%rbx)
jne 0x682f6
movq 0x30(%rbx), %r14
cmpl $0x0, (%r14)
je 0x682d3
movl $0x4, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
movq 0x10(%r14), %rax
movl %r13d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r12d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x682c0
movq 0x20(%r14), %rax
movq (%rax,%r15,2), %rdi
callq 0x68a0
incq %r13
movl (%r14), %eax
addq $0xc, %r15
addl $0x2, %r12d
cmpq %rax, %r13
jb 0x6829a
movq 0x18(%r14), %rdi
callq 0x68a0
movq 0x10(%r14), %rdi
callq 0x68a0
movq 0x20(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0x6819a
callq 0x68328
jmp 0x6819a
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: mt_destroy
static void mt_destroy(mtaux_t *mt)
{
    int i;
    // signal all workers to quit
    pthread_mutex_lock(&mt->lock);
    mt->done = 1; mt->proc_cnt = 0;
    pthread_cond_broadcast(&mt->cv);
    pthread_mutex_unlock(&mt->lock);
    for (i = 1; i < mt->n_threads; ++i) pthread_join(mt->tid[i], 0); // worker 0 is effectively launched by the master thread
    // free other data allocated on heap
    for (i = 0; i < mt->n_blks; ++i) free(mt->blk[i]);
    for (i = 0; i < mt->n_threads; ++i) free(mt->w[i].buf);
    free(mt->blk); free(mt->len); free(mt->w); free(mt->tid);
    pthread_cond_destroy(&mt->cv);
    pthread_mutex_destroy(&mt->lock);
    free(mt);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
movq %r14, %rdi
callq 0x6ae0
movl $0x1, 0xc(%rbx)
movl $0x0, 0x10(%rbx)
leaq 0x60(%rbx), %r15
movq %r15, %rdi
callq 0x6250
movq %r14, %rdi
callq 0x64f0
cmpl $0x2, (%rbx)
jl 0x68387
movl $0x1, %r12d
movq 0x30(%rbx), %rax
movq (%rax,%r12,8), %rdi
xorl %esi, %esi
callq 0x6610
incq %r12
movslq (%rbx), %rax
cmpq %rax, %r12
jl 0x6836d
cmpl $0x0, 0x4(%rbx)
jle 0x683a9
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rdi
callq 0x68a0
incq %r12
movslq 0x4(%rbx), %rax
cmpq %rax, %r12
jl 0x68390
cmpl $0x0, (%rbx)
jle 0x683d3
movl $0x8, %r12d
xorl %r13d, %r13d
movq 0x28(%rbx), %rax
movq (%rax,%r12), %rdi
callq 0x68a0
incq %r13
movslq (%rbx), %rax
addq $0x20, %r12
cmpq %rax, %r13
jl 0x683b7
movq 0x18(%rbx), %rdi
callq 0x68a0
movq 0x20(%rbx), %rdi
callq 0x68a0
movq 0x28(%rbx), %rdi
callq 0x68a0
movq 0x30(%rbx), %rdi
callq 0x68a0
movq %r15, %rdi
callq 0x6e60
movq %r14, %rdi
callq 0x6860
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x68a0
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_check_EOF
int bgzf_check_EOF(BGZF *fp)
{
    uint8_t buf[28];
    off_t offset = htell(fp->fp);
    if (hseek(fp->fp, -28, SEEK_END) < 0) {
        if (errno == ESPIPE) { hclearerr(fp->fp); return 2; }
        else return -1;
    }
    if ( hread(fp->fp, buf, 28) != 28 ) return -1;
    if ( hseek(fp->fp, offset, SEEK_SET) < 0 ) return -1;
    return (memcmp("\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\033\0\3\0\0\0\0\0\0\0\0\0", buf, 28) == 0)? 1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
movq 0x28(%rdi), %r14
addq 0x8(%rdi), %r14
subq (%rdi), %r14
movq $-0x1c, %rsi
movl $0x2, %edx
callq 0x6b2df
testq %rax, %rax
js 0x68524
movq 0x38(%rbx), %r12
movq 0x8(%r12), %rsi
movq 0x10(%r12), %r13
subq %rsi, %r13
cmpq $0x1c, %r13
movl $0x1c, %r15d
cmovbq %r13, %r15
movq %rsp, %rdi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r12)
cmpq $0x1b, %r13
ja 0x684d6
movq %rsp, %rsi
movl $0x1c, %edx
movq %r12, %rdi
movq %r15, %rcx
callq 0x6b053
movq %rax, %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpq $0x1c, %r15
jne 0x68543
movq 0x38(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6b2df
testq %rax, %rax
js 0x68543
movdqu 0xc(%rsp), %xmm0
pcmpeqb 0x3151e(%rip), %xmm0    # 0x99a20
movdqa (%rsp), %xmm1
pcmpeqb 0x31521(%rip), %xmm1    # 0x99a30
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
xorl %ebp, %ebp
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bpl
jmp 0x68543
callq 0x6060
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x1d, (%rax)
jne 0x68543
movq 0x38(%rbx), %rax
movl $0x0, 0x34(%rax)
movl $0x2, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_seek
int64_t bgzf_seek(BGZF* fp, int64_t pos, int where)
{
    int block_offset;
    int64_t block_address;

    if (fp->is_write || where != SEEK_SET) {
        fp->errcode |= BGZF_ERR_MISUSE;
        return -1;
    }
    block_offset = pos & 0xFFFF;
    block_address = pos >> 16;
    if (hseek(fp->fp, block_address, SEEK_SET) < 0) {
        fp->errcode |= BGZF_ERR_IO;
        return -1;
    }
    fp->block_length = 0;  // indicates current block has not been loaded
    fp->block_address = block_address;
    fp->block_offset = block_offset;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %eax
movl %eax, %ecx
andl $0x30000, %ecx          # imm = 0x30000
orl %edx, %ecx
je 0x68578
orl $0x8, %eax
movl %eax, (%rbx)
movq $-0x1, %rax
jmp 0x685a9
movq %rsi, %r14
movq %rsi, %r15
sarq $0x10, %r15
movq 0x38(%rbx), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x6b2df
testq %rax, %rax
js 0x685af
movzwl %r14w, %eax
movl $0x0, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movl %eax, 0xc(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
orb $0x4, (%rbx)
jmp 0x6856f
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_is_bgzf
int bgzf_is_bgzf(const char *fn)
{
    uint8_t buf[16];
    int n;
    hFILE *fp;
    if ((fp = hopen(fn, "r")) == 0) return 0;
    n = hread(fp, buf, 16);
    if ( hclose(fp) < 0 ) return -1;
    if (n != 16) return 0;
    return memcmp(g_magic, buf, 16) == 0? 1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x2d863(%rip), %rsi     # 0x95e29
callq 0x6b707
xorl %ebx, %ebx
testq %rax, %rax
je 0x6864d
movq %rax, %r14
movq 0x8(%rax), %rsi
movq 0x10(%rax), %r12
subq %rsi, %r12
cmpq $0x10, %r12
movl $0x10, %r15d
cmovbq %r12, %r15
movq %rsp, %rdi
movq %r15, %rdx
callq 0x6570
addq %r15, 0x8(%r14)
cmpq $0xf, %r12
ja 0x68619
movq %rsp, %rsi
movl $0x10, %edx
movq %r14, %rdi
movq %r15, %rcx
callq 0x6b053
movq %rax, %r15
movq %r14, %rdi
callq 0x6b37e
testl %eax, %eax
js 0x68648
cmpl $0x10, %r15d
jne 0x6864d
movdqa (%rsp), %xmm0
pcmpeqb 0x313f8(%rip), %xmm0    # 0x99a30
pmovmskb %xmm0, %eax
xorl %ebx, %ebx
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bl
jmp 0x6864d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: bgzf_getc
int bgzf_getc(BGZF *fp)
{
    int c;
    if (fp->block_offset >= fp->block_length) {
        if (bgzf_read_block(fp) != 0) return -2; /* error */
        if (fp->block_length == 0) return -1; /* end-of-file */
    }
    c = ((unsigned char*)fp->uncompressed_block)[fp->block_offset++];
    if (fp->block_offset == fp->block_length) {
        fp->block_address = htell(fp->fp);
        fp->block_offset = 0;
        fp->block_length = 0;
    }
    fp->uncompressed_address++;
    return c;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0xc(%rdi), %eax
cmpl 0x8(%rdi), %eax
jge 0x6869f
movq 0x20(%rbx), %rax
movslq 0xc(%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0xc(%rbx)
movzbl (%rax,%rcx), %eax
cmpl 0x8(%rbx), %edx
jne 0x68699
movq 0x38(%rbx), %rcx
movq 0x28(%rcx), %rdx
addq 0x8(%rcx), %rdx
subq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
movq $0x0, 0x8(%rbx)
incq 0x18(%rbx)
jmp 0x686b2
movq %rbx, %rdi
callq 0x66fe4
movl %eax, %ecx
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
testl %ecx, %ecx
je 0x686b4
popq %rbx
retq
cmpl $0x0, 0x8(%rbx)
jne 0x68667
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x686b2
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/bgzf.c
// Function: worker_aux
static int worker_aux(worker_t *w)
{
    int i, stop = 0;
    // wait for condition: to process or all done
    pthread_mutex_lock(&w->mt->lock);
    while (!w->toproc && !w->mt->done)
        pthread_cond_wait(&w->mt->cv, &w->mt->lock);
    if (w->mt->done) stop = 1;
    w->toproc = 0;
    pthread_mutex_unlock(&w->mt->lock);
    if (stop) return 1; // to quit the thread
    w->errcode = 0;
    for (i = w->i; i < w->mt->curr; i += w->mt->n_threads) {
        size_t clen = BGZF_MAX_BLOCK_SIZE;
        if (bgzf_compress(w->buf, &clen, w->mt->blk[i], w->mt->len[i], w->compress_level) != 0)
            w->errcode |= BGZF_ERR_ZLIB;
        memcpy(w->mt->blk[i], w->buf, clen);
        w->mt->len[i] = clen;
    }
    __sync_fetch_and_add(&w->mt->proc_cnt, 1);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
addq $0x38, %rdi
callq 0x6ae0
cmpl $0x0, 0x18(%rbx)
jne 0x6924a
movq (%rbx), %rsi
cmpl $0x0, 0xc(%rsi)
jne 0x6924a
leaq 0x60(%rsi), %rdi
addq $0x38, %rsi
callq 0x6b90
jmp 0x6922c
movq (%rbx), %rdi
movl 0xc(%rdi), %ebp
movl $0x0, 0x18(%rbx)
addq $0x38, %rdi
callq 0x64f0
movl $0x1, %eax
testl %ebp, %ebp
jne 0x692f2
movl $0x0, 0x14(%rbx)
movl 0x10(%rbx), %ecx
movq (%rbx), %rax
cmpl 0x8(%rax), %ecx
jge 0x692ec
leaq 0x8(%rsp), %r14
movq $0x10000, 0x8(%rsp)     # imm = 0x10000
movq 0x8(%rbx), %rdi
movslq %ecx, %r12
movq 0x18(%rax), %rcx
movq 0x20(%rax), %rax
movq (%rcx,%r12,8), %rdx
movslq (%rax,%r12,4), %rcx
movl 0x1c(%rbx), %r8d
movq %r14, %rsi
callq 0x66ef6
testl %eax, %eax
je 0x692b8
orb $0x1, 0x14(%rbx)
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %rdi
movq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x6570
movq (%rbx), %rax
movq 0x20(%rax), %rcx
movl %r15d, (%rcx,%r12,4)
movl (%rax), %ecx
addl %r12d, %ecx
movq (%rbx), %rax
cmpl 0x8(%rax), %ecx
jl 0x69284
lock
incl 0x10(%rax)
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/faidx.c
// Function: fai_save
void fai_save(const faidx_t *fai, FILE *fp)
{
    khint_t k;
    int i;
    for (i = 0; i < fai->n; ++i) {
        faidx1_t x;
        k = kh_get(s, fai->hash, fai->name[i]);
        x = kh_value(fai->hash, k);
#ifdef _WIN32
        fprintf(fp, "%s\t%d\t%ld\t%d\t%d\n", fai->name[i], (int)x.len, (long)x.offset, (int)x.line_blen, (int)x.line_len);
#else
        fprintf(fp, "%s\t%d\t%lld\t%d\t%d\n", fai->name[i], (int)x.len, (long long)x.offset, (int)x.line_blen, (int)x.line_len);
#endif
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, 0x30(%rsp)
cmpl $0x0, 0x8(%rdi)
jle 0x69b32
movq %rdi, %rbx
xorl %r14d, %r14d
movq %rdi, 0x18(%rsp)
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
movq (%rax,%r14,8), %r10
movq %rcx, 0x10(%rsp)
movl (%rcx), %esi
movl $0x0, %eax
testl %esi, %esi
je 0x69ae9
movq %r14, 0x28(%rsp)
movsbl (%r10), %r14d
testl %r14d, %r14d
je 0x69a4b
movb 0x1(%r10), %al
testb %al, %al
je 0x69a4e
leaq 0x2(%r10), %rcx
movl %r14d, %edx
shll $0x5, %edx
subl %r14d, %edx
movsbl %al, %r14d
addl %edx, %r14d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x69a30
jmp 0x69a4e
xorl %r14d, %r14d
movq %rsi, 0x20(%rsp)
leal -0x1(%rsi), %r12d
andl %r12d, %r14d
movq 0x10(%rsp), %rax
movq 0x10(%rax), %rsi
movl $0x1, %r15d
movl %r14d, %ebx
movq %r10, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%rsi,%rax,4), %r13d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r13d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x69ace
testb $0x1, %al
jne 0x69ab9
movq 0x10(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r10, %rsi
callq 0x6a50
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %r10
testl %eax, %eax
je 0x69ace
addl %r15d, %ebx
andl %r12d, %ebx
incl %r15d
cmpl %r14d, %ebx
jne 0x69a76
movq 0x20(%rsp), %rax
jmp 0x69adf
movl %ebp, %ecx
shrl %cl, %r13d
testb $0x3, %r13b
movq 0x20(%rsp), %rax
cmovel %ebx, %eax
movq 0x18(%rsp), %rbx
movq 0x28(%rsp), %r14
movq 0x10(%rsp), %rcx
movq 0x20(%rcx), %rdx
movl %eax, %eax
leaq (%rax,%rax,2), %rax
movl (%rdx,%rax,8), %esi
movl 0x4(%rdx,%rax,8), %r9d
movl 0x8(%rdx,%rax,8), %ecx
movq 0x10(%rdx,%rax,8), %r8
movl %esi, (%rsp)
movq 0x30(%rsp), %rdi
leaq 0x30209(%rip), %rsi     # 0x99d21
movq %r10, %rdx
xorl %eax, %eax
callq 0x6a90
incq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x699f6
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/faidx.c
// Function: fai_read
faidx_t *fai_read(FILE *fp)
{
    faidx_t *fai;
    char *buf, *p;
    int len, line_len, line_blen;
#ifdef _WIN32
    long offset;
#else
    long long offset;
#endif
    fai = (faidx_t*)calloc(1, sizeof(faidx_t));
    fai->hash = kh_init(s);
    buf = (char*)calloc(0x10000, 1);
    while (!feof(fp) && fgets(buf, 0x10000, fp)) {
        for (p = buf; *p && isgraph(*p); ++p);
        *p = 0; ++p;
#ifdef _WIN32
        sscanf(p, "%d%ld%d%d", &len, &offset, &line_blen, &line_len);
#else
        sscanf(p, "%d%lld%d%d", &len, &offset, &line_blen, &line_len);
#endif
        fai_insert_index(fai, buf, len, line_len, line_blen, offset);
    }
    free(buf);
    return fai;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x1, %edi
movl $0x20, %esi
callq 0x6470
movq %rax, %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x6470
movq %rax, 0x18(%r14)
movl $0x10000, %edi          # imm = 0x10000
movl $0x1, %esi
callq 0x6470
movq %rax, %r15
movq %rbx, %rdi
callq 0x6bc0
testl %eax, %eax
jne 0x69c36
leaq 0x4(%rsp), %r12
leaq 0x8(%rsp), %r13
movq %r15, %rdi
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdx
callq 0x6c00
testq %rax, %rax
je 0x69c36
movb (%r15), %bpl
movq %r15, %rdi
testb %bpl, %bpl
je 0x69be5
callq 0x6790
movq (%rax), %rax
movq %r15, %rdi
movsbq %bpl, %rcx
cmpw $0x0, (%rax,%rcx,2)
jns 0x69be5
movb 0x1(%rdi), %bpl
incq %rdi
testb %bpl, %bpl
jne 0x69bce
movb $0x0, (%rdi)
incq %rdi
leaq 0x30141(%rip), %rsi     # 0x99d33
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x66d0
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %ecx
movl 0x4(%rsp), %r8d
movq 0x10(%rsp), %r9
movq %r14, %rdi
movq %r15, %rsi
callq 0x69689
movq %rbx, %rdi
callq 0x6bc0
testl %eax, %eax
je 0x69ba3
movq %r15, %rdi
callq 0x68a0
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/faidx.c
// Function: fai_build
int fai_build(const char *fn)
{
    char *str;
    BGZF *bgzf;
    FILE *fp;
    faidx_t *fai;
    str = (char*)calloc(strlen(fn) + 5, 1);
    sprintf(str, "%s.fai", fn);
    bgzf = bgzf_open(fn, "r");
    if ( !bgzf ) {
        fprintf(stderr, "[fai_build] fail to open the FASTA file %s\n",fn);
        free(str);
        return -1;
    }
    if ( bgzf->is_compressed ) bgzf_index_build_init(bgzf);
    fai = fai_build_core(bgzf);
    if ( !fai )
    {
        if ( bgzf->is_compressed && bgzf->is_gzip ) fprintf(stderr,"Cannot index files compressed with gzip, please use bgzip\n");
        bgzf_close(bgzf);
        free(str);
        return -1;
    }
    if ( bgzf->is_compressed ) bgzf_index_dump(bgzf, fn, ".gzi");
    bgzf_close(bgzf);
    fp = fopen(str, "wb");
    if ( !fp ) {
        fprintf(stderr, "[fai_build] fail to write FASTA index %s\n",str);
        fai_destroy(fai); free(str);
        return -1;
    }
    fai_save(fai, fp);
    fclose(fp);
    free(str);
    fai_destroy(fai);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x62d0
leaq 0x5(%rax), %rdi
movl $0x1, %esi
callq 0x6470
movq %rax, %rbx
leaq 0x2f4c8(%rip), %rsi     # 0x99140
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6170
leaq 0x2c19d(%rip), %rsi     # 0x95e29
movq %r14, %rdi
callq 0x66a24
testq %rax, %rax
je 0x69d52
movq %rax, %r15
testb $0x60, 0x3(%rax)
je 0x69cae
movq %r15, %rdi
callq 0x6888a
movq %r15, %rdi
callq 0x69300
movq %rax, %r12
movl (%r15), %eax
testq %r12, %r12
je 0x69d20
testl $0x60000000, %eax       # imm = 0x60000000
je 0x69cda
leaq 0x2f478(%rip), %rdx     # 0x99147
movq %r15, %rdi
movq %r14, %rsi
callq 0x688bd
movq %r15, %rdi
callq 0x68168
leaq 0x28e8c(%rip), %rsi     # 0x92b75
movq %rbx, %rdi
callq 0x6880
testq %rax, %rax
je 0x69d6f
movq %rax, %r14
movq %r12, %rdi
movq %rax, %rsi
callq 0x699ce
movq %r14, %rdi
callq 0x66e0
movq %rbx, %rdi
callq 0x68a0
movq %r12, %rdi
callq 0x69954
xorl %eax, %eax
jmp 0x69d46
testl $0x60000000, %eax       # imm = 0x60000000
sete %cl
testl %eax, %eax
setns %al
orb %cl, %al
je 0x69d7c
movq %r15, %rdi
callq 0x68168
movq %rbx, %rdi
callq 0x68a0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x5527f(%rip), %rax     # 0xbefd8
movq (%rax), %rdi
leaq 0x2ffdb(%rip), %rsi     # 0x99d3e
movq %r14, %rdx
xorl %eax, %eax
callq 0x6a90
jmp 0x69d39
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7bee
jmp 0x69d41
callq 0x7c2a
jmp 0x69d31
// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/hfile.c
// Function: hfile_init
hFILE *hfile_init(size_t struct_size, const char *mode, size_t capacity)
{
    hFILE *fp = (hFILE *) malloc(struct_size);
    if (fp == NULL) goto error;

    if (capacity == 0) capacity = 32768;
    // FIXME For now, clamp input buffer sizes so mpileup doesn't eat memory
    if (strchr(mode, 'r') && capacity > 32768) capacity = 32768;

    fp->buffer = (char *) malloc(capacity);
    if (fp->buffer == NULL) goto error;

    fp->begin = fp->end = fp->buffer;
    fp->limit = &fp->buffer[capacity];

    fp->offset = 0;
    fp->at_eof = 0;
    fp->has_errno = 0;
    return fp;

error:
    hfile_destroy(fp);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
callq 0x69d0
movq %rax, %rbx
testq %rax, %rax
je 0x6aedf
testq %r15, %r15
movl $0x8000, %r14d          # imm = 0x8000
cmoveq %r14, %r15
movq %r12, %rdi
movl $0x72, %esi
callq 0x6270
cmpq %r14, %r15
cmovbq %r15, %r14
testq %rax, %rax
cmoveq %r15, %r14
movq %r14, %rdi
callq 0x69d0
movq %rax, (%rbx)
testq %rax, %rax
je 0x6aedf
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
addq %rax, %r14
movq %r14, 0x18(%rbx)
movq $0x0, 0x28(%rbx)
andb $-0x2, 0x30(%rbx)
movl $0x0, 0x34(%rbx)
jmp 0x6aee9
movq %rbx, %rdi
callq 0x6aef8
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq