// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movl %esi, %r15d
leaq (,%r15,8), %rax
testl %esi, %esi
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x7030
movq %rax, %r12
testl %ebp, %ebp
jle 0xb15f
xorl %ebx, %ebx
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movsd %xmm0, (%r12,%rbx,8)
incq %rbx
cmpq %rbx, %r15
jne 0xb134
movsd (%r12), %xmm6
cmpl $0x1, %ebp
jne 0xb192
movapd %xmm6, %xmm7
movapd %xmm6, %xmm5
jmp 0xb1c7
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
xorpd %xmm0, %xmm0
movsd 0x290e3(%rip), %xmm7    # 0x34270
jmp 0xb258
movl $0x1, %eax
movapd %xmm6, %xmm5
movapd %xmm6, %xmm7
movsd (%r12,%rax,8), %xmm0
ucomisd %xmm0, %xmm5
jbe 0xb1b1
movapd %xmm0, %xmm5
jmp 0xb1bb
ucomisd %xmm6, %xmm0
jbe 0xb1bb
movapd %xmm0, %xmm6
addsd %xmm0, %xmm7
incq %rax
cmpq %rax, %r15
jne 0xb19f
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
divsd %xmm0, %xmm7
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movapd %xmm0, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
testl %ebp, %ebp
jle 0xb254
movapd %xmm6, %xmm1
subsd %xmm5, %xmm1
xorpd %xmm0, %xmm0
xorl %eax, %eax
movsd 0x2906a(%rip), %xmm2    # 0x34278
ucomisd %xmm5, %xmm6
movsd (%r12,%rax,8), %xmm3
jne 0xb21c
jnp 0xb235
movapd %xmm3, %xmm4
subsd %xmm5, %xmm4
divsd %xmm1, %xmm4
mulsd %xmm2, %xmm4
cvttsd2si %xmm4, %ecx
movslq %ecx, %rcx
jmp 0xb23a
movl $0x13, %ecx
incl 0x30(%rsp,%rcx,4)
subsd %xmm7, %xmm3
mulsd %xmm3, %xmm3
addsd %xmm3, %xmm0
incq %rax
cmpq %rax, %r15
jne 0xb20e
jmp 0xb258
xorpd %xmm0, %xmm0
decl %ebp
xorps %xmm1, %xmm1
cvtsi2sd %ebp, %xmm1
divsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movsd %xmm5, 0x20(%rsp)
movsd %xmm6, 0x18(%rsp)
movsd %xmm7, 0x10(%rsp)
jb 0xb287
sqrtsd %xmm0, %xmm0
jmp 0xb28c
callq 0x7728
movsd %xmm0, 0x8(%rsp)
xorpd %xmm0, %xmm0
xorl %eax, %eax
movdqa 0x30(%rsp,%rax,4), %xmm1
movapd %xmm0, %xmm2
pcmpgtd %xmm1, %xmm0
andpd %xmm0, %xmm2
pandn %xmm1, %xmm0
por %xmm2, %xmm0
addq $0x4, %rax
cmpq $0x14, %rax
jne 0xb298
movq %r12, 0x28(%rsp)
pshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
movdqa %xmm0, %xmm2
pcmpgtd %xmm1, %xmm2
pand %xmm2, %xmm0
pandn %xmm1, %xmm2
por %xmm0, %xmm2
pshufd $0x55, %xmm2, %xmm0     # xmm0 = xmm2[1,1,1,1]
movdqa %xmm2, %xmm1
pcmpgtd %xmm0, %xmm1
pand %xmm1, %xmm2
pandn %xmm0, %xmm1
por %xmm2, %xmm1
movd %xmm1, %eax
cmpl $0x47, %eax
jl 0xb31b
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 0xb300
movq 0x3cc6e(%rip), %r15     # 0x47f90
leaq 0x29c6e(%rip), %rsi     # 0x34f97
movl $0x1, %edx
movq %r15, %rdi
callq 0x7400
xorl %ebp, %ebp
leaq 0x28f41(%rip), %r12     # 0x34280
leaq 0x28f9f(%rip), %r13     # 0x342e5
movl $0x2, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x7400
movl 0x30(%rsp,%rbp,4), %ebx
cmpl $0x2, %ebx
jl 0xb375
decl %ebx
movl $0x1, %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x7400
decl %ebx
jne 0xb361
incq %rbp
cmpq $0x14, %rbp
jne 0xb346
movq 0x3cc0b(%rip), %r15     # 0x47f90
leaq 0x29c0b(%rip), %rsi     # 0x34f97
movl $0x1, %edx
movq %r15, %rdi
callq 0x7400
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
testq %rax, %rax
je 0xb3c6
movq %rax, %r12
movq %rax, %rdi
callq 0x7170
movq 0x3cbd7(%rip), %rdi     # 0x47f90
movq %r12, %rsi
movq %rax, %rdx
callq 0x7400
jmp 0xb3de
movq (%r15), %rax
movq -0x18(%rax), %rax
leaq (%r15,%rax), %rdi
movl 0x20(%r15,%rax), %esi
orl $0x1, %esi
callq 0x7640
leaq 0x29bb2(%rip), %rbx     # 0x34f97
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7400
leaq 0x28e87(%rip), %rsi     # 0x34283
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
movq %xmm0, (%rsi)
movl %eax, 0x8(%rsi)
movq %r15, %rdi
callq 0xb089
movq %rax, %r13
leaq 0x28e3b(%rip), %rsi     # 0x3428e
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
movq %xmm0, (%rsi)
movl %eax, 0x8(%rsi)
movq %r13, %rdi
callq 0xb089
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x7400
leaq 0x28ded(%rip), %rsi     # 0x3429a
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 0x28dbe(%rip), %rsi     # 0x342a5
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 0x28d8c(%rip), %rsi     # 0x342b1
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 0x18(%rsp), %xmm0
callq 0x75c0
movq %rax, %r14
leaq 0x28d5b(%rip), %rsi     # 0x342ba
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
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x7400
movq %r15, %rdi
callq 0x7260
movl $0x8, %esi
movq 0x28(%rsp), %rdi
callq 0x7390
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq