// File: /workspace/github_c_makefile_star2_O2/lh3[P]fermi2/profk.c
// Function: main_kprof
int main_kprof(int argc, char *argv[])
{
	ketopt_t o = KETOPT_INIT;
	int c, min_ext = 61, sat_occ = 0;
	rld_t *e;
	kseq_t *ks;
	gzFile fp;

	while ((c = ketopt(&o, argc, argv, 1, "k:c:", 0)) >= 0) {
		if (c == 'k') min_ext = atoi(o.arg);
		else if (c == 'c') sat_occ = atoi(o.arg);
	}
	if (argc - o.ind < 2) {
		fprintf(stderr, "Usage: fermi2 kprof [options] <in.fmd> <in.fa>\n");
		fprintf(stderr, "Options:\n");
		fprintf(stderr, "  -k INT    min k-mer size [%d]\n", min_ext);
		fprintf(stderr, "  -c INT    occurrence saturation [%d]\n", sat_occ);
		return 1;
	}

	fp = gzopen(argv[o.ind+1], "r");
	if (fp == 0) {
		fprintf(stderr, "[E::%s] failed to open the sequence file\n", __func__);
		return 1;
	}
	ks = kseq_init(fp);
	e = rld_restore(argv[o.ind]);

	while (kseq_read(ks) >= 0) {
		int i, n_a;
		fm_icnt_t *a;
		a = fm_kprof(e, ks->seq.s, min_ext, sat_occ, &n_a);
		for (i = 0; i < n_a; ++i)
			fprintf(stdout, "%s\t%d\t%d\t%d\n", ks->name.s, a[i].st, a[i].en, a[i].occ);
		free(a);
	}
	rld_destroy(e);
	kseq_destroy(ks);
	gzclose(fp);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbp
movq %rdi, 0x50(%rsp)
movslq %edi, %r12
leal -0x1(%r12), %eax
movl %eax, 0x40(%rsp)
pushq $0x3d
popq %rax
movl %eax, 0x2c(%rsp)
pushq $0x1
popq %r15
xorl %r13d, %r13d
pushq $0x3f
popq %rdi
leaq 0x344c(%rip), %r8       # 0x1b20d
pushq $0x5
popq %rdx
movabsq $0x100000000, %rbx      # imm = 0x100000000
movl $0x0, 0x20(%rsp)
movl $0x0, 0x28(%rsp)
movq %r15, 0x8(%rsp)
movslq %r15d, %rcx
movq %rcx, %r15
shlq $0x20, %r15
leaq (,%rcx,8), %r9
addq %rbp, %r9
xorl %r14d, %r14d
movq %rcx, %rax
leaq (%rcx,%r14), %rsi
cmpq %r12, %rsi
jge 0x1803b
movq (%r9,%r14,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x17e1a
cmpb $0x0, 0x1(%rsi)
jne 0x17e25
incq %rax
incq %r14
addq %rbx, %r15
jmp 0x17dfe
sarq $0x1d, %r15
movq (%rbp,%r15), %rcx
cmpb $0x2d, (%rcx)
jne 0x1841f
movq %rbp, 0x18(%rsp)
movl 0x8(%rsp), %ebp
addq %r14, %rbp
movq %r13, 0x38(%rsp)
movl %r13d, %r13d
addq %r14, %r13
movq %rcx, %rsi
movzbl 0x1(%rcx), %ecx
cmpl $0x2d, %ecx
je 0x17ec1
movq %rsi, 0x30(%rsp)
testl %ecx, %ecx
je 0x1842c
movl 0x20(%rsp), %eax
cmpl $0x1, %eax
adcl $0x0, %eax
movl %eax, 0x20(%rsp)
movslq %eax, %rcx
movq 0x30(%rsp), %rax
movsbl (%rax,%rcx), %esi
incq %rcx
movq %rcx, 0x48(%rsp)
movq %r8, %rdi
movl %esi, 0x4(%rsp)
callq 0x2180
pushq $0x3a
popq %rsi
pushq $0x3f
popq %rdi
movl %edi, %ecx
testq %rax, %rax
je 0x17eda
cmpb $0x3a, 0x1(%rax)
jne 0x17ed6
movq 0x30(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
je 0x17fcf
addq %rcx, %rax
jmp 0x17eeb
cmpb $0x0, 0x2(%rsi)
je 0x1843e
xorl %eax, %eax
movl %edi, 0x4(%rsp)
movl %ebp, %r15d
jmp 0x17ef8
movl 0x4(%rsp), %ecx
cmpl $-0x2, 0x20(%rsp)
jg 0x17f92
movl %ecx, 0x4(%rsp)
xorl %eax, %eax
movl %ebp, %r15d
leaq 0x3318(%rip), %r8       # 0x1b20d
pushq $0x5
popq %rdx
movq %rax, 0x30(%rsp)
leal 0x1(%r15), %eax
movq %rax, 0x8(%rsp)
movl $0x0, 0x20(%rsp)
testl %r13d, %r13d
jle 0x17f3e
cmpl %r15d, %ebp
jg 0x17f2b
movq 0x18(%rsp), %rdi
movl %ebp, %esi
movl %r13d, %edx
callq 0x18468
incl %ebp
jmp 0x17f13
movl 0x4(%rsp), %ecx
pushq $0x3f
popq %rdi
leaq 0x32d4(%rip), %r8       # 0x1b20d
pushq $0x5
popq %rdx
jmp 0x17f42
movl 0x4(%rsp), %ecx
movq 0x8(%rsp), %r15
testl %ecx, %ecx
movq 0x18(%rsp), %rbp
js 0x18434
cmpl $0x63, %ecx
je 0x18007
cmpl $0x6b, %ecx
jne 0x17dde
movq 0x30(%rsp), %rdi
movq %r8, %r13
movq %r15, 0x8(%rsp)
movq %rdx, %r15
callq 0x2300
movq %r15, %rdx
movq 0x8(%rsp), %r15
movq %r13, %r8
pushq $0x3f
popq %rdi
movl %eax, 0x2c(%rsp)
jmp 0x1802e
movq 0x18(%rsp), %rax
movq (%rax,%r15), %rax
movq 0x48(%rsp), %rsi
movl %esi, %edx
cmpb $0x0, (%rax,%rdx)
leaq 0x3260(%rip), %r8       # 0x1b20d
pushq $0x5
popq %rdx
je 0x17fc4
movl %esi, 0x20(%rsp)
movl %ebp, %r15d
movq $0x0, 0x30(%rsp)
jmp 0x17f47
movl %ecx, 0x4(%rsp)
xorl %eax, %eax
jmp 0x17ed1
cmpl %ebp, 0x40(%rsp)
leaq 0x3233(%rip), %r8       # 0x1b20d
pushq $0x5
popq %rdx
jle 0x17ffc
movq 0x8(%rsp), %rax
leal (%rax,%r14), %r15d
incl %r15d
movslq %r15d, %rax
movq 0x18(%rsp), %rcx
movq (%rcx,%rax,8), %rax
jmp 0x17ef8
xorl %eax, %eax
movl %esi, 0x4(%rsp)
jmp 0x17ed1
movq 0x30(%rsp), %rdi
movq %r8, %r13
movq %r15, 0x8(%rsp)
movq %rdx, %r15
callq 0x2300
movq %r15, %rdx
movq 0x8(%rsp), %r15
movq %r13, %r8
pushq $0x3f
popq %rdi
movl %eax, 0x28(%rsp)
movq 0x38(%rsp), %r13
addl %r14d, %r13d
jmp 0x17dde
cmpq %r12, %rcx
cmovgq %rcx, %r12
movl %r12d, %r15d
movq 0x50(%rsp), %rax
addl %r13d, %eax
subl %r15d, %eax
addl %r14d, %eax
cmpl $0x1, %eax
jle 0x18398
movslq %r15d, %r15
movslq %r13d, %rax
subq %rax, %r15
subq %r14, %r15
movq 0x8(%rbp,%r15,8), %rdi
leaq 0x1330(%rip), %rsi      # 0x193a4
callq 0x22b0
testq %rax, %rax
je 0x183f8
movq %rax, %r13
pushq $0x1
popq %rbx
pushq $0x50
popq %rsi
movq %rbx, %rdi
callq 0x2190
movq %rax, %r12
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x2190
movq %rax, %r14
movq %r13, 0x20(%rsp)
movq %r13, 0x10(%rax)
movl $0x10000, 0x8(%rax)     # imm = 0x10000
movl $0x4000, %edi           # imm = 0x4000
callq 0x2220
movq %rax, 0x18(%r14)
movq %r14, 0x48(%r12)
movq (%rbp,%r15,8), %rdi
callq 0x2f1e
movq %rax, 0x18(%rsp)
leaq 0x30(%r12), %r13
leaq 0x20(%r12), %rbx
leaq 0x10(%r12), %rax
movq %rax, 0x8(%rsp)
xorl %eax, %eax
testl %eax, %eax
jne 0x18114
movq %r14, %rdi
callq 0x1849e
cmpl $-0x1, %eax
je 0x18320
cmpl $0x40, %eax
je 0x1810b
cmpl $0x3e, %eax
jne 0x180f0
movl %eax, 0x14(%rsp)
movl %eax, 0x40(%r12)
andl $0x0, 0x30(%r12)
andl $0x0, 0x20(%r12)
andl $0x0, 0x10(%r12)
movq %r14, %rdi
xorl %esi, %esi
movq %r12, %rdx
leaq 0x14(%rsp), %rcx
callq 0x18511
testl %eax, %eax
js 0x18320
cmpl $0xa, 0x14(%rsp)
pushq $0x2
popq %rbp
je 0x1815b
movq %r14, %rdi
movl %ebp, %esi
movq 0x8(%rsp), %rdx
xorl %ecx, %ecx
callq 0x18511
cmpq $0x0, 0x28(%r12)
jne 0x1817b
movl $0x100, 0x24(%r12)      # imm = 0x100
movl $0x100, %edi            # imm = 0x100
callq 0x2220
movq %rax, 0x28(%r12)
movq %r14, %rdi
callq 0x1849e
movl %eax, 0x14(%rsp)
cmpl $0xa, %eax
je 0x1817b
cmpl $-0x1, %eax
je 0x181cf
cmpl $0x2b, %eax
je 0x181cf
cmpl $0x3e, %eax
je 0x181ca
cmpl $0x40, %eax
je 0x181ca
movq 0x28(%r12), %rcx
movl 0x20(%r12), %edx
leal 0x1(%rdx), %esi
movl %esi, 0x20(%r12)
movb %al, (%rcx,%rdx)
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r8
callq 0x18516
jmp 0x1817b
movl %eax, 0x40(%r12)
movl 0x20(%r12), %r15d
movl 0x24(%r12), %ebp
leal 0x1(%r15), %ecx
movq 0x28(%r12), %rax
cmpl %ebp, %ecx
jb 0x1821f
movl %ecx, %edx
shrl %edx
orl %ecx, %edx
movl %edx, %ecx
shrl $0x2, %ecx
orl %edx, %ecx
movl %ecx, %edx
shrl $0x4, %edx
orl %ecx, %edx
movl %edx, %ecx
shrl $0x8, %ecx
orl %edx, %ecx
movl %ecx, %ebp
shrl $0x10, %ebp
orl %ecx, %ebp
incl %ebp
movl %ebp, 0x24(%r12)
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2260
movq %rax, 0x28(%r12)
movb $0x0, (%rax,%r15)
cmpl $0x2b, 0x14(%rsp)
jne 0x18297
cmpl %ebp, 0x34(%r12)
jae 0x18248
movl %ebp, 0x34(%r12)
movq 0x38(%r12), %rdi
movl %ebp, %esi
callq 0x2260
movq %rax, 0x38(%r12)
movq %r14, %rdi
callq 0x1849e
movl %eax, 0x14(%rsp)
cmpl $-0x1, %eax
je 0x18320
cmpl $0xa, %eax
jne 0x18248
pushq $0x2
popq %rbp
movq %r14, %rdi
movl %ebp, %esi
movq %r13, %rdx
xorl %ecx, %ecx
pushq $0x1
popq %r8
callq 0x18516
movl (%rbx), %r15d
movl (%r13), %ecx
testl %eax, %eax
js 0x18288
cmpl %r15d, %ecx
jb 0x18265
andl $0x0, 0x40(%r12)
cmpl %ecx, %r15d
jne 0x18320
testl %r15d, %r15d
js 0x18320
movq 0x28(%r12), %rsi
movq 0x18(%rsp), %rdi
movl 0x2c(%rsp), %edx
movl 0x28(%rsp), %ecx
leaq 0x44(%rsp), %r8
callq 0x17c78
movq %rax, %r14
movl 0x44(%rsp), %eax
testl %eax, %eax
movl $0x0, %ecx
cmovlel %ecx, %eax
imulq $0xc, %rax, %r15
xorl %ebp, %ebp
cmpq %rbp, %r15
je 0x18309
movq 0x9ce1(%rip), %rax      # 0x21fc0
movq (%rax), %rdi
movq 0x8(%r12), %rdx
movl (%r14,%rbp), %ecx
movl 0x4(%r14,%rbp), %r8d
movl 0x8(%r14,%rbp), %r9d
leaq 0x2f9a(%rip), %rsi      # 0x1b296
xorl %eax, %eax
callq 0x21c0
addq $0xc, %rbp
jmp 0x182d3
movq %r14, %rdi
callq 0x2040
movq 0x48(%r12), %r14
movl 0x40(%r12), %eax
jmp 0x180ec
movq 0x18(%rsp), %rdi
callq 0x26e6
testq %r12, %r12
movq 0x20(%rsp), %r14
je 0x1837f
movq 0x8(%r12), %rdi
callq 0x2040
movq 0x18(%r12), %rdi
callq 0x2040
movq 0x28(%r12), %rdi
callq 0x2040
movq 0x38(%r12), %rdi
callq 0x2040
movq 0x48(%r12), %rbx
testq %rbx, %rbx
je 0x18377
movq 0x18(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
movq %r12, %rdi
callq 0x2040
movq %r14, %rdi
callq 0x2030
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9c59(%rip), %r14      # 0x21ff8
movq (%r14), %rcx
leaq 0x2e69(%rip), %rdi      # 0x1b212
pushq $0x2f
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x2310
movq (%r14), %rcx
leaq 0x2a45(%rip), %rdi      # 0x1ae06
pushq $0x9
popq %rsi
movq %rbx, %rdx
callq 0x2310
movq (%r14), %rdi
leaq 0x2e6c(%rip), %rsi      # 0x1b242
movl 0x2c(%rsp), %edx
xorl %eax, %eax
callq 0x21c0
movq (%r14), %rdi
leaq 0x2e78(%rip), %rsi      # 0x1b263
movl 0x28(%rsp), %edx
xorl %eax, %eax
callq 0x21c0
jmp 0x18417
movq 0x9bf9(%rip), %rax      # 0x21ff8
movq (%rax), %rdi
leaq 0x2c0b(%rip), %rsi      # 0x1b014
leaq 0x2e7b(%rip), %rdx      # 0x1b28b
xorl %eax, %eax
callq 0x21c0
pushq $0x1
popq %rax
jmp 0x18389
movq 0x8(%rsp), %r15
addl %r14d, %r15d
jmp 0x18045
movl %eax, %r15d
movq 0x18(%rsp), %rbp
movq 0x38(%rsp), %r13
jmp 0x18045
movq 0x38(%rsp), %r13
leal (%r14,%r13), %edx
movq 0x8(%rsp), %r15
leal (%r15,%r14), %esi
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
callq 0x18468
addl %r14d, %r15d
incl %r15d
jmp 0x18045