// File: /workspace/github_c_makefile_star2_O2/lh3[P]bgt/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 (_n) *_n = 0;
	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) {
			int i;
			if (str.l == 0) continue;
			for (i = 0; i < str.l && str.s[i] != '\t'; ++i);
			str.s[i] = 0;
			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 == ':' || *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, %r15
movq %rdi, %r14
testq %rsi, %rsi
je 0x60c6
andl $0x0, (%r15)
leaq 0x1312b(%rip), %rsi     # 0x191f8
movq %r14, %rdi
callq 0x2380
testq %rax, %rax
je 0x61fb
movq %r15, 0x18(%rsp)
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r12
movaps %xmm0, (%r12)
andq $0x0, 0x10(%r12)
movq %rax, 0x20(%rsp)
movq %rax, %rdi
callq 0x5584
movq %rax, %r13
xorl %ebx, %ebx
pushq $0x2
popq %r15
leaq 0x2c(%rsp), %rbp
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq %r13, %rdi
movl %r15d, %esi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x60a1
movl %ebx, %r14d
testl %eax, %eax
js 0x61c6
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x6122
movq 0x40(%rsp), %rdi
movq %rax, %rcx
negq %rcx
pushq $-0x1
popq %rdx
movq 0x10(%rsp), %r8
leaq (%rcx,%rdx), %rsi
cmpq $-0x1, %rsi
je 0x6175
leaq 0x1(%rdx), %rsi
cmpb $0x9, 0x1(%rdi,%rdx)
movq %rsi, %rdx
jne 0x615b
jmp 0x6178
movq %rax, %rsi
movb $0x0, (%rdi,%rsi)
cmpl %ebx, 0xc(%rsp)
jne 0x61ac
leal (%rbx,%rbx), %ecx
testl %ebx, %ebx
pushq $0x10
popq %rax
cmovel %eax, %ecx
movl %ecx, 0xc(%rsp)
movslq %ecx, %rsi
shlq $0x3, %rsi
movq %r8, %rdi
callq 0x2340
movq %rax, 0x10(%rsp)
movq 0x40(%rsp), %rdi
jmp 0x61b1
movq %r8, 0x10(%rsp)
callq 0x2430
incl %ebx
movq 0x10(%rsp), %rcx
movq %rax, (%rcx,%r14,8)
jmp 0x6122
movq %r13, %rdi
callq 0x55bd
movq 0x20(%rsp), %rdi
callq 0x2040
shlq $0x3, %r14
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x2340
movq %rax, %rbp
movq 0x40(%rsp), %rdi
callq 0x2050
jmp 0x62c0
movzbl (%r14), %eax
xorl %ebx, %ebx
cmpl $0x3a, %eax
je 0x620f
cmpl $0x2c, %eax
jne 0x62e1
movq %r15, 0x18(%rsp)
leaq 0x1(%r14), %r13
addq $0x2, %r14
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq %r13, %r12
movzbl -0x1(%r14), %eax
cmpl $0x2c, %eax
je 0x623e
testl %eax, %eax
jne 0x62a9
cmpl %ebx, 0xc(%rsp)
jne 0x6269
leal (%rbx,%rbx), %ecx
testl %ebx, %ebx
pushq $0x10
popq %rax
cmovel %eax, %ecx
movl %ecx, 0xc(%rsp)
movslq %ecx, %rsi
shlq $0x3, %rsi
movq 0x10(%rsp), %rdi
callq 0x2340
movq %rax, %r15
jmp 0x626e
movq 0x10(%rsp), %r15
movq %r13, %rbp
subq %r12, %r13
leaq 0x1(%r13), %rdi
pushq $0x1
popq %rsi
callq 0x2220
movslq %ebx, %rcx
movq %r15, 0x10(%rsp)
movq %rax, (%r15,%rcx,8)
incl %ebx
movq %rax, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2080
cmpb $0x0, -0x1(%r14)
je 0x62b4
movq %r14, %r12
movq %rbp, %r13
incq %r14
incq %r13
jmp 0x6230
movslq %ebx, %r14
shlq $0x3, %r14
movq 0x10(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2340
movq 0x18(%rsp), %rcx
movl %ebx, (%rcx)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x62d2