// File: chhylp123[P]hifiasm/hic.cpp
// Function: debug_flip(G_partition*, hc_links*, bubble_type*, unsigned int)
void debug_flip(G_partition* g_p, hc_links* link, bubble_type* bub, uint32_t id)
{
    fprintf(stderr, "33333333333\n");
    uint32_t *h0, h0_n, *h1, h1_n, k, wrong;
    double hw0, hw1;
    for (k = wrong = 0; k < g_p->n; k++)
    {
        hw0 = hw1 = 0;
        get_phased_block(g_p, NULL, k, NULL, NULL, &h0, &h0_n, &h1, &h1_n, NULL, NULL);
        if(h0_n >0) hw0 = get_cluster_weight_debug(g_p, link, h0, h0_n);
        if(h1_n >0) hw1 = get_cluster_weight_debug(g_p, link, h1, h1_n);
        if(hw0 != g_p->a[k].weight[0])
        {
            if((uint32_t)hw0 != (uint32_t)g_p->a[k].weight[0]) wrong = 1;
            fprintf(stderr, "k: %u, ERROR(id: %u): hw0: %f, weight[0]: %f\n", k, id, hw0, g_p->a[k].weight[0]);
        } 
        
        if(hw1 != g_p->a[k].weight[1])
        {
            if((uint32_t)hw1 != (uint32_t)g_p->a[k].weight[1]) wrong = 1;
            fprintf(stderr, "k: %u, ERROR(id: %u): hw1: %f, weight[1]: %f\n", k, id, hw1, g_p->a[k].weight[1]);
        }

        if(wrong) break;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq 0x1d41df(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x19ce0c(%rip), %rsi    # 0x38cc17
movb $0x0, %al
callq 0x22a0
movl $0x0, -0x44(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x1effe5
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movl -0x40(%rbp), %eax
movl %eax, %edx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x28(%rbp), %r9
leaq -0x2c(%rbp), %r11
leaq -0x38(%rbp), %r10
leaq -0x3c(%rbp), %rax
movq %r8, %rsi
movq %r8, %rcx
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x20(%rsp)
callq 0x214690
cmpl $0x0, -0x2c(%rbp)
jbe 0x1efea8
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq 0x1efff0
movsd %xmm0, -0x50(%rbp)
cmpl $0x0, -0x3c(%rbp)
jbe 0x1efec7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq 0x1efff0
movsd %xmm0, -0x58(%rbp)
movsd -0x50(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x40(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
ucomisd 0x30(%rax), %xmm0
jne 0x1efee9
jp 0x1efee9
jmp 0x1eff4a
cvttsd2si -0x50(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x40(%rbp), %edx
leaq (%rdx,%rdx,8), %rdx
cvttsd2si 0x30(%rcx,%rdx,8), %rcx
cmpl %ecx, %eax
je 0x1eff10
movl $0x1, -0x44(%rbp)
movq 0x1d40c9(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x40(%rbp), %edx
movl -0x1c(%rbp), %ecx
movsd -0x50(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x40(%rbp), %esi
imulq $0x48, %rsi, %rsi
addq %rsi, %rax
movsd 0x30(%rax), %xmm1
leaq 0x19cce1(%rip), %rsi    # 0x38cc24
movb $0x2, %al
callq 0x22a0
movsd -0x58(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x40(%rbp), %ecx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
ucomisd 0x38(%rax), %xmm0
jne 0x1eff6c
jp 0x1eff6c
jmp 0x1effcd
cvttsd2si -0x58(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl -0x40(%rbp), %edx
leaq (%rdx,%rdx,8), %rdx
cvttsd2si 0x38(%rcx,%rdx,8), %rcx
cmpl %ecx, %eax
je 0x1eff93
movl $0x1, -0x44(%rbp)
movq 0x1d4046(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x40(%rbp), %edx
movl -0x1c(%rbp), %ecx
movsd -0x58(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x40(%rbp), %esi
imulq $0x48, %rsi, %rsi
addq %rsi, %rax
movsd 0x38(%rax), %xmm1
leaq 0x19cc8c(%rip), %rsi    # 0x38cc52
movb $0x2, %al
callq 0x22a0
cmpl $0x0, -0x44(%rbp)
je 0x1effd5
jmp 0x1effe5
jmp 0x1effd7
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x1efe20
addq $0x80, %rsp
popq %rbp
retq
nop