// File: /workspace/github_c_makefile_star2_O2/lh3[P]fermi2/unitig.c
// Function: fm6_unitig
int fm6_unitig(const rld_t *e, int min_match, int min_merge_len, int n_threads)
{
	extern void kt_for(int n_threads, void (*func)(void*,long,int), void *data, long n);
	worker_t w;
	int j;
	w.used    = (uint64_t*)calloc((e->mcnt[1] + 63)/64, 8);
	w.bend    = (uint64_t*)calloc((e->mcnt[1] + 63)/64, 8);
	w.visited = (uint64_t*)calloc((e->mcnt[1] + 63)/64, 8);
	w.e       = e;
	assert(e->mcnt[1] >= n_threads * 2);
	w.d = calloc(n_threads, sizeof(thrdat_t));
	w.prime = 0;
	for (j = 0; utg_primes[j] > 0; ++j)
		if (e->mcnt[1] % utg_primes[j] != 0) {
			w.prime = utg_primes[j];
			break;
		}
	assert(w.prime);
	if (fm_verbose >= 3) fprintf(stderr, "[M::%s] choose prime %llu\n", __func__, (unsigned long long)w.prime);
	for (j = 0; j < n_threads; ++j) {
		w.d[j].a.e = e; w.d[j].a.min_match = min_match; w.d[j].a.min_merge_len = min_merge_len;
		w.d[j].a.used = w.used; w.d[j].a.bend = w.bend;
	}
	kt_for(n_threads, worker, &w, e->mcnt[1]);
	for (j = 0; j < n_threads; ++j) {
		free(w.d[j].a.a[0].a); free(w.d[j].a.a[1].a); free(w.d[j].a.nei.a); free(w.d[j].a.cat.a);
		free(w.d[j].z.nei[0].a); free(w.d[j].z.nei[1].a); free(w.d[j].z.seq); free(w.d[j].z.cov);
		free(w.d[j].a.str.s); free(w.d[j].str.s); free(w.d[j].cov.s); free(w.d[j].out.s);
	}
	free(w.used); free(w.bend); free(w.visited);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x40(%rsp)
movl %edx, 0xc(%rsp)
movl %esi, %r15d
movq %rdi, %r14
movq 0x28(%rdi), %rax
movq 0x8(%rax), %rbp
leaq 0x3f(%rbp), %rbx
shrq $0x6, %rbx
pushq $0x8
popq %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2190
movq %rax, %r12
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2190
movq %rax, %r13
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
pushq $0x8
popq %rsi
callq 0x2190
movq 0x40(%rsp), %rcx
movq %rax, 0x28(%rsp)
movq %r14, 0x30(%rsp)
leal (%rcx,%rcx), %eax
cltq
cmpq %rax, %rbp
jb 0x13fa5
movslq %ecx, %rdi
movl $0x150, %esi            # imm = 0x150
callq 0x2190
movq %rax, %rbx
movq %rax, 0x38(%rsp)
xorl %esi, %esi
leaq 0x6e11(%rip), %rdi      # 0x1abd0
cmpq $0x28, %rsi
je 0x13f86
movq (%rsi,%rdi), %rcx
movq %rbp, %rax
xorl %edx, %edx
divq %rcx
addq $0x8, %rsi
testq %rdx, %rdx
je 0x13dbf
movq %rcx, 0x10(%rsp)
leaq 0xe476(%rip), %rax      # 0x22260
cmpl $0x2, (%rax)
jg 0x13f62
xorl %eax, %eax
movq 0x40(%rsp), %rdi
testl %edi, %edi
movl $0x0, %ecx
cmovgl %edi, %ecx
imulq $0x150, %rcx, %rbp      # imm = 0x150
movl 0xc(%rsp), %ecx
cmpq %rax, %rbp
je 0x13e37
movq %r14, 0x8(%rbx,%rax)
movl %r15d, 0x10(%rbx,%rax)
movl %ecx, 0x14(%rbx,%rax)
movq %r12, 0x78(%rbx,%rax)
movq %r13, 0x80(%rbx,%rax)
addq $0x150, %rax            # imm = 0x150
jmp 0x13e0f
movq 0x28(%r14), %rax
movq 0x8(%rax), %rcx
leaq 0x17e(%rip), %rsi       # 0x13fc4
leaq 0x10(%rsp), %rdx
callq 0x247c
xorl %ebx, %ebx
cmpq %rbx, %rbp
je 0x13f33
movq 0x38(%rsp), %rax
movq 0x28(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x40(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x58(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x70(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x118(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x130(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x138(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x140(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0x90(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0xc0(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0xd0(%rax,%rbx), %rdi
callq 0x2040
movq 0x38(%rsp), %rax
movq 0xe0(%rax,%rbx), %rdi
callq 0x2040
addq $0x150, %rbx            # imm = 0x150
jmp 0x13e52
movq 0x18(%rsp), %rdi
callq 0x2040
movq 0x20(%rsp), %rdi
callq 0x2040
movq 0x28(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xe08f(%rip), %rax      # 0x21ff8
movq (%rax), %rdi
leaq 0x6b29(%rip), %rsi      # 0x1aa9c
leaq 0x6b3d(%rip), %rdx      # 0x1aab7
xorl %eax, %eax
callq 0x21c0
jmp 0x13df3
leaq 0x6b07(%rip), %rdi      # 0x1aa94
leaq 0x69b0(%rip), %rsi      # 0x1a944
leaq 0x6acc(%rip), %rcx      # 0x1aa67
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x2120
leaq 0x6a9f(%rip), %rdi      # 0x1aa4b
leaq 0x6991(%rip), %rsi      # 0x1a944
leaq 0x6aad(%rip), %rcx      # 0x1aa67
movl $0x19e, %edx            # imm = 0x19E
callq 0x2120