// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]oatk/path.c
// Function: asg_stat
void asg_stat(asg_t *asg, FILE *fo)
{
    uint64_t i, nv, n_vtx, n_seg, max_deg, tot_seg_len, n_link, n_arc, tot_deg;
    asmg_t *g;

    n_vtx = n_seg = max_deg = tot_seg_len = n_link = n_arc = tot_deg = 0;
    g = asg->asmg;
    for (i = 0; i < asg->n_seg; ++i) {
        if (g->vtx[i].del) continue;
        tot_seg_len += asg->seg[i].len;
        ++n_seg;
    }
    fprintf(fo, "Number of segments: %lu\n", n_seg);
    fprintf(fo, "Total segment length: %lu\n", tot_seg_len);
    if (n_seg) fprintf(fo, "Average segment length: %.3f\n", (double) tot_seg_len / n_seg);

    for (i = 0; i < g->n_arc; ++i) {
        if (!g->arc[i].del) {
            ++n_arc;
            if (!g->arc[i].comp)
                ++n_link;
        }
    }
    fprintf(fo, "Number of links: %lu\n", n_link);
    fprintf(fo, "Number of arcs: %lu\n", n_arc);

    n_vtx = asmg_vtx_n(g);
    for (i = 0; i < n_vtx; ++i) {
        nv = asmg_arc_n1(g, i);
        if (nv > max_deg)
            max_deg = nv;
        tot_deg += nv;
    }
    fprintf(fo, "Max degree: %lu\n", max_deg);
    if (n_seg > 0) fprintf(fo, "Average degree: %.3f\n", (double) tot_deg / n_seg / 2);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq 0x8(%rdi), %rax
movq 0x20(%rdi), %r13
testq %rax, %rax
je 0xb879
movq 0x10(%r13), %rcx
addq $0x20, %rcx
movl $0x10, %edx
xorl %r15d, %r15d
xorl %r14d, %r14d
testb $0x40, 0x3(%rcx)
jne 0xb86a
movq 0x10(%rdi), %rsi
movl (%rsi,%rdx), %esi
addq %rsi, %r15
incq %r14
addq $0x28, %rcx
addq $0x18, %rdx
decq %rax
jne 0xb857
jmp 0xb87f
xorl %r14d, %r14d
xorl %r15d, %r15d
leaq 0xf338(%rip), %rsi      # 0x1abbe
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3290
leaq 0xf33d(%rip), %rsi      # 0x1abd7
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3290
movq %r14, %xmm4
testq %r14, %r14
movdqa %xmm4, 0x10(%rsp)
je 0xb90d
movq %r15, %xmm1
movq 0xeccc(%rip), %xmm2     # 0x1a590
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0xecd0(%rip), %xmm3     # 0x1a5a0
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movdqa %xmm4, %xmm1
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
subpd %xmm3, %xmm1
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
divsd %xmm2, %xmm0
leaq 0xf2ef(%rip), %rsi      # 0x1abf2
movq %rbx, %rdi
movb $0x1, %al
callq 0x3290
movq 0x18(%r13), %rax
testq %rax, %rax
je 0xb942
movq 0x28(%r13), %rcx
addq $0x20, %rcx
xorl %r12d, %r12d
xorl %edx, %edx
movl (%rcx), %esi
cmpl $0x40000000, %esi       # imm = 0x40000000
adcq $0x0, %rdx
btl $0x1e, %esi
sbbq $-0x1, %r12
addq $0x30, %rcx
decq %rax
jne 0xb923
jmp 0xb947
xorl %edx, %edx
xorl %r12d, %r12d
leaq 0xf2c2(%rip), %rsi      # 0x1ac10
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3290
leaq 0xf2c4(%rip), %rsi      # 0x1ac26
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3290
movq (%r13), %rax
addq %rax, %rax
je 0xba05
movq 0x28(%r13), %rcx
movq 0x30(%r13), %rdx
movq 0x38(%r13), %rsi
addq $0x20, %rcx
xorl %edi, %edi
xorl %r8d, %r8d
xorl %r15d, %r15d
movq (%rsi,%rdi,8), %r9
testq %r9, %r9
je 0xb9c8
movq (%rdx,%rdi,8), %r10
leaq (%r10,%r10,2), %r11
shlq $0x4, %r11
addq %rcx, %r11
movq %r9, %r10
movl (%r11), %ebp
addl %ebp, %ebp
sarl $0x1f, %ebp
movslq %ebp, %r12
addq %r12, %r10
addq $0x30, %r11
decq %r9
jne 0xb9af
jmp 0xb9cb
xorl %r10d, %r10d
cmpq %r15, %r10
cmovaq %r10, %r15
addq %r10, %r8
incq %rdi
cmpq %rax, %rdi
jne 0xb994
movq %r8, %xmm0
punpckldq 0xeba6(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xebae(%rip), %xmm0     # 0x1a5a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, (%rsp)
jmp 0xba0e
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
leaq 0xf226(%rip), %rsi      # 0x1ac3b
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3290
testq %r14, %r14
je 0xba78
movapd 0x10(%rsp), %xmm1
unpcklps 0xeb5c(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xeb64(%rip), %xmm1     # 0x1a5a0
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movapd (%rsp), %xmm0
divsd %xmm2, %xmm0
mulsd 0xea9f(%rip), %xmm0     # 0x1a4f8
leaq 0xf1ec(%rip), %rsi      # 0x1ac4c
movq %rbx, %rdi
movb $0x1, %al
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3290
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq