// File: /workspace/github_cpp_makefile_star2_O1/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, %r12
movq %rsi, %r13
movq %rdi, 0x10(%rsp)
cmpq %rdx, 0x20(%r9)
jae 0x1d4f6e
leaq -0x1(%r12), %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, 0x28(%rbx)
movq 0x28(%rbx), %rdi
leaq (,%r12,8), %rdx
movl $0xff, %esi
callq 0x20e0
xorl %eax, %eax
testq %r13, %r13
je 0x1d5033
xorl %ecx, %ecx
imulq $0x68, %rcx, %rsi
movq 0x10(%rsp), %rdx
movq 0x20(%rdx,%rsi), %rdx
testq %rdx, %rdx
je 0x1d5021
movq 0x10(%rsp), %rdi
addq %rdi, %rsi
addq $0x18, %rsi
movq %rcx, %rdi
shlq $0x20, %rdi
movl $0x1, %r8d
movl $0x1c, %r9d
movq %rdx, %r11
xorl %r10d, %r10d
cmpq %r11, %r8
je 0x1d4fe6
movq (%rsi), %r11
leaq (%r10,%r10,8), %r14
leaq (%r14,%r14,2), %r14
addq %r10, %r14
movl (%r11,%r14), %ebp
cmpl (%r11,%r9), %ebp
je 0x1d5011
movq 0x28(%rbx), %r11
movq (%rsi), %r14
leaq (%r10,%r10,8), %r15
leaq (%r15,%r15,2), %r15
addq %r10, %r15
movl (%r14,%r15), %r14d
cmpq $-0x1, (%r11,%r14,8)
jne 0x1d531a
orq %rdi, %r10
movq %r10, (%r11,%r14,8)
movq %r8, %r10
incq %r8
movq 0x8(%rsi), %r11
addq $0x1c, %r9
cmpq %r11, %r8
jbe 0x1d4fc9
addq %rdx, %rax
incq %rcx
cmpq %r13, %rcx
jne 0x1d4f91
addq %rax, %rax
addq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x1d508c
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)
movq %r12, 0x18(%rsp)
testq %r12, %r12
je 0x1d530b
xorl %r13d, %r13d
movl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
movq 0x28(%rbx), %rcx
movq (%rcx,%r13,8), %rax
cmpq $-0x1, %rax
je 0x1d52f5
movq %rax, %rcx
shrq $0x20, %rcx
imulq $0x68, %rcx, %rcx
movl %eax, %r15d
movq 0x10(%rsp), %rax
cmpq 0x20(%rax,%rcx), %r15
jae 0x1d52fd
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), %rax
movq 0x20(%rsp), %rcx
movl (%rax,%rcx), %ecx
cmpl (%rax,%r14), %ecx
jne 0x1d52fd
movq 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x1d5138
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
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, 0x8(%rax,%rcx)
movl 0x4(%rdx,%r14), %esi
movl %esi, (%rax,%rcx)
movl 0x8(%rdx,%r14), %esi
movl %esi, 0x4(%rax,%rcx)
movl 0xc(%rdx,%r14), %esi
addl 0xc(%rsp), %esi
movl %esi, 0x14(%rax,%rcx)
movl 0x10(%rdx,%r14), %esi
movl %esi, 0xc(%rax,%rcx)
movl 0x14(%rdx,%r14), %esi
movl %esi, 0x10(%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 0x8(%rbx), %rax
cmpq %rax, (%rbx)
jne 0x1d5226
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x4, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
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)
movl 0x4(%rdx,%r14), %esi
movl %esi, 0xc(%rax,%rcx)
movl 0x8(%rdx,%r14), %esi
movl %esi, 0x10(%rax,%rcx)
movl 0xc(%rdx,%r14), %esi
addl 0xc(%rsp), %esi
movl %esi, 0x8(%rax,%rcx)
movl 0x10(%rdx,%r14), %esi
movl %esi, (%rax,%rcx)
movl 0x14(%rdx,%r14), %esi
movl %esi, 0x4(%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 0x1d50f0
jmp 0x1d52fd
movq $0x0, (%rcx,%r13,8)
incq %r13
cmpq 0x18(%rsp), %r13
jne 0x1d50a3
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x625b4(%rip), %rdi     # 0x2378d5
leaq 0x5e663(%rip), %rsi     # 0x23398b
leaq 0x625cc(%rip), %rcx     # 0x2378fb
movl $0x49e7, %edx           # imm = 0x49E7
callq 0x2110