// File: 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
movq %rsp, %rbp
subq $0x1c0, %rsp            # imm = 0x1C0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x8040
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x1222a
movq 0x97d6f(%rip), %rdi     # 0xa9f88
leaq 0x642d8(%rip), %rsi     # 0x764f8
callq 0x84a0
jmp 0x1294b
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1225a
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
callq *(%rax)
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x12231
movq -0x78(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x78(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x78(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x98(%rbp)
movl $0x1, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x1232a
movsd -0x88(%rbp), %xmm0
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x122d3
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x88(%rbp)
jmp 0x122ff
movsd -0x80(%rbp), %xmm1
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x122fd
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x80(%rbp)
jmp 0x122ff
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x90(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x12299
cvtsi2sdl -0xc(%rbp), %xmm1
movsd -0x90(%rbp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x14, -0x10(%rbp)
jge 0x12367
movslq -0x10(%rbp), %rax
movl $0x0, -0x70(%rbp,%rax,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1234a
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x12458
movsd -0x80(%rbp), %xmm0
ucomisd -0x88(%rbp), %xmm0
jne 0x1238d
jp 0x1238d
jmp 0x123bd
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd -0x88(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
subsd -0x88(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x120(%rbp)
jmp 0x123cf
movsd 0x63c4b(%rip), %xmm0    # 0x76010
movsd %xmm0, -0x120(%rbp)
jmp 0x123cf
movsd -0x120(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd 0x64109(%rip), %xmm0    # 0x764f0
mulsd -0xa0(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movl -0x70(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x70(%rbp,%rax,4)
movq -0x78(%rbp), %rax
movslq -0x10(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
subsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd -0xa8(%rbp), %xmm2
movsd -0x98(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1236e
movsd -0x98(%rbp), %xmm0
movl -0xc(%rbp), %eax
subl $0x1, %eax
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
callq 0x8938
movsd %xmm0, -0x98(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x14, -0x10(%rbp)
jge 0x124b4
movl -0x14(%rbp), %eax
movslq -0x10(%rbp), %rcx
cmpl -0x70(%rbp,%rcx,4), %eax
jge 0x124a7
movslq -0x10(%rbp), %rax
movl -0x70(%rbp,%rax,4), %eax
movl %eax, -0x14(%rbp)
jmp 0x124a9
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x12489
cmpl $0x46, -0x14(%rbp)
jle 0x124f4
movl $0x0, -0x10(%rbp)
cmpl $0x14, -0x10(%rbp)
jge 0x124f2
movslq -0x10(%rbp), %rax
movslq -0x70(%rbp,%rax,4), %rax
imulq $0x46, %rax, %rax
movslq -0x14(%rbp), %rcx
cqto
idivq %rcx
movl %eax, %ecx
movslq -0x10(%rbp), %rax
movl %ecx, -0x70(%rbp,%rax,4)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x124c1
jmp 0x124f4
movq 0x97a8d(%rip), %rdi     # 0xa9f88
leaq 0x64d1a(%rip), %rsi     # 0x7721c
callq 0x84a0
movl $0x0, -0x10(%rbp)
cmpl $0x14, -0x10(%rbp)
jge 0x12566
movq 0x97a6d(%rip), %rdi     # 0xa9f88
leaq 0x63ff0(%rip), %rsi     # 0x76512
callq 0x84a0
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
movslq -0x10(%rbp), %rcx
cmpl -0x70(%rbp,%rcx,4), %eax
jge 0x12559
movq 0x97a46(%rip), %rdi     # 0xa9f88
leaq 0x64053(%rip), %rsi     # 0x7659c
callq 0x84a0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1252e
jmp 0x1255b
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x1250e
movq 0x97a1b(%rip), %rdi     # 0xa9f88
movq %rdi, -0x1b0(%rbp)
leaq 0x64ca1(%rip), %rsi     # 0x7721c
movq %rsi, -0x1b8(%rbp)
callq 0x84a0
movq %rax, -0x1c0(%rbp)
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
movq 0x8(%rax), %rax
callq *%rax
movq -0x1c0(%rbp), %rdi
movq %rax, %rsi
callq 0x84a0
movq -0x1b8(%rbp), %rsi
movq %rax, %rdi
callq 0x84a0
movq -0x1b0(%rbp), %rdi
leaq 0x63f4e(%rip), %rsi     # 0x76515
callq 0x84a0
movq %rax, -0x1a8(%rbp)
movl $0x9, %edi
movl %edi, -0x18c(%rbp)
callq 0x12960
movq -0x1a8(%rbp), %rdi
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %esi
callq 0x85a0
movq %rax, -0x1a0(%rbp)
movl $0x5, %edi
movl %edi, -0x17c(%rbp)
callq 0x12980
movq -0x1a0(%rbp), %rdi
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %esi
callq 0x8760
movq %rax, -0x198(%rbp)
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
movq -0x198(%rbp), %rdi
movl %eax, -0xc8(%rbp)
movsd %xmm0, -0xd0(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, -0xb8(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0xc0(%rbp)
leaq -0xc0(%rbp), %rsi
callq 0x120e0
movq %rax, %rdi
leaq 0x63e9d(%rip), %rsi     # 0x76520
callq 0x84a0
movl -0x18c(%rbp), %edi
movq %rax, -0x188(%rbp)
callq 0x12960
movq -0x188(%rbp), %rdi
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %esi
callq 0x85a0
movl -0x17c(%rbp), %edi
movq %rax, -0x178(%rbp)
callq 0x12980
movq -0x178(%rbp), %rdi
movl %eax, -0xd8(%rbp)
movl -0xd8(%rbp), %esi
callq 0x8760
movq %rax, -0x170(%rbp)
movq -0x8(%rbp), %rdi
movq (%rdi), %rax
movq 0x30(%rax), %rax
callq *%rax
movq -0x170(%rbp), %rdi
movl %eax, -0xf0(%rbp)
movsd %xmm0, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl -0xf0(%rbp), %eax
movl %eax, -0xe0(%rbp)
leaq -0xe8(%rbp), %rsi
callq 0x120e0
movq %rax, %rdi
leaq 0x64ae7(%rip), %rsi     # 0x7721c
callq 0x84a0
movq 0x97847(%rip), %rdi     # 0xa9f88
leaq 0x63de4(%rip), %rsi     # 0x7652c
callq 0x84a0
movq %rax, -0x168(%rbp)
movl $0x9, %edi
callq 0x12960
movq -0x168(%rbp), %rdi
movl %eax, -0xfc(%rbp)
movl -0xfc(%rbp), %esi
callq 0x85a0
movq %rax, -0x160(%rbp)
movl $0x5, %edi
callq 0x12980
movq -0x160(%rbp), %rdi
movl %eax, -0x100(%rbp)
movl -0x100(%rbp), %esi
callq 0x8760
movq %rax, %rdi
movsd -0x90(%rbp), %xmm0
callq 0x88c0
movq %rax, %rdi
leaq 0x63d7e(%rip), %rsi     # 0x76537
callq 0x84a0
movq %rax, -0x158(%rbp)
movl $0x9, %edi
callq 0x12960
movq -0x158(%rbp), %rdi
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %esi
callq 0x85a0
movq %rax, -0x150(%rbp)
movl $0x5, %edi
callq 0x12980
movq -0x150(%rbp), %rdi
movl %eax, -0x108(%rbp)
movl -0x108(%rbp), %esi
callq 0x8760
movq %rax, %rdi
movsd -0x98(%rbp), %xmm0
mulsd -0x98(%rbp), %xmm0
callq 0x88c0
movq %rax, %rdi
leaq 0x63d11(%rip), %rsi     # 0x76543
callq 0x84a0
movq %rax, -0x148(%rbp)
movl $0x9, %edi
callq 0x12960
movq -0x148(%rbp), %rdi
movl %eax, -0x10c(%rbp)
movl -0x10c(%rbp), %esi
callq 0x85a0
movq %rax, -0x140(%rbp)
movl $0x5, %edi
callq 0x12980
movq -0x140(%rbp), %rdi
movl %eax, -0x110(%rbp)
movl -0x110(%rbp), %esi
callq 0x8760
movq %rax, %rdi
movsd -0x80(%rbp), %xmm0
callq 0x88c0
movq %rax, %rdi
leaq 0x63cac(%rip), %rsi     # 0x7654c
callq 0x84a0
movq %rax, -0x138(%rbp)
movl $0x9, %edi
callq 0x12960
movq -0x138(%rbp), %rdi
movl %eax, -0x114(%rbp)
movl -0x114(%rbp), %esi
callq 0x85a0
movq %rax, -0x130(%rbp)
movl $0x5, %edi
callq 0x12980
movq -0x130(%rbp), %rdi
movl %eax, -0x118(%rbp)
movl -0x118(%rbp), %esi
callq 0x8760
movq %rax, %rdi
movsd -0x88(%rbp), %xmm0
callq 0x88c0
movq %rax, %rdi
leaq 0x6490b(%rip), %rsi     # 0x7721c
callq 0x84a0
movq 0x9766b(%rip), %rdi     # 0xa9f88
movq 0x9766c(%rip), %rsi     # 0xa9f90
callq 0x8520
movq -0x78(%rbp), %rax
movq %rax, -0x128(%rbp)
cmpq $0x0, %rax
je 0x1294b
movq -0x128(%rbp), %rdi
movl $0x8, %esi
callq 0x84d0
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop