// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: remap_gen_arcs(usg_t*, unsigned int, unsigned int, unsigned int, unsigned int)
void remap_gen_arcs(usg_t *g, uint32_t ov, uint32_t ow, uint32_t nv, uint32_t nw)
{
    usg_arc_t *op = NULL, *np = NULL; usg_arc_warp *sv; uint32_t k; usg_arc_mm_t *v_a, *pm; uint32_t v_n;
    sv = &(g->a[nv>>1].arc[nv&1]); kv_pushp(usg_arc_t, *sv, &np);
    op = get_usg_arc(g, ov, ow); assert(op);///must get op ater since op might be changed by kv_pushp

    np->ul = (uint32_t)op->ul; np->ul |= (((uint64_t)nv)<<32); np->v = nw;
    np->ol = op->ol; np->del = 0; np->ou = op->ou; 
    np->idx = g->a[nv>>1].arc_mm[nv&1].n; np->idx <<= 32; np->idx |= (uint32_t)op->idx;

    v_n = (uint32_t)op->idx;
    for (k = 0; k < v_n; k++) {
        kv_pushp(usg_arc_mm_t, g->a[nv>>1].arc_mm[nv&1], &pm);
        v_a = g->a[op->ul>>33].arc_mm[(op->ul>>32)&1].a + (op->idx>>32);//va might be changed
        pm->v = nw; pm->uid = v_a[k].uid; pm->off = v_a[k].off;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %ebx
movq %rdi, %r8
movl %ecx, %eax
shrl %eax
movq %rcx, 0x18(%rsp)
andl $0x1, %ecx
imulq $0x78, %rax, %rbp
movq (%rdi), %rax
addq %rbp, %rax
imulq $0x18, %rcx, %r12
leaq (%r12,%rax), %r15
addq $0x10, %r15
movq (%r15), %r14
pushq $0x2
popq %rax
cmpq 0x8(%r15), %r14
jne 0x1c89d5
movl %esi, 0xc(%rsp)
leaq (%r14,%r14), %rsi
testq %r14, %r14
cmoveq %rax, %rsi
movq %rsi, 0x8(%r15)
movq 0x10(%r15), %rdi
shlq $0x5, %rsi
movq %r8, %r14
movl %edx, %r13d
callq 0x2370
movl 0xc(%rsp), %esi
movl %r13d, %edx
movq %r14, %r8
movq %rax, %r13
movq %rax, 0x10(%r15)
movq (%r15), %r14
jmp 0x1c89d9
movq 0x10(%r15), %r13
movq %r8, 0x10(%rsp)
leaq 0x1(%r14), %rax
movq %rax, (%r15)
movq %r8, %rdi
callq 0x1dee3b
testq %rax, %rax
je 0x1c8b41
movq %rax, %r15
shlq $0x5, %r14
movl (%rax), %eax
movq 0x18(%rsp), %rcx
shlq $0x20, %rcx
orq %rax, %rcx
movq %rcx, (%r13,%r14)
movl %ebx, 0x8(%r13,%r14)
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl 0xc(%r15), %eax
movl %eax, 0xc(%r13,%r14)
movl 0x10(%r15), %eax
movl %eax, 0x10(%r13,%r14)
movq 0x10(%rsp), %r11
movq (%r11), %rcx
leaq (%rcx,%rbp), %rax
movq 0x40(%r12,%rax), %rdx
movq %rdx, %rax
shlq $0x20, %rax
movq %rax, 0x18(%r13,%r14)
movl 0x18(%r15), %esi
orq %rax, %rsi
movq %rsi, 0x18(%r13,%r14)
movq 0x18(%r15), %rax
movl %eax, %esi
imulq $0xc, %rsi, %r13
xorl %r14d, %r14d
movq %r12, 0x20(%rsp)
cmpq %r14, %r13
je 0x1c8b32
leaq (%rcx,%rbp), %rsi
cmpq 0x48(%r12,%rsi), %rdx
jne 0x1c8ada
leaq (%rdx,%rdx), %rax
testq %rdx, %rdx
pushq $0x2
popq %rcx
cmoveq %rcx, %rax
leaq (%r12,%rsi), %rcx
addq $0x40, %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rcx), %rdi
imulq $0xc, %rax, %rsi
movq %rbp, %r12
movq %r15, %rbp
movq %r13, %r15
movl %ebx, %r13d
movq %r11, %rbx
callq 0x2370
movq %rbx, %r11
movl %r13d, %ebx
movq %r15, %r13
movq %rbp, %r15
movq %r12, %rbp
movq 0x20(%rsp), %r12
movq (%r11), %rcx
leaq (%rcx,%rbp), %rdx
movq %rax, 0x50(%r12,%rdx)
movq 0x18(%r15), %rax
movq 0x40(%r12,%rdx), %rdx
leaq (%rcx,%rbp), %rsi
movq 0x50(%r12,%rsi), %rdi
imulq $0xc, %rdx, %r8
incq %rdx
movq %rdx, 0x40(%r12,%rsi)
movq (%r15), %rsi
movq %rsi, %r9
shrq $0x21, %r9
shrq $0x20, %rsi
andl $0x1, %esi
imulq $0x78, %r9, %r9
addq %rcx, %r9
imulq $0x18, %rsi, %rsi
movq %rax, %r10
shrq $0x20, %r10
imulq $0xc, %r10, %r10
addq 0x50(%rsi,%r9), %r10
movl %ebx, (%rdi,%r8)
movq 0x4(%r14,%r10), %rsi
movq %rsi, 0x4(%rdi,%r8)
addq $0xc, %r14
jmp 0x1c8a67
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x21454(%rip), %rdi     # 0x1e9f9c
leaq 0x2e98a(%rip), %rsi     # 0x1f74d9
leaq 0x31a47(%rip), %rcx     # 0x1fa59d
movl $0x2d77, %edx           # imm = 0x2D77
callq 0x2110