// File: chhylp123[P]hifiasm/hic.cpp
// Function: get_max_block(H_partition*, G_partition*, bubble_type*, long long*, long long*, long long*, long long*, long long*, double*)
int get_max_block(H_partition* h, G_partition* g_p, bubble_type* bub, long long* min_u,
long long* min_f_bid, long long* min_f_uid, long long* min_l_bid, long long* min_l_uid, 
double* min_w)
{
    uint32_t i;
    long long f_bid, f_uid, l_bid, l_uid;
    double w;
    (*min_w) = 1;
    (*min_u) = (*min_f_bid) = (*min_f_uid) = (*min_l_bid) = (*min_l_uid) = -1;
    for (i = 0; i < bub->chain_weight.n; i++)
    {
        if(bub->chain_weight.a[i].del) continue;
        select_max_block_by_utg(h, g_p, bub, h->link, bub->chain_weight.a[i].id,
        &f_bid, &f_uid, &l_bid, &l_uid, &w);
        if(f_bid == -1 || f_uid == -1 || l_bid == -1 || l_uid == -1) continue;
        if((*min_w) > w)
        {
            (*min_w) = w;
            (*min_u) = bub->chain_weight.a[i].id;
            (*min_f_bid) = f_bid;
            (*min_f_uid) = f_uid;
            (*min_l_bid) = l_bid;
            (*min_l_uid) = l_uid;
        }
    }

    if((*min_u) != -1 && (*min_f_bid) != -1 && (*min_f_uid) != -1 && (*min_l_bid) != -1 && (*min_l_uid) != -1)
    {
        return 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x88, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
movq 0x20(%rbp), %rax
movsd 0x18f614(%rip), %xmm0   # 0x382000
movsd %xmm0, (%rax)
movq 0x18(%rbp), %rax
movq $-0x1, (%rax)
movq 0x10(%rbp), %rax
movq $-0x1, (%rax)
movq -0x40(%rbp), %rax
movq $-0x1, (%rax)
movq -0x38(%rbp), %rax
movq $-0x1, (%rax)
movq -0x30(%rbp), %rax
movq $-0x1, (%rax)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpq 0xc8(%rcx), %rax
jae 0x1f2b55
movq -0x28(%rbp), %rax
movq 0xd8(%rax), %rax
movl -0x44(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
cmpb $0x0, 0x18(%rax)
je 0x1f2a62
jmp 0x1f2b47
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x28(%rbp), %rax
movq 0xd8(%rax), %rax
movl -0x44(%rbp), %r8d
shlq $0x5, %r8
addq %r8, %rax
movq 0x10(%rax), %rax
movl %eax, %r8d
leaq -0x50(%rbp), %r9
leaq -0x58(%rbp), %rbx
leaq -0x60(%rbp), %r11
leaq -0x68(%rbp), %r10
leaq -0x70(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x1f27f0
cmpq $-0x1, -0x50(%rbp)
je 0x1f2adb
cmpq $-0x1, -0x58(%rbp)
je 0x1f2adb
cmpq $-0x1, -0x60(%rbp)
je 0x1f2adb
cmpq $-0x1, -0x68(%rbp)
jne 0x1f2add
jmp 0x1f2b47
movq 0x20(%rbp), %rax
movsd (%rax), %xmm0
ucomisd -0x70(%rbp), %xmm0
jbe 0x1f2b45
movsd -0x70(%rbp), %xmm0
movq 0x20(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x28(%rbp), %rax
movq 0xd8(%rax), %rax
movl -0x44(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x68(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1f2b47
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x1f2a2e
movq -0x30(%rbp), %rax
cmpq $-0x1, (%rax)
je 0x1f2b90
movq -0x38(%rbp), %rax
cmpq $-0x1, (%rax)
je 0x1f2b90
movq -0x40(%rbp), %rax
cmpq $-0x1, (%rax)
je 0x1f2b90
movq 0x10(%rbp), %rax
cmpq $-0x1, (%rax)
je 0x1f2b90
movq 0x18(%rbp), %rax
cmpq $-0x1, (%rax)
je 0x1f2b90
movl $0x1, -0xc(%rbp)
jmp 0x1f2b97
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)