// File: /workspace/github_cpp_makefile_star2_O1/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
movslq %esi, %r14
leaq (,%r14,8), %rax
testl %r14d, %r14d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x7030
movq %rax, %rbx
movl %ebp, %r15d
testl %r14d, %r14d
jle 0xb0c9
xorl %r14d, %r14d
movq (%r12), %rax
movq %r12, %rdi
callq *(%rax)
movsd %xmm0, (%rbx,%r14,8)
incq %r14
cmpq %r14, %r15
jne 0xb0b2
movsd (%rbx), %xmm6
cmpl $0x2, %ebp
jl 0xb108
movl $0x1, %eax
movapd %xmm6, %xmm5
movapd %xmm6, %xmm7
movsd (%rbx,%rax,8), %xmm0
ucomisd %xmm0, %xmm5
jbe 0xb0f0
movapd %xmm0, %xmm5
jmp 0xb0fa
ucomisd %xmm6, %xmm0
jbe 0xb0fa
movapd %xmm0, %xmm6
addsd %xmm0, %xmm7
incq %rax
cmpq %rax, %r15
jne 0xb0df
jmp 0xb110
movapd %xmm6, %xmm7
movapd %xmm6, %xmm5
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
divsd %xmm0, %xmm7
xorpd %xmm1, %xmm1
xorpd %xmm0, %xmm0
testl %ebp, %ebp
jle 0xb19f
movapd %xmm6, %xmm2
subsd %xmm5, %xmm2
xorl %eax, %eax
movsd 0x2a14d(%rip), %xmm3    # 0x352a8
ucomisd %xmm5, %xmm6
jne 0xb163
jnp 0xb17d
movsd (%rbx,%rax,8), %xmm4
subsd %xmm5, %xmm4
divsd %xmm2, %xmm4
mulsd %xmm3, %xmm4
cvttsd2si %xmm4, %ecx
movslq %ecx, %rcx
jmp 0xb182
movl $0x13, %ecx
incl 0x30(%rsp,%rcx,4)
movsd (%rbx,%rax,8), %xmm4
subsd %xmm7, %xmm4
mulsd %xmm4, %xmm4
addsd %xmm4, %xmm0
incq %rax
cmpq %rax, %r15
jne 0xb15b
decl %ebp
xorps %xmm2, %xmm2
cvtsi2sd %ebp, %xmm2
divsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
movsd %xmm5, 0x28(%rsp)
movsd %xmm6, 0x20(%rsp)
movsd %xmm7, 0x10(%rsp)
jb 0xb1ca
sqrtsd %xmm0, %xmm0
jmp 0xb1cf
callq 0x7728
movsd %xmm0, 0x8(%rsp)
xorl %ecx, %ecx
xorl %eax, %eax
movl %eax, %edx
movl 0x30(%rsp,%rcx,4), %eax
cmpl %eax, %edx
cmovgl %edx, %eax
incq %rcx
cmpq $0x14, %rcx
jne 0xb1d9
movq %r12, 0x18(%rsp)
cmpl $0x47, %eax
jl 0xb216
movl %eax, %ecx
xorl %esi, %esi
movslq 0x30(%rsp,%rsi,4), %rax
imulq $0x46, %rax, %rax
cqto
idivq %rcx
movl %eax, 0x30(%rsp,%rsi,4)
incq %rsi
cmpq $0x14, %rsi
jne 0xb1fb
movq 0x3dd73(%rip), %r15     # 0x48f90
leaq 0x2ad53(%rip), %rsi     # 0x35f77
movl $0x1, %edx
movq %r15, %rdi
callq 0x7400
xorl %ebp, %ebp
leaq 0x2a076(%rip), %r12     # 0x352b0
leaq 0x2a0d4(%rip), %r13     # 0x35315
movl $0x2, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x7400
movl 0x30(%rsp,%rbp,4), %r14d
cmpl $0x2, %r14d
jl 0xb274
decl %r14d
movl $0x1, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x7400
decl %r14d
jne 0xb25f
incq %rbp
cmpq $0x14, %rbp
jne 0xb241
movq 0x3dd0c(%rip), %r15     # 0x48f90
leaq 0x2acec(%rip), %rsi     # 0x35f77
movl $0x1, %edx
movq %r15, %rdi
callq 0x7400
movq 0x18(%rsp), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
testq %rax, %rax
je 0xb2ca
movq %rax, %r12
movq %rax, %rdi
callq 0x7170
movq 0x3dcd3(%rip), %rdi     # 0x48f90
movq %r12, %rsi
movq %rax, %rdx
callq 0x7400
jmp 0xb2e2
movq (%r15), %rax
movq -0x18(%rax), %rax
leaq (%r15,%rax), %rdi
movl 0x20(%r15,%rax), %esi
orl $0x1, %esi
callq 0x7640
leaq 0x2ac8e(%rip), %rsi     # 0x35f77
movl $0x1, %edx
movq %r15, %rdi
callq 0x7400
leaq 0x29fb6(%rip), %rsi     # 0x352b3
movl $0xa, %edx
movq %r15, %rdi
callq 0x7400
movq (%r15), %rax
movq -0x18(%rax), %rcx
movl $0x9, %ebp
movq %rbp, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
movl $0x5, %r12d
movq %r12, 0x8(%r15,%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x28(%rax)
leaq 0x98(%rsp), %rsi
movsd %xmm0, (%rsi)
movl %eax, 0x8(%rsi)
movq %r15, %rdi
callq 0xb001
movq %rax, %r13
leaq 0x29f6a(%rip), %rsi     # 0x352be
movl $0xb, %edx
movq %rax, %rdi
callq 0x7400
movq (%r13), %rax
movq -0x18(%rax), %rcx
movq %rbp, 0x10(%r13,%rcx)
movq -0x18(%rax), %rax
movq %r12, 0x8(%r13,%rax)
movq (%r14), %rax
movq %r14, %rdi
callq *0x30(%rax)
leaq 0x88(%rsp), %rsi
movsd %xmm0, (%rsi)
movl %eax, 0x8(%rsi)
movq %r13, %rdi
callq 0xb001
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2abd1(%rip), %r13     # 0x35f77
movq %r13, %rsi
callq 0x7400
leaq 0x29f15(%rip), %rsi     # 0x352ca
movl $0xa, %edx
movq %r15, %rdi
callq 0x7400
movq (%r15), %rax
movq -0x18(%rax), %rcx
movq %rbp, 0x10(%r15,%rcx)
movq -0x18(%rax), %rax
movq %r12, 0x8(%r15,%rax)
movq %r15, %rdi
movsd 0x10(%rsp), %xmm0
callq 0x75c0
movq %rax, %r14
leaq 0x29ee6(%rip), %rsi     # 0x352d5
movl $0xb, %edx
movq %rax, %rdi
callq 0x7400
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq %rbp, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movq %r12, 0x8(%r14,%rax)
movsd 0x8(%rsp), %xmm0
mulsd %xmm0, %xmm0
movq %r14, %rdi
callq 0x75c0
movq %rax, %r14
leaq 0x29eb4(%rip), %rsi     # 0x352e1
movl $0x8, %edx
movq %rax, %rdi
callq 0x7400
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq %rbp, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movq %r12, 0x8(%r14,%rax)
movq %r14, %rdi
movsd 0x20(%rsp), %xmm0
callq 0x75c0
movq %rax, %r14
leaq 0x29e83(%rip), %rsi     # 0x352ea
movl $0x8, %edx
movq %rax, %rdi
callq 0x7400
movq (%r14), %rax
movq -0x18(%rax), %rcx
movq %rbp, 0x10(%r14,%rcx)
movq -0x18(%rax), %rax
movq %r12, 0x8(%r14,%rax)
movq %r14, %rdi
movsd 0x28(%rsp), %xmm0
callq 0x75c0
movl $0x1, %edx
movq %rax, %rdi
movq %r13, %rsi
callq 0x7400
movq %r15, %rdi
callq 0x7260
movl $0x8, %esi
movq %rbx, %rdi
callq 0x7390
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop