// File: /workspace/github_c_makefile_star2_O1/lh3[P]fermi2/dfs.c
// Function: main_count
int main_count(int argc, char *argv[])
{
	int i, c, n_threads = 1;
	dfs_count_t d;
	rld_t *e;
	memset(&d, 0, sizeof(dfs_count_t));
	d.len = 51, d.min_occ = 1;
	while ((c = getopt(argc, argv, "2bk:o:t:")) >= 0) {
		if (c == 'k') d.len = atoi(optarg);
		else if (c == 'o') d.min_occ = atoi(optarg);
		else if (c == 't') n_threads = atoi(optarg);
		else if (c == '2') d.bidir = 1;
		else if (c == 'b') d.bifur_only = d.bidir = 1;
	}
	if (d.bifur_only && d.min_occ < 2) d.min_occ = 2; // in the -b mode, we need to see at least 2 k-mers
	if (optind == argc) {
		fprintf(stderr, "\n");
		fprintf(stderr, "Usage:   fermi2 count [options] <in.fmd>\n\n");
		fprintf(stderr, "Options: -k INT      k-mer length [%d]\n", d.len);
		fprintf(stderr, "         -o INT      min occurence [%d]\n", d.min_occ);
		fprintf(stderr, "         -t INT      number of threads [%d]\n", n_threads);
		fprintf(stderr, "         -b          only print bifurcating k-mers (force -2)\n");
		fprintf(stderr, "         -2          bidirectional counting\n");
		fprintf(stderr, "\n");
		return 1;
	}
	d.str = calloc(n_threads, sizeof(kstring_t));
	d.e = e = rld_restore(argv[optind]);
	if (!(d.len&1)) {
		++d.len;
		if (dfs_verbose >= 2)
			fprintf(stderr, "[W::%s] %d is an even number; change k to %d\n", __func__, d.len-1, d.len);
	}
	if (d.bidir) fm_dfs(1, &e, 1, d.len, n_threads, 0, dfs_count2, &d);
	else fm_dfs(1, &e, 1, d.len, n_threads, dfs_count, 0, &d);
	rld_destroy(e);
	for (i = 0; i < n_threads; ++i) free(d.str[i].s);
	free(d.str);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movl %edi, %ebp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movabsq $0x100000033, %rax      # imm = 0x100000033
movq %rax, 0x8(%rsp)
leaq 0x10b8d(%rip), %rdx     # 0x1cd68
callq 0x22f0
movl $0x1, %ebx
testl %eax, %eax
js 0xc26e
movabsq $0x100000001, %r12      # imm = 0x100000001
leaq 0x10b6a(%rip), %r15     # 0x1cd68
movq 0x17dd3(%rip), %r13     # 0x23fd8
cmpl $0x6a, %eax
jle 0xc228
cmpl $0x74, %eax
je 0xc239
cmpl $0x6f, %eax
je 0xc246
cmpl $0x6b, %eax
jne 0xc25d
movq (%r13), %rdi
callq 0x2300
movl %eax, 0x8(%rsp)
jmp 0xc25d
cmpl $0x32, %eax
je 0xc255
cmpl $0x62, %eax
jne 0xc25d
movq %r12, 0x10(%rsp)
jmp 0xc25d
movq (%r13), %rdi
callq 0x2300
movl %eax, %ebx
jmp 0xc25d
movq (%r13), %rdi
callq 0x2300
movl %eax, 0xc(%rsp)
jmp 0xc25d
movl $0x1, 0x10(%rsp)
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x22f0
testl %eax, %eax
jns 0xc205
cmpl $0x0, 0x14(%rsp)
je 0xc284
cmpl $0x1, 0xc(%rsp)
jg 0xc284
movl $0x2, 0xc(%rsp)
movq 0x17d45(%rip), %rax     # 0x23fd0
movslq (%rax), %r15
cmpl %ebp, %r15d
je 0xc3b4
movslq %ebx, %rdi
movl $0x10, %esi
callq 0x2190
movq %rax, 0x18(%rsp)
movq (%r14,%r15,8), %rdi
callq 0x436c
movq %rax, 0x20(%rsp)
movq %rax, (%rsp)
movl 0x8(%rsp), %ecx
testb $0x1, %cl
je 0xc3cc
movl 0x8(%rsp), %esi
movl %esi, %eax
sarl %eax
cmpl $0x5, %eax
movl $0x5, %r8d
cmovll %eax, %r8d
leal (%r8,%r8), %ecx
movl $0x1, %eax
shll %cl, %eax
movl $0x1, %ecx
cmpl %ebx, %eax
movl %ebx, %edi
cmovll %eax, %edi
cmpl $0x0, 0x10(%rsp)
je 0xc327
leaq 0x28(%rsp), %rdx
movl %ecx, (%rdx)
leaq 0x20(%rsp), %r9
movq %r9, 0x10(%rdx)
movq %rsp, %r9
movq %r9, 0x18(%rdx)
movq $0x0, 0x20(%rdx)
leaq 0xdb(%rip), %r9         # 0xc3fc
movq %r9, 0x28(%rdx)
jmp 0xc351
leaq 0x28(%rsp), %rdx
movl %ecx, (%rdx)
leaq 0x20(%rsp), %r9
movq %r9, 0x10(%rdx)
movq %rsp, %r9
movq %r9, 0x18(%rdx)
leaq 0x410(%rip), %r9        # 0xc755
movq %r9, 0x20(%rdx)
movq $0x0, 0x28(%rdx)
movl %esi, 0x4(%rdx)
movl %ecx, 0xc(%rdx)
movl %r8d, 0x8(%rdx)
leaq -0x22e(%rip), %rsi      # 0xc134
movq %rax, %rcx
callq 0x360c
movq 0x20(%rsp), %rdi
callq 0x38cc
testl %ebx, %ebx
jle 0xc399
movl %ebx, %ebx
shlq $0x4, %rbx
xorl %r14d, %r14d
movq 0x18(%rsp), %rax
movq 0x8(%rax,%r14), %rdi
callq 0x2040
addq $0x10, %r14
cmpq %r14, %rbx
jne 0xc381
movq 0x18(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8(%rsp), %rdi
leaq 0xc(%rsp), %rsi
movl %ebx, %edx
callq 0x2c27
movl $0x1, %eax
jmp 0xc3a5
movl %ecx, %r8d
orl $0x1, %r8d
movl %r8d, 0x8(%rsp)
movq 0x17c19(%rip), %rax     # 0x23ff8
movq (%rax), %rdi
leaq 0x10a9d(%rip), %rsi     # 0x1ce86
leaq 0x10ac4(%rip), %rdx     # 0x1ceb4
xorl %eax, %eax
callq 0x21c0
jmp 0xc2c8