// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r14
movq 0x28(%rdi), %rax
movq 0x8(%rax), %r12
leaq 0x3f(%r12), %r13
shrq $0x6, %r13
movl $0x8, %esi
movq %r13, %rdi
callq 0x2190
movq %rax, 0x10(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x2190
movq %rax, 0x18(%rsp)
movl $0x8, %esi
movq %r13, %rdi
callq 0x2190
movq %rax, 0x20(%rsp)
movq %r14, 0x28(%rsp)
leal (%rbx,%rbx), %eax
cltq
cmpq %rax, %r12
jb 0x161f1
movslq %ebx, %rdi
movl $0x150, %esi            # imm = 0x150
callq 0x2190
movq %rax, 0x30(%rsp)
movq $0x0, 0x8(%rsp)
movl $0x1e241, %ecx          # imm = 0x1E241
movl $0x1, %esi
leaq 0x7ad0(%rip), %rdi      # 0x1dae0
movq %r12, %rax
xorl %edx, %edx
divq %rcx
testq %rdx, %rdx
jne 0x1602c
movq (%rdi,%rsi,8), %rcx
incq %rsi
cmpq $0x6, %rsi
jne 0x16010
jmp 0x16031
movq %rcx, 0x8(%rsp)
movq 0x8(%rsp), %rcx
testq %rcx, %rcx
je 0x16210
leaq 0xe21a(%rip), %rax      # 0x24260
cmpl $0x3, (%rax)
jge 0x161cd
movl %ebx, %r12d
testl %ebx, %ebx
jle 0x16095
movq 0x30(%rsp), %rax
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rdx
imulq $0x150, %r12, %rsi      # imm = 0x150
xorl %edi, %edi
movq %r14, 0x8(%rax,%rdi)
movl %r15d, 0x10(%rax,%rdi)
movl %ebp, 0x14(%rax,%rdi)
movq %rcx, 0x78(%rax,%rdi)
movq %rdx, 0x80(%rax,%rdi)
addq $0x150, %rdi            # imm = 0x150
cmpq %rdi, %rsi
jne 0x1606e
movq 0x28(%r14), %rax
movq 0x8(%rax), %rcx
leaq 0x18b(%rip), %rsi       # 0x1622f
leaq 0x8(%rsp), %rdx
movl %ebx, %edi
callq 0x360c
testl %ebx, %ebx
jle 0x1619e
imulq $0x150, %r12, %rbx      # imm = 0x150
xorl %r14d, %r14d
movq 0x30(%rsp), %rax
movq 0x28(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x40(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x58(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x70(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x118(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x130(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x138(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x140(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x90(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0xc0(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0xd0(%rax,%r14), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0xe0(%rax,%r14), %rdi
callq 0x2040
addq $0x150, %r14            # imm = 0x150
cmpq %r14, %rbx
jne 0x160c2
movq 0x10(%rsp), %rdi
callq 0x2040
movq 0x18(%rsp), %rdi
callq 0x2040
movq 0x20(%rsp), %rdi
callq 0x2040
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xde24(%rip), %rax      # 0x23ff8
movq (%rax), %rdi
leaq 0x77ce(%rip), %rsi      # 0x1d9ac
leaq 0x77e2(%rip), %rdx      # 0x1d9c7
xorl %eax, %eax
callq 0x21c0
jmp 0x1604f
leaq 0x7763(%rip), %rdi      # 0x1d95b
leaq 0x7655(%rip), %rsi      # 0x1d854
leaq 0x7771(%rip), %rcx      # 0x1d977
movl $0x19e, %edx            # imm = 0x19E
callq 0x2120
leaq 0x778d(%rip), %rdi      # 0x1d9a4
leaq 0x7636(%rip), %rsi      # 0x1d854
leaq 0x7752(%rip), %rcx      # 0x1d977
movl $0x1a6, %edx            # imm = 0x1A6
callq 0x2120