// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rsi, 0x18(%rsp)
movq %rdi, %r14
movl $0x0, 0xc(%rsp)
movq $0x0, 0x10(%rsp)
leaq 0x853e1(%rip), %rsi     # 0x9b5c4
callq 0xa4a5
testq %rax, %rax
je 0x162d4
movq %rax, %r15
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r12
movaps %xmm0, (%r12)
movq $0x0, 0x10(%r12)
leaq 0x83123(%rip), %r13     # 0x99334
xorl %ebx, %ebx
movl %ebx, %ebp
movq %r15, %rdi
movl $0xa, %esi
movq %r12, %rdx
callq 0xdc2d
testl %eax, %eax
js 0x162b4
cmpq $0x0, 0x20(%rsp)
je 0x16215
testl %ebp, %ebp
jne 0x1625e
movq %r12, %rdi
callq 0x15be6
testl %eax, %eax
je 0x1625e
movl $0x3, %edi
movq %r13, %rsi
leaq 0x8307b(%rip), %rdx     # 0x992cf
movq %r14, %rcx
xorl %eax, %eax
callq 0x14378
leal 0x1(%rbp), %ebx
cmpl 0xc(%rsp), %ebx
jbe 0x16291
movl %ebx, %esi
movq %r13, (%rsp)
movl $0x8, %edi
movl $0x4, %edx
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
xorl %r9d, %r9d
callq 0x16026
testl %eax, %eax
js 0x163ba
movq 0x30(%rsp), %rdi
callq 0x4930
movq 0x10(%rsp), %rcx
movl %ebp, %edx
movq %rax, (%rcx,%rdx,8)
testq %rax, %rax
jne 0x16213
jmp 0x163ba
cmpl $-0x1, %eax
jne 0x163ba
movq %r15, %rdi
callq 0xd4a4
movq 0x30(%rsp), %rdi
callq 0x45c0
jmp 0x1638f
xorl %ebp, %ebp
cmpb $0x3a, (%r14)
jne 0x163eb
leaq 0x1(%r14), %rbx
addq $0x2, %r14
movq %rbx, %r15
movzbl -0x1(%r14), %eax
cmpl $0x2c, %eax
je 0x162f9
testl %eax, %eax
jne 0x16374
leal 0x1(%rbp), %r12d
cmpl 0xc(%rsp), %r12d
jbe 0x16335
movl %r12d, %esi
leaq 0x83026(%rip), %rax     # 0x99334
movq %rax, (%rsp)
xorl %r13d, %r13d
movl $0x8, %edi
movl $0x4, %edx
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
xorl %r9d, %r9d
callq 0x16026
testl %eax, %eax
js 0x1638a
movq %rbx, %r13
subq %r15, %r13
leaq 0x1(%r13), %rdi
movl $0x1, %esi
callq 0x4300
movq 0x10(%rsp), %rcx
movl %ebp, %edx
movq %rax, (%rcx,%rdx,8)
testq %rax, %rax
je 0x1637f
movq %rax, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x4250
cmpb $0x0, -0x1(%r14)
je 0x16384
movl %r12d, %ebp
movq %r14, %r15
incq %r14
incq %rbx
jmp 0x162eb
xorl %r13d, %r13d
jmp 0x1638a
movb $0x1, %r13b
movl %r12d, %ebp
testb %r13b, %r13b
je 0x163ba
movq 0x10(%rsp), %rdi
movl %ebp, %esi
shlq $0x3, %rsi
callq 0x4840
testq %rax, %rax
je 0x163ba
movq %rax, 0x10(%rsp)
cmpl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
jae 0x163fc
movq 0x18(%rsp), %rcx
movl %ebp, (%rcx)
jmp 0x163ed
testl %ebp, %ebp
je 0x163db
movq 0x10(%rsp), %r14
movl %ebp, %r15d
xorl %ebx, %ebx
movq (%r14,%rbx,8), %rdi
callq 0x45c0
incq %rbx
cmpq %rbx, %r15
jne 0x163c8
jmp 0x163dd
xorl %ebx, %ebx
movl %ebx, 0xc(%rsp)
movq 0x10(%rsp), %rdi
callq 0x45c0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x82ef1(%rip), %rdi     # 0x992f4
leaq 0x82ef6(%rip), %rsi     # 0x99300
leaq 0x82f31(%rip), %rcx     # 0x99342
movl $0x86d, %edx            # imm = 0x86D
callq 0x42f0