// File: /workspace/github_c_makefile_star2_O1/icebert[P]pblat/htslib/hts.c
// Function: hts_readlist
char **hts_readlist(const char *string, int is_file, int *_n)
{
    int m = 0, n = 0, dret;
    char **s = 0;
    if ( is_file )
    {
#if KS_BGZF
        BGZF *fp = bgzf_open(string, "r");
#else
        gzFile fp = gzopen(string, "r");
#endif
        if ( !fp ) return NULL;

        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;
            n++;
            hts_expand(char*,n,m,s);
            s[n-1] = strdup(str.s);
        }
        ks_destroy(ks);
#if KS_BGZF
        bgzf_close(fp);
#else
        gzclose(fp);
#endif
        free(str.s);
    }
    else
    {
        const char *q = string, *p = string;
        while ( 1 )
        {
            if (*p == ',' || *p == 0)
            {
                n++;
                hts_expand(char*,n,m,s);
                s[n-1] = (char*)calloc(p - q + 1, 1);
                strncpy(s[n-1], q, p - q);
                q = p + 1;
            }
            if ( !*p ) break;
            p++;
        }
    }
    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 $0x38, %rsp
movq %rdx, 0x10(%rsp)
movq %rdi, %r14
testl %esi, %esi
je 0x4e8c4
leaq 0x47680(%rip), %rsi     # 0x95e29
movq %r14, %rdi
callq 0x66a24
movq %rax, %r14
testq %rax, %rax
je 0x4e975
movl $0x1, %edi
movl $0x28, %esi
callq 0x6470
movq %rax, %r12
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r13
movaps %xmm0, (%r13)
movq $0x0, 0x10(%r13)
movq %r14, 0x8(%rsp)
movq %r14, 0x18(%rax)
movl 0x8(%rax), %eax
andl $0x3, %eax
orl $0x40000, %eax          # imm = 0x40000
movl %eax, 0x8(%r12)
movl $0x10000, %edi          # imm = 0x10000
callq 0x69d0
movq %rax, 0x20(%r12)
xorl %ebx, %ebx
leaq 0x1c(%rsp), %rbp
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %r12, %rdi
movl $0x2, %esi
movq %r13, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq 0x4c2d5
testl %eax, %eax
js 0x4e8a0
cmpq $0x0, 0x20(%rsp)
je 0x4e819
movslq %r14d, %rax
cmpq %rax, %rbx
jl 0x4e881
movl %ebx, %eax
shrl %eax
orl %ebx, %eax
movl %eax, %ecx
shrl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %r14d
shrl $0x10, %r14d
orl %ecx, %r14d
movslq %r14d, %rax
incl %r14d
leaq 0x8(,%rax,8), %rsi
movq %r15, %rdi
callq 0x6c80
movq %rax, %r15
leaq 0x1(%rbx), %rax
movq %rax, (%rsp)
movq 0x30(%rsp), %rdi
callq 0x6dd0
movq %rax, (%r15,%rbx,8)
movq (%rsp), %rbx
jmp 0x4e819
movq %r12, %rdi
callq 0x4c2b9
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x68168
movq 0x30(%rsp), %rdi
callq 0x68a0
jmp 0x4e97a
leaq 0x1(%r14), %r13
xorl %ebx, %ebx
movq %r14, %rbp
xorl %r15d, %r15d
movl $0x0, (%rsp)
movzbl -0x1(%r13), %eax
cmpl $0x2c, %eax
je 0x4e8e5
testl %eax, %eax
jne 0x4e961
cmpl (%rsp), %ebx
jl 0x4e927
movl %ebx, %eax
sarl %eax
orl %ebx, %eax
movl %eax, %ecx
sarl $0x2, %ecx
orl %eax, %ecx
movl %ecx, %eax
sarl $0x4, %eax
orl %ecx, %eax
movl %eax, %ecx
sarl $0x8, %ecx
orl %eax, %ecx
movl %ecx, %edx
sarl $0x10, %edx
orl %ecx, %edx
movslq %edx, %rax
incl %edx
movl %edx, (%rsp)
leaq 0x8(,%rax,8), %rsi
movq %r15, %rdi
callq 0x6c80
movq %rax, %r15
leal 0x1(%rbx), %eax
movl %eax, 0x8(%rsp)
movq %rbp, %r12
subq %r14, %r12
leaq 0x1(%r12), %rdi
movl $0x1, %esi
callq 0x6470
movslq %ebx, %rcx
movq %rax, (%r15,%rcx,8)
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x6380
movl 0x8(%rsp), %eax
movl %eax, %ebx
movq %r13, %r14
incq %rbp
cmpb $0x0, -0x1(%r13)
leaq 0x1(%r13), %r13
jne 0x4e8d7
jmp 0x4e97f
xorl %ebx, %ebx
xorl %r15d, %r15d
testq %r14, %r14
je 0x4e99b
movslq %ebx, %rbx
leaq (,%rbx,8), %rsi
movq %r15, %rdi
callq 0x6c80
movq 0x10(%rsp), %rcx
movl %ebx, (%rcx)
jmp 0x4e99d
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq