// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/hts.c
// Function: hts_readlist
char **hts_readlist(const char *string, int is_file, int *_n)
{
    unsigned int m = 0, n = 0;
    char **s = 0, **s_new;
    if ( is_file )
    {
        BGZF *fp = bgzf_open(string, "r");
        if ( !fp ) return NULL;

        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", string);
            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
    {
        const char *q = string, *p = string;
        while ( 1 )
        {
            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 ) break;
            p++;
        }
    }
    // 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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0x1e2dc
movq -0x10(%rbp), %rdi
leaq 0xd4950(%rip), %rsi     # 0xf2af1
callq 0xc090
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x1e1be
movq $0x0, -0x8(%rbp)
jmp 0x1e487
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x40(%rbp), %rdi
movl $0xa, %esi
leaq -0x58(%rbp), %rdx
callq 0x10f40
movl %eax, -0x5c(%rbp)
cmpl $0x0, %eax
jl 0x1e2ba
cmpq $0x0, -0x58(%rbp)
jne 0x1e1fd
jmp 0x1e1d6
cmpl $0x0, -0x28(%rbp)
jne 0x1e22f
leaq -0x58(%rbp), %rdi
callq 0x1dd90
cmpl $0x0, %eax
je 0x1e22f
movq -0x10(%rbp), %rcx
movl $0x3, %edi
leaq 0xd2379(%rip), %rsi     # 0xf059a
leaq 0xd237f(%rip), %rdx     # 0xf05a7
movb $0x0, %al
callq 0x1b030
movl -0x28(%rbp), %eax
addl $0x1, %eax
cmpl -0x24(%rbp), %eax
jbe 0x1e26e
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
movl $0x8, %edi
movl $0x4, %edx
leaq -0x24(%rbp), %rcx
leaq -0x30(%rbp), %r8
xorl %r9d, %r9d
leaq 0xd233a(%rip), %rax     # 0xf059a
movq %rax, (%rsp)
callq 0x1e4a0
movl %eax, -0x74(%rbp)
jmp 0x1e275
xorl %eax, %eax
movl %eax, -0x74(%rbp)
jmp 0x1e275
movl -0x74(%rbp), %eax
cmpl $0x0, %eax
jge 0x1e282
jmp 0x1e44c
movq -0x48(%rbp), %rdi
callq 0x4920
movq %rax, %rdx
movq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x1e2ac
jmp 0x1e44c
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1e1d6
cmpl $-0x1, -0x5c(%rbp)
jge 0x1e2c5
jmp 0x1e44c
movq -0x40(%rbp), %rdi
callq 0x103d0
movq -0x48(%rbp), %rdi
callq 0x45a0
jmp 0x1e3e8
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x1e308
movq -0x70(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x1e3ca
movl -0x28(%rbp), %eax
addl $0x1, %eax
cmpl -0x24(%rbp), %eax
jbe 0x1e347
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
movl $0x8, %edi
movl $0x4, %edx
leaq -0x24(%rbp), %rcx
leaq -0x30(%rbp), %r8
xorl %r9d, %r9d
leaq 0xd2261(%rip), %rax     # 0xf059a
movq %rax, (%rsp)
callq 0x1e4a0
movl %eax, -0x78(%rbp)
jmp 0x1e34e
xorl %eax, %eax
movl %eax, -0x78(%rbp)
jmp 0x1e34e
movl -0x78(%rbp), %eax
cmpl $0x0, %eax
jge 0x1e35b
jmp 0x1e44c
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rax
subq %rax, %rdi
addq $0x1, %rdi
movl $0x1, %esi
callq 0x42f0
movq %rax, %rdx
movq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x1e395
jmp 0x1e44c
movq -0x30(%rbp), %rax
movl -0x28(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x28(%rbp)
movl %ecx, %ecx
movq (%rax,%rcx,8), %rdi
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rax
subq %rax, %rdx
callq 0x4240
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x1e3d5
jmp 0x1e3e6
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x1e2ec
jmp 0x1e3e8
movq -0x30(%rbp), %rdi
movl -0x28(%rbp), %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0x4820
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1e407
jmp 0x1e44c
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpl $0x7fffffff, -0x28(%rbp) # imm = 0x7FFFFFFF
jae 0x1e41a
jmp 0x1e439
leaq 0xd21ab(%rip), %rdi     # 0xf05cc
leaq 0xd21b0(%rip), %rsi     # 0xf05d8
movl $0x836, %edx            # imm = 0x836
leaq 0xd21aa(%rip), %rcx     # 0xf05de
callq 0x42e0
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1e487
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x28(%rbp), %eax
jae 0x1e476
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x45a0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1e453
movq -0x30(%rbp), %rdi
callq 0x45a0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)