// File: /workspace/github_c_makefile_star2_O3/lh3[P]fermi-lite/unitig.c
// Function: fml_fmi2mag_core
mag_t *fml_fmi2mag_core(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;
	mag_t *g;

	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);
	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]);
	g = (mag_t*)calloc(1, sizeof(mag_t));
	for (j = 0; j < n_threads; ++j) {
		kv_resize(magv_t, g->v, g->v.n + w.d[j].v.n);
		memcpy(g->v.a + g->v.n, w.d[j].v.a, w.d[j].v.n * sizeof(magv_t));
		g->v.n += w.d[j].v.n;
		free(w.d[j].v.a);
		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); free(w.used); free(w.bend); free(w.visited);

	mag_g_build_hash(g);
	mag_g_amend(g);
	g->rdist = mag_cal_rdist(g);
	return g;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x38(%rsp)
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %r12
movq 0x28(%rdi), %rax
movq 0x8(%rax), %rbx
leaq 0x3f(%rbx), %r14
shrq $0x6, %r14
movl $0x8, %esi
movq %r14, %rdi
movq %r14, 0x40(%rsp)
callq 0x2130
movq %rax, %r13
movq %rax, 0x10(%rsp)
movl $0x8, %esi
movq %r14, %rdi
callq 0x2130
movq %rax, %r14
movq %rax, 0x18(%rsp)
movl $0x8, %esi
movq 0x40(%rsp), %rdi
callq 0x2130
movq 0x38(%rsp), %rcx
movq %rax, 0x20(%rsp)
movq %r12, 0x28(%rsp)
leal (%rcx,%rcx), %eax
cltq
cmpq %rax, %rbx
jb 0xc0e9
movslq %ecx, %rdi
movl $0x170, %esi            # imm = 0x170
callq 0x2130
movq %rax, %rcx
movq %rax, 0x30(%rsp)
movl $0x1e241, %esi          # imm = 0x1E241
movl $0x1, %edi
leaq 0xbc58(%rip), %r8       # 0x17ab0
movq %rbx, %rax
xorl %edx, %edx
divq %rsi
testq %rdx, %rdx
jne 0xbe91
movq (%r8,%rdi,8), %rsi
incq %rdi
cmpq $0x6, %rdi
jne 0xbe58
leaq 0xbbd1(%rip), %rdi      # 0x17a4a
leaq 0xba71(%rip), %rsi      # 0x178f1
leaq 0xbb8d(%rip), %rcx      # 0x17a14
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x20e0
movq %rsi, 0x8(%rsp)
movq 0x38(%rsp), %rdi
movl %edi, %esi
testl %edi, %edi
jle 0xbed1
imulq $0x170, %rsi, %rax      # imm = 0x170
xorl %edx, %edx
movq %r12, 0x8(%rcx,%rdx)
movl %r15d, 0x10(%rcx,%rdx)
movl %ebp, 0x14(%rcx,%rdx)
movq %r13, 0x78(%rcx,%rdx)
movq %r14, 0x80(%rcx,%rdx)
addq $0x170, %rdx            # imm = 0x170
cmpq %rdx, %rax
jne 0xbeaa
movq %rsi, %r15
leaq 0x22d(%rip), %rsi       # 0xc108
leaq 0x8(%rsp), %rdx
movq %rdi, %r14
movq %rbx, %rcx
callq 0x14684
movl $0x1, %edi
movl $0x28, %esi
callq 0x2130
movq %rax, %rbx
testl %r14d, %r14d
jle 0xc08e
imulq $0x170, %r15, %r15      # imm = 0x170
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r13d, %r13d
movq 0x30(%rsp), %rax
movq 0x158(%rax,%r12), %rcx
leaq (%rcx,%rbp), %rdx
cmpq %rdx, %r13
jae 0xbf8c
decq %rdx
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %r13
shrq $0x10, %r13
orq %rcx, %r13
incq %r13
movq %r13, 0x8(%rbx)
imulq $0x68, %r13, %rsi
movq %r14, %rdi
callq 0x21c0
movq %rax, %r14
movq %rax, 0x10(%rbx)
movq (%rbx), %rbp
movq 0x30(%rsp), %rax
movq 0x158(%rax,%r12), %rcx
imulq $0x68, %rbp, %rdi
addq %r14, %rdi
movq 0x168(%rax,%r12), %rsi
imulq $0x68, %rcx, %rdx
callq 0x2170
movq 0x30(%rsp), %rax
movq (%rbx), %rbp
addq 0x158(%rax,%r12), %rbp
movq %rbp, (%rbx)
movq 0x168(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x28(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x40(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x58(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x70(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x120(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x138(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x140(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x148(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0x98(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0xd0(%rax,%r12), %rdi
callq 0x2040
movq 0x30(%rsp), %rax
movq 0xe8(%rax,%r12), %rdi
callq 0x2040
addq $0x170, %r12            # imm = 0x170
cmpq %r12, %r15
jne 0xbf18
movq 0x30(%rsp), %rdi
callq 0x2040
movq 0x10(%rsp), %rdi
callq 0x2040
movq 0x18(%rsp), %rdi
callq 0x2040
movq 0x20(%rsp), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0xefef
movq %rbx, %rdi
callq 0xf0ff
movq %rbx, %rdi
callq 0x1219c
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x18(%rbx)
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xb908(%rip), %rdi      # 0x179f8
leaq 0xb7fa(%rip), %rsi      # 0x178f1
leaq 0xb916(%rip), %rcx      # 0x17a14
movl $0x1a1, %edx            # imm = 0x1A1
callq 0x20e0