// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: extracr_clean_arc(usg_t*, unsigned int, asg64_v*, asg64_v*)
void extracr_clean_arc(usg_t *g, uint32_t v, asg64_v *b, asg64_v *ub)
{
    usg_arc_t *av; uint32_t i, kv, nv; uint64_t x, kocc[2];
    av = usg_arc_a(g, v); nv = usg_arc_n(g, v);
    if (nv < 2) return;
    for (i = kv = kocc[0] = kocc[1] = 0; i < nv; ++i) {
        if(av[i].del) continue;
        kv++; 
        if((av[i].ou>>1) > 0) { ///if av[i].ou == 1, ignore it
            if(kocc[1] < (av[i].ou>>1)) kocc[1] = (av[i].ou>>1);
        } else if(av[i].ou == 0) { 
            kocc[0]++;
        }            
    }
    if(kv < 2 || kocc[0] == 0 || kocc[1] == 0) return;
    for (i = 0; i < nv; ++i) {
        if(av[i].del || av[i].ou) continue;
        // if(max_drop_len && av[i].ol >= (*max_drop_len)) continue;
        x = av[i].ol; x <<= 32;
        kv_push(uint64_t, *b, ((x)|((uint64_t)(ub->n))));
        kv_push(uint64_t, *ub, ((((uint64_t)(v))<<32)|((uint64_t)(i))));   
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0xc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0xc(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl -0xc(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x78, %rcx, %rcx
addq %rcx, %rax
addq $0x10, %rax
movl -0xc(%rbp), %ecx
andl $0x1, %ecx
movl %ecx, %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movl %eax, -0x34(%rbp)
cmpl $0x2, -0x34(%rbp)
jae 0x36d280
jmp 0x36d50d
movq $0x0, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x36d351
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
je 0x36d2c5
jmp 0x36d343
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
shrl %eax
cmpl $0x0, %eax
jbe 0x36d31f
movq -0x48(%rbp), %rax
movq -0x28(%rbp), %rcx
movl -0x2c(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0x10(%rcx), %ecx
shrl %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x36d31d
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
shrl %eax
movl %eax, %eax
movq %rax, -0x48(%rbp)
jmp 0x36d341
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
jne 0x36d33f
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x36d341
jmp 0x36d343
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x36d29e
cmpl $0x2, -0x30(%rbp)
jb 0x36d365
cmpq $0x0, -0x50(%rbp)
je 0x36d365
cmpq $0x0, -0x48(%rbp)
jne 0x36d36a
jmp 0x36d50d
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x36d50d
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x36d3aa
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x0, 0x10(%rax)
je 0x36d3af
jmp 0x36d4ff
movq -0x28(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
shlq $0x20, %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x36d43f
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x36d404
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x58(%rbp)
jmp 0x36d40f
movl $0x2, %eax
movq %rax, -0x58(%rbp)
jmp 0x36d40f
movq -0x58(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdx
movq -0x20(%rbp), %rax
orq (%rax), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x36d469
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x36d4d1
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x36d496
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x60(%rbp)
jmp 0x36d4a1
movl $0x2, %eax
movq %rax, -0x60(%rbp)
jmp 0x36d4a1
movq -0x60(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0xc(%rbp), %eax
movl %eax, %edx
shlq $0x20, %rdx
movl -0x2c(%rbp), %eax
orq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x36d4ff
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x36d371
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)