// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/syncmer.c
// Function: hist_plot
static void hist_plot(int64_t *hist, uint32_t n, const char *h, FILE *fo)
{
    if (n < 5) return;

    uint32_t i, j, b, p_cnt, cnts[n];
    int32_t c, c_digits;
    double tot_cnt, cnt;
    
    tot_cnt = .0;
    cnts[0] = cnts[1] = cnts[2] = 0;
    for (i = 3; i < n; ++i) {
        cnts[i] = (uint32_t) hist[i];
        tot_cnt += cnts[i];
    }
    tot_cnt *= .99;
    cnt = .0;
    b = 0;
    for (i = 0; i < n; ++i) {
        cnt += cnts[i];
        if (cnt >= tot_cnt) {
            b = i + 1;
            break;
        }
    }
    p_cnt = 0;
    for (i = 0; i < b; ++i)
        if (p_cnt < cnts[i])
            p_cnt = cnts[i];

    c_digits = 0;
    for (i = 0; i < b; ++i) {
        c = hist[i] >> 32;
        int d = c > 0? 0 : 1;
        do {
            c /= 10;
            ++d;
        } while (c != 0);
        if (d > c_digits) c_digits = d;
    }
    if (b < n) ++c_digits;

    double per_dot = MAX(1, p_cnt / 100);
    uint32_t d;
    for (i = 0; i < b; ++i) {
        c = hist[i] >> 32;
        cnt = (uint32_t) hist[i];
        fprintf(fo, "[M::%s] [%s] %*d: ", __func__, h, c_digits, c);
        d = (uint32_t) (cnt / per_dot);
        for (j = 0; j < MIN(d, 100); ++j) fputc('*', fo);
        d = cnt/per_dot > 100? (uint32_t) log10(cnt/per_dot/100) : 0;
        for (j = 0; j < MAX(d, 0); ++j) fputc('+', fo);
        fprintf(fo, " %d\n", (int) cnt);
    }
    if (b < n) {
        c = hist[b-1] >> 32;
        cnt = .0;
        for (i = b; i < n; ++i)
            cnt += (uint32_t) hist[i];
        fprintf(fo, "[M::%s] [%s] >%*d: ", __func__, h, c_digits-1, c);
        d = (uint32_t) (cnt / per_dot);
        for (j = 0; j < MIN(d, 100); ++j) fputc('*', fo);
        d = cnt/per_dot > 100? (uint32_t) log10(cnt/per_dot/100) : 0;
        for (j = 0; j < MAX(d, 0); ++j) fputc('+', fo);
        fprintf(fo, " %d\n", (int) cnt);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
cmpl $0x5, -0xc(%rbp)
jae 0x18b25
jmp 0x19065
movl -0xc(%rbp), %eax
movl %eax, %ecx
movq %rsp, %rax
movq %rax, -0x38(%rbp)
leaq 0xf(,%rcx,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rax
subq %rdx, %rax
movq %rax, -0x78(%rbp)
movq %rax, %rsp
movq %rcx, -0x40(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x50(%rbp)
movl $0x0, 0x8(%rax)
movl $0x0, 0x4(%rax)
movl $0x0, (%rax)
movl $0x3, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x18baa
movq -0x78(%rbp), %rax
movq -0x8(%rbp), %rdx
movl -0x24(%rbp), %ecx
movl (%rdx,%rcx,8), %edx
movl %edx, (%rax,%rcx,4)
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %eax
cvtsi2sd %rax, %xmm0
addsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x18b71
movsd 0x14bde(%rip), %xmm0    # 0x2d790
mulsd -0x50(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x18c17
movq -0x78(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %eax
cvtsi2sd %rax, %xmm0
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movsd -0x58(%rbp), %xmm0
ucomisd -0x50(%rbp), %xmm0
jb 0x18c0a
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x18c17
jmp 0x18c0c
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x18bd2
movl $0x0, -0x30(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x18c56
movq -0x78(%rbp), %rcx
movl -0x30(%rbp), %eax
movl -0x24(%rbp), %edx
cmpl (%rcx,%rdx,4), %eax
jae 0x18c49
movq -0x78(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
jmp 0x18c4b
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x18c25
movl $0x0, -0x48(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x18cc9
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movq (%rax,%rcx,8), %rax
sarq $0x20, %rax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %edx
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovgl %ecx, %eax
movl %eax, -0x5c(%rbp)
movl -0x44(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, -0x44(%rbp)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x44(%rbp)
jne 0x18c91
movl -0x5c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jle 0x18cbc
movl -0x5c(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0x18cbe
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x18c64
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x18cda
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movl -0x30(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jbe 0x18cfb
movl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x18d0a
movl -0x30(%rbp), %eax
movl $0x64, %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x68(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jae 0x18eaa
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl 0x4(%rax,%rcx,8), %eax
movl %eax, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,8), %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl -0x48(%rbp), %r8d
movl -0x44(%rbp), %r9d
leaq 0x15765(%rip), %rsi     # 0x2e4ca
leaq 0x15771(%rip), %rdx     # 0x2e4dd
xorl %eax, %eax
callq 0x2290
movsd -0x58(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x80(%rbp)
cmpl $0x64, -0x6c(%rbp)
jae 0x18da7
movl -0x6c(%rbp), %eax
movl %eax, -0x84(%rbp)
jmp 0x18db4
movl $0x64, %eax
movl %eax, -0x84(%rbp)
jmp 0x18db4
movl -0x80(%rbp), %eax
movl -0x84(%rbp), %ecx
cmpl %ecx, %eax
jae 0x18dda
movq -0x20(%rbp), %rsi
movl $0x2a, %edi
callq 0x2220
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x18d90
movsd -0x58(%rbp), %xmm0
divsd -0x68(%rbp), %xmm0
movsd 0x1513c(%rip), %xmm1    # 0x2df28
ucomisd %xmm1, %xmm0
jbe 0x18e1e
movsd -0x58(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0x15120(%rip), %xmm1    # 0x2df28
divsd %xmm1, %xmm0
callq 0x2270
cvttsd2si %xmm0, %rax
movl %eax, -0x88(%rbp)
jmp 0x18e28
xorl %eax, %eax
movl %eax, -0x88(%rbp)
jmp 0x18e28
movl -0x88(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x8c(%rbp)
cmpl $0x0, -0x6c(%rbp)
jbe 0x18e52
movl -0x6c(%rbp), %eax
movl %eax, -0x90(%rbp)
jmp 0x18e5c
xorl %eax, %eax
movl %eax, -0x90(%rbp)
jmp 0x18e5c
movl -0x8c(%rbp), %eax
movl -0x90(%rbp), %ecx
cmpl %ecx, %eax
jae 0x18e85
movq -0x20(%rbp), %rsi
movl $0x2b, %edi
callq 0x2220
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x18e38
movq -0x20(%rbp), %rdi
cvttsd2si -0x58(%rbp), %edx
leaq 0x152f3(%rip), %rsi     # 0x2e188
movb $0x0, %al
callq 0x2290
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x18d20
movl -0x2c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x1905e
movq -0x8(%rbp), %rax
movl -0x2c(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
sarq $0x20, %rax
movl %eax, -0x44(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0xc(%rbp), %eax
jae 0x18f07
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,8), %eax
cvtsi2sd %rax, %xmm0
addsd -0x58(%rbp), %xmm0
movsd %xmm0, -0x58(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x18edb
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl -0x48(%rbp), %r8d
decl %r8d
movl -0x44(%rbp), %r9d
leaq 0x155c6(%rip), %rsi     # 0x2e4e7
leaq 0x155b5(%rip), %rdx     # 0x2e4dd
xorl %eax, %eax
callq 0x2290
movsd -0x58(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0x94(%rbp)
cmpl $0x64, -0x6c(%rbp)
jae 0x18f66
movl -0x6c(%rbp), %eax
movl %eax, -0x98(%rbp)
jmp 0x18f73
movl $0x64, %eax
movl %eax, -0x98(%rbp)
jmp 0x18f73
movl -0x94(%rbp), %eax
movl -0x98(%rbp), %ecx
cmpl %ecx, %eax
jae 0x18f9c
movq -0x20(%rbp), %rsi
movl $0x2a, %edi
callq 0x2220
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x18f4c
movsd -0x58(%rbp), %xmm0
divsd -0x68(%rbp), %xmm0
movsd 0x14f7a(%rip), %xmm1    # 0x2df28
ucomisd %xmm1, %xmm0
jbe 0x18fe0
movsd -0x58(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd 0x14f5e(%rip), %xmm1    # 0x2df28
divsd %xmm1, %xmm0
callq 0x2270
cvttsd2si %xmm0, %rax
movl %eax, -0x9c(%rbp)
jmp 0x18fea
xorl %eax, %eax
movl %eax, -0x9c(%rbp)
jmp 0x18fea
movl -0x9c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, -0xa0(%rbp)
cmpl $0x0, -0x6c(%rbp)
jbe 0x19014
movl -0x6c(%rbp), %eax
movl %eax, -0xa4(%rbp)
jmp 0x1901e
xorl %eax, %eax
movl %eax, -0xa4(%rbp)
jmp 0x1901e
movl -0xa0(%rbp), %eax
movl -0xa4(%rbp), %ecx
cmpl %ecx, %eax
jae 0x19047
movq -0x20(%rbp), %rsi
movl $0x2b, %edi
callq 0x2220
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x18ffa
movq -0x20(%rbp), %rdi
cvttsd2si -0x58(%rbp), %edx
leaq 0x15131(%rip), %rsi     # 0x2e188
movb $0x0, %al
callq 0x2290
movq -0x38(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)