// File: /workspace/github_cpp_makefile_star2_O1/karel-brinda[P]ococo/ext/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 0x10125
leaq 0x4390f(%rip), %rsi     # 0x53919
movq %r14, %rdi
callq 0x436f0
movq %rax, %r14
testq %rax, %rax
je 0x101d6
movl $0x1, %edi
movl $0x28, %esi
callq 0x4360
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 0x4700
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 0xda21
testl %eax, %eax
js 0x10101
cmpq $0x0, 0x20(%rsp)
je 0x1007a
movslq %r14d, %rax
cmpq %rax, %rbx
jl 0x100e2
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 0x48d0
movq %rax, %r15
leaq 0x1(%rbx), %rax
movq %rax, (%rsp)
movq 0x30(%rsp), %rdi
callq 0x49c0
movq %rax, (%r15,%rbx,8)
movq (%rsp), %rbx
jmp 0x1007a
movq %r12, %rdi
callq 0xda05
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x4514a
movq 0x30(%rsp), %rdi
callq 0x4610
jmp 0x101db
leaq 0x1(%r14), %r13
xorl %ebx, %ebx
movq %r14, %rbp
xorl %r15d, %r15d
movl $0x0, (%rsp)
movzbl -0x1(%r13), %eax
cmpl $0x2c, %eax
je 0x10146
testl %eax, %eax
jne 0x101c2
cmpl (%rsp), %ebx
jl 0x10188
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 0x48d0
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 0x4360
movslq %ebx, %rcx
movq %rax, (%r15,%rcx,8)
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x42b0
movl 0x8(%rsp), %eax
movl %eax, %ebx
movq %r13, %r14
incq %rbp
cmpb $0x0, -0x1(%r13)
leaq 0x1(%r13), %r13
jne 0x10138
jmp 0x101e0
xorl %ebx, %ebx
xorl %r15d, %r15d
testq %r14, %r14
je 0x101fc
movslq %ebx, %rbx
leaq (,%rbx,8), %rsi
movq %r15, %rdi
callq 0x48d0
movq 0x10(%rsp), %rcx
movl %ebx, (%rcx)
jmp 0x101fe
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq