// File: /workspace/github_c_makefile_star2_O2/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
andl $0x0, 0x14(%rsp)
movq %rdi, %rbp
andq $0x0, 0x18(%rsp)
leaq 0x6771b(%rip), %rsi     # 0x7a526
callq 0x9596
testq %rax, %rax
je 0x12f4a
movq %rax, %r12
movq %rbx, 0x28(%rsp)
leaq 0x30(%rsp), %r13
andq $0x0, 0x10(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, (%r13)
pushq $0xa
popq %rbx
movq $0x0, 0x20(%rsp)
xorl %r14d, %r14d
movl %r14d, %r15d
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0xc2ab
testl %eax, %eax
js 0x12ef5
cmpq $0x0, 0x30(%rsp)
je 0x12e45
testl %r15d, %r15d
jne 0x12e8e
movq %r13, %rdi
callq 0x12869
testl %eax, %eax
je 0x12e8e
pushq $0x3
popq %rdi
leaq 0x65548(%rip), %rsi     # 0x783c5
leaq 0x654dc(%rip), %rdx     # 0x78360
movq %rbp, %rcx
xorl %eax, %eax
callq 0x110c6
leal 0x1(%r15), %r14d
cmpl 0x14(%rsp), %r14d
jbe 0x12ed1
movl %r14d, %esi
leaq 0x65522(%rip), %rax     # 0x783c5
movq %rax, (%rsp)
pushq $0x8
popq %rdi
pushq $0x4
popq %rdx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
xorl %r9d, %r9d
callq 0x12c5c
testl %eax, %eax
js 0x1300f
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x40(%rsp), %rdi
callq 0x4930
movl %r15d, %ecx
movq 0x20(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
testq %rax, %rax
jne 0x12e42
jmp 0x1300f
cmpl $-0x1, %eax
jne 0x1300f
movq %r12, %rdi
callq 0xbc96
movq 0x40(%rsp), %rdi
callq 0x45c0
movl %r15d, %r12d
movq 0x18(%rsp), %rdi
movl %r12d, %esi
shlq $0x3, %rsi
callq 0x4840
testq %rax, %rax
je 0x1300c
cmpl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
jae 0x1304a
movq %rax, %r15
movq 0x28(%rsp), %rax
movl %r12d, (%rax)
jmp 0x13038
xorl %r15d, %r15d
cmpb $0x3a, (%rbp)
jne 0x13038
movq %rbx, 0x28(%rsp)
leaq 0x1(%rbp), %rbx
addq $0x2, %rbp
movq $0x0, 0x20(%rsp)
movq %rbx, %r14
movzbl -0x1(%rbp), %eax
cmpl $0x2c, %eax
je 0x12f7d
testl %eax, %eax
jne 0x12ffb
leal 0x1(%r15), %r12d
cmpl 0x14(%rsp), %r12d
jbe 0x12fbc
movl %r12d, %esi
leaq 0x65433(%rip), %rax     # 0x783c5
movq %rax, (%rsp)
pushq $0x8
popq %rdi
pushq $0x4
popq %rdx
leaq 0x14(%rsp), %rcx
leaq 0x18(%rsp), %r8
xorl %r9d, %r9d
callq 0x12c5c
testl %eax, %eax
js 0x1300f
movq 0x18(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %rbx, %r13
subq %r14, %r13
leaq 0x1(%r13), %rdi
pushq $0x1
popq %rsi
callq 0x4300
movl %r15d, %ecx
movq 0x20(%rsp), %rdx
movq %rax, (%rdx,%rcx,8)
testq %rax, %rax
je 0x1300f
movq %rax, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x4250
cmpb $0x0, -0x1(%rbp)
movq %rbp, %r14
jne 0x12ffe
jmp 0x12f13
movl %r15d, %r12d
incq %rbp
incq %rbx
movl %r12d, %r15d
jmp 0x12f70
movl %r12d, %r15d
movq 0x18(%rsp), %rbx
movl %r15d, %r14d
xorl %r15d, %r15d
cmpq %r15, %r14
je 0x1302d
movq (%rbx,%r15,8), %rdi
callq 0x45c0
incq %r15
jmp 0x1301a
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 0x65334(%rip), %rdi     # 0x78385
leaq 0x65339(%rip), %rsi     # 0x78391
leaq 0x65374(%rip), %rcx     # 0x783d3
movl $0x86d, %edx            # imm = 0x86D
callq 0x42f0