// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %r15
testq %rsi, %rsi
je 0x6823
movl $0x0, (%r14)
leaq 0x18a1e(%rip), %rsi     # 0x1f248
movq %r15, %rdi
callq 0x2370
testq %rax, %rax
je 0x6955
movq %rax, %rbx
movq %r14, 0x18(%rsp)
movl $0x1, %edi
movl $0x20, %esi
callq 0x2220
movq %rax, %r15
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r12
movaps %xmm0, (%r12)
movq $0x0, 0x10(%r12)
movq %rbx, 0x8(%rsp)
movq %rbx, 0x10(%rax)
movl $0x10000, 0x8(%rax)     # imm = 0x10000
movl $0x4000, %edi           # imm = 0x4000
callq 0x22e0
movq %rax, 0x18(%r15)
leaq 0x14(%rsp), %rcx
xorl %ebx, %ebx
movq %r15, %rdi
movl $0x2, %esi
movq %r12, %rdx
xorl %r8d, %r8d
callq 0x5ca1
testl %eax, %eax
js 0x6a20
xorl %r14d, %r14d
leaq 0x20(%rsp), %r13
leaq 0x14(%rsp), %rbp
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x6932
movq 0x30(%rsp), %rdi
xorl %ecx, %ecx
cmpb $0x9, (%rdi,%rcx)
je 0x68df
incq %rcx
cmpq %rcx, %rax
jne 0x68ce
movq %rax, %rcx
movb $0x0, (%rdi,%rcx)
cmpl %ebx, %r14d
jne 0x6924
movq %r12, %rdi
movq %r15, %r12
movq %rbp, %r15
movq %r13, %rbp
leal (%r14,%r14), %r13d
testl %r14d, %r14d
movl $0x10, %eax
cmovel %eax, %r13d
movslq %r13d, %rsi
shlq $0x3, %rsi
callq 0x2330
movq 0x30(%rsp), %rdi
movl %r13d, %r14d
movq %rbp, %r13
movq %r15, %rbp
movq %r12, %r15
movq %rax, %r12
callq 0x2420
movslq %ebx, %rcx
incl %ebx
movq %rax, (%r12,%rcx,8)
movq %r15, %rdi
movl $0x2, %esi
movq %r13, %rdx
movq %rbp, %rcx
xorl %r8d, %r8d
callq 0x5ca1
testl %eax, %eax
jns 0x68bd
jmp 0x6a23
movzbl (%r15), %eax
xorl %ebx, %ebx
cmpl $0x3a, %eax
je 0x6969
cmpl $0x2c, %eax
jne 0x6a75
movq %r14, 0x18(%rsp)
leaq 0x1(%r15), %r13
addq $0x2, %r15
movq $0x0, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movq %r13, %rbp
movzbl -0x1(%r15), %eax
cmpl $0x2c, %eax
je 0x6998
testl %eax, %eax
jne 0x6a07
cmpl %ebx, 0x10(%rsp)
jne 0x69c5
leal (%rbx,%rbx), %ecx
testl %ebx, %ebx
movl $0x10, %eax
cmovel %eax, %ecx
movl %ecx, 0x10(%rsp)
movslq %ecx, %rsi
shlq $0x3, %rsi
movq 0x8(%rsp), %rdi
callq 0x2330
movq %rax, %r14
jmp 0x69ca
movq 0x8(%rsp), %r14
movq %r13, %r12
subq %rbp, %r13
leaq 0x1(%r13), %rdi
movl $0x1, %esi
callq 0x2220
movslq %ebx, %rcx
movq %r14, 0x8(%rsp)
movq %rax, (%r14,%rcx,8)
incl %ebx
movq %rax, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x2080
cmpb $0x0, -0x1(%r15)
je 0x6a12
movq %r15, %rbp
movq %r12, %r13
incq %r15
incq %r13
jmp 0x698a
movslq %ebx, %r15
shlq $0x3, %r15
movq 0x8(%rsp), %r12
jmp 0x6a54
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x5c85
movq 0x8(%rsp), %rdi
callq 0x2040
movslq %ebx, %r15
shlq $0x3, %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x2330
movq %rax, %r12
movq 0x30(%rsp), %rdi
callq 0x2050
movq %r12, %rdi
movq %r15, %rsi
callq 0x2330
movq 0x18(%rsp), %rcx
movl %ebx, (%rcx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x6a66