// File: /workspace/github_cpp_makefile_star2_O2/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 0x10078b
testq %rax, %rax
je 0x100cdb
cmpq $0xb07b, 0x8(%rsp)      # imm = 0xB07B
jne 0x100be9
leaq 0xecdad(%rip), %rdx     # 0x1ed977
movl $0xb07b, %edi           # imm = 0xB07B
movq %rbx, %rsi
callq 0x100a06
leaq 0xecda2(%rip), %rdx     # 0x1ed980
movq %r15, %rdi
movq %rbx, %rsi
callq 0x100a06
xorl %r15d, %r15d
cmpq 0xb0(%rbx), %r15
jae 0x100cdb
movq 0xc0(%rbx), %rax
cmpb $0x0, (%rax,%r15)
je 0x100cd3
movq 0xf0(%rbx), %rax
cmpb $0x0, (%rax,%r15)
je 0x100cd3
leaq 0x1(%r15), %rax
movq %rax, 0x10(%rsp)
imulq $0x18, %r15, %r12
pushq $0x18
popq %r13
xorl %r14d, %r14d
movq 0x10(%rbx), %rax
cmpq (%rax,%r12), %r14
jae 0x100cd3
leaq (%rax,%r12), %rcx
movq 0x10(%rcx), %rdx
cmpb $0x0, (%rdx,%r13)
js 0x100c9c
movl -0x10(%rdx,%r13), %ebp
movq 0xc0(%rbx), %rcx
cmpb $0x0, (%rcx,%rbp)
jne 0x100c9c
movq 0xf0(%rbx), %rcx
cmpb $0x0, (%rcx,%rbp)
je 0x100c9c
cmpq $0xb07b, 0x8(%rsp)      # imm = 0xB07B
je 0x100ca5
movq 0x10(%rax,%r12), %rax
orb $-0x80, (%rax,%r13)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xff998
orb $-0x80, 0x18(%rax)
addq $0x2, 0x168(%rbx)
incq %r14
addq $0x28, %r13
jmp 0x100c31
movq 0x152334(%rip), %rax    # 0x252fe0
movq (%rax), %rdi
leaq 0x1(%rbp), %rcx
movsd -0x18(%rdx,%r13), %xmm0
leaq 0xecc9e(%rip), %rsi     # 0x1ed95f
movq 0x10(%rsp), %rdx
movb $0x1, %al
callq 0x22b0
movq 0x10(%rbx), %rax
jmp 0x100c78
incq %r15
jmp 0x100bec
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq