// File: /workspace/github_c_makefile_star2_O1/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 $0x48, %rsp
movq %rdi, %r14
movl $0x1, %edi
movl $0x28, %esi
callq 0x2160
movq %rax, %r15
leaq 0x9238(%rip), %rsi      # 0xc3ae
movq %r14, %rdi
callq 0x2170
testl %eax, %eax
je 0x3193
leaq 0x800f(%rip), %rsi      # 0xb198
movq %r14, %rdi
callq 0x2220
jmp 0x31b0
movq 0xce2e(%rip), %rax      # 0xffc8
movq (%rax), %rdi
callq 0x21b0
leaq 0x7fef(%rip), %rsi      # 0xb198
movl %eax, %edi
callq 0x20b0
testq %rax, %rax
je 0x353a
movl $0x1, %edi
movl $0x20, %esi
movq %rax, %rbx
callq 0x2160
movq %rax, %rbp
movq %rbx, 0x38(%rsp)
movq %rbx, 0x18(%rax)
movl $0x4000, %edi           # imm = 0x4000
callq 0x21d0
movq %rax, (%rbp)
movl $0x1, %edi
movl $0x18, %esi
callq 0x2160
movq %rax, %rbx
leaq 0xc(%rsp), %rcx
movq %rbp, %rdi
xorl %esi, %esi
movq %rax, %rdx
xorl %r8d, %r8d
callq 0x9c69
testl %eax, %eax
js 0x350c
movq %rbp, 0x10(%rsp)
movq %rbx, 0x18(%rsp)
movq %r15, 0x20(%rsp)
movq 0x10(%rbx), %rsi
movl (%r15), %edi
testl %edi, %edi
je 0x3257
movsbl (%rsi), %ebx
testl %ebx, %ebx
je 0x325f
movb 0x1(%rsi), %al
testb %al, %al
je 0x3261
leaq 0x2(%rsi), %rcx
movl %ebx, %edx
shll $0x5, %edx
subl %ebx, %edx
movsbl %al, %ebx
addl %edx, %ebx
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x3240
jmp 0x3261
xorl %r13d, %r13d
jmp 0x330c
xorl %ebx, %ebx
movq %rdi, 0x30(%rsp)
leal -0x1(%rdi), %edx
movl %ebx, %edi
andl %edx, %edi
movl %ebx, %eax
shrl $0x3, %eax
shll $0x3, %ebx
xorl %eax, %ebx
orl $0x1, %ebx
andl %edx, %ebx
movq 0x10(%r15), %r14
movl %edi, %r13d
movl %edi, 0x2c(%rsp)
movl %edx, 0x28(%rsp)
movl %r13d, %eax
shrl $0x4, %eax
movl (%r14,%rax,4), %r12d
leal (,%r13,2), %ebp
andl $0x1e, %ebp
movl %r12d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x32eb
testb $0x1, %al
jne 0x32d6
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rdi
movq %rsi, %r15
callq 0x2170
movl 0x2c(%rsp), %edi
movl 0x28(%rsp), %edx
movq %r15, %rsi
testl %eax, %eax
je 0x32eb
addl %ebx, %r13d
andl %edx, %r13d
cmpl %edi, %r13d
jne 0x328b
movq 0x30(%rsp), %rdi
movl %edi, %r13d
jmp 0x32fd
movl %ebp, %ecx
shrl %cl, %r12d
testb $0x3, %r12b
movq 0x30(%rsp), %rdi
cmovnel %edi, %r13d
movq 0x20(%rsp), %r15
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %rbx
cmpl %edi, %r13d
jne 0x333e
movq %rsi, %rdi
callq 0x2270
movq %r15, %rdi
movq %rax, %rsi
leaq 0x44(%rsp), %rdx
callq 0x354f
movl %eax, %r13d
movq 0x20(%r15), %rax
movl %r13d, %ecx
shlq $0x4, %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx)
movl %r13d, %r12d
shlq $0x4, %r12
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
addq 0x20(%r15), %r12
cmpl $0xa, 0xc(%rsp)
je 0x3391
movq %rbp, %rdi
xorl %esi, %esi
movq %rbx, %rdx
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0x9c69
testl %eax, %eax
jle 0x3391
callq 0x2290
movq %rax, %rbp
movq (%rax), %rax
movq 0x10(%rbx), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x3399
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x33e9
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x33ee
callq 0x2250
movl %eax, %r13d
cmpl $0xa, 0xc(%rsp)
je 0x33e9
movq 0x10(%rsp), %rdi
xorl %esi, %esi
movq %rbx, %rdx
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0x9c69
testl %eax, %eax
jle 0x33e9
movq (%rbp), %rax
movq 0x10(%rbx), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x33e9
callq 0x2250
movl %eax, %r14d
testl %eax, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovsl %eax, %r14d
movq 0x10(%rsp), %rbp
cmpl $0xa, 0xc(%rsp)
je 0x346b
movl 0xc(%rbp), %eax
movl $0xfffffffd, %ebx       # imm = 0xFFFFFFFD
testl %eax, %eax
js 0x3450
cmpl $0x0, 0x10(%rbp)
je 0x340c
cmpl %eax, 0x8(%rbp)
jge 0x344b
cmpl %eax, 0x8(%rbp)
jl 0x3430
movl $0x0, 0x8(%rbp)
movq (%rbp), %rsi
movq 0x18(%rbp), %rdi
movl $0x4000, %edx           # imm = 0x4000
callq 0x2180
testl %eax, %eax
je 0x3444
js 0x345f
movq (%rbp), %rcx
movslq 0x8(%rbp), %rdx
leal 0x1(%rdx), %esi
movl %esi, 0x8(%rbp)
movzbl (%rcx,%rdx), %ebx
jmp 0x3450
movl $0x1, 0x10(%rbp)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, 0xc(%rsp)
testl %ebx, %ebx
jle 0x3468
cmpl $0xa, %ebx
jne 0x33f8
jmp 0x3468
movl $0x1, 0x10(%rbp)
jmp 0x3450
movl %eax, 0xc(%rbp)
testl %r14d, %r14d
sets %al
testl %r13d, %r13d
setg %cl
andb %al, %cl
movzbl %cl, %eax
movl %r13d, %ebx
subl %eax, %ebx
testb %al, %al
cmovnel %r13d, %r14d
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmovsl %eax, %r14d
movl 0x4(%r12), %eax
cmpl %eax, (%r12)
jne 0x34cc
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x4, %eax
cmovel %eax, %ecx
movl %ecx, 0x4(%r12)
movq 0x8(%r12), %rdi
shll $0x3, %ecx
movslq %ecx, %rsi
callq 0x2200
movq %rax, 0x8(%r12)
shlq $0x20, %rbx
movslq %r14d, %rax
orq %rbx, %rax
movq 0x8(%r12), %rcx
movslq (%r12), %rdx
leal 0x1(%rdx), %esi
movl %esi, (%r12)
movq %rax, (%rcx,%rdx,8)
movq %rbp, %rdi
xorl %esi, %esi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
leaq 0xc(%rsp), %rcx
xorl %r8d, %r8d
callq 0x9c69
testl %eax, %eax
jns 0x3223
movq (%rbp), %rdi
callq 0x2050
movq %rbp, %rdi
callq 0x2050
movq 0x38(%rsp), %rdi
callq 0x2040
movq 0x10(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
jmp 0x353d
xorl %r15d, %r15d
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq