// File: /workspace/github_cpp_makefile_star2_O1/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
xorl %ebp, %ebp
testl %esi, %esi
je 0x1137a6
movb 0x4(%rdi), %cl
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
shll %cl, %r13d
testl %esi, %esi
jle 0x1137a6
movq %rdx, %rbx
notl %r13d
movq %r13, 0x20(%rsp)
andl (%rdx), %r13d
shlq $0x5, %r13
addq 0x18(%rdi), %r13
movabsq $-0x80000000000001, %rax # imm = 0xFF7FFFFFFFFFFFFF
movabsq $0x7ffffff0000000, %rcx # imm = 0x7FFFFFF0000000
movl %esi, %edx
shlq $0x4, %rdx
movq %rdx, 0x18(%rsp)
xorl %r14d, %r14d
movl $0x10000000, %edx       # imm = 0x10000000
addq %rdx, %rcx
movq %rcx, 0x8(%rsp)
addq %rax, %rdx
movq %rdx, 0x10(%rsp)
xorl %ebp, %ebp
movq (%rbx,%r14), %rsi
movl (%rbx), %eax
xorl %esi, %eax
testl %eax, 0x20(%rsp)
jne 0x1137b7
movq %rdi, %r12
movb 0x4(%rdi), %cl
shrq %cl, %rsi
movq (%r13), %r15
shlq $0xc, %rsi
movq %r15, %rdi
callq 0x1137f5
movq 0x10(%r15), %rdx
testq %rdx, %rdx
je 0x1136d8
movb (%r15), %cl
movl $0x1, %esi
shll %cl, %esi
jmp 0x1136da
xorl %esi, %esi
cmpl %esi, %eax
je 0x113794
movl %eax, %eax
shlq $0x4, %rax
movq (%rdx,%rax), %rcx
movl $0xfff, %esi            # imm = 0xFFF
andq %rsi, %rcx
cmpq %rsi, %rcx
je 0x1137d6
addq %rax, %rdx
movq 0x8(%rdx), %rdx
shlq $0x3, %rdx
addq 0x10(%r13), %rdx
movq 0x8(%rbx,%r14), %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,%r14), %rsi
andq 0x8(%rsp), %rsi
movabsq $-0x80000000000001, %r8 # imm = 0xFF7FFFFFFFFFFFFF
andq %r8, %rdi
orq %rsi, %rdi
movq %rdi, (%rdx,%rcx,8)
movq 0x8(%rbx,%r14), %rsi
movabsq $0x7ffffff0000000, %r8  # imm = 0x7FFFFFF0000000
andq %r8, %rsi
andq 0x10(%rsp), %rdi
orq %rsi, %rdi
movq %rdi, (%rdx,%rcx,8)
movzbl 0xf(%rbx,%r14), %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 %ebp
addq $0x10, %r14
cmpq %r14, 0x18(%rsp)
movq %r12, %rdi
jne 0x113698
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11a352(%rip), %rdi    # 0x22db10
leaq 0x11a36a(%rip), %rsi    # 0x22db2f
leaq 0x11a36c(%rip), %rcx    # 0x22db38
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x2110
leaq 0x11a393(%rip), %rdi    # 0x22db70
leaq 0x11a34b(%rip), %rsi    # 0x22db2f
leaq 0x11a34d(%rip), %rcx    # 0x22db38
movl $0x1c4, %edx            # imm = 0x1C4
callq 0x2110