// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/./newran02/hist.cpp
// Function: Histogram(Random*, int)
void Histogram(Random* rx, int n)          // draw histogram with n obsv
{
   int i,j; int count[20];
   Real* a = new Real[n];
   if (!a) { cout << "\nNo memory for Histogram\n"; return; }
   for (i = 0; i < n; i++) a[i] = rx->Next();
   Real amax = a[0]; Real amin = a[0]; Real mean = a[0]; Real sd = 0;
   for (i = 1; i < n; i++)
   {
      if (amin > a[i]) amin = a[i]; else if (amax < a[i]) amax = a[i];
      mean += a[i];
   }
   mean /= n;
   for (i = 0; i < 20; i++) count[i]=0;
   for (i = 0; i < n; i++)
   {
     Real rat= (amax != amin) ? (a[i] - amin)/(amax - amin) : 1.0;
     j = (int)( 19.999 * rat ); count[j]++;
     Real diff = a[i] - mean; sd += diff*diff;
   }
   sd = sqrt(sd/(n-1));
   j = 0;
   for (i = 0; i < 20; i++) { if (j < count[i]) j = count[i]; }
   if (j > 70) { for (i = 0; i < 20; i++) count[i] = (int)((70L*count[i])/j); }
   cout << "\n";
   for (i = 0; i < 20; i++)
      { cout << "\n|"; for (j = 1; j < count[i]; j = j+1) cout << "*"; }
   cout << "\n" << rx->Name() << "\n";
   cout << "p. mean = " << setw(9) << setprecision(5) << rx->Mean()
        << ", p. var = " << setw(9) << setprecision(5)
           << rx->Variance() << "\n";
   cout << "s. mean = " << setw(9) << setprecision(5) << mean
        << ", s. var = " << setw(9) << setprecision(5) << sd*sd
        << ", max = " << setw(9) << setprecision(5) << amax
        << ", min = " << setw(9) << setprecision(5) << amin
        << "\n";
   cout << flush;
   delete a;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %esi, %ebp
movq %rdi, %r12
movl %esi, %eax
shlq $0x3, %rax
xorl %r14d, %r14d
testl %esi, %esi
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
movl $0x0, %r15d
cmovgl %esi, %r15d
callq 0x7030
movq %rax, %rbx
cmpq %r14, %r15
je 0xaa2f
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
movsd %xmm0, (%rbx,%r14,8)
incq %r14
jmp 0xaa16
movsd (%rbx), %xmm7
movslq %ebp, %rax
pushq $0x1
popq %rcx
movapd %xmm7, %xmm5
movapd %xmm7, %xmm6
cmpq %rax, %rcx
jge 0xaa6a
movsd (%rbx,%rcx,8), %xmm0
ucomisd %xmm0, %xmm5
jbe 0xaa57
movapd %xmm0, %xmm5
jmp 0xaa61
ucomisd %xmm6, %xmm0
jbe 0xaa61
movapd %xmm0, %xmm6
addsd %xmm0, %xmm7
incq %rcx
jmp 0xaa41
cvtsi2sd %ebp, %xmm0
xorl %eax, %eax
cmpq $0x14, %rax
je 0xaa80
andl $0x0, 0x30(%rsp,%rax,4)
incq %rax
jmp 0xaa70
divsd %xmm0, %xmm7
movapd %xmm6, %xmm1
subsd %xmm5, %xmm1
xorpd %xmm0, %xmm0
xorl %eax, %eax
pushq $0x13
popq %rcx
movsd 0x227f3(%rip), %xmm2    # 0x2d290
cmpq %rax, %r15
je 0xaade
ucomisd %xmm5, %xmm6
movsd (%rbx,%rax,8), %xmm3
movq %rcx, %rdx
jne 0xaab2
jnp 0xaac9
movapd %xmm3, %xmm4
subsd %xmm5, %xmm4
divsd %xmm1, %xmm4
mulsd %xmm2, %xmm4
cvttsd2si %xmm4, %edx
movslq %edx, %rdx
incl 0x30(%rsp,%rdx,4)
subsd %xmm7, %xmm3
mulsd %xmm3, %xmm3
addsd %xmm3, %xmm0
incq %rax
jmp 0xaa9d
decl %ebp
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm5, 0x20(%rsp)
movsd %xmm6, 0x18(%rsp)
movsd %xmm7, 0x8(%rsp)
jb 0xab0a
sqrtsd %xmm0, %xmm0
jmp 0xab0f
callq 0x7778
movsd %xmm0, (%rsp)
xorl %ecx, %ecx
xorl %eax, %eax
cmpq $0x14, %rcx
je 0xab2c
movl 0x30(%rsp,%rcx,4), %edx
cmpl %edx, %eax
cmovlel %edx, %eax
incq %rcx
jmp 0xab18
cmpl $0x47, %eax
jl 0xab52
movl %eax, %ecx
xorl %esi, %esi
cmpq $0x14, %rsi
je 0xab52
movslq 0x30(%rsp,%rsi,4), %rax
imulq $0x46, %rax, %rax
cqto
idivq %rcx
movl %eax, 0x30(%rsp,%rsi,4)
incq %rsi
jmp 0xab35
movq %r12, 0x10(%rsp)
movq %rbx, 0x28(%rsp)
movq 0x3a42d(%rip), %r15     # 0x44f90
leaq 0x233dd(%rip), %rsi     # 0x2df47
movq %r15, %rdi
callq 0x73d0
xorl %ebp, %ebp
pushq $0x1
popq %r12
leaq 0x2277e(%rip), %r13     # 0x2d2fd
cmpq $0x14, %rbp
je 0xabb5
movq %r15, %rdi
leaq 0x22709(%rip), %rsi     # 0x2d298
callq 0x73d0
movl 0x30(%rsp,%rbp,4), %ebx
movl %r12d, %r14d
cmpl %ebx, %r14d
jge 0xabb0
movq %r15, %rdi
movq %r13, %rsi
callq 0x73d0
incl %r14d
jmp 0xab9b
incq %rbp
jmp 0xab7f
movq 0x3a3d4(%rip), %r14     # 0x44f90
leaq 0x23384(%rip), %r12     # 0x2df47
movq %r14, %rdi
movq %r12, %rsi
callq 0x73d0
movq %rax, %r13
movq 0x10(%rsp), %rbx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movq %r13, %rdi
movq %rax, %rsi
callq 0x73d0
movq %rax, %rdi
movq %r12, %rsi
callq 0x73d0
leaq 0x2269f(%rip), %rsi     # 0x2d29b
movq %r14, %rdi
callq 0x73d0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rcx
pushq $0x9
popq %rbp
movq %rbp, 0x10(%r13,%rcx)
movq -0x18(%rax), %rax
pushq $0x5
popq %r15
movq %r15, 0x8(%r13,%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
leaq 0x98(%rsp), %rsi
movsd %xmm0, (%rsi)
movl %eax, 0x8(%rsi)
movq %r13, %rdi
callq 0xa97f
leaq 0x2265c(%rip), %rsi     # 0x2d2a6
movq %rax, %rdi
callq 0x73d0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rcx
movq %rbp, 0x10(%r13,%rcx)
movq -0x18(%rax), %rax
movq %r15, 0x8(%r13,%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x30(%rax)
leaq 0x88(%rsp), %rsi
movsd %xmm0, (%rsi)
movl %eax, 0x8(%rsi)
movq %r13, %rdi
callq 0xa97f
movq %rax, %rdi
movq %r12, %rsi
callq 0x73d0
leaq 0x22616(%rip), %rsi     # 0x2d2b2
movq %r14, %rdi
callq 0x73d0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq %rbp, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq %r15, 0x8(%rax,%rcx)
movq %rax, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x7620
leaq 0x225ef(%rip), %rsi     # 0x2d2bd
movq %rax, %rdi
callq 0x73d0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq %rbp, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq %r15, 0x8(%rax,%rcx)
movsd (%rsp), %xmm0
mulsd %xmm0, %xmm0
movq %rax, %rdi
callq 0x7620
leaq 0x225c6(%rip), %rsi     # 0x2d2c9
movq %rax, %rdi
callq 0x73d0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq %rbp, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq %r15, 0x8(%rax,%rcx)
movq %rax, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x7620
leaq 0x2259d(%rip), %rsi     # 0x2d2d2
movq %rax, %rdi
callq 0x73d0
movq (%rax), %rcx
movq -0x18(%rcx), %rdx
movq %rbp, 0x10(%rax,%rdx)
movq -0x18(%rcx), %rcx
movq %r15, 0x8(%rax,%rcx)
movq %rax, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x7620
movq %rax, %rdi
movq %r12, %rsi
callq 0x73d0
movq %r14, %rdi
callq 0x72c0
pushq $0x8
popq %rsi
movq 0x28(%rsp), %rdi
callq 0x7400
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop