// File: chhylp123[P]hifiasm/hic.cpp
// Function: select_max_block_by_utg(H_partition*, G_partition*, bubble_type*, hc_links*, unsigned int, long long*, long long*, long long*, long long*, double*)
void select_max_block_by_utg(H_partition* hap, G_partition* g_p, bubble_type* bub, hc_links* link, uint32_t chain_id,
long long* min_f_bid, long long* min_f_uid, long long* min_l_bid, long long* min_l_uid, double* min_w)
{
    long long c_bid, c_uid, l_bid, l_uid;
    uint32_t gid;
    ma_utg_t *u = &(bub->b_ug->u.a[chain_id]);
    (*min_w) = 1;
    hap->b.bid = hap->b.uid = 0;
    (*min_f_bid) = (*min_f_uid) = (*min_l_bid) = (*min_l_uid) = -1;
    while (1)
    {
        gid = next_hap_label_id(&(hap->b), g_p, bub, u, 1, &c_bid, &c_uid);
        if(gid == (uint32_t)-1) break;

        if(identify_best_interval(&(hap->b), hap->lock, g_p, bub, u, link, c_bid, c_uid, &l_bid, &l_uid))
        {
            break;
        }
        if(l_bid == -1 || l_uid == -1) continue;
        if((*min_w) > hap->b.weight)
        {
            (*min_w) = hap->b.weight;
            (*min_f_bid) = c_bid;
            (*min_f_uid) = c_uid;
            (*min_l_bid) = l_bid;
            (*min_l_uid) = l_uid;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x88, %rsp
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movq %r9, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq 0xc0(%rax), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq 0x28(%rbp), %rax
movsd 0x18f7b3(%rip), %xmm0   # 0x382000
movsd %xmm0, (%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0xb8(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0xb0(%rax)
movq 0x20(%rbp), %rax
movq $-0x1, (%rax)
movq 0x18(%rbp), %rax
movq $-0x1, (%rax)
movq 0x10(%rbp), %rax
movq $-0x1, (%rax)
movq -0x38(%rbp), %rax
movq $-0x1, (%rax)
movq -0x10(%rbp), %rdi
addq $0x90, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x68(%rbp), %rcx
movl $0x1, %r8d
leaq -0x40(%rbp), %r9
leaq -0x48(%rbp), %rax
movq %rax, (%rsp)
callq 0x1f0aa0
movl %eax, -0x5c(%rbp)
cmpl $-0x1, -0x5c(%rbp)
jne 0x1f28d7
jmp 0x1f2997
movq -0x10(%rbp), %rdi
addq $0x90, %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x68(%rbp), %r8
movq -0x28(%rbp), %r9
movq -0x40(%rbp), %rbx
movq -0x48(%rbp), %r11
leaq -0x50(%rbp), %r10
leaq -0x58(%rbp), %rax
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0x1f1280
cmpl $0x0, %eax
je 0x1f2929
jmp 0x1f2997
cmpq $-0x1, -0x50(%rbp)
je 0x1f2937
cmpq $-0x1, -0x58(%rbp)
jne 0x1f293c
jmp 0x1f289b
movq 0x28(%rbp), %rax
movsd (%rax), %xmm0
movq -0x10(%rbp), %rax
ucomisd 0xa8(%rax), %xmm0
jbe 0x1f2992
movq -0x10(%rbp), %rax
movsd 0xa8(%rax), %xmm0
movq 0x28(%rbp), %rax
movsd %xmm0, (%rax)
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq 0x20(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1f289b
addq $0x88, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)