// File: /workspace/github_c_makefile_star2_O2/aokad[P]sequeeze/seqtk.c
// Function: stk_reg_read
reghash_t *stk_reg_read(const char *fn)
{
	reghash_t *h = kh_init(reg);
	gzFile fp;
	kstream_t *ks;
	int dret;
	kstring_t *str;
	// read the list
	fp = strcmp(fn, "-")? gzopen(fn, "r") : gzdopen(fileno(stdin), "r");
	if (fp == 0) return 0;
	ks = ks_init(fp);
	str = calloc(1, sizeof(kstring_t));
	while (ks_getuntil(ks, 0, str, &dret) >= 0) {
		int beg = -1, end = -1;
		reglist_t *p;
		khint_t k = kh_get(reg, h, str->s);
		if (k == kh_end(h)) {
			int ret;
			char *s = strdup(str->s);
			k = kh_put(reg, h, s, &ret);
			memset(&kh_val(h, k), 0, sizeof(reglist_t));
		}
		p = &kh_val(h, k);
		if (dret != '\n') {
			if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
				beg = atoi(str->s);
				if (dret != '\n') {
					if (ks_getuntil(ks, 0, str, &dret) > 0 && isdigit(str->s[0])) {
						end = atoi(str->s);
						if (end < 0) end = -1;
					}
				}
			}
		}
		// skip the rest of the line
		if (dret != '\n') while ((dret = ks_getc(ks)) > 0 && dret != '\n');
		if (end < 0 && beg > 0) end = beg, beg = beg - 1; // if there is only one column
		if (beg < 0) beg = 0, end = INT_MAX;
		if (p->n == p->m) {
			p->m = p->m? p->m<<1 : 4;
			p->a = realloc(p->a, p->m * 8);
		}
		p->a[p->n++] = (uint64_t)beg<<32 | end;
	}
	ks_destroy(ks);
	gzclose(fp);
	free(str->s); free(str);
	return h;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
callq 0x86d9
movq %rax, %r13
cmpb $0x2d, (%r14)
jne 0x23d6
cmpb $0x0, 0x1(%r14)
je 0x2614
leaq 0x6dcb(%rip), %rsi      # 0x91a8
movq %r14, %rdi
callq 0x2220
testq %rax, %rax
je 0x25ff
movq %rax, 0x18(%rsp)
movq %rax, %rdi
callq 0x2636
movq %rax, %r12
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x2160
movq %rax, %rbx
movq %r13, 0x10(%rsp)
movq %rax, 0x8(%rsp)
movq %r12, %rdi
xorl %esi, %esi
movq %rbx, %rdx
leaq 0x4(%rsp), %rcx
callq 0x2667
testl %eax, %eax
js 0x25da
movq 0x10(%rbx), %r14
movq %r13, %rdi
movq %r14, %rsi
callq 0x266f
cmpl (%r13), %eax
jne 0x2474
movq %r14, %rdi
callq 0x2270
movq %r13, %rdi
movq %rax, %rsi
leaq 0x24(%rsp), %rdx
callq 0x273f
movq 0x20(%r13), %rbx
movl %eax, %r15d
movq %r15, %rax
shlq $0x4, %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rbx,%rax)
jmp 0x247b
movq 0x20(%r13), %rbx
movl %eax, %r15d
pushq $-0x1
popq %rbp
cmpl $0xa, 0x4(%rsp)
movl %ebp, %r14d
je 0x2552
movq %r12, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %rcx
callq 0x2667
pushq $-0x1
popq %r14
movl %r14d, %ebp
testl %eax, %eax
jle 0x252a
callq 0x2290
movq %rax, %r13
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
pushq $-0x1
popq %r14
movl %r14d, %ebp
je 0x252a
callq 0x2250
movl %eax, %ebp
cmpl $0xa, 0x4(%rsp)
jne 0x24e5
pushq $-0x1
popq %r14
jmp 0x2531
movq %r12, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %r14
movq %r14, %rdx
leaq 0x4(%rsp), %rcx
callq 0x2667
testl %eax, %eax
jle 0x2513
movq (%r13), %rax
movq 0x10(%r14), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x2519
pushq $-0x1
popq %r14
jmp 0x252a
callq 0x2250
movl %eax, %r14d
testl %eax, %eax
pushq $-0x1
popq %rax
cmovsl %eax, %r14d
cmpl $0xa, 0x4(%rsp)
jne 0x2538
movq 0x10(%rsp), %r13
jmp 0x2552
movq 0x10(%rsp), %r13
movq %r12, %rdi
callq 0x2914
movl %eax, 0x4(%rsp)
testl %eax, %eax
jle 0x2552
cmpl $0xa, %eax
jne 0x253d
shlq $0x4, %r15
addq %r15, %rbx
testl %r14d, %r14d
sets %al
testl %ebp, %ebp
setg %cl
andb %al, %cl
movzbl %cl, %eax
movl %ebp, %r15d
subl %eax, %r15d
testb %al, %al
cmovnel %ebp, %r14d
testl %r15d, %r15d
movl $0x0, %eax
cmovlel %eax, %r15d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmovsl %eax, %r14d
movl (%rbx), %ecx
cmpl 0x4(%rbx), %ecx
jne 0x25b6
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
pushq $0x4
popq %rcx
cmovel %ecx, %eax
movl %eax, 0x4(%rbx)
movq 0x8(%rbx), %rdi
shll $0x3, %eax
movslq %eax, %rsi
callq 0x2200
movq %rax, 0x8(%rbx)
movl (%rbx), %ecx
jmp 0x25ba
movq 0x8(%rbx), %rax
shlq $0x20, %r15
movslq %r14d, %rdx
orq %r15, %rdx
leal 0x1(%rcx), %esi
movl %esi, (%rbx)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x8(%rsp), %rbx
jmp 0x2416
movq %r12, %rdi
callq 0x2992
movq 0x18(%rsp), %rdi
callq 0x2040
movq 0x10(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
jmp 0x2602
xorl %r13d, %r13d
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb9ad(%rip), %rax      # 0xdfc8
movq (%rax), %rdi
callq 0x21b0
leaq 0x6b7e(%rip), %rsi      # 0x91a8
movl %eax, %edi
callq 0x20b0
jmp 0x23e5