// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: update_poa_arch_0(poa_g_t*, unsigned int, unsigned int, long, long, long)
void update_poa_arch_0(poa_g_t *g, uint32_t src, uint32_t des, int64_t str_id, int64_t str_src, int64_t str_des)
{
    uint32_t k, v, w, a_n; poa_arc_t *a; emap_t *em;
    v = src<<1; w = des<<1;
    a_n = poa_arc_n(g, v); a = poa_arc_a(g, v);
    for (k = 0; k < a_n; k++) {
        if(a[k].v == w) break;
    }
    if(k >= a_n) {
        push_poa_arch_0(g, src, des, str_id, str_src, str_des);
    } else {
        a[k].ul++;
        v = des<<1; v^=1; 
        w = src<<1; w^=1;
        a_n = poa_arc_n(g, v); a = poa_arc_a(g, v);
        for (k = 0; k < a_n; k++) {
            if(a[k].v == w) break;
        }
        assert(k < a_n);
        a[k].ul++;

        kv_pushp(emap_t, g->e_idx, &em);
        em->pge = src; em->pge <<= 32; em->pge += des;
        em->ule = str_src; em->ule <<= 32; em->ule += str_des;
        em->ulid = str_id;

        // assert((g->seq.a[em->pge>>32].nid^(debug_is_rev?1:0)) == ((uint32_t)debug_str->a[em->ule>>32]));
        // assert((g->seq.a[(uint32_t)em->pge].nid^(debug_is_rev?1:0)) == ((uint32_t)debug_str->a[(uint32_t)em->ule]));
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl -0xc(%rbp), %eax
shll %eax
movl %eax, -0x30(%rbp)
movl -0x10(%rbp), %eax
shll %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x30(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x32ff9a
movq -0x40(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x32ff8d
jmp 0x32ff9a
jmp 0x32ff8f
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x32ff6d
movl -0x2c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jb 0x32ffc2
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
movq -0x28(%rbp), %r9
callq 0x32fc10
jmp 0x3301b8
movq -0x40(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movl -0x10(%rbp), %eax
shll %eax
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x30(%rbp)
movl -0xc(%rbp), %eax
shll %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
xorl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movl -0x30(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x40(%rcx), %rcx
movl -0x30(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x330068
movq -0x40(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
cmpl -0x34(%rbp), %eax
jne 0x33005b
jmp 0x330068
jmp 0x33005d
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x33003b
movl -0x2c(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x330072
jmp 0x330091
leaq 0x678ed(%rip), %rdi     # 0x397966
leaq 0x66139(%rip), %rsi     # 0x3961b9
movl $0x15af, %edx           # imm = 0x15AF
leaq 0x678e2(%rip), %rcx     # 0x39796e
callq 0x2130
movq -0x40(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0xd0(%rcx), %rax
jne 0x330127
movq -0x8(%rbp), %rax
cmpq $0x0, 0xd0(%rax)
je 0x3300e3
movq -0x8(%rbp), %rax
movq 0xd0(%rax), %rax
shlq %rax
movq %rax, -0x50(%rbp)
jmp 0x3300ee
movl $0x2, %eax
movq %rax, -0x50(%rbp)
jmp 0x3300ee
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd0(%rax)
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rdi
movq -0x8(%rbp), %rax
imulq $0x18, 0xd0(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0xd8(%rax)
movq -0x8(%rbp), %rax
movq 0xd8(%rax), %rax
movq -0x8(%rbp), %rdx
movq 0xc8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0xc8(%rdx)
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movl -0xc(%rbp), %eax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq (%rax), %rcx
shlq $0x20, %rcx
movq %rcx, (%rax)
movl -0x10(%rbp), %eax
movl %eax, %ecx
movq -0x48(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
movq 0x8(%rax), %rcx
shlq $0x20, %rcx
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x10(%rax)
addq $0x50, %rsp
popq %rbp
retq
nop