// File: /workspace/github_c_makefile_star2_O3/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 $0x58, %rsp
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r12
movq (%rsi), %rax
testq %rax, %rax
je 0x9ef1
movq 0x10(%r13), %rcx
addq $0x20, %rcx
xorpd %xmm1, %xmm1
xorl %esi, %esi
movl $0x1, %edx
movl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
xorl %r8d, %r8d
movq %r8, %r9
movl %esi, %r8d
movl -0x18(%rcx), %esi
andl %edi, %esi
cmpl %r8d, %esi
cmovlel %r8d, %esi
movl -0x8(%rcx), %r8d
cmpq %r8, %r9
cmovaq %r9, %r8
movapd %xmm1, %xmm0
movsd (%rcx), %xmm1
maxsd %xmm0, %xmm1
movl %edx, %r9d
addq $0x30, %rcx
incl %edx
cmpq %r9, %rax
ja 0x9e97
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
movapd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r8, %xmm0
movapd %xmm0, 0x30(%rsp)
movapd %xmm1, 0x40(%rsp)
jmp 0x9f07
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
movapd %xmm0, 0x10(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
callq 0x3270
callq 0x33e0
movsd %xmm0, 0x8(%rsp)
movaps 0x10(%rsp), %xmm0
callq 0x3270
callq 0x33e0
movsd %xmm0, 0x10(%rsp)
movaps 0x30(%rsp), %xmm0
callq 0x3270
callq 0x33e0
movsd %xmm0, (%rsp)
movapd 0x40(%rsp), %xmm0
andpd 0x1062a(%rip), %xmm0    # 0x1a580
callq 0x3270
callq 0x33e0
cmpq $0x0, (%r13)
je 0xa0f2
movsd 0x105ad(%rip), %xmm1    # 0x1a520
movsd 0x8(%rsp), %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
movl %eax, 0x30(%rsp)
movsd 0x10(%rsp), %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
movq %rax, 0x10(%rsp)
movsd (%rsp), %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
movq %rax, 0x8(%rsp)
addsd 0x1050e(%rip), %xmm0    # 0x1a4c0
cvttsd2si %xmm0, %eax
movq %rax, (%rsp)
leaq 0x1089b(%rip), %r15     # 0x1a85c
xorl %eax, %eax
xorl %r8d, %r8d
movq %r13, 0x50(%rsp)
movq %r12, 0x28(%rsp)
movq 0x10(%r13), %rcx
leaq (%rax,%rax,2), %rax
shlq $0x4, %rax
movl 0x8(%rcx,%rax), %esi
movq 0x10(%rcx,%rax), %r10
movl 0x18(%rcx,%rax), %r14d
movsd 0x20(%rcx,%rax), %xmm0
movl %esi, %r13d
andl $0x3fffffff, %r13d      # imm = 0x3FFFFFFF
testl %esi, %esi
movl $0x2a, %edx
movl $0x23, %edi
cmovnsl %edi, %edx
btl $0x1e, %esi
leaq 0x10871(%rip), %r9      # 0x1a885
leaq 0x10459(%rip), %rsi     # 0x1a474
cmovaeq %rsi, %r9
movsd 0x28(%rcx,%rax), %xmm1
movq 0x10(%r12), %r11
movq %r10, %r12
movl (%r10), %eax
movl %eax, %ecx
shrl %ecx
leaq (%rcx,%rcx,2), %rbp
andl $0x1, %eax
movsbl (%rax,%r15), %r10d
subq $0x8, %rsp
movq %rbx, %rdi
leaq 0x10811(%rip), %rsi     # 0x1a85f
movl 0x38(%rsp), %ecx
movq %r8, 0x48(%rsp)
movb $0x2, %al
pushq %r10
pushq (%r11,%rbp,8)
pushq 0x18(%rsp)
pushq %r14
pushq 0x30(%rsp)
pushq %r13
pushq 0x48(%rsp)
callq 0x3290
addq $0x40, %rsp
cmpl $0x2, %r13d
movq %rbx, %r14
leaq 0x10806(%rip), %rbx     # 0x1a88c
jb 0xa0c3
movl $0x1, %ebp
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movl (%r12,%rbp,4), %ecx
movl %ecx, %edx
shrl %edx
leaq (%rdx,%rdx,2), %rdx
movq (%rax,%rdx,8), %rdx
andl $0x1, %ecx
movsbl (%rcx,%r15), %ecx
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3290
incq %rbp
cmpq %rbp, %r13
jne 0xa08d
movl $0xa, %edi
movq %r14, %rsi
callq 0x3200
movq 0x40(%rsp), %r8
incl %r8d
movq %r8, %rax
movq 0x50(%rsp), %r13
cmpq %r8, (%r13)
movq 0x28(%rsp), %r12
movq %r14, %rbx
ja 0x9fd0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq