LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/hfile.c
// Function: hfile_init
hFILE *hfile_init(size_t struct_size, const char *mode, size_t capacity)
{
    hFILE *fp = (hFILE *) malloc(struct_size);
    if (fp == NULL) goto error;

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

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

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

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

error:
    hfile_destroy(fp);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
callq 0x69d0
movq %rax, %rbx
testq %rax, %rax
je 0x5f607
testq %r15, %r15
movl $0x8000, %r14d          # imm = 0x8000
cmoveq %r14, %r15
pushq $0x72
popq %rsi
movq %r12, %rdi
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 0x5f607
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 0x5f611
movq %rbx, %rdi
callq 0x5f620
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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, %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 0x5f813
testb $0x1, 0x30(%rbx)
jne 0x5f813
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *(%rax)
movq %rax, %r13
testq %rax, %rax
js 0x5f81d
jne 0x5f7c7
orb $0x1, 0x30(%rbx)
addq %r13, 0x28(%rbx)
addq %r13, %r12
subq %r13, %r15
addq %r13, %r14
jmp 0x5f79b
testb $0x1, 0x30(%rbx)
jne 0x5f818
movq %rbx, %rdi
callq 0x5f672
testq %rax, %rax
js 0x5f829
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %r13
subq %rsi, %r13
cmpq %r15, %r13
cmovaeq %r15, %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x6570
addq %r13, 0x8(%rbx)
addq %r13, %r12
subq %r13, %r15
addq %r13, %r14
testq %r15, %r15
jne 0x5f7d6
movq %r14, %r13
jmp 0x5f82c
callq 0x6060
movl (%rax), %eax
movl %eax, 0x34(%rbx)
jmp 0x5f82c
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_c_makefile_star2_O2/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 0x5f9dc
movq %rbx, %rdi
callq 0x5f87f
testl %eax, %eax
js 0x5fa3b
cmpl $0x1, %ebp
jne 0x5fa0f
movq 0x28(%rbx), %rsi
addq %r14, %rsi
addq 0x8(%rbx), %rsi
xorl %ebp, %ebp
subq (%rbx), %rsi
jns 0x5fa12
testq %r14, %r14
pushq $0x16
popq %rax
pushq $0x4b
popq %rbp
cmovsl %eax, %ebp
callq 0x6060
movl %ebp, (%rax)
movl %ebp, 0x34(%rbx)
pushq $-0x1
popq %r14
jmp 0x5fa4a
movq %r14, %rsi
movq 0x20(%rbx), %rax
movq %rbx, %rdi
movl %ebp, %edx
callq *0x10(%rax)
movq %rax, %r14
testq %rax, %rax
js 0x5fa40
movq (%rbx), %rax
movq %rax, 0x10(%rbx)
movq %rax, 0x8(%rbx)
andb $-0x2, 0x30(%rbx)
movq %r14, 0x28(%rbx)
jmp 0x5fa4a
movslq %eax, %r14
jmp 0x5fa4a
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_O2/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 0x5fa74
movq %rbx, %rdi
callq 0x5f83e
testl %eax, %eax
jns 0x5fa74
movl 0x34(%rbx), %ebp
movq 0x20(%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
testl %eax, %eax
jns 0x5fa89
callq 0x6060
movl (%rax), %ebp
movq %rbx, %rdi
callq 0x5f620
testl %ebp, %ebp
je 0x5faa1
callq 0x6060
movl %ebp, (%rax)
pushq $-0x1
popq %rax
jmp 0x5faa3
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/hfile.c
// Function: hclose_abruptly
void hclose_abruptly(hFILE *fp)
{
    int save = errno;
    if (fp->backend->close(fp) < 0) { /* Ignore subsequent errors */ }
    hfile_destroy(fp);
    errno = save;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x6060
movq %rax, %r14
movl (%rax), %ebp
movq 0x20(%rbx), %rax
movq %rbx, %rdi
callq *0x20(%rax)
movq %rbx, %rdi
callq 0x5f620
movl %ebp, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x5fe20
testq %rax, %rax
je 0x5fdde
movq (%rax), %rax
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *%rax
cmpb $0x2d, (%r14)
jne 0x5fdeb
cmpb $0x0, 0x1(%r14)
je 0x5fdfd
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x600a4
pushq $0x72
popq %rsi
movq %rbx, %rdi
callq 0x6270
xorl %edi, %edi
testq %rax, %rax
sete %dil
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5fad5
// File: /workspace/github_c_makefile_star2_O2/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 0x601be
callq 0x6260
jmp 0x601c5
xorl %ecx, %ecx
callq 0x6350
movq %rax, %r12
testq %rax, %rax
jns 0x601d7
callq 0x6060
cmpl $0x4, (%rax)
je 0x601a6
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x28b6b(%rip), %rsi     # 0x89088
pushq $0x5
popq %rdx
callq 0x6330
xorl %r12d, %r12d
testl %eax, %eax
sete %bpl
pushq $0x72
popq %rsi
movq %r14, %rdi
callq 0x6270
testq %rax, %rax
je 0x60585
xorl %r15d, %r15d
pushq $0x50
popq %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x5f598
testq %rax, %rax
je 0x60593
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)
andq $0x0, 0x48(%r14)
leaq 0x526ac(%rip), %rax     # 0xb2c28
movq %rax, 0x20(%r14)
movq %r14, %r15
jmp 0x60593
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_O2/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 0x28ade(%rip), %rsi     # 0x8908e
pushq $0x11
popq %rdx
callq 0x6330
testl %eax, %eax
je 0x605e7
leaq 0x28add(%rip), %rsi     # 0x890a0
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x6330
testl %eax, %eax
je 0x605eb
callq 0x6060
movl $0x5d, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
jmp 0x605ed
pushq $0x7
popq %rax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x600a4
// File: /workspace/github_c_makefile_star2_O2/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 0x60663
cmpl $0x1, %edx
je 0x6065a
cmpl $0x2, %edx
jne 0x60688
pushq $0x40
jmp 0x6065c
pushq $0x48
popq %rax
movq (%rdi,%rax), %rax
jmp 0x60665
movl %edx, %eax
testq %rsi, %rsi
sets %dl
cmpq %rax, %rcx
seta %r8b
testb %r8b, %dl
jne 0x60688
testq %rsi, %rsi
js 0x60698
movq 0x40(%rdi), %rdx
subq %rax, %rdx
cmpq %rdx, %rcx
jbe 0x60698
callq 0x6060
movl $0x16, (%rax)
pushq $-0x1
popq %rax
jmp 0x6069f
addq %rsi, %rax
movq %rax, 0x48(%rdi)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x68071(%rip), %rbx     # 0xc8720
testq %rbx, %rbx
je 0x606d7
movq 0x18(%rbx), %rdi
callq 0x68a0
movq 0x10(%rbx), %rdi
callq 0x68a0
movq 0x20(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
callq 0x68a0
movq 0x68072(%rip), %rbx     # 0xc8750
testq %rbx, %rbx
je 0x60706
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x606ee
callq *%rax
movq 0x20(%rbx), %r14
movq %r14, 0x68057(%rip)     # 0xc8750
movq %rbx, %rdi
callq 0x68a0
movq %r14, %rbx
jmp 0x606de
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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, 0x68033(%rip)     # 0xc8758
jne 0x6072e
movb $0x1, 0x6802a(%rip)     # 0xc8758
xorl %r12d, %r12d
pushq $0x40
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x5f598
testq %rax, %rax
je 0x60775
movq %rax, %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x76480
movq %rax, 0x38(%r15)
testq %rax, %rax
je 0x6076a
leaq 0x524ef(%rip), %rax     # 0xb2c50
movq %rax, 0x20(%r15)
movq %r15, %r12
jmp 0x60775
movq %r15, %rdi
callq 0x5f620
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x288f3(%rip), %rax     # 0x8907f
movq %rax, 0x10(%rdi)
leaq 0x20700(%rip), %rdi     # 0x80e97
leaq 0x524da(%rip), %rbx     # 0xb2c78
movq %rbx, %rsi
callq 0x5fbb6
leaq 0x206e5(%rip), %rdi     # 0x80e92
movq %rbx, %rsi
callq 0x5fbb6
leaq 0x23781(%rip), %rdi     # 0x83f3d
movq %rbx, %rsi
callq 0x5fbb6
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x612f8
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
je 0x612c9
xorl %r14d, %r14d
movslq (%rbx), %rax
movq 0x20(%rbx), %rdi
cmpq %rax, %r14
jge 0x612bb
movq (%rdi,%r14,8), %rdi
callq 0x68a0
incq %r14
jmp 0x612a1
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 0x612e9
callq 0x45f88
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x68a0
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x613af
movq %rdi, %r14
callq 0x61280
xorl %ebp, %ebp
testq %rax, %rax
je 0x613af
movq %rax, %rbx
movq (%r14), %r12
movq %r12, (%rax)
movl 0x8(%r14), %r15d
movl %r15d, 0x8(%rax)
andq $0x0, 0x18(%rax)
andq $0x0, 0x30(%rax)
leal 0x1(%r15), %edi
pushq $0x1
popq %rsi
callq 0x6470
movq %rax, 0x28(%rbx)
movq 0x28(%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x6570
movslq %r12d, %r15
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x6470
movq %rax, %r12
movq %rax, 0x10(%rbx)
pushq $0x8
popq %rsi
movq %r15, %rdi
callq 0x6470
movq %rax, %r13
movq %rax, 0x20(%rbx)
testl %r15d, %r15d
cmovlel %ebp, %r15d
cmpq %rbp, %r15
je 0x613b1
movq 0x10(%r14), %rax
movl (%rax,%rbp,4), %eax
movl %eax, (%r12,%rbp,4)
movq 0x20(%r14), %rax
movq (%rax,%rbp,8), %rdi
callq 0x6dd0
movq %rax, (%r13,%rbp,8)
incq %rbp
jmp 0x61388
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_O2/icebert[P]pblat/htslib/sam.c
// Function: bam_copy1
bam1_t *bam_copy1(bam1_t *bdst, const bam1_t *bsrc)
{
    uint8_t *data = bdst->data;
    int m_data = bdst->m_data;   // backup data and m_data
    if (m_data < bsrc->l_data) { // double the capacity
        m_data = bsrc->l_data; kroundup32(m_data);
        data = (uint8_t*)realloc(data, m_data);
    }
    memcpy(data, bsrc->data, bsrc->l_data); // copy var-len data
    *bdst = *bsrc; // copy the rest
    // restore the backup
    bdst->m_data = m_data;
    bdst->data = data;
    return bdst;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x28(%rdi), %r15
movl 0x24(%rdi), %ebp
movl 0x20(%rsi), %eax
cmpl %eax, %ebp
jge 0x61979
decl %eax
movl %eax, %ecx
sarl %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x8, %eax
orl %ecx, %eax
movl %eax, %ebp
sarl $0x10, %ebp
orl %eax, %ebp
incl %ebp
movslq %ebp, %rsi
movq %r15, %rdi
callq 0x6c80
movq %rax, %r15
movl 0x20(%r14), %eax
movq 0x28(%r14), %rsi
movslq %eax, %rdx
movq %r15, %rdi
callq 0x6570
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups %xmm2, 0x20(%rbx)
movups %xmm0, (%rbx)
movups %xmm1, 0x10(%rbx)
movq 0x30(%r14), %rax
movq %rax, 0x30(%rbx)
movl %ebp, 0x24(%rbx)
movq %r15, 0x28(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x619e4
movq %rdi, %r14
callq 0x618ff
testq %rax, %rax
je 0x619e4
movq %rax, %rbx
movq %rax, %rdi
movq %r14, %rsi
callq 0x61926
jmp 0x619e6
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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:
xorl %ecx, %ecx
testl %edi, %edi
cmovlel %ecx, %edi
movl $0x3c1a7, %edx          # imm = 0x3C1A7
xorl %eax, %eax
cmpq %rcx, %rdi
je 0x61a2b
movl (%rsi,%rcx,4), %r8d
leal (%r8,%r8), %r9d
btl %r9d, %edx
movl $0x0, %r9d
sbbl %r9d, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addl %eax, %r8d
incq %rcx
movl %r8d, %eax
jmp 0x619ff
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/sam.c
// Function: bam_cigar2rlen
int bam_cigar2rlen(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]))&2)
            l += bam_cigar_oplen(cigar[k]);
    return l;
}

// Assembly:
xorl %edx, %edx
testl %edi, %edi
cmovlel %edx, %edi
xorl %eax, %eax
cmpq %rdx, %rdi
je 0x61a65
movl (%rsi,%rdx,4), %r8d
leal (%r8,%r8), %ecx
movl $0x3c1a7, %r9d          # imm = 0x3C1A7
shrl %cl, %r9d
shll $0x1e, %r9d
sarl $0x1f, %r9d
shrl $0x4, %r8d
andl %r9d, %r8d
addl %eax, %r8d
incq %rdx
movl %r8d, %eax
jmp 0x61a35
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/sam.c
// Function: bam_write1
int bam_write1(BGZF *fp, const bam1_t *b)
{
    const bam1_core_t *c = &b->core;
    uint32_t x[8], block_len = b->l_data + 32, y;
    int i, ok;
    x[0] = c->tid;
    x[1] = c->pos;
    x[2] = (uint32_t)c->bin<<16 | c->qual<<8 | c->l_qname;
    x[3] = (uint32_t)c->flag<<16 | c->n_cigar;
    x[4] = c->l_qseq;
    x[5] = c->mtid;
    x[6] = c->mpos;
    x[7] = c->isize;
    ok = (bgzf_flush_try(fp, 4 + block_len) >= 0);
    if (fp->is_be) {
        for (i = 0; i < 8; ++i) ed_swap_4p(x + i);
        y = block_len;
        if (ok) ok = (bgzf_write(fp, ed_swap_4p(&y), 4) >= 0);
        swap_data(c, b->l_data, b->data, 1);
    } else {
        if (ok) ok = (bgzf_write(fp, &block_len, 4) >= 0);
    }
    if (ok) ok = (bgzf_write(fp, x, 32) >= 0);
    if (ok) ok = (bgzf_write(fp, b->data, b->l_data) >= 0);
    if (fp->is_be) swap_data(c, b->l_data, b->data, 0);
    return ok? 4 + block_len : -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x20(%rsi), %esi
leal 0x20(%rsi), %ebp
movl %ebp, 0x8(%rsp)
movq (%rbx), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rbx), %rax
movl %eax, %ecx
shll $0x10, %ecx
movl %eax, %edx
shrl $0x8, %edx
andl $0xff00, %edx           # imm = 0xFF00
orl %ecx, %edx
movl %eax, %ecx
shrl $0x18, %ecx
orl %edx, %ecx
movl %ecx, 0x18(%rsp)
movq %rax, %rcx
shrq $0x10, %rcx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
shrq $0x30, %rax
orl %ecx, %eax
movl %eax, 0x1c(%rsp)
movups 0x10(%rbx), %xmm0
movaps %xmm0, 0x20(%rsp)
addl $0x24, %esi
callq 0x5cf84
testb $0xc, 0x2(%r14)
je 0x61ea0
xorl %ecx, %ecx
cmpq $0x8, %rcx
je 0x61e79
movl 0x10(%rsp,%rcx,4), %edx
bswapl %edx
movl %edx, 0x10(%rsp,%rcx,4)
incq %rcx
jmp 0x61e64
movl %ebp, 0xc(%rsp)
testl %eax, %eax
js 0x61ebf
bswapl %ebp
leaq 0xc(%rsp), %rsi
movl %ebp, (%rsi)
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x5cfd3
xorl %ebp, %ebp
testq %rax, %rax
setns %bpl
jmp 0x61ec1
testl %eax, %eax
js 0x61f08
leaq 0x8(%rsp), %rsi
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x5cfd3
xorl %ebp, %ebp
testq %rax, %rax
setns %bpl
jmp 0x61ed3
xorl %ebp, %ebp
movl 0x20(%rbx), %esi
movq 0x28(%rbx), %rdx
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0x61c4e
movb $0x1, %r15b
testl %ebp, %ebp
je 0x61f0b
leaq 0x10(%rsp), %rsi
pushq $0x20
popq %rdx
movq %r14, %rdi
callq 0x5cfd3
testq %rax, %rax
js 0x61f0b
movq 0x28(%rbx), %rsi
movslq 0x20(%rbx), %rdx
movq %r14, %rdi
callq 0x5cfd3
movq %rax, %r15
shrq $0x3f, %r15
jmp 0x61f0b
movb $0x1, %r15b
testb $0xc, 0x2(%r14)
je 0x61f23
movl 0x20(%rbx), %esi
movq 0x28(%rbx), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x61c4e
movl 0x8(%rsp), %ecx
addl $0x4, %ecx
testb %r15b, %r15b
pushq $-0x1
popq %rax
cmovel %ecx, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/sam.c
// Function: sam_index_build2
int sam_index_build2(const char *fn, const char *fnidx, int min_shift)
{
    hts_idx_t *idx;
    htsFile *fp;
    int ret = 0;

    if ((fp = hts_open(fn, "r")) == 0) return -2;
    switch (fp->format.format) {
    case cram:
        ret = cram_index_build(fp->fp.cram, fn, fnidx);
        break;

    case bam:
        idx = bam_index(fp->fp.bgzf, min_shift);
        if (idx) {
            ret = hts_idx_save_as(idx, fn, fnidx, (min_shift > 0)? HTS_FMT_CSI : HTS_FMT_BAI);
            hts_idx_destroy(idx);
        }
        else ret = -1;
        break;

    default:
        ret = -3;
        break;
    }
    hts_close(fp);

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
leaq 0x22eae(%rip), %rsi     # 0x84e09
callq 0x4710c
testq %rax, %rax
je 0x61f8b
movq %rax, %rbx
movl 0x44(%rax), %eax
cmpl $0x4, %eax
je 0x61f93
cmpl $0x6, %eax
jne 0x61fef
movq 0x38(%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x4c1f7
movl %eax, %ebp
jmp 0x620b4
pushq $-0x2
popq %rbp
jmp 0x620bc
movl %ebp, 0x4(%rsp)
movq 0x38(%rbx), %r13
movq %r13, %rdi
callq 0x613c3
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x620b4
movq %rax, %r12
movl (%rax), %edi
movl 0x4(%rsp), %ecx
testl %ecx, %ecx
movq %r14, 0x10(%rsp)
movq %r15, 0x8(%rsp)
jle 0x62017
xorl %r8d, %r8d
testl %edi, %edi
movl $0x0, %edx
cmovgl %edi, %edx
xorl %eax, %eax
cmpq %r8, %rdx
je 0x61ff6
movq 0x10(%r12), %rsi
movl (%rsi,%r8,4), %esi
cmpq %rsi, %rax
cmovleq %rsi, %rax
incq %r8
jmp 0x61fd5
pushq $-0x3
jmp 0x620b3
pushq $0x1
popq %rdx
shll %cl, %edx
addq $0x100, %rax            # imm = 0x100
movslq %edx, %rdx
xorl %esi, %esi
xorl %r8d, %r8d
cmpq %rdx, %rax
jle 0x62021
incl %r8d
shlq $0x3, %rdx
jmp 0x62009
pushq $0xe
popq %rcx
pushq $0x5
popq %r8
pushq $0x1
popq %rsi
movq 0x10(%r13), %rax
shlq $0x10, %rax
movzwl 0xc(%r13), %edx
orq %rax, %rdx
callq 0x487ad
movq %rax, %r14
movq %r12, %rdi
callq 0x6128b
callq 0x618ff
movq %rax, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x61a9e
testl %eax, %eax
js 0x6209c
movl (%r12), %ebp
movl 0x4(%r12), %r15d
movq %r12, %rdi
callq 0x61a66
movq 0x10(%r13), %rcx
shlq $0x10, %rcx
movzwl 0xc(%r13), %r8d
orq %rcx, %r8
xorl %r9d, %r9d
btq $0x22, 0x8(%r12)
setae %r9b
movq %r14, %rdi
movl %ebp, %esi
movl %r15d, %edx
movl %eax, %ecx
callq 0x48ec6
testl %eax, %eax
jns 0x62049
jmp 0x620a1
cmpl $-0x1, %eax
je 0x620cd
movq %r12, %rdi
callq 0x6190a
movq %r14, %rdi
callq 0x492db
pushq $-0x1
popq %rbp
movq %rbx, %rdi
callq 0x4780a
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r13), %rax
shlq $0x10, %rax
movzwl 0xc(%r13), %esi
orq %rax, %rsi
movq %r14, %rdi
callq 0x4887b
movq %r12, %rdi
callq 0x6190a
testq %r14, %r14
pushq $-0x1
popq %rbp
je 0x620b4
xorl %ecx, %ecx
cmpl $0x0, 0x4(%rsp)
setle %cl
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x4947d
movl %eax, %ebp
movq %r14, %rdi
callq 0x492db
jmp 0x620b4
// File: /workspace/github_c_makefile_star2_O2/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 0x6214e
cmpl $0x4, %eax
jne 0x6217b
testq %rdx, %rdx
je 0x6217f
movq %rsi, %rdi
movq %rdx, %rsi
popq %rbx
jmp 0x4a544
movq %rdi, %rbx
movq 0x38(%rdi), %rdi
callq 0x4b8c0
testl %eax, %eax
js 0x6217b
pushq $0x10
popq %rdi
callq 0x69d0
testq %rax, %rax
je 0x6217b
movl $0x3, (%rax)
movq 0x38(%rbx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x6217d
xorl %eax, %eax
popq %rbx
retq
pushq $0x1
popq %rax
movq %rsi, %rdi
movl %eax, %esi
popq %rbx
jmp 0x4a4e3
// File: /workspace/github_c_makefile_star2_O2/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 0x621a7
cmpl $0x3, (%rdi)
jne 0x621b5
leaq 0x139(%rip), %r8        # 0x622de
jmp 0x6220b
leaq 0x13(%rip), %r8         # 0x621c1
xorl %edi, %edi
jmp 0x49973
leaq 0x137(%rip), %r8        # 0x622f3
jmp 0x49973
// File: /workspace/github_c_makefile_star2_O2/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 0x621dc
cmpl $0x4, %eax
jne 0x621ea
movq %rdx, %rsi
popq %rax
jmp 0x61a9e
movq 0x38(%rsi), %rdi
movq %rsp, %rsi
callq 0x6c67b
popq %rcx
retq
movq 0x50de7(%rip), %rax     # 0xb2fd8
movq (%rax), %rcx
leaq 0x275cd(%rip), %rdi     # 0x897c8
pushq $0x40
popq %rsi
pushq $0x1
popq %rdx
callq 0x6e70
callq 0x63c0
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rdi
pushq $0x50
popq %rsi
callq 0x6470
testq %rax, %rax
je 0x62299
movq %rax, %rbx
movl $0x1, (%rax)
movq %r13, 0x38(%rax)
testl %ebp, %ebp
sets %al
cmpl $-0x2, %ebp
setne %cl
testb %cl, %al
jne 0x6229d
cmpl $-0x2, %ebp
pushq $-0x1
popq %rax
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
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x53c3c
movl %ebp, 0x4(%rbx)
movl %r15d, 0x8(%rbx)
movl %r14d, 0xc(%rbx)
testl %eax, %eax
je 0x622ad
cmpl $-0x2, %eax
je 0x622a7
movq %rbx, %rdi
callq 0x68a0
xorl %ebx, %ebx
jmp 0x622ad
cmpl $-0x4, %ebp
je 0x622ad
cmpl $-0x5, %ebp
jne 0x622bf
movl $0x3, (%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x50d12(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
leaq 0x27539(%rip), %rsi     # 0x89809
movl %ebp, %edx
xorl %eax, %eax
callq 0x6a90
callq 0x63c0
// File: /workspace/github_c_makefile_star2_O2/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 0x61a9e
movl %eax, %ebp
testl %eax, %eax
js 0x6232d
movl (%r14), %eax
movl %eax, (%r12)
movl 0x4(%r14), %eax
movl %eax, (%r15)
movq %r14, %rdi
callq 0x61a66
movl %eax, (%rbx)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x63a29
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 0x63a28
movq %rax, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %rax
movq %rdi, %r14
movq %rdx, (%rsp)
movl 0x44(%rdi), %eax
cmpl $0x6, %eax
je 0x63b97
movq %rdx, %rbx
movq %rsi, %r15
cmpl $0x4, %eax
je 0x63b58
cmpl $0x3, %eax
jne 0x63bd1
leaq 0x10(%r14), %r12
leaq 0x51302(%rip), %r13     # 0xb4de8
cmpq $0x0, (%r12)
jne 0x63b03
movq %r14, %rdi
pushq $0x2
popq %rsi
movq %r12, %rdx
callq 0x47a0a
testl %eax, %eax
js 0x63bbd
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x62bbc
movl %eax, %ebp
andq $0x0, (%r12)
testl %eax, %eax
jns 0x63bc0
cmpl $0x0, (%r13)
jg 0x63b33
cmpl $0x0, 0x4(%r15)
jne 0x63ae6
jmp 0x63bc0
movq 0x4f49e(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
movq 0x8(%r14), %rcx
leaq 0x25ac1(%rip), %rsi     # 0x89609
leaq 0x25adc(%rip), %rdx     # 0x8962b
xorl %eax, %eax
callq 0x6a90
jmp 0x63b27
movq 0x38(%r14), %rdi
movq %rbx, %rsi
callq 0x61a9e
testl %eax, %eax
js 0x63b93
movl (%rbx), %edx
movl (%r15), %ecx
cmpl %ecx, %edx
setge %sil
cmpl $-0x1, %edx
setl %dl
orb %sil, %dl
pushq $-0x3
popq %rbp
jne 0x63bc0
movl 0x14(%rbx), %edx
cmpl %ecx, %edx
setge %cl
cmpl $-0x1, %edx
setl %dl
orb %cl, %dl
jne 0x63bc0
movl %eax, %ebp
jmp 0x63bc0
movq 0x38(%r14), %rdi
movq %rsp, %rsi
callq 0x6c67b
movl %eax, %ebp
testl %eax, %eax
jns 0x63bc0
movq 0x38(%r14), %rdi
callq 0x53c35
cmpl $0x1, %eax
pushq $-0x1
popq %rbp
sbbl $0x0, %ebp
jmp 0x63bc0
pushq $-0x1
popq %rbp
movl %ebp, %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_O2/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 %r14
pushq %rbx
pushq %rax
movl 0x44(%rdi), %eax
decl %eax
cmpl $0x5, %eax
ja 0x64400
movq %rdi, %rbx
leaq 0x24eb3(%rip), %rcx     # 0x8921c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movabsq $0x400000001, %rax      # imm = 0x400000001
movq %rax, 0x40(%rbx)
movq 0x38(%rbx), %rdi
movq %rdx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x61df0
movq 0x38(%rbx), %rdi
movq %rdx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x7432b
movabsq $0x300000001, %rax      # imm = 0x300000001
movq %rax, 0x40(%rbx)
leaq 0x10(%rbx), %r14
movq %rsi, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x63bd6
testl %eax, %eax
js 0x643f5
pushq $0xa
popq %rdi
movq %r14, %rsi
callq 0x62808
movq 0x38(%rbx), %rdi
movq 0x10(%rbx), %rdx
movq 0x20(%rbx), %rsi
callq 0x62b5d
movq 0x10(%rbx), %rcx
cmpq %rcx, %rax
pushq $-0x1
popq %rax
cmovel %ecx, %eax
jmp 0x643f8
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
callq 0x63c0
// File: /workspace/github_c_makefile_star2_O2/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
movsbl (%rsi), %eax
shll $0x8, %eax
movsbl 0x1(%rsi), %ebp
orl %eax, %ebp
movq 0x8(%rdi), %rdx
movq 0x28(%rdi), %rcx
movq %rdx, %rax
shrq $0x30, %rax
leaq (%rcx,%rax,4), %rax
shrl $0x18, %edx
addq %rax, %rdx
movslq 0x10(%rdi), %rsi
leal 0x1(%rsi), %eax
sarl %eax
cltq
addq %rdx, %rax
addq %rsi, %rax
movslq 0x20(%rbx), %rdx
addq %rcx, %rdx
cmpq %rdx, %rax
jae 0x6451d
movzwl (%rax), %ecx
rolw $0x8, %cx
movzwl %cx, %ecx
addq $0x2, %rax
cmpl %ebp, %ecx
je 0x6451f
movq %rax, %rdi
callq 0x64526
movq 0x28(%rbx), %rcx
jmp 0x644f1
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
movq %rdi, %rbx
movzbl (%rdi), %edi
callq 0x642f6
cmpb $0x42, %al
je 0x64562
incq %rbx
movzbl %al, %ecx
cmpl $0x48, %ecx
je 0x64554
cmpl $0x5a, %ecx
je 0x64554
testl %ecx, %ecx
je 0x64578
movl %eax, %eax
addq %rax, %rbx
movq %rbx, %rax
jmp 0x64576
leaq 0x1(%rbx), %rax
cmpb $0x0, (%rbx)
movq %rax, %rbx
jne 0x64554
jmp 0x64576
movzbl 0x1(%rbx), %edi
callq 0x642f6
imull 0x2(%rbx), %eax
addq %rbx, %rax
addq $0x6, %rax
popq %rbx
retq
callq 0x63c0
// File: /workspace/github_c_makefile_star2_O2/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 0x6462d
movzbl %al, %eax
leaq 0x24c24(%rip), %rcx     # 0x89234
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 0x6463a
movl 0x1(%rdi), %eax
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x64651
xorps %xmm0, %xmm0
cmpl $0x64, %eax
jne 0x64656
movsd 0x1(%rdi), %xmm0
retq
cvtss2sd 0x1(%rdi), %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
pushq $-0x1
popq %rbx
pushq $0x2e
popq %rbp
pushq $0x2f
popq %r13
testq %r15, %r15
jne 0x646c9
testq %r12, %r12
je 0x64718
movq %r12, %rdi
movl %ebp, %esi
callq 0x67c0
testq %rax, %rax
je 0x64718
movq %rax, %r15
movq %rax, %rdi
movl %r13d, %esi
callq 0x6270
incq %r15
testq %rax, %rax
je 0x64698
jmp 0x64718
leaq 0x22f01(%rip), %rsi     # 0x875d1
movq %r15, %rdi
callq 0x6a50
testl %eax, %eax
je 0x64708
leaq 0x22ef2(%rip), %rsi     # 0x875d5
movq %r15, %rdi
callq 0x6a50
testl %eax, %eax
je 0x64710
leaq 0x22ed7(%rip), %rsi     # 0x875cd
movq %r15, %rdi
callq 0x6a50
testl %eax, %eax
jne 0x64718
movb $0x0, (%r14)
jmp 0x64716
movw $0x62, (%r14)
jmp 0x64716
movw $0x63, (%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/sam.c
// Function: bam_plp_destroy
void bam_plp_destroy(bam_plp_t iter)
{
    if ( iter->overlaps ) kh_destroy(olap_hash, iter->overlaps);
    mp_free(iter->mp, iter->dummy);
    mp_free(iter->mp, iter->head);
    if (iter->mp->cnt != 0)
        fprintf(stderr, "[bam_plp_destroy] memory leak: %d. Continue anyway.\n", iter->mp->cnt);
    mp_destroy(iter->mp);
    if (iter->b) bam_destroy1(iter->b);
    free(iter->plp);
    free(iter);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x68(%rdi), %r14
testq %r14, %r14
je 0x64ee8
movq 0x18(%r14), %rdi
callq 0x68a0
movq 0x10(%r14), %rdi
callq 0x68a0
movq 0x20(%r14), %rdi
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq (%rbx), %rdi
movq 0x18(%rbx), %rsi
callq 0x64f87
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x64f87
movq (%rbx), %r14
movl (%r14), %edx
testl %edx, %edx
jne 0x64f6a
xorl %r15d, %r15d
movslq 0x4(%r14), %rax
movq 0x10(%r14), %rdi
cmpq %rax, %r15
jge 0x64f39
movq (%rdi,%r15,8), %rax
movq 0x28(%rax), %rdi
callq 0x68a0
movq 0x10(%r14), %rax
movq (%rax,%r15,8), %rdi
callq 0x68a0
incq %r15
jmp 0x64f0d
callq 0x68a0
movq %r14, %rdi
callq 0x68a0
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x64f54
callq 0x6190a
movq 0x48(%rbx), %rdi
callq 0x68a0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x68a0
movq 0x4e067(%rip), %rax     # 0xb2fd8
movq (%rax), %rdi
leaq 0x24760(%rip), %rsi     # 0x896db
xorl %eax, %eax
callq 0x6a90
movq (%rbx), %r14
jmp 0x64f0a
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/sam.c
// Function: bam_plp_auto
const bam_pileup1_t *bam_plp_auto(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp)
{
    const bam_pileup1_t *plp;
    if (iter->func == 0 || iter->error) { *_n_plp = -1; return 0; }
    if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
    else { // no pileup line can be obtained; read alignments
        *_n_plp = 0;
        if (iter->is_eof) return 0;
        int ret;
        while ( (ret=iter->func(iter->data, iter->b)) >= 0) {
            if (bam_plp_push(iter, iter->b) < 0) {
                *_n_plp = -1;
                return 0;
            }
            if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
            // otherwise no pileup line can be returned; read the next alignment.
        }
        if ( ret < -1 ) { iter->error = ret; *_n_plp = -1; return 0; }
        bam_plp_push(iter, 0);
        if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
        return 0;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
cmpq $0x0, 0x58(%rdi)
je 0x65c0a
movq %rdi, %r15
cmpl $0x0, 0x38(%rdi)
je 0x65c1b
orl $-0x1, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rdx, %r14
movq %rsi, %r12
movq %r15, %rdi
movq %rbx, %rcx
callq 0x64fe2
testq %rax, %rax
jne 0x65c0f
andl $0x0, (%rbx)
cmpl $0x0, 0x30(%r15)
jne 0x65c0d
jmp 0x65c63
movq 0x50(%r15), %rsi
movq %r15, %rdi
callq 0x655a2
testl %eax, %eax
js 0x65c0a
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x64fe2
testq %rax, %rax
jne 0x65c0f
movq 0x50(%r15), %rsi
movq 0x60(%r15), %rdi
callq *0x58(%r15)
testl %eax, %eax
jns 0x65c3d
cmpl $-0x1, %eax
je 0x65c7e
movl %eax, 0x38(%r15)
jmp 0x65c0a
movq %r15, %rdi
xorl %esi, %esi
callq 0x655a2
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x64fe2
// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/sam.c
// Function: bam_plp_reset
void bam_plp_reset(bam_plp_t iter)
{
    lbnode_t *p, *q;
    iter->max_tid = iter->max_pos = -1;
    iter->tid = iter->pos = 0;
    iter->is_eof = 0;
    for (p = iter->head; p->next;) {
        overlap_remove(iter, NULL);
        q = p->next;
        mp_free(iter->mp, p);
        p = q;
    }
    iter->head = iter->tail;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movaps 0x2359d(%rip), %xmm0    # 0x89250
movups %xmm0, 0x20(%rdi)
andl $0x0, 0x30(%rdi)
movq 0x8(%rdi), %r14
cmpq $0x0, 0x50(%r14)
je 0x65ce4
movq %rbx, %rdi
xorl %esi, %esi
callq 0x65524
movq 0x50(%r14), %r15
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x64f87
movq %r15, %r14
jmp 0x65cbf
movq 0x10(%rbx), %rax
movq %rax, 0x8(%rbx)
popq %rbx
popq %r14
popq %r15
retq