// File: /workspace/github_c_makefile_star2_O1/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 0xb3a5
movq 0x10(%r13), %rcx
addq $0x20, %rcx
movl $0x10, %edx
xorl %r15d, %r15d
xorl %r14d, %r14d
testb $0x40, 0x3(%rcx)
jne 0xb396
movq 0x10(%rdi), %rsi
movl (%rsi,%rdx), %esi
addq %rsi, %r15
incq %r14
addq $0x28, %rcx
addq $0x18, %rdx
decq %rax
jne 0xb383
jmp 0xb3ab
xorl %r14d, %r14d
xorl %r15d, %r15d
leaq 0xe7fc(%rip), %rsi      # 0x19bae
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x3290
leaq 0xe801(%rip), %rsi      # 0x19bc7
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3290
movq %r14, %xmm4
testq %r14, %r14
movdqa %xmm4, 0x10(%rsp)
je 0xb439
movq %r15, %xmm1
movq 0xe1a0(%rip), %xmm2     # 0x19590
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0xe1a4(%rip), %xmm3     # 0x195a0
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 0xe7b3(%rip), %rsi      # 0x19be2
movq %rbx, %rdi
movb $0x1, %al
callq 0x3290
movq 0x18(%r13), %rax
testq %rax, %rax
je 0xb46e
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 0xb44f
jmp 0xb473
xorl %edx, %edx
xorl %r12d, %r12d
leaq 0xe786(%rip), %rsi      # 0x19c00
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3290
leaq 0xe788(%rip), %rsi      # 0x19c16
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3290
movq (%r13), %rax
addq %rax, %rax
je 0xb531
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 0xb4f4
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 0xb4db
jmp 0xb4f7
movq %r9, %r10
cmpq %r15, %r10
cmovaq %r10, %r15
addq %r10, %r8
incq %rdi
cmpq %rax, %rdi
jne 0xb4c0
movq %r8, %xmm0
punpckldq 0xe07a(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xe082(%rip), %xmm0     # 0x195a0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, (%rsp)
jmp 0xb53a
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
leaq 0xe6ea(%rip), %rsi      # 0x19c2b
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x3290
testq %r14, %r14
je 0xb5a4
movapd 0x10(%rsp), %xmm1
unpcklps 0xe030(%rip), %xmm1     # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xe038(%rip), %xmm1     # 0x195a0
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movapd (%rsp), %xmm0
divsd %xmm2, %xmm0
mulsd 0xdf4b(%rip), %xmm0     # 0x194d0
leaq 0xe6b0(%rip), %rsi      # 0x19c3c
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