LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/kstring.c
// Function: kgetline
int kgetline(kstring_t *s, kgets_func *fgets_fn, void *fp)
{
	size_t l0 = s->l;

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

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rdi), %r12
pushq $-0x1
popq %rbp
movq %r12, %rdi
cmpq %r12, %rdi
je 0x35b6d
movq 0x10(%rbx), %rax
cmpb $0xa, -0x1(%rax,%rdi)
je 0x35bcb
movq 0x8(%rbx), %rax
movq %rax, %rsi
subq %rdi, %rsi
cmpq $0xc7, %rsi
ja 0x35b9f
addq $0xc8, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x357a1
testl %eax, %eax
js 0x35c00
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
subq %rdi, %rsi
addq 0x10(%rbx), %rdi
movq %r14, %rdx
callq *%r15
movq (%rbx), %r13
testq %rax, %rax
je 0x35bc8
movq 0x10(%rbx), %rdi
addq %r13, %rdi
callq 0x4210
movq %rax, %rdi
addq %r13, %rdi
movq %rdi, (%rbx)
jmp 0x35b5d
movq %r13, %rdi
cmpq %r12, %rdi
je 0x35c00
movq 0x10(%rbx), %rax
jbe 0x35bf7
cmpb $0xa, -0x1(%rax,%rdi)
jne 0x35bf7
leaq -0x1(%rdi), %rcx
movq %rcx, (%rbx)
cmpq %r12, %rcx
jbe 0x35bfa
cmpb $0xd, -0x2(%rax,%rdi)
jne 0x35bfa
addq $-0x2, %rdi
movq %rdi, (%rbx)
movq %rdi, %rcx
movb $0x0, (%rax,%rcx)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_open
BGZF *bgzf_open(const char *path, const char *mode)
{
    BGZF *fp = 0;
    assert(compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE);
    if (strchr(mode, 'r')) {
        hFILE *fpr;
        if ((fpr = hopen(path, mode)) == 0) return 0;
        fp = bgzf_read_init(fpr);
        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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0xff00, %edi           # imm = 0xFF00
callq 0x4870
cmpq $0x10000, %rax          # imm = 0x10000
jae 0x35f8d
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x41e0
testq %rax, %rax
je 0x35f2e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3a708
testq %rax, %rax
je 0x35f83
movq %rax, %r14
movq %rax, %rdi
callq 0x35fac
testq %rax, %rax
jne 0x35f6e
movq %r14, %rdi
callq 0x3a3fa
jmp 0x35f83
pushq $0x77
popq %rsi
movq %rbx, %rdi
callq 0x41e0
testq %rax, %rax
jne 0x35f4e
pushq $0x61
popq %rsi
movq %rbx, %rdi
callq 0x41e0
testq %rax, %rax
je 0x35f78
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3a708
testq %rax, %rax
je 0x35f83
movq %rax, %r14
movq %rbx, %rdi
callq 0x3607a
testq %rax, %rax
je 0x35f83
movq %r14, 0x38(%rax)
andb $-0xd, 0x2(%rax)
jmp 0x35f85
callq 0x4060
movl $0x16, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1098c(%rip), %rdi     # 0x46920
leaq 0x109ba(%rip), %rsi     # 0x46955
leaq 0x109ba(%rip), %rcx     # 0x4695c
movl $0xed, %edx
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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
pushq $0x12
popq %rdx
callq 0x3a049
testq %rax, %rax
js 0x36068
movq %rax, %r14
pushq $0x1
popq %rdi
pushq $0x60
popq %rsi
callq 0x4370
xorl %r15d, %r15d
testq %rax, %rax
je 0x36068
movq %rax, %rbx
cmpb $0x1f, (%rsp)
setne %bpl
cmpb $-0x75, 0x1(%rsp)
setne %r12b
movl $0x10000, %edi          # imm = 0x10000
callq 0x46f0
movq %rax, 0x20(%rbx)
movl $0x10000, %edi          # imm = 0x10000
callq 0x46f0
movq %rax, 0x28(%rbx)
cmpq $0x12, %r14
setne %cl
orb %bpl, %cl
orb %r12b, %cl
movl %ecx, %eax
xorb $0x1, %al
movzbl %al, %eax
shll $0x1d, %eax
testb %cl, %cl
jne 0x36051
movl $0x80000000, %r15d      # imm = 0x80000000
testb $0x4, 0x3(%rsp)
je 0x36051
xorl %r15d, %r15d
cmpl $0x24342, 0xc(%rsp)     # imm = 0x24342
setne %r15b
shll $0x1f, %r15d
orl %eax, %r15d
movl %r15d, (%rbx)
pushq $0x1
popq %rdi
pushq $0x28
popq %rsi
callq 0x4370
movq %rax, 0x30(%rbx)
jmp 0x3606a
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_dopen
BGZF *bgzf_dopen(int fd, const char *mode)
{
    BGZF *fp = 0;
    assert(compressBound(BGZF_BLOCK_SIZE) < BGZF_MAX_BLOCK_SIZE);
    if (strchr(mode, 'r')) {
        hFILE *fpr;
        if ((fpr = hdopen(fd, mode)) == 0) return 0;
        fp = bgzf_read_init(fpr);
        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
movl $0xff00, %edi           # imm = 0xFF00
callq 0x4870
cmpq $0x10000, %rax          # imm = 0x10000
jae 0x3630e
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x41e0
testq %rax, %rax
je 0x362b3
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3a425
testq %rax, %rax
je 0x36307
movq %rax, %r14
movq %rax, %rdi
callq 0x35fac
testq %rax, %rax
jne 0x362f2
movq %r14, %rdi
callq 0x3a3fa
jmp 0x36307
pushq $0x77
popq %rsi
movq %rbx, %rdi
callq 0x41e0
testq %rax, %rax
jne 0x362d3
pushq $0x61
popq %rsi
movq %rbx, %rdi
callq 0x41e0
testq %rax, %rax
je 0x362fc
movl %ebp, %edi
movq %rbx, %rsi
callq 0x3a425
testq %rax, %rax
je 0x36307
movq %rax, %r14
movq %rbx, %rdi
callq 0x3607a
testq %rax, %rax
je 0x36307
movq %r14, 0x38(%rax)
andb $-0xd, 0x2(%rax)
jmp 0x36309
callq 0x4060
movl $0x16, (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x1060b(%rip), %rdi     # 0x46920
leaq 0x10639(%rip), %rsi     # 0x46955
leaq 0x10665(%rip), %rcx     # 0x46988
movl $0x104, %edx            # imm = 0x104
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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);
        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
movl $0xff00, %edi           # imm = 0xFF00
callq 0x4870
cmpq $0x10000, %rax          # imm = 0x10000
jae 0x363af
pushq $0x72
popq %rsi
movq %r14, %rdi
callq 0x41e0
testq %rax, %rax
je 0x36363
movq %rbx, %rdi
callq 0x35fac
jmp 0x3638b
pushq $0x77
popq %rsi
movq %r14, %rdi
callq 0x41e0
testq %rax, %rax
jne 0x36383
pushq $0x61
popq %rsi
movq %r14, %rdi
callq 0x41e0
testq %rax, %rax
je 0x3639a
movq %r14, %rdi
callq 0x3607a
testq %rax, %rax
je 0x363a5
movq %rbx, 0x38(%rax)
andb $-0xd, 0x2(%rax)
jmp 0x363a7
callq 0x4060
movl $0x16, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1056a(%rip), %rdi     # 0x46920
leaq 0x10598(%rip), %rsi     # 0x46955
leaq 0x105e8(%rip), %rcx     # 0x469ac
movl $0x11b, %edx            # imm = 0x11B
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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_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 0x36587
movq 0x30(%rsi), %rbx
testq %rbx, %rbx
je 0x36587
movq %rbx, %rax
popq %rbx
retq
leal 0x6(%rcx), %eax
cmpl $0x5, %eax
ja 0x365d9
leaq 0x1032a(%rip), %rcx     # 0x468c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10840(%rip), %rbx     # 0x46de6
jmp 0x36582
leaq 0x10789(%rip), %rbx     # 0x46d38
jmp 0x36582
leaq 0x107db(%rip), %rbx     # 0x46d93
jmp 0x36582
leaq 0x107b9(%rip), %rbx     # 0x46d7a
jmp 0x36582
leaq 0x107d7(%rip), %rbx     # 0x46da1
jmp 0x36582
callq 0x4060
movl (%rax), %edi
popq %rbx
jmp 0x4190
leaq 0x20fb0(%rip), %rbx     # 0x57590
leaq 0x10815(%rip), %rdx     # 0x46dfc
pushq $0x20
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4880
jmp 0x36582
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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;
            fp->gz_stream->msg = NULL;
            ret = inflate(fp->gz_stream, Z_NO_FLUSH);
            if ( ret==Z_BUF_ERROR ) continue;   // non-critical error
            if ( ret<0 ) {
                if (hts_verbose >= 1) {
                    fprintf(stderr, "[E::%s] inflate failed: %s\n",
                            __func__,
                            bgzf_zerr(ret, ret == Z_DATA_ERROR ? fp->gz_stream : NULL));
                }
                fp->errcode |= BGZF_ERR_ZLIB;
                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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x58(%rdi), %rdi
testl %esi, %esi
jne 0x36f03
cmpl $0x0, 0x20(%rdi)
sete %dl
testb $0x1, %dl
jne 0x36f03
movq 0x28(%rbx), %rsi
movq 0x38(%rbx), %rdi
movl $0xff00, %edx           # imm = 0xFF00
callq 0x36e62
movq 0x58(%rbx), %rdi
movl %eax, 0x8(%rdi)
testl %eax, %eax
je 0x36f70
movq 0x28(%rbx), %rax
movq %rax, (%rdi)
movslq 0xc(%rbx), %rax
movl $0x10000, %ecx          # imm = 0x10000
subl %eax, %ecx
addq 0x20(%rbx), %rax
movq %rax, 0x18(%rdi)
movl %ecx, 0x20(%rdi)
andq $0x0, 0x30(%rdi)
xorl %esi, %esi
callq 0x4410
cmpl $-0x5, %eax
jne 0x36f3e
movq 0x58(%rbx), %rdi
movl 0x20(%rdi), %edx
testl %edx, %edx
je 0x36f03
movl $0x10000, %ecx          # imm = 0x10000
subl %edx, %ecx
jmp 0x36f53
testl %eax, %eax
js 0x36f5c
movq 0x58(%rbx), %rdi
movl 0x20(%rdi), %edx
xorl %ecx, %ecx
cmpl $0x10000, %edx          # imm = 0x10000
jne 0x36f74
xorl %edx, %edx
cmpl $0x1, %eax
jne 0x36eda
jmp 0x36f7b
leaq 0x205e5(%rip), %rcx     # 0x57548
cmpl $0x0, (%rcx)
jg 0x36f85
orb $0x1, (%rbx)
pushq $-0x1
popq %rcx
jmp 0x36f7b
xorl %ecx, %ecx
jmp 0x36f7b
movl $0x10000, %ecx          # imm = 0x10000
subl %edx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x20044(%rip), %rcx     # 0x56fd0
movq (%rcx), %r14
cmpl $-0x3, %eax
jne 0x36f9a
movq 0x58(%rbx), %rsi
jmp 0x36f9c
xorl %esi, %esi
movl %eax, %edi
callq 0x36571
leaq 0xfe5f(%rip), %rsi      # 0x46e09
leaq 0xfe74(%rip), %rdx      # 0x46e25
movq %r14, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x4770
jmp 0x36f68
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 0x48(%rdi), %rcx
movl (%rcx), %eax
leal 0x1(%rax), %edx
movl %edx, (%rcx)
cmpl 0x4(%rcx), %eax
jge 0x36fda
movq 0x8(%rcx), %rax
jmp 0x37027
movl %eax, %edx
sarl %edx
orl %eax, %edx
movl %edx, %eax
sarl $0x2, %eax
orl %edx, %eax
movl %eax, %edx
sarl $0x4, %edx
orl %eax, %edx
movl %edx, %eax
sarl $0x8, %eax
orl %edx, %eax
movl %eax, %edx
sarl $0x10, %edx
orl %eax, %edx
movslq %edx, %rax
movq %rax, %rsi
shlq $0x4, %rsi
incl %eax
movl %eax, 0x4(%rcx)
movq 0x8(%rcx), %rdi
addq $0x10, %rsi
callq 0x48c0
movq 0x48(%rbx), %rcx
movq %rax, 0x8(%rcx)
testq %rax, %rax
je 0x37044
movl (%rcx), %edx
movq 0x10(%rcx), %rcx
movslq %edx, %rdx
shlq $0x4, %rdx
movq %rcx, -0x10(%rax,%rdx)
movq 0x10(%rbx), %rcx
movq %rcx, -0x8(%rax,%rdx)
xorl %eax, %eax
popq %rbx
retq
pushq $-0x1
popq %rax
jmp 0x37042
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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) {
            int ret = bgzf_read_block(fp);
            if (ret != 0) {
                if (hts_verbose >= 2) {
                    fprintf(stderr, "[E::%s] bgzf_read_block error %d after %zd of %zu bytes\n", __func__, ret, bytes_read, length);
                }
                fp->errcode |= BGZF_ERR_ZLIB;
                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 0x370cf
movq %rdi, %rbx
testb $0x3, 0x2(%rdi)
jne 0x3714c
movq %rdx, %rbp
movq %rsi, %r12
movl 0xc(%rbx), %eax
xorl %r14d, %r14d
movq %rbp, %r15
movl 0x8(%rbx), %ecx
subq %r14, %r15
jbe 0x370dc
subl %eax, %ecx
jg 0x37097
movq %rbx, %rdi
callq 0x365f6
testl %eax, %eax
jne 0x370fe
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %eax
subl %eax, %ecx
jle 0x370ca
movl %ecx, %r13d
cmpq %r13, %r15
cmovbq %r15, %r13
movslq %eax, %rsi
addq 0x20(%rbx), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x4420
movl 0xc(%rbx), %eax
addl %r13d, %eax
movl %eax, 0xc(%rbx)
addq %r13, %r12
addq %r13, %r14
xorl %ecx, %ecx
testl %ecx, %ecx
je 0x37072
jmp 0x370d4
pushq $0x3
popq %rcx
jmp 0x370c4
xorl %r14d, %r14d
jmp 0x37111
cmpl $0x3, %ecx
jne 0x3710d
movl 0x8(%rbx), %ecx
cmpl %ecx, %eax
jne 0x370f8
movq 0x38(%rbx), %rax
movq 0x28(%rax), %rcx
addq 0x8(%rax), %rcx
subq (%rax), %rcx
movq %rcx, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
addq %r14, 0x18(%rbx)
jmp 0x37111
leaq 0x20443(%rip), %rcx     # 0x57548
cmpl $0x2, (%rcx)
jge 0x37123
orb $0x1, (%rbx)
pushq $-0x1
popq %r14
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1fea6(%rip), %rcx     # 0x56fd0
movq (%rcx), %rdi
leaq 0xf996(%rip), %rsi      # 0x46aca
leaq 0xf9c8(%rip), %rdx      # 0x46b03
movl %eax, %ecx
movq %r14, %r8
movq %rbp, %r9
xorl %eax, %eax
callq 0x4770
jmp 0x3710a
leaq 0xf93b(%rip), %rdi      # 0x46a8e
leaq 0xf7fb(%rip), %rsi      # 0x46955
leaq 0xf93f(%rip), %rcx      # 0x46aa0
movl $0x2b2, %edx            # imm = 0x2B2
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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) {
        int block_length;
        if ( fp->idx_build_otf )
        {
            bgzf_index_add_block(fp);
            fp->idx->ublock_addr += fp->block_offset;
        }
        block_length = deflate_block(fp, fp->block_offset);
        if (block_length < 0) {
            if (hts_verbose >= 3) fprintf(stderr, "[E::%s] deflate_block error %d\n", __func__, block_length);
            return -1;
        }
        if (hwrite(fp->fp, fp->compressed_block, block_length) != block_length) {
            if (hts_verbose >= 1) fprintf(stderr, "[E::%s] hwrite error (wrong size)\n", __func__);
            fp->errcode |= BGZF_ERR_IO; // possibly truncated file
            return -1;
        }
        fp->block_address += block_length;
    }
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
xorl %ebx, %ebx
testb $0x3, 0x2(%rdi)
je 0x373d1
movq %rdi, %r14
cmpq $0x0, 0x40(%rdi)
je 0x37382
cmpl $0x0, 0xc(%r14)
je 0x37332
movq %r14, %rdi
callq 0x373fa
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x37461
cmpl $0x0, 0x50(%r14)
je 0x3735a
movq %r14, %rdi
callq 0x36fc0
movslq 0xc(%r14), %rsi
movq 0x48(%r14), %rax
addq %rsi, 0x10(%rax)
movq %r14, %rdi
callq 0x3753e
testl %eax, %eax
js 0x3738c
movq 0x28(%r14), %rsi
movq 0x38(%r14), %rdi
movl %eax, %r15d
movq %r15, %rdx
callq 0x37631
cmpq %r15, %rax
jne 0x373be
addq %r15, 0x10(%r14)
movl 0xc(%r14), %esi
testl %esi, %esi
jg 0x3733f
jmp 0x373d1
leaq 0x201b5(%rip), %rcx     # 0x57548
pushq $-0x1
popq %rbx
cmpl $0x3, (%rcx)
jl 0x373d1
movq 0x1fc2e(%rip), %rcx     # 0x56fd0
movq (%rcx), %rdi
leaq 0xf761(%rip), %rsi      # 0x46b0d
leaq 0xf77a(%rip), %rdx      # 0x46b2d
movl %eax, %ecx
xorl %eax, %eax
callq 0x4770
jmp 0x373d1
leaq 0x20183(%rip), %rax     # 0x57548
cmpl $0x0, (%rax)
jg 0x373d9
orb $0x4, (%r14)
pushq $-0x1
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0x1fbf0(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0xf74e(%rip), %rsi      # 0x46b38
leaq 0xf73c(%rip), %rdx      # 0x46b2d
xorl %eax, %eax
callq 0x4770
jmp 0x373ca
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 0x37442
movq %rdi, %rbx
movq 0x18(%r14), %rcx
movq (%rcx,%rax,8), %rdi
movq 0x20(%rbx), %rsi
movslq 0xc(%rbx), %rdx
callq 0x4420
movl 0xc(%rbx), %eax
movq 0x20(%r14), %rcx
movslq 0x8(%r14), %rdx
movl %eax, (%rcx,%rdx,4)
andl $0x0, 0xc(%rbx)
incl 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xfa80(%rip), %rdi      # 0x46ec9
leaq 0xf505(%rip), %rsi      # 0x46955
leaq 0xfa88(%rip), %rcx      # 0x46edf
movl $0x341, %edx            # imm = 0x341
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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;
    if (fp->errcode == 0) {
        /* Only try to write if all the threads worked, as otherwise we
           could get a file with holes in it */
        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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x40(%rdi), %r15
leaq 0x38(%r15), %r14
movq %r14, %rdi
callq 0x47a0
movl (%r15), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
shlq $0x5, %rax
cmpq %rcx, %rax
je 0x3749e
movq 0x28(%r15), %rdx
movl $0x1, 0x18(%rdx,%rcx)
addq $0x20, %rcx
jmp 0x37487
movl $0x0, 0x10(%r15)
leaq 0x60(%r15), %rdi
callq 0x41c0
movq %r14, %rdi
callq 0x43f0
movq 0x28(%r15), %rdi
callq 0x3875e
movl (%r15), %edx
movl 0x10(%r15), %eax
cmpl %edx, %eax
jl 0x374c3
pushq $0x14
popq %rax
xorl %ecx, %ecx
movslq %edx, %rdx
cmpq %rdx, %rcx
jge 0x374ee
movq 0x28(%r15), %rdx
movzwl (%rdx,%rax), %edx
orl %edx, (%rbx)
incq %rcx
movl (%r15), %edx
addq $0x20, %rax
jmp 0x374d0
cmpw $0x0, (%rbx)
jne 0x3752c
xorl %r14d, %r14d
movslq 0x8(%r15), %rax
cmpq %rax, %r14
jge 0x3752c
movq 0x38(%rbx), %rdi
movq 0x18(%r15), %rax
movq 0x20(%r15), %rcx
movq (%rax,%r14,8), %rsi
movslq (%rcx,%r14,4), %rdx
callq 0x37631
movq 0x20(%r15), %rcx
movslq (%rcx,%r14,4), %rcx
incq %r14
cmpq %rcx, %rax
je 0x374f7
orb $0x4, (%rbx)
andl $0x0, 0x8(%r15)
xorl %eax, %eax
cmpw (%rbx), %ax
sbbl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 )
    {
        if (hts_verbose >= 3) {
            fprintf(stderr, "[E::%s] compression error %d\n", __func__, ret);
        }
        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 0x375a4
movslq %esi, %rcx
shll $0x3, %r8d
sarl $0x17, %r8d
movq %rsp, %rsi
callq 0x363ce
testl %eax, %eax
je 0x375e8
leaq 0x1ffcd(%rip), %rax     # 0x57548
cmpl $0x3, (%rax)
jl 0x375e0
movq 0x1fa49(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0xf964(%rip), %rsi      # 0x46ef5
leaq 0xf97b(%rip), %rdx      # 0x46f13
pushq $-0x1
popq %rcx
xorl %eax, %eax
callq 0x4770
jmp 0x375e0
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 0x4260
cmpl $-0x2, %eax
jne 0x375ee
leaq 0x1ff6d(%rip), %rax     # 0x57548
cmpl $0x0, (%rax)
jg 0x37606
orb $0x1, (%rbx)
pushq $-0x1
popq %rax
jmp 0x375fe
movq (%rsp), %rax
jmp 0x375fa
movl 0x20(%r14), %ecx
movl $0x10000, %eax          # imm = 0x10000
subq %rcx, %rax
andl $0x0, 0xc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x1f9c3(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0xf3ec(%rip), %rsi      # 0x46a03
leaq 0xf903(%rip), %rdx      # 0x46f21
leaq 0xf713(%rip), %rcx      # 0x46d38
xorl %eax, %eax
callq 0x4770
jmp 0x37574
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x376cd
cmpl $0x0, 0xc(%rbx)
je 0x376c1
movq %rbx, %rdi
callq 0x373fa
movq 0x40(%rbx), %rax
movl 0x8(%rax), %ecx
cmpl 0x4(%rax), %ecx
jge 0x376d6
xorl %eax, %eax
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0x37308
movq %rbx, %rdi
popq %rbx
jmp 0x37461
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl (%rdi), %eax
testl $0x60000000, %eax       # imm = 0x60000000
je 0x37777
testl $0x30000, %eax          # imm = 0x30000
je 0x37794
pushq $-0x1
popq %r12
movq %rbx, %rbp
testq %rbp, %rbp
jle 0x3775f
movslq 0xc(%r15), %rdi
movl $0xff00, %eax           # imm = 0xFF00
subq %rdi, %rax
cmpq %rax, %rbp
movl %ebp, %ecx
cmovgel %eax, %ecx
addq 0x20(%r15), %rdi
movslq %ecx, %r13
movq %r14, %rsi
movq %r13, %rdx
callq 0x4420
movl 0xc(%r15), %eax
addl %r13d, %eax
movl %eax, 0xc(%r15)
addq %r13, %r14
subq %r13, %rbp
cmpl $0xff00, %eax           # imm = 0xFF00
jne 0x3770e
movq %r15, %rdi
callq 0x376a2
testl %eax, %eax
je 0x3770e
jmp 0x37765
subq %rbp, %rbx
movq %rbx, %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%r15), %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x37631
leaq 0xf3c0(%rip), %rdi      # 0x46b5b
leaq 0xf1b3(%rip), %rsi      # 0x46955
leaq 0xf3bf(%rip), %rcx      # 0x46b68
movl $0x3a9, %edx            # imm = 0x3A9
callq 0x4360
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_index_destroy
void bgzf_index_destroy(BGZF *fp)
{
    if ( !fp->idx ) return;
    free(fp->idx->offs);
    free(fp->idx);
    fp->idx = NULL;
    fp->idx_build_otf = 0;
}

// Assembly:
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x37ae3
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rax), %rdi
callq 0x4600
movq 0x48(%rbx), %rdi
callq 0x4600
andq $0x0, 0x48(%rbx)
andl $0x0, 0x50(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
movq 0x38(%rdi), %rdi
movq 0x28(%rdi), %r15
addq 0x8(%rdi), %r15
subq (%rdi), %r15
pushq $-0x1c
popq %rsi
pushq $0x2
popq %rbx
movl %ebx, %edx
callq 0x3a30a
testq %rax, %rax
js 0x37b60
movq 0x38(%r14), %rdi
movq %rsp, %rsi
pushq $0x1c
popq %rdx
callq 0x36e62
pushq $-0x1
popq %rbx
cmpq $0x1c, %rax
jne 0x37b77
movq 0x38(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3a30a
testq %rax, %rax
js 0x37b77
leaq 0xeda7(%rip), %rdi      # 0x468f3
movq %rsp, %rsi
pushq $0x1c
popq %rdx
callq 0x4550
xorl %ebx, %ebx
testl %eax, %eax
sete %bl
jmp 0x37b77
callq 0x4060
cmpl $0x1d, (%rax)
jne 0x37b74
movq 0x38(%r14), %rax
andl $0x0, 0x34(%rax)
jmp 0x37b77
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 0x37ba3
orl $0x8, %eax
movl %eax, (%rbx)
pushq $-0x1
popq %rax
jmp 0x37bd1
movq %rsi, %r14
movq %rsi, %r15
sarq $0x10, %r15
movq 0x38(%rbx), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x3a30a
testq %rax, %rax
js 0x37bd7
andl $0x0, 0x8(%rbx)
movzwl %r14w, %eax
movq %r15, 0x10(%rbx)
movl %eax, 0xc(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
orb $0x4, (%rbx)
jmp 0x37b9e
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 %rbx
subq $0x10, %rsp
leaq 0xccc9(%rip), %rsi      # 0x448b5
callq 0x3a708
xorl %ebx, %ebx
testq %rax, %rax
je 0x37c3e
movq %rax, %r14
movq %rsp, %rsi
pushq $0x10
popq %rdx
movq %rax, %rdi
callq 0x36e62
movq %rax, %r15
movq %r14, %rdi
callq 0x3a3a2
testl %eax, %eax
js 0x37c3b
cmpl $0x10, %r15d
jne 0x37c3e
movdqa (%rsp), %xmm0
pcmpeqb 0xece5(%rip), %xmm0     # 0x46910
pmovmskb %xmm0, %eax
xorl %ebx, %ebx
cmpl $0xffff, %eax           # imm = 0xFFFF
sete %bl
jmp 0x37c3e
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 0x8(%rdi), %ecx
movl 0xc(%rdi), %eax
cmpl %ecx, %eax
jge 0x37c8a
movq 0x20(%rbx), %rdx
leal 0x1(%rax), %esi
movl %esi, 0xc(%rbx)
cltq
movzbl (%rdx,%rax), %eax
cmpl %ecx, %esi
jne 0x37c84
movq 0x38(%rbx), %rcx
movq 0x28(%rcx), %rdx
addq 0x8(%rcx), %rdx
subq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
andq $0x0, 0x8(%rbx)
incq 0x18(%rbx)
jmp 0x37c99
movq %rbx, %rdi
callq 0x365f6
testl %eax, %eax
je 0x37c9b
pushq $-0x2
popq %rax
popq %rbx
retq
movl 0x8(%rbx), %ecx
testl %ecx, %ecx
je 0x37ca7
movl 0xc(%rbx), %eax
jmp 0x37c58
pushq $-0x1
jmp 0x37c98
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/bgzf.c
// Function: bgzf_index_build_init
int bgzf_index_build_init(BGZF *fp)
{
    bgzf_index_destroy(fp);
    fp->idx = (bgzidx_t*) calloc(1,sizeof(bgzidx_t));
    if ( !fp->idx ) return -1;
    fp->idx_build_otf = 1;  // build index on the fly
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x37aba
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x4370
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x37e71
movl $0x1, 0x50(%rbx)
xorl %eax, %eax
jmp 0x37e74
pushq $-0x1
popq %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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;
        int ret = bgzf_compress(w->buf, &clen, w->mt->blk[i], w->mt->len[i], w->compress_level);
        if (ret != 0) {
            if (hts_verbose >= 2) fprintf(stderr, "[E::%s] bgzf_compress error %d\n", __func__, ret);
            w->errcode |= BGZF_ERR_ZLIB; // Report error
            // We're not going to do any more, so set remaining lengths to 0
            for (; i < w->mt->curr; i += w->mt->n_threads) w->mt->len[i] = 0;
            break; // Give up
        } else {
            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 0x47a0
cmpl $0x0, 0x18(%rbx)
movq (%rbx), %rdi
movl 0xc(%rdi), %ebp
jne 0x3879c
leaq 0x38(%rdi), %rsi
testl %ebp, %ebp
jne 0x38820
addq $0x60, %rdi
callq 0x47f0
jmp 0x38779
andl $0x0, 0x18(%rbx)
addq $0x38, %rdi
callq 0x43f0
testl %ebp, %ebp
jne 0x3882c
andl $0x0, 0x14(%rbx)
movl 0x10(%rbx), %ebp
movq (%rbx), %rax
leaq 0x8(%rsp), %r14
cmpl 0x8(%rax), %ebp
jge 0x38863
movq $0x10000, 0x8(%rsp)     # imm = 0x10000
movq 0x8(%rbx), %rdi
movslq %ebp, %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 0x363ce
testl %eax, %eax
jne 0x3883c
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movq 0x18(%rax), %rax
movq (%rax,%r12,8), %rdi
movq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x4420
movq (%rbx), %rax
movq 0x20(%rax), %rcx
movl %r15d, (%rcx,%r12,4)
addl (%rax), %ebp
jmp 0x387bc
andl $0x0, 0x18(%rbx)
movq %rsi, %rdi
callq 0x43f0
pushq $0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1ed05(%rip), %rax     # 0x57548
cmpl $0x2, (%rax)
jge 0x3886b
orb $0x1, 0x14(%rbx)
movq (%rbx), %rax
cmpl 0x8(%rax), %ebp
jge 0x38863
movq 0x20(%rax), %rcx
movslq %ebp, %rdx
andl $0x0, (%rcx,%rdx,4)
addl (%rax), %ebp
jmp 0x3884f
lock
incl 0x10(%rax)
xorl %eax, %eax
jmp 0x3882f
movq 0x1e75e(%rip), %rax     # 0x56fd0
movq (%rax), %rdi
leaq 0xe622(%rip), %rsi      # 0x46e9e
leaq 0xe63b(%rip), %rdx      # 0x46ebe
pushq $-0x1
popq %rcx
xorl %eax, %eax
callq 0x4770
jmp 0x38848
nop
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/faidx.c
// Function: fai_destroy
void fai_destroy(faidx_t *fai)
{
    int i;
    for (i = 0; i < fai->n; ++i) free(fai->name[i]);
    free(fai->name);
    kh_destroy(s, fai->hash);
    if (fai->bgzf) bgzf_close(fai->bgzf);
    free(fai);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movslq 0x8(%rbx), %rax
movq 0x10(%rbx), %rdi
cmpq %rax, %r14
jge 0x38ecb
movq (%rdi,%r14,8), %rdi
callq 0x4600
incq %r14
jmp 0x38eb0
callq 0x4600
movq 0x18(%rbx), %r14
testq %r14, %r14
je 0x38efc
movq 0x18(%r14), %rdi
callq 0x4600
movq 0x10(%r14), %rdi
callq 0x4600
movq 0x20(%r14), %rdi
callq 0x4600
movq %r14, %rdi
callq 0x4600
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x38f09
callq 0x377bc
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4600
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xe0b5(%rip), %r15      # 0x46fe5
xorl %ebp, %ebp
movslq 0x8(%r14), %rax
cmpq %rax, %rbp
jge 0x38f86
movq 0x10(%r14), %rax
movq 0x18(%r14), %r12
movq (%rax,%rbp,8), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x38f95
movq 0x20(%r12), %rdx
movl %eax, %eax
imulq $0x18, %rax, %rax
movl (%rdx,%rax), %esi
movl 0x4(%rdx,%rax), %r9d
movl 0x8(%rdx,%rax), %ecx
movq 0x10(%rdx,%rax), %r8
movl %esi, (%rsp)
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x4770
incq %rbp
jmp 0x38f32
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/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 0x46f0
movq %rax, %rbx
testq %rax, %rax
je 0x39f57
testq %r15, %r15
movl $0x8000, %r14d          # imm = 0x8000
cmoveq %r14, %r15
pushq $0x72
popq %rsi
movq %r12, %rdi
callq 0x41e0
cmpq %r14, %r15
cmovbq %r15, %r14
testq %rax, %rax
cmoveq %r15, %r14
movq %r14, %rdi
callq 0x46f0
movq %rax, (%rbx)
testq %rax, %rax
je 0x39f57
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
addq %rax, %r14
movq %r14, 0x18(%rbx)
andq $0x0, 0x28(%rbx)
movb $0x0, 0x30(%rbx)
andl $0x0, 0x34(%rbx)
jmp 0x39f61
movq %rbx, %rdi
callq 0x39f70
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hfile_destroy
void hfile_destroy(hFILE *fp)
{
    int save = errno;
    if (fp) free(fp->buffer);
    free(fp);
    errno = save;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x4060
movq %rax, %r14
movl (%rax), %ebp
testq %rbx, %rbx
je 0x39f8e
movq (%rbx), %rdi
callq 0x4600
movq %rbx, %rdi
callq 0x4600
movl %ebp, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: refill_buffer
static ssize_t refill_buffer(hFILE *fp)
{
    ssize_t n;

    // Move any unread characters to the start of the buffer
    if (fp->begin > fp->buffer) {
        fp->offset += fp->begin - fp->buffer;
        memmove(fp->buffer, fp->begin, fp->end - fp->begin);
        fp->end = &fp->buffer[fp->end - fp->begin];
        fp->begin = fp->buffer;
    }

    // Read into the available buffer space at fp->[end,limit)
    if (fp->at_eof || fp->end == fp->limit) n = 0;
    else {
        n = fp->backend->read(fp, fp->end, fp->limit - fp->end);
        if (n < 0) { fp->has_errno = errno; return n; }
        else if (n == 0) fp->at_eof = 1;
    }

    fp->end += n;
    return n;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x8(%rbx), %rsi
movq %rsi, %rax
subq %rdi, %rax
jbe 0x39ffe
addq %rax, 0x28(%rbx)
movq 0x10(%rbx), %rdx
subq %rsi, %rdx
callq 0x48b0
movq 0x10(%rbx), %rax
subq 0x8(%rbx), %rax
movq (%rbx), %rcx
addq %rcx, %rax
movq %rax, 0x10(%rbx)
movq %rcx, 0x8(%rbx)
testb $0x1, 0x30(%rbx)
jne 0x3a02b
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
cmpq %rdx, %rsi
je 0x3a02b
movq 0x20(%rbx), %rax
subq %rsi, %rdx
movq %rbx, %rdi
callq *(%rax)
movq %rax, %r14
testq %rax, %rax
js 0x3a03d
jne 0x3a02e
orb $0x1, 0x30(%rbx)
xorl %r14d, %r14d
addq %r14, 0x10(%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x4060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
jmp 0x3a032
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hpeek
ssize_t hpeek(hFILE *fp, void *buffer, size_t nbytes)
{
    size_t n = fp->end - fp->begin;
    while (n < nbytes) {
        ssize_t ret = refill_buffer(fp);
        if (ret < 0) return ret;
        else if (ret == 0) break;
        else n += ret;
    }

    if (n > nbytes) n = nbytes;
    memcpy(buffer, fp->begin, n);
    return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq 0x10(%rdi), %r13
subq 0x8(%rdi), %r13
pushq $0x1
popq %rbp
cmpq %rbx, %r13
jae 0x3a09c
movq %r15, %rdi
callq 0x39fc2
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
leal (%rcx,%rcx,2), %ecx
movl $0x0, %edx
cmovgq %rax, %rdx
cmovsq %rax, %r12
cmovsl %ebp, %ecx
addq %rdx, %r13
testl %ecx, %ecx
je 0x3a068
cmpl $0x3, %ecx
jne 0x3a0b5
cmpq %rbx, %r13
cmovbq %r13, %rbx
movq 0x8(%r15), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x4420
movq %rbx, %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hread2
ssize_t hread2(hFILE *fp, void *destv, size_t nbytes, size_t nread)
{
    const size_t capacity = fp->limit - fp->buffer;
    char *dest = (char *) destv;
    dest += nread, nbytes -= nread;

    // Read large requests directly into the destination buffer
    while (nbytes * 2 >= capacity && !fp->at_eof) {
        ssize_t n = fp->backend->read(fp, dest, nbytes);
        if (n < 0) { fp->has_errno = errno; return n; }
        else if (n == 0) fp->at_eof = 1;
        fp->offset += n;
        dest += n, nbytes -= n;
        nread += n;
    }

    while (nbytes > 0 && !fp->at_eof) {
        size_t n;
        ssize_t ret = refill_buffer(fp);
        if (ret < 0) return ret;

        n = fp->end - fp->begin;
        if (n > nbytes) n = nbytes;
        memcpy(dest, fp->begin, n);
        fp->begin += n;
        dest += n, nbytes -= n;
        nread += n;
    }

    return nread;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
movq 0x18(%rdi), %rbp
subq (%rdi), %rbp
addq %rcx, %r12
subq %rcx, %r15
leaq (%r15,%r15), %rax
cmpq %rbp, %rax
jb 0x3a163
testb $0x1, 0x30(%rbx)
jne 0x3a163
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *(%rax)
movq %rax, %r13
testq %rax, %rax
js 0x3a16d
jne 0x3a117
orb $0x1, 0x30(%rbx)
addq %r13, 0x28(%rbx)
addq %r13, %r12
subq %r13, %r15
addq %r13, %r14
jmp 0x3a0eb
testb $0x1, 0x30(%rbx)
jne 0x3a168
movq %rbx, %rdi
callq 0x39fc2
testq %rax, %rax
js 0x3a179
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %r13
subq %rsi, %r13
cmpq %r15, %r13
cmovaeq %r15, %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x4420
addq %r13, 0x8(%rbx)
addq %r13, %r12
subq %r13, %r15
addq %r13, %r14
testq %r15, %r15
jne 0x3a126
movq %r14, %r13
jmp 0x3a17c
callq 0x4060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
jmp 0x3a17c
movq %rax, %r13
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: hflush
int hflush(hFILE *fp)
{
    if (flush_buffer(fp) < 0) return EOF;
    if (fp->backend->flush) {
        if (fp->backend->flush(fp) < 0) { fp->has_errno = errno; return EOF; }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x3a1cf
pushq $-0x1
popq %r14
testq %rax, %rax
js 0x3a1c5
movq 0x20(%rbx), %rax
movq 0x18(%rax), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x3a1c8
movq %rbx, %rdi
callq *%rax
testl %eax, %eax
jns 0x3a1c8
callq 0x4060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movl %r14d, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/karel-brinda[P]ococo/ext/htslib/hfile.c
// Function: flush_buffer
static ssize_t flush_buffer(hFILE *fp)
{
    const char *buffer = fp->buffer;
    while (buffer < fp->begin) {
        ssize_t n = fp->backend->write(fp, buffer, fp->begin - buffer);
        if (n < 0) { fp->has_errno = errno; return n; }
        buffer += n;
        fp->offset += n;
    }

    fp->begin = fp->buffer;  // Leave the buffer empty
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movq 0x8(%rbx), %rdx
cmpq %rdx, %r14
jae 0x3a204
movq 0x20(%rbx), %rax
subq %r14, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x8(%rax)
movq %rax, %r15
testq %rax, %rax
js 0x3a210
addq %r15, %r14
addq %r15, 0x28(%rbx)
jmp 0x3a1da
movq (%rbx), %rax
movq %rax, 0x8(%rbx)
xorl %r15d, %r15d
jmp 0x3a21a
callq 0x4060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq