// File: 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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x35329d
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x353262
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x58(%rbp)
jmp 0x35326d
movl $0x2, %eax
movq %rax, -0x58(%rbp)
jmp 0x35326d
movq -0x58(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x5, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
callq 0x37d400
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x3532dd
jmp 0x3532fc
leaq 0x359e3(%rip), %rdi     # 0x388cc7
leaq 0x42ece(%rip), %rsi     # 0x3961b9
movl $0x2d77, %edx           # imm = 0x2D77
leaq 0x45fd7(%rip), %rcx     # 0x3992ce
callq 0x2130
movq -0x20(%rbp), %rax
movq (%rax), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl -0x14(%rbp), %eax
movl %eax, %ecx
shlq $0x20, %rcx
movq -0x28(%rbp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movl -0x18(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl 0xc(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq -0x28(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0xc(%rax)
movq -0x28(%rbp), %rax
movl 0xc(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0xc(%rax)
movq -0x20(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rcx
shlq $0x20, %rcx
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %eax
movl %eax, %ecx
movq -0x28(%rbp), %rax
orq 0x18(%rax), %rcx
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, -0x4c(%rbp)
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jae 0x353676
jmp 0x3533ec
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl -0x14(%rbp), %edx
shrl %edx
movl %edx, %edx
imulq $0x78, %rdx, %rdx
addq %rdx, %rcx
addq $0x40, %rcx
movl -0x14(%rbp), %edx
andl $0x1, %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jne 0x353575
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x3534ad
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x60(%rbp)
jmp 0x3534b8
movl $0x2, %eax
movq %rax, -0x60(%rbp)
jmp 0x3534b8
movq -0x60(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %edx
shrl %edx
movl %edx, %edx
imulq $0x78, %rdx, %rdx
addq %rdx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %edx
andl $0x1, %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
imulq $0xc, 0x8(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %edx
shrl %edx
movl %edx, %edx
imulq $0x78, %rdx, %rdx
addq %rdx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %edx
andl $0x1, %edx
movl %edx, %edx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdx
movl -0x14(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rdx
addq $0x40, %rdx
movl -0x14(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x21, %rcx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x40, %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
shrq $0x20, %rcx
andq $0x1, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x18(%rcx), %rcx
shrq $0x20, %rcx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl -0x18(%rbp), %ecx
movq -0x48(%rbp), %rax
movl %ecx, (%rax)
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x40(%rbp), %rax
movl -0x34(%rbp), %ecx
imulq $0xc, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3533de
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)