// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/hic.cpp
// Function: graph_cut(unsigned long, unsigned long, min_cut_t*)
void graph_cut(uint64_t src, uint64_t dest, min_cut_t* x)
{
    /*******************************for debug************************************/
    ///if(src == 45179) print_debug_rGraph(x);
    /*******************************for debug************************************/
    if(maxFlow(src, dest, x))
    {
        ///in the last time bfs of maxFlow, rGraphVis has already been set
        uint64_t i, j, v, u;
        hc_edge *p;
        /*******************************for debug************************************/
        if(src == 45179)
        ///if(src == 26818)
        {
            ///print_debug_rGraph(x);
            print_src_dest(src, x, "src utg:");
            print_src_dest(dest, x, "dest utg:");
        }
        /*******************************for debug************************************/
        for (i = 0; i < x->rGraphVis.n; i++)
        {
            if(x->rGraphVis.a[i] == 0) continue;
            if(!x->bmerVis.a[i]) continue;
            v = i;
            for (j = 0; j < x->rGraph.a[i].n; j++)
            {
                if(x->rGraph.a[i].a[j].del) continue;
                u = x->rGraph.a[i].a[j].uID;
                if(x->rGraphVis.a[u]) continue;
                if(!x->bmerVis.a[u]) continue;
                /*******************************for debug************************************/
                if(src == 45179) fprintf(stderr, "utg%.6lul\tutg%.6lul\t%f\n", v+1, u+1, x->rGraph.a[i].a[j].weight);    
                /*******************************for debug************************************/
                ///delete <v, u>
                x->rGraph.a[i].a[j].del = 1;
                ///delete <u, v>
                p = get_rGraph_edge(x, u, v);
                p->del = 1;
                x->c_e += 2;
            }
            
        }

        /*******************************for debug************************************/
        ///if(src == 45179 || src == 31635)
        // if(src == 26818)
        // {
        //     fprintf(stderr, "hahahaha\n");
        //     print_path(26818, 1143, x);
        // }
        /*******************************for debug************************************/
    }
    /*******************************for debug************************************/
    ///if(src == 45179 || src == 31635)
    // {
    //     print_src_dest(src, x, "++++++src utg:");
    //     uint64_t m;
    //     for (m = 0; m < x->rGraph.a[src].n; m++)
    //     {
    //         if(x->rGraph.a[src].a[m].del) continue;
    //         fprintf(stderr, "src(utg%.6dl, enz:%lu)\tdes(utg%.6dl, enz:%lu)\t%f\n", 
    //         (int)(src+1), x->enzymes[src], 
    //         (int)(x->rGraph.a[src].a[m].uID+1), x->enzymes[x->rGraph.a[src].a[m].uID], 
    //         x->rGraph.a[src].a[m].weight);   
    //     }
    // }
    /*******************************for debug************************************/
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, 0x8(%rsp)
callq 0x148163
testq %rax, %rax
je 0x148527
cmpq $0xb07b, 0x8(%rsp)      # imm = 0xB07B
je 0x148536
movq 0xb0(%rbx), %rcx
testq %rcx, %rcx
je 0x148527
xorl %r15d, %r15d
movq 0xc0(%rbx), %rax
cmpb $0x0, (%rax,%r15)
je 0x14851b
movq 0xf0(%rbx), %rax
cmpb $0x0, (%rax,%r15)
je 0x14851b
movq 0x10(%rbx), %rax
leaq (%r15,%r15,2), %r12
cmpq $0x0, (%rax,%r12,8)
je 0x14851b
leaq 0x1(%r15), %rcx
movq %rcx, 0x10(%rsp)
movl $0x18, %r13d
xorl %r14d, %r14d
movq 0x10(%rax,%r12,8), %rdx
cmpb $0x0, (%rdx,%r13)
js 0x1484d2
movl -0x10(%rdx,%r13), %ebp
movq 0xc0(%rbx), %rcx
cmpb $0x0, (%rcx,%rbp)
jne 0x1484d2
movq 0xf0(%rbx), %rcx
cmpb $0x0, (%rcx,%rbp)
je 0x1484d2
cmpq $0xb07b, 0x8(%rsp)      # imm = 0xB07B
je 0x1484e1
orb $-0x80, (%rdx,%r13)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x147100
orb $-0x80, 0x18(%rax)
addq $0x2, 0x168(%rbx)
movq 0x10(%rbx), %rax
incq %r14
addq $0x28, %r13
cmpq (%rax,%r12,8), %r14
jb 0x148479
jmp 0x148514
movq 0x14caf8(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x1(%rbp), %rcx
movsd -0x18(%rdx,%r13), %xmm0
leaq 0xf3572(%rip), %rsi     # 0x23ba6f
movq 0x10(%rsp), %rdx
movb $0x1, %al
callq 0x22b0
movq 0x10(%rbx), %rax
movq 0x10(%rax,%r12,8), %rdx
jmp 0x1484af
movq 0xb0(%rbx), %rcx
incq %r15
cmpq %rcx, %r15
jb 0x148430
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1c69f
jmp 0x14841d