// File: /workspace/github_c_makefile_star2_O3/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
cmpb $0x2d, (%r14)
jne 0x3180
cmpb $0x0, 0x1(%r14)
je 0x3594
leaq 0x8021(%rip), %rsi      # 0xb1a8
movq %r14, %rdi
callq 0x2220
testq %rax, %rax
je 0x357f
movl $0x1, %edi
movl $0x20, %esi
movq %rax, %rbx
callq 0x2160
movq %rbx, 0x30(%rsp)
movq %rbx, 0x18(%rax)
movq %rax, %rbx
movl $0x4000, %edi           # imm = 0x4000
callq 0x21d0
movq %rax, (%rbx)
movl $0x1, %edi
movl $0x18, %esi
callq 0x2160
movq %rax, %r14
leaq 0x4(%rsp), %rcx
movq %rbx, %rdi
xorl %esi, %esi
movq %rax, %rdx
xorl %r8d, %r8d
callq 0x9f07
testl %eax, %eax
js 0x3552
movq $0x0, 0x28(%rsp)
movq %r15, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movq 0x10(%r14), %r14
movl (%r15), %edi
testl %edi, %edi
je 0x3245
movsbl (%r14), %r13d
testl %r13d, %r13d
je 0x324c
movb 0x1(%r14), %al
testb %al, %al
je 0x324f
leaq 0x2(%r14), %rcx
movl %r13d, %edx
shll $0x5, %edx
subl %r13d, %edx
movsbl %al, %r13d
addl %edx, %r13d
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x322a
jmp 0x324f
xorl %ebx, %ebx
jmp 0x32db
xorl %r13d, %r13d
movq %rdi, 0x38(%rsp)
leal -0x1(%rdi), %edx
movl %r13d, %edi
andl %edx, %edi
movl %r13d, %eax
shrl $0x3, %eax
shll $0x3, %r13d
xorl %eax, %r13d
orl $0x1, %r13d
andl %edx, %r13d
movq 0x10(%r15), %r12
movl %edi, %ebx
movl %edi, 0x24(%rsp)
movl %edx, 0x20(%rsp)
movl %ebx, %eax
shrl $0x4, %eax
movl (%r12,%rax,4), %r15d
leal (%rbx,%rbx), %ebp
andl $0x1e, %ebp
movl %r15d, %eax
movl %ebp, %ecx
shrl %cl, %eax
testb $0x2, %al
jne 0x32ca
testb $0x1, %al
jne 0x32bf
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rax
movl %ebx, %ecx
movq (%rax,%rcx,8), %rdi
movq %r14, %rsi
callq 0x2170
movl 0x24(%rsp), %edi
movl 0x20(%rsp), %edx
testl %eax, %eax
je 0x32ca
addl %r13d, %ebx
andl %edx, %ebx
cmpl %edi, %ebx
jne 0x327e
jmp 0x32df
movl %ebp, %ecx
shrl %cl, %r15d
testb $0x3, %r15b
movq 0x38(%rsp), %rdi
cmovnel %edi, %ebx
cmpl %edi, %ebx
jne 0x3318
movq %r14, %rdi
callq 0x2270
movq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rax, %rsi
leaq 0x44(%rsp), %rdx
callq 0x35b6
movq 0x20(%r15), %rdx
movl %eax, %r12d
movq %r12, %rax
shlq $0x4, %rax
xorps %xmm0, %xmm0
movq %rdx, 0x28(%rsp)
movups %xmm0, (%rdx,%rax)
jmp 0x3320
movl %ebx, %r12d
movq 0x18(%rsp), %r15
movq 0x10(%rsp), %rbx
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0xa, 0x4(%rsp)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
je 0x3470
movq %rbx, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %r14
movq %r14, %rdx
leaq 0x4(%rsp), %rcx
xorl %r8d, %r8d
callq 0x9f07
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testl %eax, %eax
jle 0x33eb
callq 0x2290
movq %rax, %rbp
movq (%rax), %rax
movq 0x10(%r14), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
je 0x33f1
callq 0x2250
movl %eax, %r13d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0xa, 0x4(%rsp)
je 0x3470
movq %rbx, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %rdx
leaq 0x4(%rsp), %rcx
xorl %r8d, %r8d
callq 0x9f07
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testl %eax, %eax
jle 0x33f1
movq (%rbp), %rax
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rdi
movsbq (%rdi), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0x33f1
callq 0x2250
movl %eax, %r14d
testl %eax, %eax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovsl %eax, %r14d
jmp 0x33f1
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0xa, 0x4(%rsp)
je 0x3470
movl 0xc(%rbx), %eax
testl %eax, %eax
js 0x345d
cmpl $0x0, 0x10(%rbx)
movl 0x8(%rbx), %ecx
je 0x340c
cmpl %eax, %ecx
jge 0x3464
movq (%rbx), %rbp
cmpl %eax, %ecx
jl 0x343d
movl $0x0, 0x8(%rbx)
movq 0x18(%rbx), %rdi
movq %rbp, %rsi
movl $0x4000, %edx           # imm = 0x4000
callq 0x2180
testl %eax, %eax
je 0x3526
xorl %ecx, %ecx
testl %eax, %eax
js 0x353e
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
movslq %ecx, %rcx
movzbl (%rbp,%rcx), %ecx
movl %ecx, 0x4(%rsp)
cmpl $0xa, %ecx
je 0x3458
testl %ecx, %ecx
jne 0x33fb
movl %eax, 0xc(%rbx)
jmp 0x3470
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jmp 0x3469
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %eax, 0xc(%rbx)
movl %ecx, 0x4(%rsp)
shlq $0x4, %r12
addq 0x28(%rsp), %r12
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 (%r12), %ecx
cmpl 0x4(%r12), %ecx
jne 0x34e0
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x4, %ecx
cmovel %ecx, %eax
movl %eax, 0x4(%r12)
movq 0x8(%r12), %rdi
shll $0x3, %eax
movslq %eax, %rsi
callq 0x2200
movq %rax, 0x8(%r12)
movl (%r12), %ecx
jmp 0x34e5
movq 0x8(%r12), %rax
shlq $0x20, %rbx
movslq %r14d, %rdx
orq %rbx, %rdx
leal 0x1(%rcx), %esi
movl %esi, (%r12)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
movq 0x8(%rsp), %r14
movq %r14, %rdx
leaq 0x4(%rsp), %rcx
xorl %r8d, %r8d
callq 0x9f07
testl %eax, %eax
jns 0x320a
jmp 0x3552
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0xc(%rbx)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
jmp 0x346c
movl %eax, 0xc(%rbx)
movl $0x1, 0x10(%rbx)
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jmp 0x346c
movq (%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
movq 0x30(%rsp), %rdi
callq 0x2040
movq 0x10(%r14), %rdi
callq 0x2050
movq %r14, %rdi
callq 0x2050
jmp 0x3582
xorl %r15d, %r15d
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xca2d(%rip), %rax      # 0xffc8
movq (%rax), %rdi
callq 0x21b0
leaq 0x7bfe(%rip), %rsi      # 0xb1a8
movl %eax, %edi
callq 0x20b0
jmp 0x318f