// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %rsi, %r15
movl %edi, %r12d
pushq $0x1
popq %rcx
pushq $0x33
popq %rax
movl %eax, 0x8(%rsp)
xorl %r14d, %r14d
leaq 0xf123(%rip), %r13      # 0x19e30
xorl %ebp, %ebp
movl %ecx, 0x4(%rsp)
movl %ecx, %ebx
movl %ebp, 0xc(%rsp)
movl %r12d, %edi
movq %r15, %rsi
movq %r13, %rdx
callq 0x22f0
testl %eax, %eax
js 0xad92
cmpl $0x32, %eax
je 0xad6e
cmpl $0x62, %eax
je 0xad8a
cmpl $0x74, %eax
je 0xad77
cmpl $0x6f, %eax
je 0xad59
cmpl $0x6b, %eax
jne 0xad19
movq 0x1728d(%rip), %rax     # 0x21fd8
movq (%rax), %rdi
callq 0x2300
movl %eax, 0x8(%rsp)
jmp 0xad19
movq 0x17278(%rip), %rax     # 0x21fd8
movq (%rax), %rdi
callq 0x2300
movl %eax, 0x4(%rsp)
jmp 0xad19
pushq $0x1
popq %rax
movl %eax, 0xc(%rsp)
jmp 0xad19
movq 0x1725a(%rip), %rax     # 0x21fd8
movq (%rax), %rdi
callq 0x2300
movl %eax, %ebx
jmp 0xad19
movb $0x1, %r14b
pushq $0x1
popq %rbp
jmp 0xad15
movl 0xc(%rsp), %r13d
movl %r13d, 0x28(%rsp)
movl %ebp, 0x2c(%rsp)
movl 0x4(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x8(%rsp), %ebp
movl %ebp, 0x20(%rsp)
cmpl $0x2, %eax
setl %al
andb %al, %r14b
cmpb $0x1, %r14b
jne 0xadce
movl $0x2, 0x24(%rsp)
pushq $0x2
popq %rax
movl %eax, 0x4(%rsp)
movq 0x171fb(%rip), %rax     # 0x21fd0
movslq (%rax), %r14
cmpl %r12d, %r14d
je 0xae9d
movslq %ebx, %rdi
pushq $0x10
popq %rsi
callq 0x2190
movq %rax, 0x30(%rsp)
movq (%r15,%r14,8), %rdi
callq 0x2f1e
movq %rax, 0x10(%rsp)
movq %rax, 0x18(%rsp)
testb $0x1, %bpl
je 0xaf44
leaq 0x18(%rsp), %rax
testl %r13d, %r13d
je 0xae36
leaq 0x15d(%rip), %r10       # 0xaf7c
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdi
movl %edi, %edx
movl %ebp, %ecx
movl %ebx, %r8d
xorl %r9d, %r9d
pushq %rax
pushq %r10
jmp 0xae4f
leaq 0x323(%rip), %r9        # 0xb160
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdi
movl %edi, %edx
movl %ebp, %ecx
movl %ebx, %r8d
pushq %rax
pushq $0x0
callq 0xac14
popq %rax
popq %rcx
movq 0x10(%rsp), %rdi
callq 0x26e6
xorl %r14d, %r14d
testl %ebx, %ebx
cmovlel %r14d, %ebx
shlq $0x4, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rbx
je 0xae87
movq 0x8(%rdi,%r14), %rdi
callq 0x2040
addq $0x10, %r14
jmp 0xae6d
callq 0x2040
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x17154(%rip), %r14     # 0x21ff8
movq (%r14), %rsi
pushq $0xa
popq %r15
movl %r15d, %edi
callq 0x2170
movq (%r14), %rcx
leaq 0xef7c(%rip), %rdi      # 0x19e39
pushq $0x2a
popq %rsi
pushq $0x1
popq %r12
movq %r12, %rdx
callq 0x2310
movq (%r14), %rdi
leaq 0xef8e(%rip), %rsi      # 0x19e64
movl %ebp, %edx
xorl %eax, %eax
callq 0x21c0
movq (%r14), %rdi
leaq 0xefa3(%rip), %rsi      # 0x19e8c
movl 0x4(%rsp), %edx
xorl %eax, %eax
callq 0x21c0
movq (%r14), %rdi
leaq 0xefb7(%rip), %rsi      # 0x19eb5
movl %ebx, %edx
xorl %eax, %eax
callq 0x21c0
movq (%r14), %rcx
leaq 0xefd1(%rip), %rdi      # 0x19ee2
pushq $0x3e
popq %rsi
movq %r12, %rdx
callq 0x2310
movq (%r14), %rcx
leaq 0xeffb(%rip), %rdi      # 0x19f21
pushq $0x2c
popq %rsi
movq %r12, %rdx
callq 0x2310
movq (%r14), %rsi
movl %r15d, %edi
callq 0x2170
pushq $0x1
popq %rax
jmp 0xae8e
movl %ebp, %r14d
orl $0x1, %r14d
movl %r14d, 0x20(%rsp)
movq 0x170a1(%rip), %rax     # 0x21ff8
movq (%rax), %rdi
leaq 0xefed(%rip), %rsi      # 0x19f4e
leaq 0xf014(%rip), %rdx      # 0x19f7c
movl %ebp, %ecx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x21c0
movl %r14d, %ebp
jmp 0xae0e