// File: /workspace/github_c_makefile_star2_O0/lh3[P]miniprot/index.c
// Function: build_bidx
static void build_bidx(const mp_idxopt_t *io, mp_idx_t *mi, const mp64_v *a)
{
	int32_t i, j, n_a = mi->nt->n_ctg * 2;
	int64_t tmp;
	uint32_t n_kmer;
	n_kmer = mp_n_bucket(io);
	mi->ki = Kcalloc(0, int64_t, n_kmer);
	for (i = 0; i < n_a; ++i) { // count
		const mp64_v *b = &a[i];
		for (j = 0; j < b->n; ++j)
			++mi->ki[b->a[j]>>32];
	}
	for (i = 0, mi->n_kb = 0; i < n_kmer; ++i)
		mi->n_kb += mi->ki[i], mi->ki[i] = mi->n_kb - mi->ki[i];
	mi->kb = Kmalloc(0, uint32_t, mi->n_kb);
	for (i = 0; i < n_a; ++i) {
		const mp64_v *b = &a[i];
		for (j = 0; j < b->n; ++j)
			mi->kb[mi->ki[b->a[j]>>32]++] = (uint32_t)b->a[j];
	}
	for (i = 0, tmp = 0; i < n_kmer; ++i) {
		int64_t t = tmp;
		tmp = mi->ki[i], mi->ki[i] -= tmp - t;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
shll %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5b60
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %esi
xorl %eax, %eax
movl %eax, %edi
movl $0x8, %edx
callq 0xab60
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x58c1
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x58b4
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x20(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
movq (%rax,%rcx,8), %rdx
addq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5876
jmp 0x58b6
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5854
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x20(%rax)
movl -0x1c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x592b
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x10(%rbp), %rax
addq 0x20(%rax), %rcx
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
subq (%rax,%rcx,8), %rdx
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x58d4
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
shlq $0x2, %rsi
xorl %eax, %eax
movl %eax, %edi
callq 0xaeb0
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x59e6
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x59d6
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rsi
movq -0x48(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x20(%rbp), %rdi
movq (%rcx,%rdi,8), %rdi
shrq $0x20, %rdi
movq (%rsi,%rdi,8), %rcx
movq %rcx, %r8
addq $0x1, %r8
movq %r8, (%rsi,%rdi,8)
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5978
jmp 0x59d8
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5952
movl $0x0, -0x1c(%rbp)
movq $0x0, -0x30(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x5a43
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
subq -0x50(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x59f5
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)