// File: /workspace/github_c_makefile_star2_O2/c-zhou[P]oatk/path.c
// Function: path_stats
void path_stats(asg_t *asg, path_v *paths, FILE *fo)
{
    uint32_t i, j, n;
    int nd_i, nd_n, nd_l, nd_w;
    uint64_t max_l;
    double max_wl;
    path_t path;

    nd_n = 0;
    max_l = 0;
    max_wl = .0;
    for (i = 0; i < paths->n; ++i) {
        if (paths->a[i].nv > nd_n)
            nd_n = paths->a[i].nv;
        if (paths->a[i].len > max_l)
            max_l = paths->a[i].len;
        if (paths->a[i].wlen > max_wl)
            max_wl = paths->a[i].wlen;
    }
    nd_i = floor(log10(fabs(paths->n))) + 1;
    nd_n = floor(log10(fabs(nd_n))) + 1;
    nd_l = floor(log10(fabs(max_l))) + 1;
    nd_w = floor(log10(fabs(max_wl))) + 3;

    for (i = 0; i < paths->n; ++i) {
        path = paths->a[i];
        n = path.nv;
        fprintf(fo, "%c %-*u %s %-*u %-*u %-*.1f %.3f %s%c", path.best? '*' : '#', nd_i, i, path.circ? "circle" : "linear",
                nd_n, n, nd_l, path.len, nd_w, path.wlen, path.srcc, asg->seg[path.v[0]>>1].name, "+-"[path.v[0]&1]);
        for (j = 1; j < n; ++j)
            fprintf(fo, ",%s%c", asg->seg[path.v[j]>>1].name, "+-"[path.v[j]&1]);
        fprintf(fo, "\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r15
movq (%rsi), %rax
xorl %r14d, %r14d
xorpd %xmm1, %xmm1
movl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
xorl %ebp, %ebp
xorl %edx, %edx
movl %edx, %edx
cmpq %rdx, %rax
jbe 0x858b
movq 0x10(%r12), %rsi
imulq $0x30, %rdx, %rdi
movl 0x8(%rsi,%rdi), %r8d
andl %ecx, %r8d
cmpl %ebp, %r8d
cmovgl %r8d, %ebp
movl 0x18(%rsi,%rdi), %r8d
cmpq %r8, %r14
cmovbeq %r8, %r14
movsd 0x20(%rsi,%rdi), %xmm0
maxsd %xmm1, %xmm0
incl %edx
movapd %xmm0, %xmm1
jmp 0x854e
cvtsi2sd %rax, %xmm0
movapd %xmm1, 0x10(%rsp)
callq 0x3270
callq 0x33e0
addsd 0xdf80(%rip), %xmm0     # 0x16528
cvttsd2si %xmm0, %eax
movl %eax, 0xc(%rsp)
cvtsi2sd %ebp, %xmm0
callq 0x3270
callq 0x33e0
addsd 0xdf62(%rip), %xmm0     # 0x16528
cvttsd2si %xmm0, %eax
movq %rax, 0x30(%rsp)
cvtsi2sd %r14, %xmm0
callq 0x3270
callq 0x33e0
addsd 0xdf42(%rip), %xmm0     # 0x16528
cvttsd2si %xmm0, %eax
movq %rax, 0x28(%rsp)
movapd 0x10(%rsp), %xmm0
andpd 0xdf83(%rip), %xmm0     # 0x16580
callq 0x3270
callq 0x33e0
addsd 0xdee9(%rip), %xmm0     # 0x164f8
cvttsd2si %xmm0, %eax
movq %rax, 0x20(%rsp)
leaq 0xe27d(%rip), %r13      # 0x1689c
xorl %r8d, %r8d
movq %r12, 0x38(%rsp)
movl %r8d, %r8d
cmpq %r8, (%r12)
jbe 0x8737
movq 0x10(%r12), %rax
imulq $0x30, %r8, %rcx
movl 0x8(%rax,%rcx), %esi
movq 0x10(%rax,%rcx), %r14
movl 0x18(%rax,%rcx), %edx
movq %rdx, 0x40(%rsp)
movsd 0x20(%rax,%rcx), %xmm0
movl %esi, %r12d
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
testl %esi, %esi
pushq $0x2a
popq %rdx
pushq $0x23
popq %rdi
cmovnsl %edi, %edx
btl $0x1e, %esi
leaq 0xe220(%rip), %r9       # 0x16895
leaq 0xddfc(%rip), %rsi      # 0x16478
cmovaeq %rsi, %r9
movsd 0x28(%rax,%rcx), %xmm1
movq 0x10(%r15), %r11
movl (%r14), %eax
movl %eax, %ecx
shrl %ecx
imulq $0x18, %rcx, %rbp
andl $0x1, %eax
leaq 0xe1cd(%rip), %rcx      # 0x1686c
movsbl (%rax,%rcx), %r10d
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0xe1bd(%rip), %rsi      # 0x1686f
movl 0x14(%rsp), %ecx
movq %r8, 0x18(%rsp)
movb $0x2, %al
pushq %r10
pushq (%r11,%rbp)
pushq 0x38(%rsp)
pushq 0x60(%rsp)
pushq 0x50(%rsp)
pushq %r12
pushq 0x68(%rsp)
callq 0x3290
addq $0x40, %rsp
pushq $0x1
popq %rbp
cmpq %r12, %rbp
jae 0x871a
movq 0x10(%r15), %rax
movl (%r14,%rbp,4), %ecx
movl %ecx, %edx
shrl %edx
imulq $0x18, %rdx, %rdx
movq (%rax,%rdx), %rdx
andl $0x1, %ecx
leaq 0xe168(%rip), %rax      # 0x1686c
movsbl (%rcx,%rax), %ecx
movq %rbx, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x3290
incq %rbp
jmp 0x86e1
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x3200
movq 0x10(%rsp), %r8
incl %r8d
movq 0x38(%rsp), %r12
jmp 0x8627
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq