LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/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 0x69c0b
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 0x69bc2
movq %r14, 0x28(%rsp)
movsbl (%r10), %r14d
testl %r14d, %r14d
je 0x69b24
movb 0x1(%r10), %al
testb %al, %al
je 0x69b27
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 0x69b09
jmp 0x69b27
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 0x69ba7
testb $0x1, %al
jne 0x69b92
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 0x69ba7
addl %r15d, %ebx
andl %r12d, %ebx
incl %r15d
cmpl %r14d, %ebx
jne 0x69b4f
movq 0x20(%rsp), %rax
jmp 0x69bb8
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 0x30360(%rip), %rsi     # 0x99f51
movq %r10, %rdx
xorl %eax, %eax
callq 0x6a90
incq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x69acf
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x69d0f
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 0x69d0f
movb (%r15), %bpl
movq %r15, %rdi
testb %bpl, %bpl
je 0x69cbe
callq 0x6790
movq (%rax), %rax
movq %r15, %rdi
movsbq %bpl, %rcx
cmpw $0x0, (%rax,%rcx,2)
jns 0x69cbe
movb 0x1(%rdi), %bpl
incq %rdi
testb %bpl, %bpl
jne 0x69ca7
movb $0x0, (%rdi)
incq %rdi
leaq 0x30298(%rip), %rsi     # 0x99f63
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 0x6974f
movq %rbx, %rdi
callq 0x6bc0
testl %eax, %eax
je 0x69c7c
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_O3/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 0x2f5fa(%rip), %rsi     # 0x9934b
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x6170
leaq 0x2c1a4(%rip), %rsi     # 0x95f09
movq %r14, %rdi
callq 0x66abc
testq %rax, %rax
je 0x69e2b
movq %rax, %r15
testb $0x60, 0x3(%rax)
je 0x69d87
movq %r15, %rdi
callq 0x68975
movq %r15, %rdi
callq 0x693b8
movq %rax, %r12
movl (%r15), %eax
testq %r12, %r12
je 0x69df9
testl $0x60000000, %eax       # imm = 0x60000000
je 0x69db3
leaq 0x2f5aa(%rip), %rdx     # 0x99352
movq %r15, %rdi
movq %r14, %rsi
callq 0x689a8
movq %r15, %rdi
callq 0x68235
leaq 0x28e84(%rip), %rsi     # 0x92c46
movq %rbx, %rdi
callq 0x6880
testq %rax, %rax
je 0x69e48
movq %rax, %r14
movq %r12, %rdi
movq %rax, %rsi
callq 0x69aa7
movq %r14, %rdi
callq 0x66e0
movq %rbx, %rdi
callq 0x68a0
movq %r12, %rdi
callq 0x69a2d
xorl %eax, %eax
jmp 0x69e1f
testl $0x60000000, %eax       # imm = 0x60000000
sete %cl
testl %eax, %eax
setns %al
orb %cl, %al
je 0x69e55
movq %r15, %rdi
callq 0x68235
movq %rbx, %rdi
callq 0x68a0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x551a6(%rip), %rax     # 0xbefd8
movq (%rax), %rdi
leaq 0x30132(%rip), %rsi     # 0x99f6e
movq %r14, %rdx
xorl %eax, %eax
callq 0x6a90
jmp 0x69e12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7b9a
jmp 0x69e1a
callq 0x7bd6
jmp 0x69e0a
// File: /workspace/github_c_makefile_star2_O3/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
testq %rax, %rax
je 0x6af37
movq %rax, %rbx
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 0x6af2f
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
addq %rax, %r14
movq %r14, 0x18(%rbx)
movq $0x0, 0x28(%rbx)
movb $0x0, 0x30(%rbx)
movl $0x0, 0x34(%rbx)
jmp 0x6af39
movq %rbx, %rdi
callq 0x6af48
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/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, %r12
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rbp
subq (%rdi), %rbp
addq %rcx, %r15
subq %rcx, %r14
leaq (%r14,%r14), %rax
cmpq %rbp, %rax
jb 0x6b102
testb $0x1, 0x30(%rbx)
jne 0x6b102
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq *(%rax)
movq %rax, %r13
testq %rax, %rax
js 0x6b150
jne 0x6b0f3
orb $0x1, 0x30(%rbx)
addq %r13, 0x28(%rbx)
addq %r13, %r15
subq %r13, %r14
addq %r13, %r12
jmp 0x6b0c7
movq %r12, %r13
testq %r14, %r14
je 0x6b15a
testb $0x1, 0x30(%rbx)
jne 0x6b15a
movq %rbx, %rdi
callq 0x6af9c
testq %rax, %rax
js 0x6b14b
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %r12
subq %rsi, %r12
cmpq %r14, %r12
cmovaeq %r14, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x6570
addq %r12, 0x8(%rbx)
addq %r12, %r15
addq %r12, %r13
subq %r12, %r14
jne 0x6b10a
jmp 0x6b15a
movq %rax, %r13
jmp 0x6b15a
callq 0x6060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: hseek
off_t hseek(hFILE *fp, off_t offset, int whence)
{
    off_t curpos, pos;

    if (writebuffer_is_nonempty(fp)) {
        int ret = flush_buffer(fp);
        if (ret < 0) return ret;
    }

    curpos = htell(fp);

    // Relative offsets are given relative to the hFILE's stream position,
    // which may differ from the backend's physical position due to buffering
    // read-ahead.  Correct for this by converting to an absolute position.
    if (whence == SEEK_CUR) {
        if (curpos + offset < 0) {
            // Either a negative offset resulted in a position before the
            // start of the file, or we overflowed when given a positive offset
            fp->has_errno = errno = (offset < 0)? EINVAL : EOVERFLOW;
            return -1;
        }

        whence = SEEK_SET;
        offset = curpos + offset;
    }

    // TODO Avoid seeking if the desired position is within our read buffer

    pos = fp->backend->seek(fp, offset, whence);
    if (pos < 0) { fp->has_errno = errno; return pos; }

    // Seeking succeeded, so discard any non-empty read buffer
    fp->begin = fp->end = fp->buffer;
    fp->at_eof = 0;

    fp->offset = pos;
    return pos;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
jbe 0x6b316
movq %rbx, %rdi
callq 0x6b1b1
testl %eax, %eax
js 0x6b37c
cmpl $0x1, %ebp
jne 0x6b350
movq 0x28(%rbx), %rsi
addq %r14, %rsi
addq 0x8(%rbx), %rsi
xorl %ebp, %ebp
subq (%rbx), %rsi
jns 0x6b353
testq %r14, %r14
movl $0x16, %eax
movl $0x4b, %ebp
cmovsl %eax, %ebp
callq 0x6060
movl %ebp, (%rax)
movl %ebp, 0x34(%rbx)
movq $-0x1, %r14
jmp 0x6b38b
movq %r14, %rsi
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movl %ebp, %edx
callq *0x10(%rax)
movq %rax, %r14
testq %rax, %rax
js 0x6b381
movq (%rbx), %rax
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
andb $-0x2, 0x30(%rbx)
movq %r14, 0x28(%rbx)
jmp 0x6b38b
movslq %eax, %r14
jmp 0x6b38b
callq 0x6060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: hclose
int hclose(hFILE *fp)
{
    int err = fp->has_errno;

    if (writebuffer_is_nonempty(fp) && hflush(fp) < 0) err = fp->has_errno;
    if (fp->backend->close(fp) < 0) err = errno;
    hfile_destroy(fp);

    if (err) {
        errno = err;
        return EOF;
    }
    else return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x34(%rdi), %ebp
movq 0x8(%rdi), %rax
cmpq 0x10(%rdi), %rax
jbe 0x6b3b5
movq %rbx, %rdi
callq 0x6b16c
testl %eax, %eax
jns 0x6b3b5
movl 0x34(%rbx), %ebp
movq 0x20(%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
jns 0x6b3ca
callq 0x6060
movl (%rax), %ebp
movq %rbx, %rdi
callq 0x6af48
testl %ebp, %ebp
je 0x6b3e4
callq 0x6060
movl %ebp, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6b3e6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: hopen
hFILE *hopen(const char *fname, const char *mode)
{
    const struct hFILE_scheme_handler *handler = find_scheme_handler(fname);
    if (handler) return handler->open(fname, mode);
    else if (strcmp(fname, "-") == 0) return hopen_fd_stdinout(mode);
    else return hopen_fd(fname, mode);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x6b78b
testq %rax, %rax
je 0x6b747
movq (%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
cmpb $0x2d, (%r14)
jne 0x6b754
cmpb $0x0, 0x1(%r14)
je 0x6b766
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6ba24
movq %rbx, %rdi
movl $0x72, %esi
callq 0x6270
xorl %edi, %edi
testq %rax, %rax
sete %dil
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6b418
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: fd_write
static ssize_t fd_write(hFILE *fpv, const void *buffer, size_t nbytes)
{
    hFILE_fd *fp = (hFILE_fd *) fpv;
    ssize_t n;
    do {
        n = fp->is_socket?  send(fp->fd, buffer, nbytes, 0)
                         : write(fp->fd, buffer, nbytes);
    } while (n < 0 && errno == EINTR);
    return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testb $0x1, 0x3c(%r15)
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
jne 0x6bb5f
callq 0x6260
jmp 0x6bb66
xorl %ecx, %ecx
callq 0x6350
movq %rax, %r12
testq %rax, %rax
jns 0x6bb78
callq 0x6060
cmpl $0x4, (%rax)
je 0x6bb47
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: hopen_mem
static hFILE *hopen_mem(const char *data, const char *mode)
{
    if (strncmp(data, "data:", 5) == 0) data += 5;

    // TODO Implement write modes, which will require memory allocation
    if (strchr(mode, 'r') == NULL) { errno = EINVAL; return NULL; }

    hFILE_mem *fp = (hFILE_mem *) hfile_init(sizeof (hFILE_mem), mode, 0);
    if (fp == NULL) return NULL;

    fp->buffer = data;
    fp->length = strlen(data);
    fp->pos = 0;
    fp->base.backend = &mem_backend;
    return &fp->base;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x2e44c(%rip), %rsi     # 0x9a308
movl $0x5, %edx
callq 0x6330
xorl %r12d, %r12d
testl %eax, %eax
sete %bpl
movq %r14, %rdi
movl $0x72, %esi
callq 0x6270
testq %rax, %rax
je 0x6bf2d
xorl %r15d, %r15d
movl $0x50, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x6aeb8
testq %rax, %rax
je 0x6bf3b
movq %rax, %r14
movb %bpl, %r12b
leaq (%r12,%r12,4), %rax
addq %rax, %rbx
movq %rbx, 0x38(%r14)
movq %rbx, %rdi
callq 0x62d0
movq %rax, 0x40(%r14)
movq $0x0, 0x48(%r14)
leaq 0x52d04(%rip), %rax     # 0xbec28
movq %rax, 0x20(%r14)
movq %r14, %r15
jmp 0x6bf3b
callq 0x6060
movl $0x16, (%rax)
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: hopen_fd_fileuri
static hFILE *hopen_fd_fileuri(const char *url, const char *mode)
{
    if (strncmp(url, "file://localhost/", 17) == 0) url += 16;
    else if (strncmp(url, "file:///", 8) == 0) url += 7;
    else { errno = EPROTONOSUPPORT; return NULL; }

    return hopen_fd(url, mode);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x2e3b6(%rip), %rsi     # 0x9a30e
movl $0x11, %edx
callq 0x6330
testl %eax, %eax
je 0x6bf93
leaq 0x2e3b3(%rip), %rsi     # 0x9a320
movl $0x8, %edx
movq %r14, %rdi
callq 0x6330
testl %eax, %eax
je 0x6bf9a
callq 0x6060
movl $0x5d, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %eax
jmp 0x6bf9f
movl $0x7, %eax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x6ba24
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: mem_seek
static off_t mem_seek(hFILE *fpv, off_t offset, int whence)
{
    hFILE_mem *fp = (hFILE_mem *) fpv;
    size_t absoffset = (offset >= 0)? offset : -offset;
    size_t origin;

    switch (whence) {
    case SEEK_SET: origin = 0; break;
    case SEEK_CUR: origin = fp->pos; break;
    case SEEK_END: origin = fp->length; break;
    default: errno = EINVAL; return -1;
    }

    if ((offset  < 0 && absoffset > origin) ||
        (offset >= 0 && absoffset > fp->length - origin)) {
        errno = EINVAL;
        return -1;
    }

    fp->pos = origin + offset;
    return fp->pos;
}

// Assembly:
pushq %rax
movq %rsi, %rcx
negq %rcx
cmovsq %rsi, %rcx
testl %edx, %edx
je 0x6c019
cmpl $0x1, %edx
je 0x6c00e
cmpl $0x2, %edx
jne 0x6c03e
movl $0x40, %eax
jmp 0x6c013
movl $0x48, %eax
movq (%rdi,%rax), %rax
jmp 0x6c01b
movl %edx, %eax
testq %rsi, %rsi
sets %dl
cmpq %rax, %rcx
seta %r8b
testb %r8b, %dl
jne 0x6c03e
testq %rsi, %rsi
js 0x6c052
movq 0x40(%rdi), %rdx
subq %rax, %rdx
cmpq %rdx, %rcx
jbe 0x6c052
callq 0x6060
movl $0x16, (%rax)
movq $-0x1, %rax
jmp 0x6c059
addq %rsi, %rax
movq %rax, 0x48(%rdi)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile.c
// Function: hfile_exit
static void hfile_exit()
{
    kh_destroy(scheme_string, schemes);

    while (plugins != NULL) {
        struct hFILE_plugin_list *p = plugins;
        if (p->plugin.destroy) p->plugin.destroy();
#ifdef ENABLE_PLUGINS
        if (p->plugin.obj) close_plugin(p->plugin.obj);
#endif
        plugins = p->next;
        free(p);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x68697(%rip), %rbx     # 0xd4700
testq %rbx, %rbx
je 0x6c091
movq 0x18(%rbx), %rdi
callq 0x68a0
movq 0x10(%rbx), %rdi
callq 0x68a0
movq 0x20(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
movq 0x68698(%rip), %rbx     # 0xd4730
testq %rbx, %rbx
je 0x6c0c3
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x6c0a8
callq *%rax
movq 0x20(%rbx), %r14
movq %r14, 0x6867d(%rip)     # 0xd4730
movq %rbx, %rdi
callq 0x68a0
movq %r14, %rbx
testq %r14, %r14
jne 0x6c09d
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile_net.c
// Function: hopen_net
hFILE *hopen_net(const char *filename, const char *mode)
{
    hFILE_net *fp;

    // Do any networking initialisation if this is the first use.
    if (! net_inited) { if (net_init() < 0) return NULL; }

    fp = (hFILE_net *) hfile_init(sizeof (hFILE_net), mode, 0);
    if (fp == NULL) return NULL;

    fp->netfp = knet_open(filename, mode);
    if (fp->netfp == NULL) { hfile_destroy((hFILE *) fp); return NULL; }

    fp->base.backend = &net_backend;
    return &fp->base;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x0, 0x68657(%rip)     # 0xd4738
jne 0x6c0ea
movb $0x1, 0x6864e(%rip)     # 0xd4738
xorl %r12d, %r12d
movl $0x40, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x6aeb8
testq %rax, %rax
je 0x6c133
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x87497
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x6c128
leaq 0x52b31(%rip), %rax     # 0xbec50
movq %rax, 0x20(%r15)
movq %r15, %r12
jmp 0x6c133
movq %r15, %rdi
callq 0x6af48
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/hfile_net.c
// Function: hfile_plugin_init_net
int hfile_plugin_init_net(struct hFILE_plugin *self)
{
    static const struct hFILE_scheme_handler handler =
        { hopen_net, hfile_always_remote, "knetfile", 0 };

    self->name = "knetfile";
    hfile_add_scheme_handler("https", &handler);
    hfile_add_scheme_handler("http", &handler);
    hfile_add_scheme_handler("ftp",  &handler);
    return 0;
}

// Assembly:
pushq %rbx
leaq 0x2e1b5(%rip), %rax     # 0x9a2ff
movq %rax, 0x10(%rdi)
leaq 0x25e42(%rip), %rdi     # 0x91f97
leaq 0x52b1c(%rip), %rbx     # 0xbec78
movq %rbx, %rsi
callq 0x6b4f5
leaq 0x25e27(%rip), %rdi     # 0x91f92
movq %rbx, %rsi
callq 0x6b4f5
leaq 0x28ec3(%rip), %rdi     # 0x9503d
movq %rbx, %rsi
callq 0x6b4f5
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_hdr_destroy
void bam_hdr_destroy(bam_hdr_t *h)
{
    int32_t i;
    if (h == NULL) return;
    if (h->target_name) {
        for (i = 0; i < h->n_targets; ++i)
            free(h->target_name[i]);
        free(h->target_name);
        free(h->target_len);
    }
    free(h->text); free(h->cigar_tab);
    if (h->sdict) kh_destroy(s2i, (sdict_t*)h->sdict);
    free(h);
}

// Assembly:
testq %rdi, %rdi
je 0x6ccd9
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rdi
testq %rdi, %rdi
je 0x6ccaa
cmpl $0x0, (%rbx)
jle 0x6cc9c
xorl %r14d, %r14d
movq 0x20(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x68a0
incq %r14
movslq (%rbx), %rax
cmpq %rax, %r14
jl 0x6cc80
movq 0x20(%rbx), %rdi
callq 0x68a0
movq 0x10(%rbx), %rdi
callq 0x68a0
movq 0x28(%rbx), %rdi
callq 0x68a0
movq 0x18(%rbx), %rdi
callq 0x68a0
movq 0x30(%rbx), %rdi
testq %rdi, %rdi
je 0x6ccca
callq 0x4c7f6
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x68a0
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_hdr_dup
bam_hdr_t *bam_hdr_dup(const bam_hdr_t *h0)
{
    if (h0 == NULL) return NULL;
    bam_hdr_t *h;
    if ((h = bam_hdr_init()) == NULL) return NULL;
    // copy the simple data
    h->n_targets = h0->n_targets;
    h->ignore_sam_err = h0->ignore_sam_err;
    h->l_text = h0->l_text;
    // Then the pointery stuff
    h->cigar_tab = NULL;
    h->sdict = NULL;
    // TODO Check for memory allocation failures
    h->text = (char*)calloc(h->l_text + 1, 1);
    memcpy(h->text, h0->text, h->l_text);
    h->target_len = (uint32_t*)calloc(h->n_targets, sizeof(uint32_t));
    h->target_name = (char**)calloc(h->n_targets, sizeof(char*));
    int i;
    for (i = 0; i < h->n_targets; ++i) {
        h->target_len[i] = h0->target_len[i];
        h->target_name[i] = strdup(h0->target_name[i]);
    }
    return h;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x6cd9f
movq %rdi, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x6470
testq %rax, %rax
je 0x6cd9f
movq %rax, %rbx
movq (%r14), %rbp
movq %rbp, (%rax)
movl 0x8(%r14), %r15d
movl %r15d, 0x8(%rax)
leal 0x1(%r15), %edi
movl $0x1, %esi
callq 0x6470
movq %rax, 0x28(%rbx)
movq 0x28(%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x6570
movslq %ebp, %r13
movl $0x4, %esi
movq %r13, %rdi
callq 0x6470
movq %rax, %r15
movq %rax, 0x10(%rbx)
movl $0x8, %esi
movq %r13, %rdi
callq 0x6470
movq %rax, 0x20(%rbx)
testl %r13d, %r13d
jle 0x6cda1
movq %rax, %r12
movq %rbx, (%rsp)
movq 0x10(%r14), %r13
movq 0x20(%r14), %r14
movl %ebp, %ebp
xorl %ebx, %ebx
movl (%r13,%rbx,4), %eax
movl %eax, (%r15,%rbx,4)
movq (%r14,%rbx,8), %rdi
callq 0x6dd0
movq %rax, (%r12,%rbx,8)
incq %rbx
cmpq %rbx, %rbp
jne 0x6cd7b
movq (%rsp), %rbx
jmp 0x6cda1
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_dup1
bam1_t *bam_dup1(const bam1_t *bsrc)
{
    if (bsrc == NULL) return NULL;
    bam1_t *bdst = bam_init1();
    if (bdst == NULL) return NULL;
    return bam_copy1(bdst, bsrc);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x6d3c0
movq %rdi, %r14
movl $0x1, %edi
movl $0x38, %esi
callq 0x6470
testq %rax, %rax
je 0x6d3c0
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x6d2f8
jmp 0x6d3c2
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_cigar2qlen
int bam_cigar2qlen(int n_cigar, const uint32_t *cigar)
{
    int k, l;
    for (k = l = 0; k < n_cigar; ++k)
        if (bam_cigar_type(bam_cigar_op(cigar[k]))&1)
            l += bam_cigar_oplen(cigar[k]);
    return l;
}

// Assembly:
testl %edi, %edi
jle 0x6d404
movl %edi, %ecx
xorl %edx, %edx
movl $0x3c1a7, %edi          # imm = 0x3C1A7
xorl %eax, %eax
movl (%rsi,%rdx,4), %r8d
leal (%r8,%r8), %r9d
btl %r9d, %edi
movl $0x0, %r9d
sbbl %r9d, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addl %r8d, %eax
incq %rdx
cmpq %rdx, %rcx
jne 0x6d3dc
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_endpos
int32_t bam_endpos(const bam1_t *b)
{
    if (!(b->core.flag & BAM_FUNMAP) && b->core.n_cigar > 0)
        return b->core.pos + bam_cigar2rlen(b->core.n_cigar, bam_get_cigar(b));
    else
        return b->core.pos + 1;
}

// Assembly:
movq 0x8(%rdi), %rdx
movq %rdx, %rax
shrq $0x22, %rax
andl $0x1, %eax
movq %rdx, %rsi
shrq $0x30, %rsi
sete %cl
orb %al, %cl
je 0x6d462
movl 0x4(%rdi), %eax
incl %eax
retq
movl 0x4(%rdi), %r8d
shrl $0x18, %edx
addq 0x28(%rdi), %rdx
xorl %edi, %edi
xorl %eax, %eax
movl (%rdx,%rdi,4), %r9d
leal (%r9,%r9), %ecx
movl $0x3c1a7, %r10d         # imm = 0x3C1A7
shrl %cl, %r10d
shll $0x1e, %r10d
sarl $0x1f, %r10d
shrl $0x4, %r9d
andl %r10d, %r9d
addl %r9d, %eax
incq %rdi
cmpq %rdi, %rsi
jne 0x6d471
addl %r8d, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: sam_index_load2
hts_idx_t *sam_index_load2(htsFile *fp, const char *fn, const char *fnidx)
{
    switch (fp->format.format) {
    case bam:
        return fnidx? hts_idx_load2(fn, fnidx) : hts_idx_load(fn, HTS_FMT_BAI);

    case cram: {
        if (cram_index_load(fp->fp.cram, fn, fnidx) < 0) return NULL;
        // Cons up a fake "index" just pointing at the associated cram_fd:
        hts_cram_idx_t *idx = malloc(sizeof (hts_cram_idx_t));
        if (idx == NULL) return NULL;
        idx->fmt = HTS_FMT_CRAI;
        idx->cram = fp->fp.cram;
        return (hts_idx_t *) idx;
        }

    default:
        return NULL; // TODO Would use tbx_index_load if it returned hts_idx_t
    }
}

// Assembly:
pushq %rbx
movl 0x44(%rdi), %eax
cmpl $0x6, %eax
je 0x6dc84
cmpl $0x4, %eax
jne 0x6dcb3
movq %rsi, %rdi
testq %rdx, %rdx
je 0x6dcb7
movq %rdx, %rsi
popq %rbx
jmp 0x51f49
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
callq 0x5342c
testl %eax, %eax
js 0x6dcb3
movl $0x10, %edi
callq 0x69d0
testq %rax, %rax
je 0x6dcb3
movl $0x3, (%rax)
movq 0x38(%rbx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x6dcb5
xorl %eax, %eax
popq %rbx
retq
movl $0x1, %esi
popq %rbx
jmp 0x51ee8
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: sam_itr_queryi
hts_itr_t *sam_itr_queryi(const hts_idx_t *idx, int tid, int beg, int end)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;
    if (idx == NULL)
        return hts_itr_query(NULL, tid, beg, end, sam_bam_cram_readrec);
    else if (cidx->fmt == HTS_FMT_CRAI)
        return cram_itr_query(idx, tid, beg, end, cram_readrec);
    else
        return hts_itr_query(idx, tid, beg, end, bam_readrec);
}

// Assembly:
testq %rdi, %rdi
je 0x6dcdc
cmpl $0x3, (%rdi)
jne 0x6dcea
leaq 0x10d(%rip), %r8        # 0x6dde7
jmp 0x6dd24
leaq 0x13(%rip), %r8         # 0x6dcf6
xorl %edi, %edi
jmp 0x50f9e
leaq 0x10b(%rip), %r8        # 0x6ddfc
jmp 0x50f9e
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: sam_bam_cram_readrec
static int sam_bam_cram_readrec(BGZF *bgzfp, void *fpv, void *bv, int *tid, int *beg, int *end)
{
    htsFile *fp = fpv;
    bam1_t *b = bv;
    switch (fp->format.format) {
    case bam:   return bam_read1(bgzfp, b);
    case cram:  return cram_get_bam_seq(fp->fp.cram, &b);
    default:
        // TODO Need headers available to implement this for SAM files
        fprintf(stderr, "[sam_bam_cram_readrec] Not implemented for SAM files -- Exiting\n");
        abort();
    }
}

// Assembly:
pushq %rax
movq %rdx, (%rsp)
movl 0x44(%rsi), %eax
cmpl $0x6, %eax
je 0x6dd11
cmpl $0x4, %eax
jne 0x6dd1f
movq %rdx, %rsi
popq %rax
jmp 0x6d4a0
movq 0x38(%rsi), %rdi
movq %rsp, %rsi
callq 0x7c49f
popq %rcx
retq
callq 0x7d9e
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: cram_itr_query
static hts_itr_t *cram_itr_query(const hts_idx_t *idx, int tid, int beg, int end, hts_readrec_func *readrec)
{
    const hts_cram_idx_t *cidx = (const hts_cram_idx_t *) idx;
    hts_itr_t *iter = (hts_itr_t *) calloc(1, sizeof(hts_itr_t));
    if (iter == NULL) return NULL;

    // Cons up a dummy iterator for which hts_itr_next() will simply invoke
    // the readrec function:
    iter->read_rest = 1;
    iter->off = NULL;
    iter->bins.a = NULL;
    iter->readrec = readrec;

    if (tid >= 0 || tid == HTS_IDX_NOCOOR) {
        cram_range r = { tid == HTS_IDX_NOCOOR ? -1 : tid, beg+1, end };
        int ret = cram_set_option(cidx->cram, CRAM_OPT_RANGE, &r);

        iter->curr_off = 0;
        // The following fields are not required by hts_itr_next(), but are
        // filled in in case user code wants to look at them.
        iter->tid = tid;
        iter->beg = beg;
        iter->end = end;

        switch (ret) {
        case 0:
            break;

        case -2:
            // No data vs this ref, so mark iterator as completed.
            // Same as HTS_IDX_NONE.
            iter->finished = 1;
            break;

        default:
            free(iter);
            return NULL;
        }
    }
    else switch (tid) {
    case HTS_IDX_REST:
        iter->curr_off = 0;
        break;
    case HTS_IDX_NONE:
        iter->curr_off = 0;
        iter->finished = 1;
        break;
    default:
        fprintf(stderr, "[cram_itr_query] tid=%d not implemented for CRAM files -- Exiting\n", tid);
        abort();
        break;
    }

    return iter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r13
movl %ecx, %r14d
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r12
movl $0x1, %edi
movl $0x50, %esi
callq 0x6470
testq %rax, %rax
je 0x6ddba
movq %rax, %rbx
movl $0x1, (%rax)
movq %r13, 0x38(%rax)
testl %ebp, %ebp
sets %al
cmpl $-0x2, %ebp
setne %cl
testb %cl, %al
jne 0x6ddbe
cmpl $-0x2, %ebp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovnel %ebp, %eax
leaq 0xc(%rsp), %rdx
movl %eax, (%rdx)
leal 0x1(%r15), %eax
movl %eax, 0x4(%rdx)
movl %r14d, 0x8(%rdx)
movq 0x8(%r12), %rdi
movl $0x5, %esi
xorl %eax, %eax
callq 0x5cfe5
movl %ebp, 0x4(%rbx)
movl %r15d, 0x8(%rbx)
movl %r14d, 0xc(%rbx)
testl %eax, %eax
je 0x6ddce
cmpl $-0x2, %eax
je 0x6ddc8
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
jmp 0x6ddce
cmpl $-0x4, %ebp
je 0x6ddce
cmpl $-0x5, %ebp
jne 0x6dde0
movl $0x3, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %edi
callq 0x7dc0
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_readrec
static int bam_readrec(BGZF *fp, void *ignored, void *bv, int *tid, int *beg, int *end)
{
    bam1_t *b = bv;
    int ret;
    if ((ret = bam_read1(fp, b)) >= 0) {
        *tid = b->core.tid;
        *beg = b->core.pos;
        *end = bam_endpos(b);
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r14
movq %rdx, %rsi
callq 0x6d4a0
movl %eax, %ebp
testl %eax, %eax
js 0x6de36
movl (%r14), %eax
movl %eax, (%r12)
movl 0x4(%r14), %eax
movl %eax, (%r15)
movq %r14, %rdi
callq 0x6d440
movl %eax, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/./htslib/kstring.h
// Function: kputsn_
static inline int kputsn_(const void *p, int l, kstring_t *s)
{
	if (s->l + l > s->m) {
		char *tmp;
		s->m = s->l + l;
		kroundup32(s->m);
		if ((tmp = (char*)realloc(s->s, s->m)))
			s->s = tmp;
		else
			return EOF;
	}
	memcpy(s->s + s->l, p, l);
	s->l += l;
	return l;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r15
movq (%rdx), %rdi
movslq %esi, %r14
leaq (%rdi,%r14), %rax
cmpq 0x8(%rdx), %rax
jbe 0x6f7eb
decq %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 0x6f800
movq %rax, 0x10(%rbx)
movq (%rbx), %rdi
jmp 0x6f7ef
movq 0x10(%rbx), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6570
addq %r14, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/./htslib/kstring.h
// Function: ks_resize
static inline int ks_resize(kstring_t *s, size_t size)
{
	if (s->m < size) {
		char *tmp;
		s->m = size;
		kroundup32(s->m);
		if ((tmp = (char*)realloc(s->s, s->m)))
			s->s = tmp;
		else
			return -1;
	}
	return 0;
}

// Assembly:
cmpq %rsi, 0x8(%rdi)
jae 0x6f85e
pushq %rbx
movq %rdi, %rbx
decq %rsi
movq %rsi, %rax
shrq %rax
orq %rsi, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%rdi)
movq 0x10(%rdi), %rdi
callq 0x6c80
testq %rax, %rax
je 0x6f85d
movq %rax, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/./htslib/kstring.h
// Function: kputc_
static inline int kputc_(int c, kstring_t *s)
{
	if (s->l + 1 > s->m) {
		char *tmp;
		s->m = s->l + 1;
		kroundup32(s->m);
		if ((tmp = (char*)realloc(s->s, s->m)))
			s->s = tmp;
		else
			return EOF;
	}
	s->s[s->l++] = c;
	return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rcx
leaq 0x1(%rcx), %rdx
cmpq 0x8(%rsi), %rdx
jbe 0x6f8c8
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x8(%r14)
movq 0x10(%r14), %rdi
callq 0x6c80
testq %rax, %rax
je 0x6f8d2
movq %rax, 0x10(%r14)
movq (%r14), %rcx
leaq 0x1(%rcx), %rdx
jmp 0x6f8cc
movq 0x10(%r14), %rax
movq %rdx, (%r14)
movb %bl, (%rax,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: sam_read1
int sam_read1(htsFile *fp, bam_hdr_t *h, bam1_t *b)
{
    switch (fp->format.format) {
    case bam: {
        int r = bam_read1(fp->fp.bgzf, b);
        if (r >= 0) {
            if (b->core.tid  >= h->n_targets || b->core.tid  < -1 ||
                b->core.mtid >= h->n_targets || b->core.mtid < -1)
                return -3;
        }
        return r;
        }

    case cram: {
        int ret = cram_get_bam_seq(fp->fp.cram, &b);
        return ret >= 0
            ? ret
            : (cram_eof(fp->fp.cram) ? -1 : -2);
    }

    case sam: {
        int ret;
err_recover:
        if (fp->line.l == 0) {
            ret = hts_getline(fp, KS_SEP_LINE, &fp->line);
            if (ret < 0) return -1;
        }
        ret = sam_parse1(&fp->line, h, b);
        fp->line.l = 0;
        if (ret < 0) {
            if (hts_verbose >= 1)
                fprintf(stderr, "[W::%s] parse error at line %lld\n", __func__, (long long)fp->lineno);
            if (h->ignore_sam_err) goto err_recover;
        }
        return ret;
        }

    default:
        abort();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq %rdx, 0x10(%rsp)
movl 0x44(%rdi), %eax
cmpl $0x6, %eax
je 0x6f9c0
movq %rdx, %rbx
movq %rsi, %r15
cmpl $0x4, %eax
je 0x6f97f
cmpl $0x3, %eax
jne 0x6fa00
leaq 0x10(%r14), %r12
leaq 0x8(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0x514a4(%rip), %r13     # 0xc0dc8
cmpq $0x0, (%r12)
jne 0x6f943
movq %r14, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x4e97b
testl %eax, %eax
js 0x6f9ea
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x6e8b2
movl %eax, %ebp
movq $0x0, (%r12)
testl %eax, %eax
jns 0x6f9ef
cmpl $0x0, (%r13)
jg 0x6f973
cmpl $0x0, 0x4(%r15)
jne 0x6f924
jmp 0x6f9ef
movq 0x8(%rsp), %rdi
callq 0x7f73
jmp 0x6f96a
movq 0x38(%r14), %rdi
movq %rbx, %rsi
callq 0x6d4a0
testl %eax, %eax
js 0x6f9bc
movl (%rbx), %edx
movl (%r15), %ecx
cmpl %ecx, %edx
setge %sil
cmpl $-0x1, %edx
setl %dl
orb %sil, %dl
movl $0xfffffffd, %ebp       # imm = 0xFFFFFFFD
jne 0x6f9ef
movl 0x14(%rbx), %edx
cmpl %ecx, %edx
setge %cl
cmpl $-0x1, %edx
setl %dl
orb %cl, %dl
jne 0x6f9ef
movl %eax, %ebp
jmp 0x6f9ef
movq 0x38(%r14), %rdi
leaq 0x10(%rsp), %rsi
callq 0x7c49f
movl %eax, %ebp
testl %eax, %eax
jns 0x6f9ef
movq 0x38(%r14), %rdi
callq 0x5cfde
cmpl $0x1, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
sbbl $0x0, %ebp
jmp 0x6f9ef
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x63c0
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: sam_write1
int sam_write1(htsFile *fp, const bam_hdr_t *h, const bam1_t *b)
{
    switch (fp->format.format) {
    case binary_format:
        fp->format.category = sequence_data;
        fp->format.format = bam;
        /* fall-through */
    case bam:
        return bam_write1(fp->fp.bgzf, b);

    case cram:
        return cram_put_bam_seq(fp->fp.cram, (bam1_t *)b);

    case text_format:
        fp->format.category = sequence_data;
        fp->format.format = sam;
        /* fall-through */
    case sam:
        if (sam_format1(h, b, &fp->line) < 0) return -1;
        kputc('\n', &fp->line);
        if ( hwrite(fp->fp.hfile, fp->line.s, fp->line.l) != fp->line.l ) return -1;
        return fp->line.l;

    default:
        abort();
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0x44(%rdi), %eax
decl %eax
cmpl $0x5, %eax
ja 0x723a6
movq %rdi, %r14
leaq 0x282b2(%rip), %rcx     # 0x9a4fc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movabsq $0x400000001, %rax      # imm = 0x400000001
movq %rax, 0x40(%r14)
movq 0x38(%r14), %rdi
movq %rdx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6d8bb
movq 0x38(%r14), %rdi
movq %rdx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8522d
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x40(%r14)
leaq 0x10(%r14), %rbx
movq %rsi, %rdi
movq %rdx, %rsi
movq %rbx, %rdx
callq 0x6fa05
testl %eax, %eax
js 0x722cd
movq 0x10(%r14), %rdx
leaq 0x1(%rdx), %rcx
cmpq 0x18(%r14), %rcx
jae 0x722d7
movq 0x20(%r14), %rax
jmp 0x72329
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x72397
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, 0x18(%r14)
movq 0x20(%r14), %rdi
callq 0x6c80
testq %rax, %rax
je 0x7233d
movq %rax, 0x20(%r14)
movq 0x10(%r14), %rdx
leaq 0x1(%rdx), %rcx
movq %rcx, 0x10(%r14)
movb $0xa, (%rax,%rdx)
movq 0x10(%r14), %rax
movq 0x20(%r14), %rcx
movb $0x0, (%rcx,%rax)
movq 0x38(%r14), %r12
movq 0x10(%r14), %r15
movq 0x20(%r14), %r13
movq 0x8(%r12), %rdi
movq 0x18(%r12), %rbp
subq %rdi, %rbp
cmpq %r15, %rbp
movq %r15, %r14
cmovbq %rbp, %r14
movq %r13, %rsi
movq %r14, %rdx
callq 0x6570
addq %r14, 0x8(%r12)
cmpq %r15, %rbp
jae 0x72389
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x6b241
movq %rax, %r14
movq (%rbx), %rcx
cmpq %rcx, %r14
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x63c0
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_aux_get
uint8_t *bam_aux_get(const bam1_t *b, const char tag[2])
{
    uint8_t *s;
    int y = tag[0]<<8 | tag[1];
    s = bam_get_aux(b);
    while (s < b->data + b->l_data) {
        int x = (int)s[0]<<8 | s[1];
        s += 2;
        if (x == y) return s;
        s = skip_aux(s);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rcx
movq 0x28(%rdi), %rdx
movq %rcx, %rax
shrq $0x30, %rax
leaq (%rdx,%rax,4), %rax
shrl $0x18, %ecx
addq %rax, %rcx
movslq 0x10(%rdi), %rdi
leal 0x1(%rdi), %eax
sarl %eax
cltq
addq %rcx, %rax
addq %rdi, %rax
movslq 0x20(%rbx), %rcx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x724ca
movsbl (%rsi), %ecx
shll $0x8, %ecx
movsbl 0x1(%rsi), %ebp
orl %ecx, %ebp
movzwl (%rax), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
addq $0x2, %rax
cmpl %ebp, %ecx
je 0x724cc
movq %rax, %rdi
callq 0x724d3
movslq 0x20(%rbx), %rcx
addq 0x28(%rbx), %rcx
cmpq %rcx, %rax
jb 0x724a3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: skip_aux
static inline uint8_t *skip_aux(uint8_t *s)
{
    int size = aux_type2size(*s); ++s; // skip type
    uint32_t n;
    switch (size) {
    case 'Z':
    case 'H':
        while (*s) ++s;
        return s + 1;
    case 'B':
        size = aux_type2size(*s); ++s;
        memcpy(&n, s, 4); s += 4;
        return s + size * n;
    case 0:
        abort();
        break;
    default:
        return s + size;
    }
}

// Assembly:
pushq %rax
movzbl (%rdi), %ecx
movl $0x1, %eax
cmpl $0x59, %ecx
jg 0x724f9
leal -0x41(%rcx), %edx
cmpl $0x8, %edx
ja 0x7254e
leaq 0x28024(%rip), %rsi     # 0x9a514
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
leal -0x63(%rcx), %edx
cmpl $0x6, %edx
ja 0x72518
leaq 0x28030(%rip), %rcx     # 0x9a538
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movl $0x4, %eax
jmp 0x7255d
cmpl $0x5a, %ecx
je 0x72529
cmpl $0x73, %ecx
jne 0x72553
movl $0x2, %eax
jmp 0x7255d
leaq 0x1(%rdi), %rdx
cmpq $0x42, %rcx
je 0x72565
cmpl $0x5a, %ecx
je 0x72540
movq %rcx, %rax
cmpl $0x48, %ecx
jne 0x7255d
leaq 0x1(%rdx), %rax
cmpb $0x0, (%rdx)
movq %rax, %rdx
jne 0x72540
jmp 0x72563
cmpl $0x53, %ecx
je 0x72522
callq 0x63c0
movl $0x8, %eax
addq %rdi, %rax
incq %rax
popq %rcx
retq
movzbl (%rdx), %ecx
movl $0x1, %eax
cmpl $0x59, %ecx
jg 0x7258a
leal -0x41(%rcx), %edx
cmpl $0x8, %edx
ja 0x725be
leaq 0x27fd3(%rip), %rsi     # 0x9a554
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
leal -0x63(%rcx), %edx
cmpl $0x6, %edx
ja 0x725a9
leaq 0x27fdf(%rip), %rcx     # 0x9a578
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movl $0x4, %eax
jmp 0x725cc
cmpl $0x5a, %ecx
je 0x725ba
cmpl $0x73, %ecx
jne 0x725c3
movl $0x2, %eax
jmp 0x725cc
movl %ecx, %eax
jmp 0x725cc
cmpl $0x53, %ecx
je 0x725b3
xorl %eax, %eax
jmp 0x725cc
movl $0x8, %eax
imull 0x2(%rdi), %eax
addq %rdi, %rax
addq $0x6, %rax
jmp 0x72563
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_aux2i
int32_t bam_aux2i(const uint8_t *s)
{
    int type;
    type = *s++;
    if (type == 'c') return (int32_t)*(int8_t*)s;
    else if (type == 'C') return (int32_t)*(uint8_t*)s;
    else if (type == 's') return (int32_t)*(int16_t*)s;
    else if (type == 'S') return (int32_t)*(uint16_t*)s;
    else if (type == 'i' || type == 'I') return *(int32_t*)s;
    else return 0;
}

// Assembly:
movb (%rdi), %cl
leal -0x43(%rcx), %eax
rolb $0x4, %al
cmpb $0x3, %al
ja 0x72689
movzbl %al, %eax
leaq 0x27f28(%rip), %rcx     # 0x9a594
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0x1(%rdi), %eax
retq
movsbl 0x1(%rdi), %eax
retq
movswl 0x1(%rdi), %eax
retq
movzwl 0x1(%rdi), %eax
retq
andb $-0x21, %cl
xorl %eax, %eax
cmpb $0x49, %cl
jne 0x72696
movl 0x1(%rdi), %eax
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: bam_aux2f
double bam_aux2f(const uint8_t *s)
{
    int type;
    type = *s++;
    if (type == 'd') return *(double*)s;
    else if (type == 'f') return *(float*)s;
    else return 0.0;
}

// Assembly:
movzbl (%rdi), %eax
cmpl $0x66, %eax
je 0x726ad
xorps %xmm0, %xmm0
cmpl $0x64, %eax
jne 0x726b2
movsd 0x1(%rdi), %xmm0
retq
cvtss2sd 0x1(%rdi), %xmm0
retq
// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/htslib/sam.c
// Function: sam_open_mode
int sam_open_mode(char *mode, const char *fn, const char *format)
{
    // TODO Parse "bam5" etc for compression level
    if (format == NULL) {
        // Try to pick a format based on the filename extension
        const char *ext = fn? strrchr(fn, '.') : NULL;
        if (ext == NULL || strchr(ext, '/')) return -1;
        return sam_open_mode(mode, fn, ext+1);
    }
    else if (strcmp(format, "bam") == 0) strcpy(mode, "b");
    else if (strcmp(format, "cram") == 0) strcpy(mode, "c");
    else if (strcmp(format, "sam") == 0) strcpy(mode, "");
    else return -1;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
testq %rdx, %rdx
je 0x72728
leaq 0x25fb7(%rip), %rsi     # 0x986a3
movq %r14, %rdi
callq 0x6a50
testl %eax, %eax
je 0x7275e
leaq 0x25fa8(%rip), %rsi     # 0x986a7
movq %r14, %rdi
callq 0x6a50
testl %eax, %eax
je 0x72765
leaq 0x25f8d(%rip), %rsi     # 0x9869f
movq %r14, %rdi
callq 0x6a50
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x7276c
movb $0x0, (%rbx)
jmp 0x7276a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rsi, %rsi
je 0x7276c
movq %rsi, %rdi
movl $0x2e, %esi
callq 0x67c0
testq %rax, %rax
je 0x7276c
movq %rax, %r14
movq %rax, %rdi
movl $0x2f, %esi
callq 0x6270
testq %rax, %rax
jne 0x7276c
incq %r14
jmp 0x726e5
movw $0x62, (%rbx)
jmp 0x7276a
movw $0x63, (%rbx)
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq