// File: /workspace/github_c_makefile_star2_O2/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), %r15
pushq $0x10
popq %rcx
pushq $0x20
popq %rdx
xorl %r14d, %r14d
xorl %r12d, %r12d
subq $0x1, %rax
jb 0x9dd0
movq 0x10(%r15), %rsi
testb $0x40, 0x3(%rsi,%rdx)
jne 0x9dc6
movq 0x10(%rdi), %rsi
movl (%rsi,%rcx), %esi
addq %rsi, %r12
incq %r14
addq $0x18, %rcx
addq $0x28, %rdx
jmp 0x9da8
leaq 0xcdf7(%rip), %rsi      # 0x16bce
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3290
leaq 0xcdfc(%rip), %rsi      # 0x16be7
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3290
movq %r14, %xmm4
testq %r14, %r14
movdqa %xmm4, 0x10(%rsp)
je 0x9e5e
movq %r12, %xmm1
movq 0xc77b(%rip), %xmm2     # 0x16590
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0xc77f(%rip), %xmm3     # 0x165a0
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 0xcdae(%rip), %rsi      # 0x16c02
movq %rbx, %rdi
movb $0x1, %al
callq 0x3290
movq 0x18(%r15), %rax
pushq $0x20
popq %rcx
xorl %edx, %edx
xorl %r13d, %r13d
subq $0x1, %rax
jb 0x9e8f
movq 0x28(%r15), %rsi
movl (%rsi,%rcx), %esi
cmpl $0x40000000, %esi       # imm = 0x40000000
adcq $0x0, %rdx
btl $0x1e, %esi
sbbq $-0x1, %r13
addq $0x30, %rcx
jmp 0x9e6a
leaq 0xcd8a(%rip), %rsi      # 0x16c20
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3290
leaq 0xcd8c(%rip), %rsi      # 0x16c36
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x3290
movq (%r15), %rbx
addq %rbx, %rbx
xorl %ebp, %ebp
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x9ee6
movq %r15, %rdi
movq %r13, %rsi
callq 0x5722
cmpq %r12, %rax
cmovaq %rax, %r12
addq %rax, %rbp
incq %r13
jmp 0x9ec7
leaq 0xcd5e(%rip), %rsi      # 0x16c4b
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3290
testq %r14, %r14
je 0x9f72
movq %rbp, %xmm1
movq 0xc67f(%rip), %xmm2     # 0x16590
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0xc683(%rip), %xmm3     # 0x165a0
subpd %xmm3, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movdqa 0x10(%rsp), %xmm4
punpckldq %xmm2, %xmm4    # xmm4 = xmm4[0],xmm2[0],xmm4[1],xmm2[1]
subpd %xmm3, %xmm4
movapd %xmm4, %xmm1
unpckhpd %xmm4, %xmm1            # xmm1 = xmm1[1],xmm4[1]
addsd %xmm4, %xmm1
divsd %xmm1, %xmm0
mulsd 0xc59d(%rip), %xmm0     # 0x164f0
leaq 0xcd02(%rip), %rsi      # 0x16c5c
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