LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/samtools[P]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) {
        if (strchr(mode, ':') == NULL
            || handler->priority < 2000
            || handler->vopen == NULL) {
            return handler->open(fname, mode);
        }
        else {
            hFILE *fp;
            va_list arg;
            va_start(arg, mode);
            fp = handler->vopen(fname, mode, arg);
            va_end(arg);
            return fp;
        }
    }
    else if (strcmp(fname, "-") == 0) return hopen_fd_stdinout(mode);
    else return hopen_fd(fname, mode);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, %rbx
movq %rdi, %r14
movq %rdx, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq %r8, 0x20(%rsp)
movq %r9, 0x28(%rsp)
testb %al, %al
je 0x10070
movaps %xmm0, 0x30(%rsp)
movaps %xmm1, 0x40(%rsp)
movaps %xmm2, 0x50(%rsp)
movaps %xmm3, 0x60(%rsp)
movaps %xmm4, 0x70(%rsp)
movaps %xmm5, 0x80(%rsp)
movaps %xmm6, 0x90(%rsp)
movaps %xmm7, 0xa0(%rsp)
callq 0x10169
testq %rax, %rax
je 0x100ef
movq %rax, %r15
movq %rbx, %rdi
movl $0x3a, %esi
callq 0x4190
testq %rax, %rax
je 0x100d7
cmpl $0x7d0, 0x18(%r15)      # imm = 0x7D0
jl 0x100d7
cmpq $0x0, 0x20(%r15)
je 0x100d7
movq %rsp, %rax
leaq 0xb0(%rsp), %rdx
movq %rax, 0x10(%rdx)
leaq 0x140(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq %r14, %rdi
movq %rbx, %rsi
callq *0x20(%r15)
jmp 0x1015b
movq (%r15), %rax
movq %r14, %rdi
movq %rbx, %rsi
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
jmpq *%rax
leaq 0x8adce(%rip), %rsi     # 0x9aec4
movq %r14, %rdi
callq 0x46c0
testl %eax, %eax
je 0x1011a
movq %r14, %rdi
movq %rbx, %rsi
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x10325
movq %rbx, %rdi
movl $0x72, %esi
callq 0x4190
xorl %ebp, %ebp
testq %rax, %rax
sete %bpl
leaq 0x88587(%rip), %rdx     # 0x986be
leaq 0xb0(%rsp), %r14
movl $0x65, %esi
movq %r14, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x4800
movl %ebp, %edi
movq %r14, %rsi
callq 0xf761
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile.c
// Function: hopen_fd
static hFILE *hopen_fd(const char *filename, const char *mode)
{
    hFILE_fd *fp = NULL;
    int fd = open(filename, hfile_oflags(mode), 0666);
    if (fd < 0) goto error;

    fp = (hFILE_fd *) hfile_init(sizeof (hFILE_fd), mode, blksize(fd));
    if (fp == NULL) goto error;

    fp->fd = fd;
    fp->is_socket = 0;
    fp->is_shared = 0;
    fp->base.backend = &fd_backend;
    return &fp->base;

error:
    if (fd >= 0) { int save = errno; (void) close(fd); errno = save; }
    hfile_destroy((hFILE *) fp);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xf814
movq %rbx, %rdi
movl %eax, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x4330
movl %eax, %ebx
testl %eax, %eax
js 0x103a7
movq %rsp, %rsi
movl %ebx, %edi
callq 0x4890
testl %eax, %eax
je 0x10367
xorl %edx, %edx
jmp 0x10381
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rsp), %eax
movl $0x20000, %edx          # imm = 0x20000
cmpl $0x1000, %eax           # imm = 0x1000
je 0x10381
movq 0x38(%rsp), %rdx
movl $0x40, %edi
movq %r14, %rsi
callq 0xee3c
testq %rax, %rax
je 0x103a7
movl %ebx, 0x38(%rax)
andb $-0x4, 0x3c(%rax)
leaq 0xa841f(%rip), %rcx     # 0xb87c0
movq %rcx, 0x20(%rax)
jmp 0x103c1
testl %ebx, %ebx
js 0x103bf
callq 0x4050
movq %rax, %r14
movl (%rax), %ebp
movl %ebx, %edi
callq 0x49c0
movl %ebp, (%r14)
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile.c
// Function: knet_open
HTSLIB_EXPORT
knetFile *knet_open(const char *fn, const char *mode) {
    knetFile *fp = calloc(1, sizeof(*fp));
    if (!fp) return NULL;
    if (!(fp->hf = hopen(fn, mode))) {
        free(fp);
        return NULL;
    }

    // FD backend is the only one implementing knet_fileno
    fp->fd = fp->hf->backend == &fd_backend
        ? ((hFILE_fd *)fp->hf)->fd
        : -1;

    return fp;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, %edi
movl $0x88, %esi
callq 0x4300
testq %rax, %rax
je 0x106d4
movq %rax, %rbx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x10014
movq %rax, 0x80(%rbx)
testq %rax, %rax
je 0x106cc
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
leaq 0xa8102(%rip), %rdx     # 0xb87c0
cmpq %rdx, 0x20(%rax)
jne 0x106c7
movl 0x38(%rax), %ecx
movl %ecx, 0x4(%rbx)
jmp 0x106d6
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile.c
// Function: knet_dopen
HTSLIB_EXPORT
knetFile *knet_dopen(int fd, const char *mode) {
    knetFile *fp = calloc(1, sizeof(*fp));
    if (!fp) return NULL;
    if (!(fp->hf = hdopen(fd, mode))) {
        free(fp);
        return NULL;
    }
    fp->fd = fd;
    return fp;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
movl $0x1, %edi
movl $0x88, %esi
callq 0x4300
testq %rax, %rax
je 0x10722
movq %rax, %rbx
movl %ebp, %edi
movq %r14, %rsi
callq 0xf761
movq %rax, 0x80(%rbx)
testq %rax, %rax
je 0x1071a
movl %ebp, 0x4(%rbx)
jmp 0x10724
movq %rbx, %rdi
callq 0x45c0
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile.c
// Function: knet_seek
HTSLIB_EXPORT
off_t knet_seek(knetFile *fp, off_t off, int whence) {
    off_t r = hseek(fp->hf, off, whence);
    if (r >= 0)
        fp->offset = r;
    return r;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
callq 0xf583
testq %rax, %rax
js 0x107c3
movq %rax, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile.c
// Function: fd_read
static ssize_t fd_read(hFILE *fpv, void *buffer, size_t nbytes)
{
    hFILE_fd *fp = (hFILE_fd *) fpv;
    ssize_t n;
    do {
        n = fp->is_socket? recv(fp->fd, buffer, nbytes, 0)
                         : read(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)
jne 0x10813
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4710
jmp 0x10824
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x4140
movq %rax, %r12
testq %rax, %rax
jns 0x10836
callq 0x4050
cmpl $0x4, (%rax)
je 0x107fb
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]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);
#ifdef _WIN32
        // On windows we have no SIGPIPE.  Instead write returns
        // EINVAL.  We check for this and our fd being a pipe.
        // If so, we raise SIGTERM instead of SIGPIPE.  It's not
        // ideal, but I think the only alternative is extra checking
        // in every single piece of code.
        if (n < 0 && errno == EINVAL &&
            GetLastError() == ERROR_NO_DATA &&
            GetFileType((HANDLE)_get_osfhandle(fp->fd)) == FILE_TYPE_PIPE) {
            raise(SIGTERM);
        }
#endif
    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)
jne 0x1086e
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x4180
jmp 0x1087f
movl 0x38(%r15), %edi
movq %r14, %rsi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x4230
movq %rax, %r12
testq %rax, %rax
jns 0x10891
callq 0x4050
cmpl $0x4, (%rax)
je 0x10856
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile.c
// Function: hopen_mem
static hFILE *hopen_mem(const char *url, const char *mode)
{
    size_t length, size;
    char *buffer;
    const char *data, *comma = strchr(url, ',');
    if (comma == NULL) { errno = EINVAL; return NULL; }
    data = comma+1;

    // TODO Implement write modes
    if (strchr(mode, 'r') == NULL) { errno = EROFS; return NULL; }

    if (comma - url >= 7 && cmp_prefix(";base64", &comma[-7]) == 0) {
        size = hts_base64_decoded_length(strlen(data));
        buffer = malloc(size);
        if (buffer == NULL) return NULL;
        hts_decode_base64(buffer, &length, data);
    }
    else {
        size = strlen(data) + 1;
        buffer = malloc(size);
        if (buffer == NULL) return NULL;
        hts_decode_percent(buffer, &length, data);
    }
    hFILE* hf;

    if(!(hf = create_hfile_mem(buffer, mode, length, size))){
        free(buffer);
        return NULL;
    }

    return hf;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r12
movl $0x2c, %esi
callq 0x4190
testq %rax, %rax
je 0x10c85
movq %rax, %r15
movq %rbx, %rdi
movl $0x72, %esi
callq 0x4190
testq %rax, %rax
je 0x10ce7
leaq 0x1(%r15), %r14
movq %r15, %rax
subq %r12, %rax
cmpq $0x7, %rax
jl 0x10c92
callq 0x40c0
movq (%rax), %rax
movb $0x3b, %r8b
movq $-0x7, %rcx
leaq 0x879fd(%rip), %rdx     # 0x9862b
movzbl (%r15,%rcx), %edi
movb (%rax,%rdi,4), %dil
cmpb %dil, %r8b
jne 0x10c92
movl %r8d, %esi
movb 0x8(%rcx,%rdx), %r8b
incq %rcx
jne 0x10c2e
cmpb %dil, %sil
jne 0x10c92
movq %r14, %rdi
callq 0x41d0
movq %rax, %rdi
callq 0x36035
movq %rax, %r12
movq %rax, %rdi
callq 0x4680
testq %rax, %rax
je 0x10d03
movq %rax, %r15
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x36042
jmp 0x10cbe
callq 0x4050
movl $0x16, (%rax)
jmp 0x10d03
movq %r14, %rdi
callq 0x41d0
movq %rax, %r12
incq %r12
movq %r12, %rdi
callq 0x4680
testq %rax, %rax
je 0x10d03
movq %rax, %r15
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x35f78
movq (%rsp), %rcx
movl $0x38, %edi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %r8
callq 0xef39
testq %rax, %rax
je 0x10cf4
leaq 0xa7b07(%rip), %rcx     # 0xb87e8
movq %rcx, 0x20(%rax)
jmp 0x10cf6
callq 0x4050
movl $0x1e, (%rax)
jmp 0x10d03
xorl %eax, %eax
testq %rax, %rax
jne 0x10d05
movq %r15, %rdi
callq 0x45c0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]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; }

#if defined(_WIN32) || defined(__MSYS__)
    // For cases like C:/foo
    if (url[0] == '/' && url[1] && url[2] == ':' && url[3] == '/') url++;
#endif

    return hopen_fd(url, mode);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x87911(%rip), %rsi     # 0x98633
movl $0x11, %edx
callq 0x4210
testl %eax, %eax
je 0x10d5d
leaq 0x8790e(%rip), %rsi     # 0x98645
movl $0x8, %edx
movq %r14, %rdi
callq 0x4210
testl %eax, %eax
je 0x10d64
callq 0x4050
movl $0x5d, (%rax)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl $0x10, %eax
jmp 0x10d69
movl $0x7, %eax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x10325
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hfile.c
// Function: init_add_plugin
static int init_add_plugin(void *obj, int (*init)(struct hFILE_plugin *),
                           const char *pluginname)
{
    struct hFILE_plugin_list *p = malloc (sizeof (struct hFILE_plugin_list));
    if (p == NULL) {
        hts_log_debug("Failed to allocate memory for plugin \"%s\"", pluginname);
        return -1;
    }

    p->plugin.api_version = 1;
    p->plugin.obj = obj;
    p->plugin.name = NULL;
    p->plugin.destroy = NULL;

    int ret = (*init)(&p->plugin);

    if (ret != 0) {
        hts_log_debug("Initialisation failed for plugin \"%s\": %d", pluginname, ret);
        free(p);
        return ret;
    }

    hts_log_debug("Loaded \"%s\"", pluginname);

    p->next = plugins, plugins = p;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
movl $0x28, %edi
callq 0x4680
testq %rax, %rax
je 0x10f74
movq %rax, %r14
movl $0x1, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq $0x0, 0x18(%rax)
movq %rax, %rdi
callq *%r15
leaq 0x87704(%rip), %rsi     # 0x9864e
testl %eax, %eax
je 0x10f96
leaq 0x87733(%rip), %rdx     # 0x98688
movl $0x5, %edi
movq %rbx, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x14378
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x45c0
leaq 0x876d3(%rip), %rsi     # 0x9864e
leaq 0x876dc(%rip), %rdx     # 0x9865e
movl $0x5, %edi
movq %rbx, %rcx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x14378
leaq 0x87715(%rip), %rdx     # 0x986b2
movl $0x5, %edi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x14378
movq 0xa884d(%rip), %rax     # 0xb9800
movq %rax, 0x20(%r14)
movq %r14, 0xa8842(%rip)     # 0xb9800
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_test_feature
const char *hts_test_feature(unsigned int id) {
    unsigned int feat = hts_features();

    switch (id) {
    case HTS_FEATURE_CONFIGURE:
        return feat & HTS_FEATURE_CONFIGURE ? "yes" : NULL;
    case HTS_FEATURE_PLUGINS:
        return feat & HTS_FEATURE_PLUGINS ? "yes" : NULL;
    case HTS_FEATURE_LIBCURL:
        return feat & HTS_FEATURE_LIBCURL ? "yes" : NULL;
    case HTS_FEATURE_S3:
        return feat & HTS_FEATURE_S3 ? "yes" : NULL;
    case HTS_FEATURE_GCS:
        return feat & HTS_FEATURE_GCS ? "yes" : NULL;
    case HTS_FEATURE_LIBDEFLATE:
        return feat & HTS_FEATURE_LIBDEFLATE ? "yes" : NULL;
    case HTS_FEATURE_BZIP2:
        return feat & HTS_FEATURE_BZIP2 ? "yes" : NULL;
    case HTS_FEATURE_LZMA:
        return feat & HTS_FEATURE_LZMA ? "yes" : NULL;

    case HTS_FEATURE_HTSCODECS:
        return htscodecs_version();

    case HTS_FEATURE_CC:
        return HTS_CC;
    case HTS_FEATURE_CFLAGS:
        return HTS_CFLAGS;
    case HTS_FEATURE_LDFLAGS:
        return HTS_LDFLAGS;
    case HTS_FEATURE_CPPFLAGS:
        return HTS_CPPFLAGS;

    default:
        fprintf(stderr, "Unknown feature code: %u\n", id);
    }

    return NULL;
}

// Assembly:
pushq %rbx
movl %edi, %edx
cmpl $0x3fffff, %edi         # imm = 0x3FFFFF
jg 0x11837
xorl %ebx, %ebx
cmpl $0xfff, %edx            # imm = 0xFFF
jg 0x11860
leal -0x1(%rdx), %eax
cmpl $0x2, %eax
jb 0x118b8
cmpl $0x400, %edx            # imm = 0x400
je 0x11878
cmpl $0x800, %edx            # imm = 0x800
je 0x118b8
jmp 0x118bd
cmpl $0xfffffff, %edx        # imm = 0xFFFFFFF
jg 0x11881
cmpl $0x400000, %edx         # imm = 0x400000
je 0x11878
cmpl $0x800000, %edx         # imm = 0x800000
je 0x118ab
cmpl $0x8000000, %edx        # imm = 0x8000000
jne 0x118bd
leaq 0x873b9(%rip), %rbx     # 0x98c17
jmp 0x118b8
cmpl $0x1000, %edx           # imm = 0x1000
je 0x118b8
cmpl $0x100000, %edx         # imm = 0x100000
je 0x118b8
cmpl $0x200000, %edx         # imm = 0x200000
jne 0x118bd
leaq 0x87394(%rip), %rbx     # 0x98c13
jmp 0x118b8
cmpl $0x10000000, %edx       # imm = 0x10000000
je 0x118a2
cmpl $0x20000000, %edx       # imm = 0x20000000
je 0x118b1
cmpl $0x40000000, %edx       # imm = 0x40000000
jne 0x118bd
leaq 0x87382(%rip), %rbx     # 0x98c22
jmp 0x118b8
leaq 0x87372(%rip), %rbx     # 0x98c1b
jmp 0x118b8
popq %rbx
jmp 0x63ea8
leaq 0x87415(%rip), %rbx     # 0x98ccd
movq %rbx, %rax
popq %rbx
retq
movq 0xa7714(%rip), %rax     # 0xb8fd8
movq (%rax), %rdi
leaq 0x87368(%rip), %rsi     # 0x98c36
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4700
jmp 0x118b8
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: parse_version
static void
parse_version(htsFormat *fmt, const unsigned char *u, const unsigned char *ulim)
{
    const char *s    = (const char *) u;
    const char *slim = (const char *) ulim;
    short v;

    fmt->version.major = fmt->version.minor = -1;

    for (v = 0; s < slim && isdigit_c(*s); s++)
        v = 10 * v + *s - '0';

    if (s < slim) {
        fmt->version.major = v;
        if (*s == '.') {
            s++;
            for (v = 0; s < slim && isdigit_c(*s); s++)
                v = 10 * v + *s - '0';
            if (s < slim)
                fmt->version.minor = v;
        }
        else
            fmt->version.minor = 0;
    }
}

// Assembly:
movl $0xffffffff, 0x8(%rdi)  # imm = 0xFFFFFFFF
cmpq %rdx, %rsi
jae 0x1249c
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0x4510
movq (%rax), %rax
xorl %ecx, %ecx
movzbl (%r15), %edx
testb $0x8, 0x1(%rax,%rdx,2)
je 0x12458
movsbl %dl, %edx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
movswl %dx, %edx
addl %edx, %ecx
addl $-0x30, %ecx
incq %r15
cmpq %r14, %r15
jne 0x12433
jmp 0x12497
movw %cx, 0x8(%rbx)
cmpb $0x2e, (%r15)
jne 0x12491
incq %r15
cmpq %r14, %r15
jae 0x12497
xorl %ecx, %ecx
movzbl (%r15), %edx
testb $0x8, 0x1(%rax,%rdx,2)
je 0x12493
movsbl %dl, %edx
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
movswl %dx, %edx
addl %edx, %ecx
addl $-0x30, %ecx
incq %r15
cmpq %r14, %r15
jb 0x1246c
jmp 0x12497
xorl %ecx, %ecx
movw %cx, 0xa(%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: is_fastaq
static int is_fastaq(const unsigned char *u, const unsigned char *ulim)
{
    const unsigned char *eol = memchr(u, '\n', ulim - u);

    // Check that the first line is entirely textual
    if (! is_text_only(u, eol? eol : ulim)) return 0;

    // If the first line is very long, consider the file to indeed be FASTA/Q
    if (eol == NULL) return 1;

    u = eol+1; // Now points to the first character of the second line

    // Scan over all base-encoding letters (including 'N' but not SEQ's '=')
    while (u < ulim && (seq_nt16_table[*u] != 15 || toupper(*u) == 'N')) {
        if (*u == '=') return 0;
        u++;
    }

    return (u == ulim || *u == '\r' || *u == '\n')? 1 : 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
movq %rsi, %rdx
subq %rdi, %rdx
movl $0xa, %esi
callq 0x4550
movq %rax, %r14
testq %rax, %rax
movq %rax, %rcx
cmoveq %rbx, %rcx
cmpq %r15, %rcx
jbe 0x124f4
movl $0x2600, %edx           # imm = 0x2600
movb (%r15), %sil
cmpb $0x1f, %sil
ja 0x124ec
movb $0x1, %al
cmpb $0xd, %sil
ja 0x124f6
movzbl %sil, %esi
btl %esi, %edx
jae 0x124f6
incq %r15
cmpq %rcx, %r15
jne 0x124d2
xorl %eax, %eax
testq %r14, %r14
sete %cl
orb %al, %cl
je 0x12504
xorb $0x1, %al
jmp 0x12552
incq %r14
leaq 0x863a2(%rip), %r15     # 0x988b0
cmpq %rbx, %r14
jae 0x1253a
movzbl (%r14), %r12d
cmpb $0xf, (%r12,%r15)
jne 0x1252d
callq 0x40a0
movq (%rax), %rax
cmpl $0x4e, (%rax,%r12,4)
jne 0x1253a
incq %r14
cmpl $0x3d, %r12d
jne 0x1250e
xorl %eax, %eax
jmp 0x12552
cmpq %rbx, %r14
je 0x12550
movb (%r14), %al
cmpb $0xd, %al
sete %cl
cmpb $0xa, %al
sete %al
orb %cl, %al
jmp 0x12552
movb $0x1, %al
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_opt_apply
int hts_opt_apply(htsFile *fp, hts_opt *opts) {
    hts_opt *last = NULL;

    for (; opts;  opts = (last=opts)->next) {
        switch (opts->opt) {
            case CRAM_OPT_REFERENCE:
                if (!(fp->fn_aux = strdup(opts->val.s)))
                    return -1;
                // fall through
            case CRAM_OPT_VERSION:
            case CRAM_OPT_PREFIX:
            case HTS_OPT_FILTER:
            case FASTQ_OPT_AUX:
            case FASTQ_OPT_BARCODE:
                if (hts_set_opt(fp,  opts->opt,  opts->val.s) != 0)
                    return -1;
                break;
            default:
                if (hts_set_opt(fp,  opts->opt,  opts->val.i) != 0)
                    return -1;
                break;
        }
    }

    return 0;
}

// Assembly:
testq %rsi, %rsi
je 0x14367
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rbx), %ebp
cmpl $0x68, %ebp
jg 0x14322
cmpl $0x1, %ebp
je 0x14337
cmpl $0x6, %ebp
je 0x14337
cmpl $0x9, %ebp
jne 0x14356
movq 0x10(%rbx), %rdi
callq 0x4930
movq %rax, 0x30(%r14)
testq %rax, %rax
jne 0x14337
jmp 0x1436a
cmpl $0x69, %ebp
je 0x14337
cmpl $0x3e9, %ebp            # imm = 0x3E9
je 0x14337
cmpl $0x3eb, %ebp            # imm = 0x3EB
jne 0x14356
movq 0x10(%rbx), %rdx
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x14e0e
testl %eax, %eax
jne 0x1436a
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
jne 0x142f7
jmp 0x14371
movl 0x10(%rbx), %edx
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x14e0e
jmp 0x14347
xorl %eax, %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x14373
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_log
void hts_log(enum htsLogLevel severity, const char *context, const char *format, ...)
{
    int save_errno = errno;
    if (severity <= hts_verbose) {
        va_list argptr;

        fprintf(stderr, "[%c::%s] ", get_severity_tag(severity), context);

        va_start(argptr, format);
        vfprintf(stderr, format, argptr);
        va_end(argptr);

        fprintf(stderr, "\n");
    }
    errno = save_errno;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x143db
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
callq 0x4050
movq %rax, %rbx
movl (%rax), %r12d
cmpl %ebp, 0xa5394(%rip)     # 0xb9780
jae 0x14403
movl %r12d, (%rbx)
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa4bce(%rip), %r13     # 0xb8fd8
movq (%r13), %rdi
decl %ebp
movl $0x2a, %edx
cmpl $0x5, %ebp
ja 0x14426
movl %ebp, %eax
leaq 0x84779(%rip), %rcx     # 0x98b9c
movl (%rcx,%rax,4), %edx
leaq 0x8554f(%rip), %rsi     # 0x9997c
movq %r15, %rcx
xorl %eax, %eax
callq 0x4700
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rsp, %rdx
movq %rax, (%rdx)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rdx)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rdx)
movq (%r13), %rdi
movq %r14, %rsi
callq 0x4690
movq (%r13), %rsi
movl $0xa, %edi
callq 0x4630
jmp 0x143ee
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_opt_free
void hts_opt_free(hts_opt *opts) {
    hts_opt *last = NULL;
    while (opts) {
        opts = (last=opts)->next;
        free(last->arg);
        free(last);
    }
}

// Assembly:
testq %rdi, %rdi
je 0x15428
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rbx), %rdi
movq 0x18(%rbx), %r14
callq 0x45c0
movq %rbx, %rdi
callq 0x45c0
movq %r14, %rbx
testq %r14, %r14
jne 0x15405
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_parse_opt_list
int hts_parse_opt_list(htsFormat *fmt, const char *str) {
    while (str && *str) {
        const char *str_start;
        int len;
        char arg[8001];

        while (*str && *str == ',')
            str++;

        for (str_start = str; *str && *str != ','; str++);
        len = str - str_start;

        // Produce a nul terminated copy of the option
        strncpy(arg, str_start, len < 8000 ? len : 8000);
        arg[len < 8000 ? len : 8000] = '\0';

        if (hts_opt_add((hts_opt **)&fmt->specific, arg) != 0)
            return -1;

        if (*str)
            str++;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1f50, %rsp           # imm = 0x1F50
movq %rsi, %r15
movq %rdi, %rbx
addq $0x18, %rbx
movl $0x1f40, %ebp           # imm = 0x1F40
movq %rsp, %r14
xorl %eax, %eax
testq %r15, %r15
je 0x154b8
cmpb $0x0, (%r15)
je 0x154b8
decq %r15
movq %r15, %rsi
cmpb $0x2c, 0x1(%rsi)
leaq 0x1(%rsi), %rsi
je 0x1545d
xorl %eax, %eax
movq %rsi, %r15
movzbl (%r15), %ecx
testl %ecx, %ecx
je 0x15480
cmpl $0x2c, %ecx
je 0x15480
incq %r15
incl %eax
jmp 0x1546c
cmpl %ebp, %eax
cmovgel %ebp, %eax
movslq %eax, %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x4250
movb $0x0, (%rsp,%r12)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14482
testl %eax, %eax
jne 0x154af
cmpb $0x1, (%r15)
sbbq $-0x1, %r15
testl %eax, %eax
je 0x1544a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x1f50, %rsp           # imm = 0x1F50
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_idx_destroy
void hts_idx_destroy(hts_idx_t *idx)
{
    khint_t k;
    int i;
    if (idx == 0) return;

    // For HTS_FMT_CRAI, idx actually points to a different type -- see sam.c
    if (idx->fmt == HTS_FMT_CRAI) {
        hts_cram_idx_t *cidx = (hts_cram_idx_t *) idx;
        cram_index_free(cidx->cram);
        free(cidx);
        return;
    }

    for (i = 0; i < idx->m; ++i) {
        bidx_t *bidx = idx->bidx[i];
        free(idx->lidx[i].offset);
        if (bidx == 0) continue;
        for (k = kh_begin(bidx); k != kh_end(bidx); ++k)
            if (kh_exist(bidx, k))
                free(kh_value(bidx, k).list);
        kh_destroy(bin, bidx);
    }
    free(idx->bidx); free(idx->lidx); free(idx->meta);
    free(idx);
}

// Assembly:
testq %rdi, %rdi
je 0x15881
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpl $0x3, (%rdi)
jne 0x15882
movq 0x8(%rbx), %rdi
callq 0x4c574
jmp 0x1593f
retq
cmpl $0x0, 0x18(%rbx)
jle 0x15924
xorl %r15d, %r15d
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rcx
movq (%rax,%r15,8), %r14
leaq (%r15,%r15,2), %rax
movq 0x10(%rcx,%rax,8), %rdi
callq 0x45c0
testq %r14, %r14
je 0x15914
cmpl $0x0, (%r14)
je 0x158f1
xorl %ebp, %ebp
xorl %r12d, %r12d
movq 0x10(%r14), %rax
movl %r12d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %ebp, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0x158e6
movq 0x20(%r14), %rax
movl %r12d, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rax,%rcx,8), %rdi
callq 0x45c0
incl %r12d
addl $0x2, %ebp
cmpl (%r14), %r12d
jne 0x158b9
movq 0x18(%r14), %rdi
callq 0x45c0
movq 0x10(%r14), %rdi
callq 0x45c0
movq 0x20(%r14), %rdi
callq 0x45c0
movq %r14, %rdi
callq 0x45c0
incq %r15
movslq 0x18(%rbx), %rax
cmpq %rax, %r15
jl 0x1588f
movq 0x28(%rbx), %rdi
callq 0x45c0
movq 0x30(%rbx), %rdi
callq 0x45c0
movq 0x38(%rbx), %rdi
callq 0x45c0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x45c0
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_set_threads
int hts_set_threads(htsFile *fp, int n)
{
    if (fp->format.format == sam) {
        return sam_set_threads(fp, n);
    } else if (fp->format.compression == bgzf) {
        return bgzf_mt(hts_get_bgzfp(fp), n, 256/*unused*/);
    } else if (fp->format.format == cram) {
        return hts_set_opt(fp, CRAM_OPT_NTHREADS, n);
    }
    else return 0;
}

// Assembly:
movl %esi, %edx
movl 0x4c(%rdi), %eax
cmpl $0x3, %eax
jne 0x159e2
movl %edx, %esi
jmp 0x29f3a
cmpl $0x2, 0x54(%rdi)
jne 0x159f1
testb $0x10, (%rdi)
jne 0x15a02
xorl %edi, %edi
jmp 0x15a06
cmpl $0x6, %eax
jne 0x15a12
movl $0xe, %esi
xorl %eax, %eax
jmp 0x14e0e
movq 0x38(%rdi), %rdi
movl %edx, %esi
movl $0x100, %edx            # imm = 0x100
jmp 0xcbc9
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_set_thread_pool
int hts_set_thread_pool(htsFile *fp, htsThreadPool *p) {
    if (fp->format.format == sam || fp->format.format == text_format) {
        return sam_set_thread_pool(fp, p);
    } else if (fp->format.compression == bgzf) {
        return bgzf_thread_pool(hts_get_bgzfp(fp), p->pool, p->qsize);
    } else if (fp->format.format == cram) {
        return hts_set_opt(fp, CRAM_OPT_THREAD_POOL, p);
    }
    else return 0;
}

// Assembly:
movq %rsi, %rdx
movl 0x4c(%rdi), %eax
movl %eax, %ecx
andl $-0x2, %ecx
cmpl $0x2, %ecx
jne 0x15a2d
movq %rdx, %rsi
jmp 0x29e50
cmpl $0x2, 0x54(%rdi)
jne 0x15a3c
testb $0x10, (%rdi)
jne 0x15a4d
xorl %edi, %edi
jmp 0x15a51
cmpl $0x6, %eax
jne 0x15a5c
movl $0xf, %esi
xorl %eax, %eax
jmp 0x14e0e
movq 0x38(%rdi), %rdi
movq (%rdx), %rsi
movl 0x8(%rdx), %edx
jmp 0xc338
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_set_filter_expression
int hts_set_filter_expression(htsFile *fp, const char *expr)
{
    if (fp->filter)
        hts_filter_free(fp->filter);

    if (!expr)
        return 0;

    return (fp->filter = hts_filter_init(expr))
        ? 0 : -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x80(%rdi), %rdi
testq %rdi, %rdi
je 0x15a96
callq 0x1d13d
testq %r14, %r14
je 0x15ab7
movq %r14, %rdi
callq 0x1d0e4
movq %rax, %rcx
movq %rax, 0x80(%rbx)
xorl %eax, %eax
cmpq $0x1, %rcx
sbbl %eax, %eax
jmp 0x15ab9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_set_fai_filename
int hts_set_fai_filename(htsFile *fp, const char *fn_aux)
{
    free(fp->fn_aux);
    if (fn_aux) {
        fp->fn_aux = strdup(fn_aux);
        if (fp->fn_aux == NULL) return -1;
    }
    else fp->fn_aux = NULL;

    if (fp->format.format == cram)
        if (cram_set_option(fp->fp.cram, CRAM_OPT_REFERENCE, fp->fn_aux))
            return -1;

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
callq 0x45c0
testq %r14, %r14
je 0x15afe
movq %r14, %rdi
callq 0x4930
movq %rax, 0x30(%rbx)
testq %rax, %rax
jne 0x15b06
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x15b2d
movq $0x0, 0x30(%rbx)
cmpl $0x6, 0x4c(%rbx)
jne 0x15b2b
movq 0x30(%rbx), %rdx
movq 0x38(%rbx), %rdi
movl $0x9, %esi
xorl %eax, %eax
callq 0x55e0e
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x15b2d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_open_tmpfile
hFILE *hts_open_tmpfile(const char *fname, const char *mode, kstring_t *tmpname)
{
    int pid = (int) getpid();
    unsigned ptr = (uintptr_t) tmpname;
    int n = 0;
    hFILE *fp = NULL;

    do {
        // Attempt to further uniquify the temporary filename
        unsigned t = ((unsigned) time(NULL)) ^ ((unsigned) clock()) ^ ptr;
        n++;

        ks_clear(tmpname);
        if (ksprintf(tmpname, "%s.tmp_%d_%d_%u", fname, pid, n, t) < 0) break;

        fp = hopen(tmpname->s, mode);
    } while (fp == NULL && errno == EEXIST && n < 100);

    return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
callq 0x4740
movl %eax, %ebp
xorl %r15d, %r15d
xorl %edi, %edi
callq 0x4450
movq %rax, %r14
callq 0x4310
xorl %ebx, %eax
xorl %eax, %r14d
leal 0x1(%r15), %r13d
movq $0x0, (%rbx)
movq %rbx, %rdi
leaq 0x8370b(%rip), %rsi     # 0x9928e
movq 0x10(%rsp), %rdx
movl %ebp, %ecx
movl %r13d, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x9aab
movl %eax, %r14d
movl $0x0, %r12d
testl %eax, %eax
js 0x15bb7
movq 0x10(%rbx), %rdi
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x10014
movq %rax, %r12
testl %r14d, %r14d
js 0x15bd4
testq %r12, %r12
jne 0x15bd4
callq 0x4050
cmpl $0x62, %r15d
ja 0x15bd4
cmpl $0x11, (%rax)
movl %r13d, %r15d
je 0x15b5a
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_getline
int hts_getline(htsFile *fp, int delimiter, kstring_t *str)
{
    int ret;
    if (! (delimiter == KS_SEP_LINE || delimiter == '\n')) {
        hts_log_error("Unexpected delimiter %d", delimiter);
        abort();
    }

    switch (fp->format.compression) {
    case no_compression:
        str->l = 0;
        ret = kgetline2(str, (kgets_func2 *) hgetln, fp->fp.hfile);
        if (ret >= 0) ret = (str->l <= INT_MAX)? (int) str->l : INT_MAX;
        else if (herrno(fp->fp.hfile)) ret = -2, errno = herrno(fp->fp.hfile);
        else ret = -1;
        break;

    case gzip:
    case bgzf:
        ret = bgzf_getline(fp->fp.bgzf, '\n', str);
        break;

    default:
        abort();
    }

    ++fp->lineno;
    return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %eax
andl $-0x9, %eax
cmpl $0x2, %eax
jne 0x15d58
movq %rdx, %r14
movq %rdi, %rbx
movl 0x54(%rdi), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jae 0x15cfb
movq 0x38(%rbx), %rdi
movl $0xa, %esi
movq %r14, %rdx
callq 0xdc2d
jmp 0x15d4f
testl %eax, %eax
jne 0x15d74
movq $0x0, (%r14)
movq 0x38(%rbx), %rdx
leaq 0x68(%rip), %rsi        # 0x15d79
movq %r14, %rdi
callq 0x9f63
testl %eax, %eax
js 0x15d31
movq (%r14), %rcx
testq $-0x80000000, %rcx      # imm = 0x80000000
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmovel %ecx, %eax
jmp 0x15d4f
movq 0x38(%rbx), %rax
movl 0x34(%rax), %ebp
testl %ebp, %ebp
je 0x15d4a
callq 0x4050
movl %ebp, (%rax)
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x15d4f
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
incq 0x8(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movl %esi, %ecx
leaq 0x8353d(%rip), %rsi     # 0x9929e
leaq 0x83542(%rip), %rdx     # 0x992aa
movl $0x1, %edi
xorl %eax, %eax
callq 0x14378
callq 0x4270
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_file_type
int hts_file_type(const char *fname)
{
    int len = strlen(fname);
    if ( !strcasecmp(".vcf.gz",fname+len-7) ) return FT_VCF_GZ;
    if ( !strcasecmp(".vcf",fname+len-4) ) return FT_VCF;
    if ( !strcasecmp(".bcf",fname+len-4) ) return FT_BCF_GZ;
    if ( !strcmp("-",fname) ) return FT_STDIN;

    hFILE *f = hopen(fname, "r");
    if (f == NULL) return 0;

    htsFormat fmt;
    if (hts_detect_format2(f, fname, &fmt) < 0) { hclose_abruptly(f); return 0; }
    if (hclose(f) < 0) return 0;

    switch (fmt.format) {
    case vcf: return (fmt.compression == no_compression)? FT_VCF : FT_VCF_GZ;
    case bcf: return (fmt.compression == no_compression)? FT_BCF : FT_BCF_GZ;
    default:  return 0;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
callq 0x41d0
movslq %eax, %r14
leaq (%rbx,%r14), %rsi
addq $-0x7, %rsi
leaq 0x82f2f(%rip), %rdi     # 0x9936c
callq 0x4520
testl %eax, %eax
je 0x164e3
addq %rbx, %r14
addq $-0x4, %r14
leaq 0x82f1c(%rip), %rdi     # 0x99374
movq %r14, %rsi
callq 0x4520
testl %eax, %eax
je 0x164ea
leaq 0x82f0a(%rip), %rdi     # 0x99379
movq %r14, %rsi
callq 0x4520
testl %eax, %eax
je 0x164f1
leaq 0x84a42(%rip), %rdi     # 0x9aec4
movq %rbx, %rsi
callq 0x46c0
testl %eax, %eax
je 0x164f8
leaq 0x8512f(%rip), %rsi     # 0x9b5c4
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10014
testq %rax, %rax
je 0x16515
movq %rax, %r14
movq %rsp, %rdx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x11915
movq %r14, %rdi
testl %eax, %eax
js 0x164ff
callq 0xf6d0
xorl %ebp, %ebp
testl %eax, %eax
js 0x16515
movl 0x4(%rsp), %eax
cmpl $0x9, %eax
je 0x16508
cmpl $0x8, %eax
jne 0x16515
cmpl $0x1, 0xc(%rsp)
movl $0x3, %ebp
jmp 0x16512
movl $0x3, %ebp
jmp 0x16515
movl $0x2, %ebp
jmp 0x16515
movl $0x5, %ebp
jmp 0x16515
movl $0x8, %ebp
jmp 0x16515
callq 0xf730
xorl %ebp, %ebp
jmp 0x16515
cmpl $0x1, 0xc(%rsp)
movl $0x5, %ebp
sbbl $0x0, %ebp
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_check_EOF
int hts_check_EOF(htsFile *fp)
{
    if (fp->format.compression == bgzf)
        return bgzf_check_EOF(hts_get_bgzfp(fp));
    else if (fp->format.format == cram)
        return cram_check_EOF(fp->fp.cram);
    else
        return 3;
}

// Assembly:
cmpl $0x2, 0x54(%rdi)
jne 0x16532
testb $0x10, (%rdi)
jne 0x16541
xorl %edi, %edi
jmp 0xd79a
cmpl $0x6, 0x4c(%rdi)
jne 0x1654a
movq 0x38(%rdi), %rdi
jmp 0x5690b
movq 0x38(%rdi), %rdi
jmp 0xd79a
movl $0x3, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_idx_init
hts_idx_t *hts_idx_init(int n, int fmt, uint64_t offset0, int min_shift, int n_lvls)
{
    hts_idx_t *idx;
    idx = (hts_idx_t*)calloc(1, sizeof(hts_idx_t));
    if (idx == NULL) return NULL;
    idx->fmt = fmt;
    idx->min_shift = min_shift;
    idx->n_lvls = n_lvls;
    idx->n_bins = ((1<<(3 * n_lvls + 3)) - 1) / 7;
    idx->z.save_tid = idx->z.last_tid = -1;
    idx->z.save_bin = idx->z.last_bin = 0xffffffffu;
    idx->z.save_off = idx->z.last_off = idx->z.off_beg = idx->z.off_end = offset0;
    idx->z.last_coor = 0xffffffffu;
    if (n) {
        idx->n = idx->m = n;
        idx->bidx = (bidx_t**)calloc(n, sizeof(bidx_t*));
        if (idx->bidx == NULL) { free(idx); return NULL; }
        idx->lidx = (lidx_t*) calloc(n, sizeof(lidx_t));
        if (idx->lidx == NULL) { free(idx->bidx); free(idx); return NULL; }
    }
    idx->tbi_n = -1;
    idx->last_tbi_tid = -1;
    idx->otf_fp = NULL;
    return idx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r15d
movl %ecx, %r12d
movq %rdx, %r14
movl %esi, %r13d
movl %edi, %ebp
movl $0x1, %edi
movl $0xa0, %esi
callq 0x4300
testq %rax, %rax
je 0x1663b
movq %rax, %rbx
movl %r13d, (%rax)
movl %r12d, 0x4(%rax)
leal (%r15,%r15,2), %ecx
addb $0x3, %cl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
movl %r15d, 0x8(%rbx)
notl %eax
movl $0x92492493, %ecx       # imm = 0x92492493
imulq %rax, %rcx
shrq $0x22, %rcx
movl %ecx, 0xc(%rbx)
movq $-0x1, %rax
movq %rax, 0x58(%rbx)
movq %rax, 0x48(%rbx)
movq %r14, 0x80(%rbx)
movq %r14, 0x78(%rbx)
movq %r14, 0x68(%rbx)
movq %r14, 0x70(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x50(%rbx)
testl %ebp, %ebp
je 0x16616
movl %ebp, 0x18(%rbx)
movl %ebp, 0x14(%rbx)
movslq %ebp, %r15
movl $0x8, %esi
movq %r15, %rdi
callq 0x4300
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x16633
movq %rax, %r14
movl $0x18, %esi
movq %r15, %rdi
callq 0x4300
movq %rax, 0x30(%rbx)
testq %rax, %rax
je 0x1662b
movq $-0x1, 0x40(%rbx)
movq $0x0, 0x98(%rbx)
jmp 0x1663d
movq %r14, %rdi
callq 0x45c0
movq %rbx, %rdi
callq 0x45c0
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_O1/samtools[P]htslib/hts.c
// Function: insert_to_b
static inline int insert_to_b(bidx_t *b, int bin, uint64_t beg, uint64_t end)
{
    khint_t k;
    bins_t *l;
    int absent;
    k = kh_put(bin, b, bin, &absent);
    if (absent < 0) return -1; // Out of memory
    l = &kh_value(b, k);
    if (absent) {
        l->m = 1; l->n = 0;
        l->list = (hts_pair64_t*)calloc(l->m, sizeof(hts_pair64_t));
        if (!l->list) {
            kh_del(bin, b, k);
            return -1;
        }
    } else if (l->n == l->m) {
        uint32_t new_m = l->m ? l->m << 1 : 1;
        hts_pair64_t *new_list = realloc(l->list, new_m * sizeof(hts_pair64_t));
        if (!new_list) return -1;
        l->list = new_list;
        l->m = new_m;
    }
    l->list[l->n].u = beg;
    l->list[l->n++].v = end;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %r12
leaq 0x4(%rsp), %rbx
movq %rbx, %rdx
callq 0x1c58e
movl %eax, %ebp
movl (%rbx), %eax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
js 0x16cfb
movl %ebp, %ecx
leaq (%rcx,%rcx,2), %r13
shlq $0x3, %r13
addq 0x20(%r12), %r13
testl %eax, %eax
je 0x16ca7
movq $0x1, (%r13)
movl $0x1, %edi
movl $0x10, %esi
callq 0x4300
movq %rax, 0x10(%r13)
testq %rax, %rax
jne 0x16cdd
cmpl %ebp, (%r12)
je 0x16cfb
movq 0x10(%r12), %rax
movl %ebp, %edx
shrl $0x4, %edx
movl (%rax,%rdx,4), %esi
addl %ebp, %ebp
andl $0x1e, %ebp
movl %esi, %edi
movl %ebp, %ecx
shrl %cl, %edi
testb $0x3, %dil
jne 0x16cfb
btsl %ebp, %esi
movl %esi, (%rax,%rdx,4)
decl 0x4(%r12)
jmp 0x16cfb
movl (%r13), %eax
cmpl %eax, 0x4(%r13)
jne 0x16cdd
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x1, %r12d
cmovnel %ecx, %r12d
movq 0x10(%r13), %rdi
movq %r12, %rsi
shlq $0x4, %rsi
callq 0x4840
testq %rax, %rax
je 0x16cfb
movq %rax, 0x10(%r13)
movl %r12d, (%r13)
movq 0x10(%r13), %rax
movslq 0x4(%r13), %rcx
leal 0x1(%rcx), %edx
shlq $0x4, %rcx
movq %r15, (%rax,%rcx)
movl %edx, 0x4(%r13)
movq %r14, 0x8(%rax,%rcx)
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_O1/samtools[P]htslib/hts.c
// Function: update_loff
static void update_loff(hts_idx_t *idx, int i, int free_lidx)
{
    bidx_t *bidx = idx->bidx[i];
    lidx_t *lidx = &idx->lidx[i];
    khint_t k;
    int l;
    // the last entry is always valid
    for (l=lidx->n-2; l >= 0; l--) {
        if (lidx->offset[l] == (uint64_t)-1)
            lidx->offset[l] = lidx->offset[l+1];
    }
    if (bidx == 0) return;
    for (k = kh_begin(bidx); k != kh_end(bidx); ++k) // set loff
        if (kh_exist(bidx, k))
        {
            if ( kh_key(bidx, k) < idx->n_bins )
            {
                int bot_bin = hts_bin_bot(kh_key(bidx, k), idx->n_lvls);
                // disable linear index if bot_bin out of bounds
                kh_val(bidx, k).loff = bot_bin < lidx->n ? lidx->offset[bot_bin] : 0;
            }
            else
                kh_val(bidx, k).loff = 0;
        }
    if (free_lidx) {
        free(lidx->offset);
        lidx->m = lidx->n = 0;
        lidx->offset = 0;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq %esi, %rcx
movq 0x28(%rdi), %rax
movq 0x30(%rdi), %rsi
movq (%rax,%rcx,8), %rax
leaq (%rcx,%rcx,2), %rcx
leaq (%rsi,%rcx,8), %rbx
movl (%rbx), %esi
addl $-0x2, %esi
js 0x16d50
movq 0x10(%rbx), %rcx
movl %esi, %esi
incq %rsi
cmpq $-0x1, -0x8(%rcx,%rsi,8)
jne 0x16d4b
movq (%rcx,%rsi,8), %r8
movq %r8, -0x8(%rcx,%rsi,8)
decq %rsi
jg 0x16d3a
testq %rax, %rax
je 0x16e21
movl (%rax), %esi
testq %rsi, %rsi
je 0x16e06
movq 0x10(%rax), %r8
xorl %r9d, %r9d
movl $0x92492493, %r10d      # imm = 0x92492493
movl %r9d, %ecx
shrl $0x4, %ecx
movl (%r8,%rcx,4), %r11d
leal (%r9,%r9), %ecx
shrl %cl, %r11d
testb $0x3, %r11b
jne 0x16dfa
movq 0x18(%rax), %rcx
movl (%rcx,%r9,4), %r11d
cmpl 0xc(%rdi), %r11d
jae 0x16deb
xorl %r14d, %r14d
testl %r11d, %r11d
je 0x16db2
movl %r11d, %ecx
incl %r14d
decl %ecx
movl %ecx, %ebp
sarl $0x3, %ebp
cmpl $0x7, %ecx
movl %ebp, %ecx
ja 0x16da1
leal (%r14,%r14,2), %ecx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
shll %cl, %r15d
movl 0x8(%rdi), %ecx
notl %r15d
imulq %r10, %r15
shrq $0x22, %r15
subl %r15d, %r11d
subl %r14d, %ecx
leal (%rcx,%rcx,2), %ecx
shll %cl, %r11d
movslq %r11d, %rcx
cmpq %rcx, (%rbx)
jle 0x16deb
movq 0x10(%rbx), %r11
movq (%r11,%rcx,8), %rcx
jmp 0x16ded
xorl %ecx, %ecx
movq 0x20(%rax), %r11
leaq (%r9,%r9,2), %r14
movq %rcx, 0x8(%r11,%r14,8)
incq %r9
cmpq %rsi, %r9
jne 0x16d71
testl %edx, %edx
je 0x16e21
movq 0x10(%rbx), %rdi
callq 0x45c0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_idx_check_range
int hts_idx_check_range(hts_idx_t *idx, int tid, hts_pos_t beg, hts_pos_t end)
{
    hts_pos_t maxpos = hts_idx_maxpos(idx);
    if (tid < 0 || (beg <= maxpos && end <= maxpos))
        return 0;

    if (idx->fmt == HTS_FMT_CSI) {
        hts_log_error("Region %"PRIhts_pos"..%"PRIhts_pos" "
                      "cannot be stored in a csi index with these parameters. "
                      "Please use a larger min_shift or depth",
                      beg, end);
    } else {
        hts_log_error("Region %"PRIhts_pos"..%"PRIhts_pos
                      " cannot be stored in a %s index. Try using a csi index",
                      beg, end, idx_format_name(idx->fmt));
    }
    errno = ERANGE;
    return -1;
}

// Assembly:
xorl %eax, %eax
testl %esi, %esi
js 0x16eec
movq %rcx, %r8
movq %rdx, %r10
movl 0x8(%rdi), %ecx
leal (%rcx,%rcx,2), %ecx
addl 0x4(%rdi), %ecx
movl $0x1, %edx
shlq %cl, %rdx
cmpq %r10, %rdx
setge %cl
cmpq %r8, %rdx
setge %dl
testb %dl, %cl
jne 0x16eec
pushq %rax
movl (%rdi), %eax
cmpq $0x3, %rax
ja 0x16eb4
leaq 0x819af(%rip), %rcx     # 0x98820
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x824fd(%rip), %rsi     # 0x9937e
leaq 0x8250a(%rip), %rdx     # 0x99392
movl $0x1, %edi
movq %r10, %rcx
xorl %eax, %eax
callq 0x14378
jmp 0x16ed8
leaq 0x82680(%rip), %r9      # 0x99520
jmp 0x16ebb
leaq 0x82a05(%rip), %r9      # 0x998ae
jmp 0x16ebb
leaq 0x82664(%rip), %r9      # 0x99516
jmp 0x16ebb
leaq 0x81349(%rip), %r9      # 0x98204
leaq 0x824bc(%rip), %rsi     # 0x9937e
leaq 0x82537(%rip), %rdx     # 0x99400
movl $0x1, %edi
movq %r10, %rcx
xorl %eax, %eax
callq 0x14378
callq 0x4050
movl $0x22, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts.c
// Function: hts_idx_tbi_name
int hts_idx_tbi_name(hts_idx_t *idx, int tid, const char *name) {
    // Horrid - we have to map incoming tid to a tbi alternative tid.
    // This is because TBI counts tids by "covered" refs while everything
    // else counts by Nth SQ/contig record in header.
    if (tid == idx->last_tbi_tid || tid < 0 || !name)
        return idx->tbi_n;

    uint32_t len = strlen(name)+1;
    uint8_t *tmp = (uint8_t *)realloc(idx->meta, idx->l_meta + len);
    if (!tmp)
        return -1;

    // Append name
    idx->meta = tmp;
    strcpy((char *)idx->meta + idx->l_meta, name);
    idx->l_meta += len;

    // Update seq length
    u32_to_le(le_to_u32(idx->meta+24)+len, idx->meta+24);

    idx->last_tbi_tid = tid;
    return ++idx->tbi_n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rdx, %rdx
je 0x173ca
movl %esi, %ebp
testl %esi, %esi
js 0x173ca
cmpl %ebp, 0x44(%rbx)
je 0x173ca
movq %rdx, %r14
movq %rdx, %rdi
callq 0x41d0
movq %rax, %r15
incl %r15d
movq 0x38(%rbx), %rdi
movl 0x10(%rbx), %esi
addl %r15d, %esi
callq 0x4840
testq %rax, %rax
je 0x173cf
movq %rax, %r12
movq %rax, 0x38(%rbx)
movl 0x10(%rbx), %r13d
movq %rax, %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0x4460
leal (%r15,%r13), %eax
movl %eax, 0x10(%rbx)
addl %r15d, 0x18(%r12)
movl %ebp, 0x44(%rbx)
movl 0x40(%rbx), %eax
incl %eax
movl %eax, 0x40(%rbx)
jmp 0x173d4
movl 0x40(%rbx), %eax
jmp 0x173d4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq