// File: /workspace/github_cpp_makefile_star2_O2/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, 0x10(%rsp)
cmpq %rdx, 0x20(%r9)
jae 0x191686
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 0x19168a
movq 0x28(%rbx), %rdi
leaq (,%rbp,8), %rdx
movl $0xff, %esi
callq 0x20e0
xorl %ecx, %ecx
pushq $0x1
popq %rdx
pushq $0x1c
popq %rsi
xorl %eax, %eax
cmpq %r13, %rcx
je 0x191718
imulq $0x68, %rcx, %rdi
movq 0x10(%rsp), %r8
addq %r8, %rdi
addq $0x18, %rdi
movq 0x8(%rdi), %r11
addq %r11, %rax
movq %rcx, %r8
shlq $0x20, %r8
movq %rsi, %r9
movq %rdx, %r10
xorl %r14d, %r14d
cmpq %r11, %r10
ja 0x191713
imulq $0x1c, %r14, %r15
movq (%rdi), %r12
movl (%r12,%r15), %r15d
cmpq %r11, %r10
je 0x1916ed
cmpl (%r12,%r9), %r15d
je 0x19170a
movq 0x28(%rbx), %r11
cmpq $-0x1, (%r11,%r15,8)
jne 0x1919a2
orq %r8, %r14
movq %r14, (%r11,%r15,8)
movq 0x8(%rdi), %r11
movq %r10, %r14
incq %r10
addq $0x1c, %r9
jmp 0x1916d2
incq %rcx
jmp 0x1916a6
addq %rax, %rax
addq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
jae 0x191770
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
imulq $0x30, %rcx, %rsi
callq 0x2370
movq %rax, 0x10(%rbx)
xorl %edx, %edx
movl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
movq %rbp, 0x18(%rsp)
cmpq %rbp, %rdx
je 0x191993
movq 0x28(%rbx), %rcx
movq (%rcx,%rdx,8), %rax
cmpq $-0x1, %rax
movq %rdx, 0x20(%rsp)
je 0x19197c
movq %rax, %rcx
shrq $0x20, %rcx
imulq $0x68, %rcx, %rcx
movq 0x10(%rsp), %rdx
leaq (%rdx,%rcx), %r13
addq $0x18, %r13
movl %eax, %r15d
imulq $0x1c, %r15, %r14
movq %r14, %rbp
cmpq 0x8(%r13), %r15
jae 0x191981
movq (%r13), %rdx
movl (%rdx,%r14), %esi
cmpl (%rdx,%rbp), %esi
jne 0x191981
movq (%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rcx
jne 0x191813
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rbx)
imulq $0x30, %rdx, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
movq (%r13), %rdx
movl (%rdx,%rbp), %esi
leaq 0x1(%rcx), %rdi
movq %rdi, (%rbx)
imulq $0x30, %rcx, %rcx
addl 0x8(%rsp), %esi
movl %esi, 0x8(%rax,%rcx)
movq 0x4(%rdx,%rbp), %rsi
movq %rsi, (%rax,%rcx)
movl 0xc(%rdx,%rbp), %esi
addl 0xc(%rsp), %esi
movl %esi, 0x14(%rax,%rcx)
movq 0x10(%rdx,%rbp), %rsi
movq %rsi, 0xc(%rax,%rcx)
movl 0x18(%rdx,%rbp), %edx
movb 0x28(%rax,%rcx), %sil
shrl $0x19, %edx
andb $0x40, %dl
andb $-0x41, %sil
orb %dl, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%r13), %rdi
movl 0x18(%rdi,%rbp), %edi
shrl $0x1e, %edi
andb $0x1, %dil
andb $-0x40, %sil
orb %dil, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%r13), %rsi
movl 0x18(%rsi,%rbp), %r8d
andl %r12d, %r8d
cvtsi2sd %r8d, %xmm0
movsd %xmm0, 0x20(%rax,%rcx)
movl 0x18(%rsi,%rbp), %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 0x1918d7
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
pushq $0x2
popq %rcx
cmoveq %rcx, %rdx
movq %rdx, 0x8(%rbx)
imulq $0x30, %rdx, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x10(%rbx)
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%rbx)
imulq $0x30, %rcx, %rcx
movq (%r13), %rdx
movl (%rdx,%rbp), %esi
addl 0x8(%rsp), %esi
movl %esi, 0x14(%rax,%rcx)
movq 0x4(%rdx,%rbp), %rsi
movq %rsi, 0xc(%rax,%rcx)
movl 0xc(%rdx,%rbp), %esi
addl 0xc(%rsp), %esi
movl %esi, 0x8(%rax,%rcx)
movq 0x10(%rdx,%rbp), %rsi
movq %rsi, (%rax,%rcx)
movl 0x18(%rdx,%rbp), %edx
movb 0x28(%rax,%rcx), %sil
shrl $0x19, %edx
andb $0x40, %dl
andb $-0x41, %sil
orb %dl, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%r13), %rdi
movl 0x18(%rdi,%rbp), %edi
shrl $0x1e, %edi
andb $0x1, %dil
andb $-0x40, %sil
orb %dil, %sil
movb %sil, 0x28(%rax,%rcx)
movq (%r13), %rsi
movl 0x18(%rsi,%rbp), %r8d
andl %r12d, %r8d
cvtsi2sd %r8d, %xmm0
movsd %xmm0, 0x20(%rax,%rcx)
movl 0x18(%rsi,%rbp), %esi
andl %r12d, %esi
movl %esi, 0x18(%rax,%rcx)
orb %dl, %dil
movb %dil, 0x28(%rax,%rcx)
incq %r15
addq $0x1c, %rbp
jmp 0x1917bf
andq $0x0, (%rcx,%rdx,8)
movq 0x20(%rsp), %rdx
incq %rdx
movq 0x18(%rsp), %rbp
jmp 0x19177d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x640c4(%rip), %rdi     # 0x1f5a6d
leaq 0x60173(%rip), %rsi     # 0x1f1b23
leaq 0x640dc(%rip), %rcx     # 0x1f5a93
movl $0x49e7, %edx           # imm = 0x49E7
callq 0x2110