// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]yahs/graph.c
// Function: trim_graph_simple_filter
int trim_graph_simple_filter(graph_t *g, double min_wt, double min_diff_h, double min_diff_l, int min_len)
{
    uint32_t v, nv, na, n_del, n_ma;
    double mwt, smwt;
    graph_arc_t *av, *a;
    nv = graph_n_vtx(g);
    nv <<= 1;
    n_del = 0;

    for (v = 0; v < nv; ++v) {
        if (g->sdict->s[v>>1].len >= min_len)
            continue;
        na = graph_arc_n(g, v);
        av = graph_arc_a(g, v);
        for (a = av; a < av + na; ++a)
            n_del += graph_arc_del_existed(g, a);
    }
    graph_clean(g, 1);

    for (v = 0; v < nv; ++v) {
        na = graph_arc_n(g, v);
        av = graph_arc_a(g, v);
        
        mwt = smwt = 0;
        n_ma = 0;
        for (a = av; a < av + na; ++a) {
            if (a->wt > mwt) {
                smwt = mwt;
                mwt = a->wt;
                n_ma = 1;
            } else if (a->wt == mwt) {
                ++n_ma;
            } else if (a->wt > smwt) {
                smwt = a->wt;
            }
        }

        for (a = av; a < av + na; ++a) {
            if ((a->wt >= min_wt && a->wt >= mwt * min_diff_h) || 
                    (a->wt < min_wt && a->wt == mwt && mwt * min_diff_l >= smwt && n_ma == 1))
                continue;
            n_del += graph_arc_del_existed(g, a);
        }
    }

    graph_clean(g, 1);

#ifdef DEBUG_GRAPH_PRUNE
    fprintf(stderr, "[DEBUG_GRAPH_PRUNE::%s] #del simple filter: %u\n", __func__, n_del);
#endif

    return n_del;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movsd %xmm1, -0x18(%rbp)
movsd %xmm2, -0x20(%rbp)
movl %esi, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
shll %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x95ee
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movl -0x28(%rbp), %ecx
shrl %ecx
movl %ecx, %ecx
imulq $0x58, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
cmpq %rcx, %rax
jb 0x9566
jmp 0x95e0
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x28(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x28(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movl -0x30(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x95de
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x97e0
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x58(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
jmp 0x95a6
jmp 0x95e0
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9531
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x88e0
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x97c3
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x28(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movl -0x28(%rbp), %edx
movq (%rcx,%rdx,8), %rcx
shrq $0x20, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x48(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x0, -0x38(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movl -0x30(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x9704
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
ucomisd -0x40(%rbp), %xmm0
jbe 0x96b2
movsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
movl $0x1, -0x38(%rbp)
jmp 0x96f1
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
ucomisd -0x40(%rbp), %xmm0
jne 0x96cf
jp 0x96cf
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x96ef
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
ucomisd -0x48(%rbp), %xmm0
jbe 0x96ed
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x48(%rbp)
jmp 0x96ef
jmp 0x96f1
jmp 0x96f3
movq -0x58(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
jmp 0x9666
movq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movl -0x30(%rbp), %edx
shlq $0x5, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
jae 0x97b3
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
ucomisd -0x10(%rbp), %xmm0
jb 0x9750
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd -0x40(%rbp), %xmm1
mulsd -0x18(%rbp), %xmm1
ucomisd %xmm1, %xmm0
jae 0x978d
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm1
movsd -0x10(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x978f
movq -0x58(%rbp), %rax
movsd 0x10(%rax), %xmm0
ucomisd -0x40(%rbp), %xmm0
jne 0x978f
jp 0x978f
movsd -0x40(%rbp), %xmm0
mulsd -0x20(%rbp), %xmm0
ucomisd -0x48(%rbp), %xmm0
jb 0x978f
cmpl $0x1, -0x38(%rbp)
jne 0x978f
jmp 0x97a2
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x97e0
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movq -0x58(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x58(%rbp)
jmp 0x970c
jmp 0x97b5
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9603
movq -0x8(%rbp), %rdi
movl $0x1, %esi
callq 0x88e0
movl -0x34(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)