// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/htslib/hts.c
// Function: hts_readlines
char **hts_readlines(const char *fn, int *_n)
{
    int m = 0, n = 0, dret;
    char **s = 0;
#if KS_BGZF
    BGZF *fp = bgzf_open(fn, "r");
#else
    gzFile fp = gzopen(fn, "r");
#endif
    if ( fp ) { // read from file
        kstream_t *ks;
        kstring_t str;
        str.s = 0; str.l = str.m = 0;
        ks = ks_init(fp);
        while (ks_getuntil(ks, KS_SEP_LINE, &str, &dret) >= 0) {
            if (str.l == 0) continue;
            if (m == n) {
                m = m? m<<1 : 16;
                s = (char**)realloc(s, m * sizeof(char*));
            }
            s[n++] = strdup(str.s);
        }
        ks_destroy(ks);
        #if KS_BGZF
            bgzf_close(fp);
        #else
            gzclose(fp);
        #endif
        s = (char**)realloc(s, n * sizeof(char*));
        free(str.s);
    } else if (*fn == ':') { // read from string
        const char *q, *p;
        for (q = p = fn + 1;; ++p)
            if (*p == ',' || *p == 0) {
                if (m == n) {
                    m = m? m<<1 : 16;
                    s = (char**)realloc(s, m * sizeof(char*));
                }
                s[n] = (char*)calloc(p - q + 1, 1);
                strncpy(s[n++], q, p - q);
                q = p + 1;
                if (*p == 0) break;
            }
    } else return 0;
    s = (char**)realloc(s, n * sizeof(char*));
    *_n = n;
    return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0x3d180(%rip), %rsi     # 0x84e09
callq 0x5bd04
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x47db0
movq %rbx, 0x18(%rsp)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
movq 0x20(%rsp), %rdi
callq 0x45c64
movq %rax, %r13
xorl %r14d, %r14d
pushq $0x2
popq %rbx
leaq 0x2c(%rsp), %rbp
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq %r13, %rdi
movl %ebx, %esi
movq %r15, %rdx
movq %rbp, %rcx
callq 0x47a2a
testl %eax, %eax
js 0x47d51
cmpq $0x0, 0x30(%rsp)
je 0x47cd6
movl %r12d, %eax
cmpq %rax, %r14
jne 0x47d2a
leal (%r12,%r12), %ecx
testl %r12d, %r12d
pushq $0x10
popq %rax
cmovel %eax, %ecx
movl %ecx, 0x10(%rsp)
movslq %ecx, %rsi
shlq $0x3, %rsi
movq 0x8(%rsp), %rdi
callq 0x6c80
movq %rax, %r12
movl 0x10(%rsp), %eax
movq %rax, 0x10(%rsp)
jmp 0x47d34
movq %r12, 0x10(%rsp)
movq 0x8(%rsp), %r12
movq 0x40(%rsp), %rdi
callq 0x6dd0
movq %r12, 0x8(%rsp)
movq %rax, (%r12,%r14,8)
incq %r14
movq 0x10(%rsp), %r12
jmp 0x47cd6
movq %r13, %rdi
callq 0x45c9d
movq 0x20(%rsp), %rdi
callq 0x5d0b0
movl %r14d, %esi
shlq $0x3, %rsi
movq 0x8(%rsp), %rdi
callq 0x6c80
movq %rax, %r12
movq 0x40(%rsp), %rdi
callq 0x68a0
movslq %r14d, %rbx
leaq (,%rbx,8), %rsi
movq %r12, %rdi
callq 0x6c80
movq %rax, %r14
movq 0x18(%rsp), %rax
movl %ebx, (%rax)
movq %r14, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
cmpb $0x3a, (%r15)
jne 0x47d9e
movq %rbx, 0x18(%rsp)
leaq 0x1(%r15), %r13
addq $0x2, %r15
xorl %r12d, %r12d
movl $0x0, 0x8(%rsp)
movq %r13, %rbp
movzbl -0x1(%r15), %eax
cmpl $0x2c, %eax
je 0x47de2
testl %eax, %eax
jne 0x47e44
cmpl %r14d, 0x8(%rsp)
jne 0x47e0c
leal (%r14,%r14), %ecx
testl %r14d, %r14d
pushq $0x10
popq %rax
cmovel %eax, %ecx
movl %ecx, 0x8(%rsp)
movslq %ecx, %rsi
shlq $0x3, %rsi
movq %r12, %rdi
callq 0x6c80
movq %rax, %r12
movq %r13, %rbx
subq %rbp, %rbx
leaq 0x1(%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x6470
movslq %r14d, %rcx
movq %rax, (%r12,%rcx,8)
incl %r14d
movq %rax, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x6380
cmpb $0x0, -0x1(%r15)
movq %r15, %rbp
je 0x47d81
incq %r15
incq %r13
jmp 0x47dd4