// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap/index.c
// Function: worker_post
static void worker_post(void *g, long i, int tid)
{
	int j, start_a, start_p, n, n_keys;
	idxhash_t *h;
	mm_idx_t *mi = (mm_idx_t*)g;
	mm_idx_bucket_t *b = &mi->B[i];
	if (b->a.n == 0) return;

	// sort by minimizer
	radix_sort_128x(b->a.a, b->a.a + b->a.n);

	// count and preallocate
	for (j = 1, n = 1, n_keys = 0, b->n = 0; j <= b->a.n; ++j) {
		if (j == b->a.n || b->a.a[j].x != b->a.a[j-1].x) {
			++n_keys;
			if (n > 1) b->n += n;
			n = 1;
		} else ++n;
	}
	h = kh_init(idx);
	kh_resize(idx, h, n_keys);
	b->p = (uint64_t*)calloc(b->n, 8);

	// create the hash table
	for (j = 1, n = 1, start_a = start_p = 0; j <= b->a.n; ++j) {
		if (j == b->a.n || b->a.a[j].x != b->a.a[j-1].x) {
			khint_t itr;
			int absent;
			mm128_t *p = &b->a.a[j-1];
			itr = kh_put(idx, h, p->x>>mi->b<<1, &absent);
			assert(absent && j - start_a == n);
			if (n == 1) {
				kh_key(h, itr) |= 1;
				kh_val(h, itr) = p->y;
			} else {
				int k;
				for (k = 0; k < n; ++k)
					b->p[start_p + k] = b->a.a[start_a + k].y;
				kh_val(h, itr) = (uint64_t)start_p<<32 | n;
				start_p += n;
			}
			start_a = j, n = 1;
		} else ++n;
	}
	b->h = h;
	assert(b->n == start_p);

	// deallocate and clear b->a
	free(b->a.a);
	b->a.n = b->a.m = 0, b->a.a = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x630e
jmp 0x662b
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x40(%rbp), %rax
movq (%rax), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0x33e0
movl $0x1, -0x18(%rbp)
movl $0x1, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x40(%rbp), %rax
movl $0x0, 0x18(%rax)
movslq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq (%rcx), %rax
ja 0x63dc
movslq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq (%rcx), %rax
je 0x639e
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x18(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
je 0x63c3
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
cmpl $0x1, -0x24(%rbp)
jle 0x63ba
movl -0x24(%rbp), %ecx
movq -0x40(%rbp), %rax
addl 0x18(%rax), %ecx
movl %ecx, 0x18(%rax)
movl $0x1, -0x24(%rbp)
jmp 0x63cc
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x63ce
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x6351
callq 0x5970
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movl -0x28(%rbp), %esi
callq 0x5990
movq -0x40(%rbp), %rax
movslq 0x18(%rax), %rdi
movl $0x8, %esi
callq 0x2150
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movl $0x1, -0x18(%rbp)
movl $0x1, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x1c(%rbp)
movslq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq (%rcx), %rax
ja 0x65c2
movslq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq (%rcx), %rax
je 0x647f
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x18(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x18(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq (%rcx), %rax
je 0x65a9
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movq -0x50(%rbp), %rax
movq (%rax), %rsi
movq -0x38(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
shrq %cl, %rsi
shlq %rsi
leaq -0x48(%rbp), %rdx
callq 0x5e50
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x48(%rbp)
je 0x64d3
movl -0x18(%rbp), %eax
subl -0x1c(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x64d3
jmp 0x64f2
leaq 0x630c(%rip), %rdi      # 0xc7e6
leaq 0x6265(%rip), %rsi      # 0xc746
movl $0x7d, %edx
leaq 0x6314(%rip), %rcx      # 0xc801
callq 0x2120
cmpl $0x1, -0x24(%rbp)
jne 0x6528
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x44(%rbp), %ecx
movq (%rax,%rcx,8), %rdx
orq $0x1, %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x50(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x44(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
jmp 0x659a
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x6573
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x1c(%rbp), %ecx
addl -0x54(%rbp), %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x20(%rbp), %ecx
addl -0x54(%rbp), %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x652f
movslq -0x20(%rbp), %rdx
shlq $0x20, %rdx
movslq -0x24(%rbp), %rax
orq %rax, %rdx
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x44(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl $0x1, -0x24(%rbp)
jmp 0x65b2
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x65b4
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x642a
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x40(%rbp), %rax
movl 0x18(%rax), %eax
cmpl -0x20(%rbp), %eax
jne 0x65dc
jmp 0x65fb
leaq 0x6242(%rip), %rdi      # 0xc825
leaq 0x615c(%rip), %rsi      # 0xc746
movl $0x8c, %edx
leaq 0x620b(%rip), %rcx      # 0xc801
callq 0x2120
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x40(%rbp), %rax
movq $0x0, (%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x10(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)