// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/hts.c
// Function: hts_readlines
char **hts_readlines(const char *fn, int *_n)
{
    unsigned int m = 0, n = 0;
    char **s = 0, **s_new;
    BGZF *fp = bgzf_open(fn, "r");
    if ( fp ) { // read from file
        kstring_t str;
        int ret;
        str.s = 0; str.l = str.m = 0;
        while ((ret = bgzf_getline(fp, '\n', &str)) >= 0) {
            if (str.l == 0) continue;
            if (n == 0 && hts_is_utf16_text(&str))
                hts_log_warning("'%s' appears to be encoded as UTF-16", fn);
            if (hts_resize(char *, n + 1, &m, &s, 0) < 0)
                goto err;
            s[n] = strdup(str.s);
            if (!s[n])
                goto err;
            n++;
        }
        if (ret < -1) // Read error
            goto err;
        bgzf_close(fp);
        free(str.s);
    } else if (*fn == ':') { // read from string
        const char *q, *p;
        for (q = p = fn + 1;; ++p)
            if (*p == ',' || *p == 0) {
                if (hts_resize(char *, n + 1, &m, &s, 0) < 0)
                    goto err;
                s[n] = (char*)calloc(p - q + 1, 1);
                if (!s[n])
                    goto err;
                strncpy(s[n++], q, p - q);
                q = p + 1;
                if (*p == 0) break;
            }
    } else return 0;
    // Try to shrink s to the minimum size needed
    s_new = (char**)realloc(s, n * sizeof(char*));
    if (!s_new)
        goto err;

    s = s_new;
    assert(n < INT_MAX); // hts_resize() should ensure this
    *_n = n;
    return s;

 err:
    for (m = 0; m < n; m++)
        free(s[m]);
    free(s);
    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x0, 0x14(%rsp)
movq $0x0, 0x18(%rsp)
leaq 0x829a7(%rip), %rsi     # 0x985cb
callq 0xa550
testq %rax, %rax
je 0x15d58
movq %rax, %r12
movq %rbx, 0x20(%rsp)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
movq $0x0, 0x10(%r13)
xorl %ebx, %ebx
xorl %ebp, %ebp
movl %ebp, %r15d
movq %r12, %rdi
movl $0xa, %esi
movq %r13, %rdx
callq 0xdb70
testl %eax, %eax
js 0x15d03
cmpq $0x0, 0x30(%rsp)
je 0x15c56
testl %r15d, %r15d
jne 0x15ca4
movq %r13, %rdi
callq 0x1564f
testl %eax, %eax
je 0x15ca4
movl $0x3, %edi
leaq 0x80741(%rip), %rsi     # 0x963d4
leaq 0x806d5(%rip), %rdx     # 0x9636f
movq %r14, %rcx
xorl %eax, %eax
callq 0x13de5
leal 0x1(%r15), %ebp
cmpl 0x14(%rsp), %ebp
jbe 0x15ce4
movl %ebp, %esi
leaq 0x8071d(%rip), %rax     # 0x963d4
movq %rax, (%rsp)
movl $0x8, %edi
movl $0x4, %edx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
xorl %r9d, %r9d
callq 0x15a69
testl %eax, %eax
js 0x15e29
movq 0x18(%rsp), %rbx
movq 0x40(%rsp), %rdi
callq 0x4930
movl %r15d, %ecx
movq %rax, (%rbx,%rcx,8)
testq %rax, %rax
jne 0x15c53
jmp 0x15e29
cmpl $-0x1, %eax
jne 0x15e29
movq %r12, %rdi
callq 0xd3cd
movq 0x40(%rsp), %rdi
callq 0x45c0
movl %r15d, %r13d
movq 0x18(%rsp), %rdi
movl %r13d, %esi
shlq $0x3, %rsi
callq 0x4840
testq %rax, %rax
je 0x15e26
cmpl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
jae 0x15e67
movq %rax, %r15
movq 0x20(%rsp), %rax
movl %r13d, (%rax)
jmp 0x15e55
xorl %r15d, %r15d
cmpb $0x3a, (%r14)
jne 0x15e55
movq %rbx, 0x20(%rsp)
leaq 0x1(%r14), %r12
addq $0x2, %r14
movq $0x0, 0x28(%rsp)
movq %r12, %rbp
movzbl -0x1(%r14), %eax
cmpl $0x2c, %eax
je 0x15d90
testl %eax, %eax
jne 0x15e15
leal 0x1(%r15), %r13d
cmpl 0x14(%rsp), %r13d
jbe 0x15dd3
movl %r13d, %esi
leaq 0x8062f(%rip), %rax     # 0x963d4
movq %rax, (%rsp)
movl $0x8, %edi
movl $0x4, %edx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
xorl %r9d, %r9d
callq 0x15a69
testl %eax, %eax
js 0x15e29
movq 0x18(%rsp), %rax
movq %rax, 0x28(%rsp)
movq %r12, %rbx
subq %rbp, %rbx
leaq 0x1(%rbx), %rdi
movl $0x1, %esi
callq 0x4300
movl %r15d, %ecx
movq 0x28(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
testq %rax, %rax
je 0x15e29
movq %rax, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x4250
cmpb $0x0, -0x1(%r14)
movq %r14, %rbp
jne 0x15e18
jmp 0x15d21
movl %r15d, %r13d
incq %r14
incq %r12
movl %r13d, %r15d
jmp 0x15d7e
movl %r13d, %r15d
movq 0x18(%rsp), %rbx
testl %r15d, %r15d
je 0x15e4a
movl %r15d, %r14d
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rdi
callq 0x45c0
incq %r15
cmpq %r15, %r14
jne 0x15e39
movq %rbx, %rdi
callq 0x45c0
xorl %r15d, %r15d
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x80526(%rip), %rdi     # 0x96394
leaq 0x8052b(%rip), %rsi     # 0x963a0
leaq 0x80566(%rip), %rcx     # 0x963e2
movl $0x86d, %edx            # imm = 0x86D
callq 0x42f0