// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r12
testq %rsi, %rsi
je 0x66b3
movl $0x0, (%rbx)
leaq 0x18b81(%rip), %rsi     # 0x1f23b
movq %r12, %rdi
callq 0x2370
testq %rax, %rax
je 0x67f4
movq %rax, %r14
movq %rbx, 0x18(%rsp)
movl $0x1, %edi
movl $0x20, %esi
callq 0x2220
movq %rax, %r12
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rbx
movaps %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq %r14, 0x8(%rsp)
movq %r14, 0x10(%rax)
movl 0x8(%rax), %eax
andl $0x3, %eax
orl $0x10000, %eax          # imm = 0x10000
movl %eax, 0x8(%r12)
movl $0x4000, %edi           # imm = 0x4000
callq 0x22e0
movq %rax, 0x18(%r12)
leaq 0x14(%rsp), %rcx
xorl %r14d, %r14d
movq %r12, %rdi
movl $0x2, %esi
movq %rbx, %rdx
xorl %r8d, %r8d
callq 0x5b79
testl %eax, %eax
js 0x68ab
xorl %r15d, %r15d
leaq 0x20(%rsp), %rbp
leaq 0x14(%rsp), %rbx
xorl %r13d, %r13d
xorl %r14d, %r14d
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x67d1
movq 0x30(%rsp), %rdx
xorl %ecx, %ecx
cmpb $0x9, (%rdx,%rcx)
je 0x6778
incq %rcx
cmpq %rcx, %rax
jne 0x6767
movq %rax, %rcx
movq 0x30(%rsp), %rax
movb $0x0, (%rax,%rcx)
cmpl %r14d, %r15d
jne 0x67bc
movq %r13, %rdi
movq %r12, %r13
movq %rbx, %r12
movq %rbp, %rbx
leal (%r15,%r15), %ebp
testl %r15d, %r15d
movl $0x10, %eax
cmovel %eax, %ebp
movslq %ebp, %rsi
shlq $0x3, %rsi
callq 0x2330
movl %ebp, %r15d
movq %rbx, %rbp
movq %r12, %rbx
movq %r13, %r12
movq %rax, %r13
movq 0x30(%rsp), %rdi
callq 0x2420
movslq %r14d, %rcx
incl %r14d
movq %rax, (%r13,%rcx,8)
movq %r12, %rdi
movl $0x2, %esi
movq %rbp, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x5b79
testl %eax, %eax
jns 0x6756
jmp 0x68ae
movzbl (%r12), %eax
xorl %r14d, %r14d
cmpl $0x3a, %eax
je 0x680a
cmpl $0x2c, %eax
jne 0x68f9
movq %rbx, 0x18(%rsp)
leaq 0x1(%r12), %rbp
addq $0x2, %r12
xorl %r15d, %r15d
xorl %ecx, %ecx
movq %rbp, %rbx
movzbl -0x1(%r12), %eax
cmpl $0x2c, %eax
je 0x682f
testl %eax, %eax
jne 0x68a0
cmpl %r14d, %ecx
jne 0x685f
leal (%rcx,%rcx), %r13d
testl %ecx, %ecx
movl $0x10, %eax
cmovel %eax, %r13d
movslq %r13d, %rsi
shlq $0x3, %rsi
movq %r15, %rdi
callq 0x2330
movq %rax, %r15
movl %r13d, %eax
movq %rax, 0x8(%rsp)
jmp 0x6864
movq %rcx, 0x8(%rsp)
movq %rbp, %r13
subq %rbx, %r13
leaq 0x1(%r13), %rdi
movl $0x1, %esi
callq 0x2220
movslq %r14d, %rcx
movq %rax, (%r15,%rcx,8)
incl %r14d
movq %rax, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x2080
cmpb $0x0, -0x1(%r12)
movq %r12, %rbx
movq 0x8(%rsp), %rcx
je 0x68dc
incq %r12
incq %rbp
jmp 0x6820
xorl %r13d, %r13d
movq %r12, %rdi
callq 0x5b5d
movq 0x8(%rsp), %rdi
callq 0x2040
movslq %r14d, %rsi
shlq $0x3, %rsi
movq %r13, %rdi
callq 0x2330
movq %rax, %r15
movq 0x30(%rsp), %rdi
callq 0x2050
movslq %r14d, %rbx
leaq (,%rbx,8), %rsi
movq %r15, %rdi
callq 0x2330
movq %rax, %r14
movq 0x18(%rsp), %rax
movl %ebx, (%rax)
movq %r14, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq