// File: /workspace/github_c_makefile_star2_O0/lh3[P]miniprot/index.c
// Function: mp_idx_build
mp_idx_t *mp_idx_build(const char *fn, const mp_idxopt_t *io, int32_t n_threads)
{
	mp_ntdb_t *nt;
	mp_idx_t *mi;
	worker_aux_t aux;
	int32_t i;

	nt = mp_ntseq_read(fn);
	if (nt == 0) return 0;

	mi = Kcalloc(0, mp_idx_t, 1);
	mi->opt = *io;
	mi->nt = nt;
	mi->bo = mp_idx_boff(mi->nt, io->bbit, &mi->n_block);
	if (mp_verbose >= 3)
		fprintf(stderr, "[M::%s@%.3f*%.2f] %d blocks\n", __func__, mp_realtime(), mp_percent_cpu(), mi->n_block);

	memset(&aux, 0, sizeof(aux));
	aux.mi = mi;
	aux.km = Kcalloc(0, void*, n_threads);
	aux.km_tmp = Kcalloc(0, void*, n_threads);
	aux.a = Kcalloc(0, mp64_v, nt->n_ctg * 2);
	for (i = 0; i < n_threads; ++i) {
		aux.km[i] = km_init();
		aux.km_tmp[i] = km_init();
	}
	kt_for(n_threads, build_worker, &aux, nt->n_ctg * 2);
	if (mp_verbose >= 3)
		fprintf(stderr, "[M::%s@%.3f*%.2f] collected syncmers\n", __func__, mp_realtime(), mp_percent_cpu());
	build_bidx(io, mi, aux.a);
	if (mp_verbose >= 3)
		fprintf(stderr, "[M::%s@%.3f*%.2f] %ld kmer-block pairs\n", __func__, mp_realtime(), mp_percent_cpu(), (long)mi->n_kb);

	for (i = 0; i < n_threads; ++i) {
		km_destroy(aux.km[i]);
		km_destroy(aux.km_tmp[i]);
	}
	free(aux.a); free(aux.km);
	return mi;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x15fe0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x5397
movq $0x0, -0x8(%rbp)
jmp 0x5617
xorl %eax, %eax
movl %eax, %edi
movl $0x1, %esi
movl $0x40, %edx
callq 0xab60
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movl 0x10(%rcx), %ecx
movl %ecx, 0x10(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rax
movl (%rax), %esi
movq -0x30(%rbp), %rdx
addq $0x14, %rdx
callq 0x5100
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x30(%rax)
leaq 0x212d5(%rip), %rax     # 0x266d8
cmpl $0x3, (%rax)
jl 0x544d
movq 0x20be9(%rip), %rax     # 0x25ff8
movq (%rax), %rax
movq %rax, -0x68(%rbp)
callq 0x41a0
movsd %xmm0, -0x60(%rbp)
callq 0x4210
movq -0x68(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x1bf9d(%rip), %rsi     # 0x213dc
leaq 0x1bfb3(%rip), %rdx     # 0x213f9
movb $0x2, %al
callq 0x21f0
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2190
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movslq -0x1c(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
movl $0x8, %edx
callq 0xab60
movq %rax, -0x48(%rbp)
movslq -0x1c(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
movl $0x8, %edx
callq 0xab60
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
shll %eax
movslq %eax, %rsi
xorl %eax, %eax
movl %eax, %edi
movl $0x10, %edx
callq 0xab60
movq %rax, -0x38(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x54f0
callq 0xabf0
movq %rax, %rdx
movq -0x48(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
callq 0xabf0
movq %rax, %rdx
movq -0x40(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x54b5
movl -0x1c(%rbp), %edi
movq -0x28(%rbp), %rax
movl (%rax), %eax
shll %eax
movslq %eax, %rcx
leaq 0x12b(%rip), %rsi       # 0x5630
leaq -0x50(%rbp), %rdx
callq 0xb410
leaq 0x211c3(%rip), %rax     # 0x266d8
cmpl $0x3, (%rax)
jl 0x5558
movq 0x20ad7(%rip), %rax     # 0x25ff8
movq (%rax), %rax
movq %rax, -0x78(%rbp)
callq 0x41a0
movsd %xmm0, -0x70(%rbp)
callq 0x4210
movq -0x78(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x70(%rbp), %xmm0
leaq 0x1bebc(%rip), %rsi     # 0x21406
leaq 0x1bea8(%rip), %rdx     # 0x213f9
movb $0x2, %al
callq 0x21f0
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x5800
leaq 0x21168(%rip), %rax     # 0x266d8
cmpl $0x3, (%rax)
jl 0x55c1
movq 0x20a7c(%rip), %rax     # 0x25ff8
movq (%rax), %rax
movq %rax, -0x88(%rbp)
callq 0x41a0
movsd %xmm0, -0x80(%rbp)
callq 0x4210
movq -0x88(%rbp), %rdi
movaps %xmm0, %xmm1
movsd -0x80(%rbp), %xmm0
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rcx
leaq 0x1be79(%rip), %rsi     # 0x2142c
leaq 0x1be3f(%rip), %rdx     # 0x213f9
movb $0x2, %al
callq 0x21f0
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x55fd
movq -0x48(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xac10
movq -0x40(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xac10
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x55c8
movq -0x38(%rbp), %rdi
callq 0x2040
movq -0x48(%rbp), %rdi
callq 0x2040
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)