// File: /workspace/github_c_makefile_star2_O1/DReichLab[P]adna/hts.c
// Function: hts_readlines
char **hts_readlines(const char *fn, int *_n)
{
	int m = 0, n = 0, dret;
	char **s = 0;
	gzFile fp;
	if ((fp = gzopen(fn, "r")) != 0) { // 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(void*));
			}
			s[n++] = strdup(str.s);
		}
		ks_destroy(ks);
		gzclose(fp);
		s = (char**)realloc(s, n * sizeof(void*));
		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(void*));
				}
				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(void*));
	*_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 0x91bd(%rip), %rsi      # 0xe910
callq 0x2320
testq %rax, %rax
je 0x58ac
movq %rax, %rbp
movq %rbx, 0x18(%rsp)
movl $0x1, %edi
movl $0x20, %esi
callq 0x21f0
movq %rax, %r15
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r13
movaps %xmm0, (%r13)
movq $0x0, 0x10(%r13)
movq %rbp, 0x10(%rax)
movl 0x8(%rax), %eax
andl $0x3, %eax
orl $0x40000, %eax          # imm = 0x40000
movl %eax, 0x8(%r15)
movl $0x10000, %edi          # imm = 0x10000
callq 0x22a0
movq %rax, 0x18(%r15)
xorl %r14d, %r14d
leaq 0x2c(%rsp), %rbx
movq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x4c1d
testl %eax, %eax
js 0x584f
cmpq $0x0, 0x30(%rsp)
je 0x57c5
movl %r12d, %eax
cmpq %rax, %r14
jne 0x5825
movq %rbp, 0x20(%rsp)
leal (%r12,%r12), %ebp
testl %r12d, %r12d
movl $0x10, %eax
cmovel %eax, %ebp
movslq %ebp, %rsi
shlq $0x3, %rsi
movq 0x8(%rsp), %rdi
callq 0x22e0
movq %rax, %r12
movl %ebp, %eax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rbp
jmp 0x582f
movq %r12, 0x10(%rsp)
movq 0x8(%rsp), %r12
movq 0x40(%rsp), %rdi
callq 0x23d0
movq %r12, 0x8(%rsp)
movq %rax, (%r12,%r14,8)
incq %r14
movq 0x10(%rsp), %r12
jmp 0x57c5
movq %r15, %rdi
callq 0x4c01
movq %rbp, %rdi
callq 0x2040
movl %r14d, %esi
shlq $0x3, %rsi
movq 0x8(%rsp), %rdi
callq 0x22e0
movq %rax, %r12
movq 0x40(%rsp), %rdi
callq 0x2050
movslq %r14d, %rbx
leaq (,%rbx,8), %rsi
movq %r12, %rdi
callq 0x22e0
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 0x589a
movq %rbx, 0x18(%rsp)
leaq 0x1(%r15), %rbp
addq $0x2, %r15
xorl %r12d, %r12d
xorl %ecx, %ecx
movq %rbp, %r13
movzbl -0x1(%r15), %eax
cmpl $0x2c, %eax
je 0x58d8
testl %eax, %eax
jne 0x5949
cmpl %r14d, %ecx
jne 0x5905
leal (%rcx,%rcx), %ebx
testl %ecx, %ecx
movl $0x10, %eax
cmovel %eax, %ebx
movslq %ebx, %rsi
shlq $0x3, %rsi
movq %r12, %rdi
callq 0x22e0
movq %rax, %r12
movl %ebx, %eax
movq %rax, 0x8(%rsp)
jmp 0x590a
movq %rcx, 0x8(%rsp)
movq %rbp, %rbx
subq %r13, %rbx
leaq 0x1(%rbx), %rdi
movl $0x1, %esi
callq 0x21f0
movslq %r14d, %rcx
movq %rax, (%r12,%rcx,8)
incl %r14d
movq %rax, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x2080
cmpb $0x0, -0x1(%r15)
movq %r15, %r13
movq 0x8(%rsp), %rcx
je 0x587d
incq %r15
incq %rbp
jmp 0x58ca