// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/path.c
// Function: select_best_seq
uint32_t select_best_seq(asg_t *g, path_v *paths, FILE *fo, int type, double seq_cf, int seq_id, int is_pltd)
{
    if (paths->n == 0)
        return UINT32_MAX;

    uint64_t l;
    size_t i, j, k;
    l = 0, j = 0;
    for (i = 0; i < paths->n; ++i) {
        if ((paths->a[i].circ || !type) && paths->a[i].len > l) {
            l = paths->a[i].len;
            j = i;
        }
    }
    
    if (!paths->a[j].circ) {
        k = UINT32_MAX, l = 0;
        for (i = 0; i < paths->n; ++i) {
            if (paths->a[i].circ && paths->a[i].len > l) {
                l = paths->a[i].len;
                k = i;
            }
        }
        if (k != UINT32_MAX) {
            uint64_t L = paths->a[j].len;
            if (is_pltd) L = MIN(L, COMMON_AVG_PLTD_SIZE);
            if ((double) l / L >= seq_cf) j = k;
        }
    }

    // TODO need more sophisticated rules for cmp_coeff
    if (is_pltd) {
        double coeff;
        uint32_t circ;
        circ = (paths->a[j].circ || type);
        k = UINT32_MAX, coeff = .0;
        for (i = 0; i < paths->n; ++i) {
            if ((paths->a[i].circ || !circ) && paths->a[i].srcc > coeff) {
                coeff = paths->a[i].srcc;
                k = i;
            }
        }
        if (k != UINT32_MAX && paths->a[k].len + 1000 >= paths->a[j].len)
            j = k;
    }
    
    if (fo) print_seq(g, &paths->a[j], fo, seq_id > 0? seq_id : 1, 0, 60, 100);

    return j;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movsd %xmm0, -0x30(%rbp)
movl %r8d, -0x34(%rbp)
movl %r9d, -0x38(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0xad5d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb0ea
movq $0x0, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xadee
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xada6
cmpl $0x0, -0x24(%rbp)
jne 0xadde
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
cmpq -0x40(%rbp), %rax
jbe 0xadde
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xade0
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xad75
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xaf45
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x58(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xae9c
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xae8c
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
cmpq -0x40(%rbp), %rax
jbe 0xae8c
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movq %rax, -0x40(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0xae8e
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xae29
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x58(%rbp)
je 0xaf43
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movq %rax, -0x60(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0xaeef
cmpq $0x27100, -0x60(%rbp)   # imm = 0x27100
jae 0xaedc
movq -0x60(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0xaee7
movl $0x27100, %eax          # imm = 0x27100
movq %rax, -0x78(%rbp)
jmp 0xaee7
movq -0x78(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x40(%rbp), %xmm0
movaps 0x18675(%rip), %xmm3    # 0x23570
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
movapd 0x18679(%rip), %xmm2    # 0x23580
subpd %xmm2, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movq -0x60(%rbp), %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
ucomisd -0x30(%rbp), %xmm0
jb 0xaf41
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xaf43
jmp 0xaf45
cmpl $0x0, -0x38(%rbp)
je 0xb061
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x50(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
shrl $0x1e, %ecx
andl $0x1, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x79(%rbp)
jne 0xaf7c
cmpl $0x0, -0x24(%rbp)
setne %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x6c(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, -0x58(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x68(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jae 0xb01f
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
shrl $0x1e, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xafd1
cmpl $0x0, -0x6c(%rbp)
jne 0xb00f
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
ucomisd -0x68(%rbp), %xmm0
jbe 0xb00f
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x48(%rbp), %rcx
addq %rcx, %rax
movsd 0x28(%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0xb011
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xafa0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x58(%rbp)
je 0xb05f
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x58(%rbp), %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
addl $0x3e8, %eax            # imm = 0x3E8
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
imulq $0x30, -0x50(%rbp), %rdx
addq %rdx, %rcx
cmpl 0x18(%rcx), %eax
jb 0xb05f
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xb061
cmpq $0x0, -0x20(%rbp)
je 0xb0e3
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0x50(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpl $0x0, -0x34(%rbp)
jle 0xb0a6
movl -0x34(%rbp), %eax
movl %eax, -0x9c(%rbp)
jmp 0xb0b3
movl $0x1, %eax
movl %eax, -0x9c(%rbp)
jmp 0xb0b3
movq -0x88(%rbp), %rdx
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdi
movl -0x9c(%rbp), %ecx
xorl %r8d, %r8d
movl $0x3c, %r9d
movl $0x64, (%rsp)
callq 0xa070
movq -0x50(%rbp), %rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)