// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/inter.cpp
// Function: fill_ctg_path_trans_idx(glchain_t*, unsigned long, unsigned long, unsigned int, unsigned int, kv_u_trans_t*)
void fill_ctg_path_trans_idx(glchain_t *a, uint64_t n, uint64_t qn, uint32_t qoff, uint32_t toff, kv_u_trans_t *ou)
{
	kv_resize(uint64_t, ou->idx, qn);
	memset(ou->idx.a, -1, sizeof((*(ou->idx.a)))*qn); 

	uint64_t i, k, l, pn; kv_ul_ov_t *s = NULL; u_trans_t *z = NULL;
	for(i = pn = 0; i < n; i++) {
		s = &(a[i].tk); pn += s->n;
		for (k = 1, l = 0; k <= s->n; k++) {
			if(k == s->n || s->a[l].qn != s->a[k].qn) {
				assert(ou->idx.a[s->a[l].qn] == (uint64_t)-1);
				ou->idx.a[s->a[l].qn] = (i<<32)|l;
				l = k;
			}
		}
	}
	kv_resize(u_trans_t, *ou, ou->n+(pn<<1)); l = ou->n;

	for (i = 0; i < qn; i++) {
		if(ou->idx.a[i] == (uint64_t)-1) {
			ou->idx.a[i] = 0; continue;
		}
		s = &(a[ou->idx.a[i]>>32].tk);
		for(k = l = (uint32_t)ou->idx.a[i]; k < s->n && s->a[l].qn == s->a[k].qn; k++) {
			kv_pushp(u_trans_t, *ou, &z);
			z->qn = s->a[k].qn+qoff; z->qs = s->a[k].qs; z->qe = s->a[k].qe; 
			z->tn = s->a[k].tn+toff; z->ts = s->a[k].ts; z->te = s->a[k].te; 
			z->rev = s->a[k].rev; 	 z->f = s->a[k].el;  z->nw = s->a[k].sec; 
			z->occ = s->a[k].sec;    z->del = 0;


			kv_pushp(u_trans_t, *ou, &z);
			z->tn = s->a[k].qn+qoff; z->ts = s->a[k].qs; z->te = s->a[k].qe; 
			z->qn = s->a[k].tn+toff; z->qs = s->a[k].ts; z->qe = s->a[k].te; 
			z->rev = s->a[k].rev; 	 z->f = s->a[k].el;  z->nw = s->a[k].sec; 
			z->occ = s->a[k].sec;    z->del = 0;

		}
		// p->idx.a[i] = pn - (k - l); p->idx.a[i] <<= 32; p->idx.a[i] |= k - l; ///pn += k - l;
	}
	// assert(l + (pn<<1) == ou->n);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movl %r8d, 0xc(%rsp)
movl %ecx, 0x8(%rsp)
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %r12
cmpq %rdx, 0x20(%r9)
jae 0x1def52
leaq -0x1(%rbp), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x20(%rbx)
movq 0x28(%rbx), %rdi
leaq 0x8(,%rcx,8), %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, 0x28(%rbx)
jmp 0x1def56
movq 0x28(%rbx), %rdi
leaq (,%rbp,8), %rdx
movl $0xff, %esi
callq 0x20e0
xorl %eax, %eax
testq %r13, %r13
je 0x1deff4
xorl %ecx, %ecx
imulq $0x68, %rcx, %rsi
movq 0x20(%r12,%rsi), %rdx
testq %rdx, %rdx
je 0x1defe6
addq %r12, %rsi
addq $0x18, %rsi
movq %rcx, %rdi
shlq $0x20, %rdi
movq (%rsi), %r8
leaq 0x1c(%r8), %r9
movl $0x1, %r10d
movq %rdx, %r14
xorl %r11d, %r11d
leaq (%r11,%r11,8), %r15
leaq (%r15,%r15,2), %r15
addq %r11, %r15
movl (%r8,%r15), %r15d
cmpq %r14, %r10
je 0x1defbd
cmpl (%r9), %r15d
je 0x1defda
movq 0x28(%rbx), %r14
cmpq $-0x1, (%r14,%r15,8)
jne 0x1df2c1
orq %rdi, %r11
movq %r11, (%r14,%r15,8)
movq 0x8(%rsi), %r14
movq %r10, %r11
incq %r10
addq $0x1c, %r9
cmpq %r14, %r10
jbe 0x1defa4
addq %rdx, %rax
incq %rcx
cmpq %r13, %rcx
jne 0x1def75
addq %rax, %rax
movq %r12, 0x10(%rsp)
addq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x1df052
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
incq %rcx
movq %rcx, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
testq %rbp, %rbp
je 0x1df2b2
xorl %r13d, %r13d
movl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
movq %rbp, 0x18(%rsp)
movq 0x28(%rbx), %rcx
movq (%rcx,%r13,8), %rax
cmpq $-0x1, %rax
je 0x1df299
movq %rax, %rcx
shrq $0x20, %rcx
imulq $0x68, %rcx, %rcx
movl %eax, %r15d
movq 0x10(%rsp), %rax
cmpq 0x20(%rax,%rcx), %r15
jae 0x1df2a1
movq 0x10(%rsp), %rax
leaq (%rax,%rcx), %rbp
addq $0x18, %rbp
leaq (%r15,%r15,8), %rax
leaq (%rax,%rax,2), %r14
addq %r15, %r14
movq %r14, 0x20(%rsp)
movq (%rbp), %rdx
movq 0x20(%rsp), %rax
movl (%rdx,%rax), %esi
cmpl (%rdx,%r14), %esi
jne 0x1df2a1
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x1df10c
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rbx)
shlq $0x4, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq (%rbp), %rdx
movl (%rdx,%r14), %esi
leaq 0x1(%rcx), %rdi
movq %rdi, (%rbx)
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
addl 0x8(%rsp), %esi
movl %esi, 0x8(%rax,%rcx)
movq 0x4(%rdx,%r14), %rsi
movq %rsi, (%rax,%rcx)
movl 0xc(%rdx,%r14), %esi
addl 0xc(%rsp), %esi
movl %esi, 0x14(%rax,%rcx)
movq 0x10(%rdx,%r14), %rsi
movq %rsi, 0xc(%rax,%rcx)
movl 0x18(%rdx,%r14), %edx
movb 0x28(%rax,%rcx), %sil
shrl $0x19, %edx
andb $0x40, %dl
andb $-0x41, %sil
orb %dl, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%rbp), %rdi
movl 0x18(%rdi,%r14), %edi
shrl $0x1e, %edi
andb $0x1, %dil
andb $-0x40, %sil
orb %dil, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%rbp), %rsi
movl 0x18(%rsi,%r14), %r8d
andl %r12d, %r8d
xorps %xmm0, %xmm0
cvtsi2sd %r8d, %xmm0
movsd %xmm0, 0x20(%rax,%rcx)
movl 0x18(%rsi,%r14), %esi
andl %r12d, %esi
movl %esi, 0x18(%rax,%rcx)
orb %dl, %dil
movb %dil, 0x28(%rax,%rcx)
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x1df1e1
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rbx)
shlq $0x4, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
movq (%rbp), %rdx
movl (%rdx,%r14), %esi
addl 0x8(%rsp), %esi
movl %esi, 0x14(%rax,%rcx)
movq 0x4(%rdx,%r14), %rsi
movq %rsi, 0xc(%rax,%rcx)
movl 0xc(%rdx,%r14), %esi
addl 0xc(%rsp), %esi
movl %esi, 0x8(%rax,%rcx)
movq 0x10(%rdx,%r14), %rsi
movq %rsi, (%rax,%rcx)
movl 0x18(%rdx,%r14), %edx
movb 0x28(%rax,%rcx), %sil
shrl $0x19, %edx
andb $0x40, %dl
andb $-0x41, %sil
orb %dl, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%rbp), %rdi
movl 0x18(%rdi,%r14), %edi
shrl $0x1e, %edi
andb $0x1, %dil
andb $-0x40, %sil
orb %dil, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%rbp), %rsi
movl 0x18(%rsi,%r14), %r8d
andl %r12d, %r8d
xorps %xmm0, %xmm0
cvtsi2sd %r8d, %xmm0
movsd %xmm0, 0x20(%rax,%rcx)
movl 0x18(%rsi,%r14), %esi
andl %r12d, %esi
movl %esi, 0x18(%rax,%rcx)
orb %dl, %dil
movb %dil, 0x28(%rax,%rcx)
incq %r15
addq $0x1c, %r14
cmpq 0x8(%rbp), %r15
jb 0x1df0b6
jmp 0x1df2a1
movq $0x0, (%rcx,%r13,8)
incq %r13
movq 0x18(%rsp), %rbp
cmpq %rbp, %r13
jne 0x1df069
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x648dd(%rip), %rdi     # 0x243ba5
leaq 0x6098c(%rip), %rsi     # 0x23fc5b
leaq 0x648f5(%rip), %rcx     # 0x243bcb
movl $0x49e7, %edx           # imm = 0x49E7
callq 0x2110