// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/htab.cpp
// Function: ha_pt_insert_list(ha_pt_s*, int, ha_mz1_t const*)
int ha_pt_insert_list(ha_pt_t *h, int n, const ha_mz1_t *a)
{
	int j, mask = (1<<h->pre) - 1, n_ins = 0;
	ha_pt1_t *g;
	if (n == 0) return 0;
	g = &h->h[a[0].x&mask];
	for (j = 0; j < n; ++j) {
		uint64_t x = a[j].x >> h->pre;
		khint_t k;
		int n;
		ha_idxpos_t *p;
		assert((a[j].x&mask) == (a[0].x&mask));
		k = yak_pt_get(g->h, x<<YAK_COUNTER_BITS);
		if (k == kh_end(g->h)) continue; // TODO: understand why we sometimes come here
		n = kh_key(g->h, k) & YAK_MAX_COUNT;
		assert(n < YAK_MAX_COUNT);
		p = &g->a[kh_val(g->h, k) + n];
		p->rid = a[j].rid, p->rev = a[j].rev, p->pos = a[j].pos, p->span = a[j].span;
		//(uint64_t)a[j].rid<<36 | (uint64_t)a[j].rev<<35 | (uint64_t)a[j].pos<<8 | (uint64_t)a[j].span;
		++kh_key(g->h, k);
		++n_ins;
	}
	return n_ins;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
testl %esi, %esi
je 0xd4ba8
movq %rdx, %rbx
movl %esi, %ebp
movabsq $-0x80000000000001, %rax # imm = 0xFF7FFFFFFFFFFFFF
movabsq $0x7ffffff0000000, %rdx # imm = 0x7FFFFFF0000000
movb 0x4(%rdi), %cl
pushq $-0x1
popq %r13
shll %cl, %r13d
notl %r13d
movq %r13, 0x20(%rsp)
andl (%rbx), %r13d
shlq $0x5, %r13
addq 0x18(%rdi), %r13
xorl %r15d, %r15d
testl %esi, %esi
cmovlel %r15d, %ebp
shlq $0x4, %rbp
movl $0x10000000, %ecx       # imm = 0x10000000
addq %rcx, %rdx
movq %rdx, 0x10(%rsp)
addq %rax, %rcx
movq %rcx, 0x18(%rsp)
movl $0x0, 0xc(%rsp)
cmpq %r15, %rbp
je 0xd4ba2
movq (%rbx,%r15), %rsi
movl (%rbx), %eax
xorl %esi, %eax
testl %eax, 0x20(%rsp)
jne 0xd4bb9
movq %rdi, %r14
movb 0x4(%rdi), %cl
shrq %cl, %rsi
movq (%r13), %r12
shlq $0xc, %rsi
movq %r12, %rdi
callq 0xd4bf7
movq 0x10(%r12), %rdx
testq %rdx, %rdx
je 0xd4ad8
movb (%r12), %cl
pushq $0x1
popq %rsi
shll %cl, %esi
jmp 0xd4ada
xorl %esi, %esi
cmpl %esi, %eax
je 0xd4b96
movl %eax, %eax
shlq $0x4, %rax
movq (%rdx,%rax), %rcx
movl $0xfff, %esi            # imm = 0xFFF
andq %rsi, %rcx
cmpq %rsi, %rcx
je 0xd4bd8
addq %rax, %rdx
movq 0x8(%rdx), %rdx
shlq $0x3, %rdx
addq 0x10(%r13), %rdx
movq 0x8(%rbx,%r15), %rsi
andl $0xfffffff, %esi        # imm = 0xFFFFFFF
movq (%rdx,%rcx,8), %rdi
movq $-0x10000000, %r8       # imm = 0xF0000000
andq %r8, %rdi
orq %rsi, %rdi
movq %rdi, (%rdx,%rcx,8)
movq 0x8(%rbx,%r15), %rsi
andq 0x10(%rsp), %rsi
movabsq $-0x80000000000001, %r8 # imm = 0xFF7FFFFFFFFFFFFF
andq %r8, %rdi
orq %rsi, %rdi
movq %rdi, (%rdx,%rcx,8)
movq 0x8(%rbx,%r15), %rsi
movabsq $0x7ffffff0000000, %r8  # imm = 0x7FFFFFF0000000
andq %r8, %rsi
andq 0x18(%rsp), %rdi
orq %rsi, %rdi
movq %rdi, (%rdx,%rcx,8)
movzbl 0xf(%rbx,%r15), %esi
shlq $0x38, %rsi
movabsq $0xffffffffffffff, %r8  # imm = 0xFFFFFFFFFFFFFF
andq %r8, %rdi
orq %rsi, %rdi
movq %rdi, (%rdx,%rcx,8)
movq (%r13), %rcx
movq 0x10(%rcx), %rcx
incq (%rcx,%rax)
incl 0xc(%rsp)
addq $0x10, %r15
movq %r14, %rdi
jmp 0xd4a8f
movl 0xc(%rsp), %eax
jmp 0xd4baa
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x117040(%rip), %rdi    # 0x1ebc00
leaq 0x117058(%rip), %rsi    # 0x1ebc1f
leaq 0x11705a(%rip), %rcx    # 0x1ebc28
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x2110
leaq 0x117081(%rip), %rdi    # 0x1ebc60
leaq 0x117039(%rip), %rsi    # 0x1ebc1f
leaq 0x11703b(%rip), %rcx    # 0x1ebc28
movl $0x1c4, %edx            # imm = 0x1C4
callq 0x2110