// File: ashlall[P]StreamStats/Test/BasicStats_test.cpp
// Function: test_MAX()
void test_MAX()
{
 BasicStats a; // tests when there is one item in the stream
  a.insert(3);
  assert(a.MAX()==3);

  BasicStats b; // tests with 100 items in the stream in ascending order
  for (int i=1;i<100;i++)
    b.insert(i);
  assert(b.MAX()==99);

  BasicStats c; // tests with one million items in the stream in descending order 
  for (int i=1000000;i>=1;i--)
    c.insert(i);
  assert(c.MAX()==1000000);

  BasicStats d; // tests the stream in ascending order
  for (int i=1;i<=100000;i++)
    d.insert(i*3);
  assert(d.MAX()==300000);
  
  BasicStats e;
  for(int i=1;i<=10000;i++)
     e.insert(rand()%1000+250); //tests in a randomly generated stream with 200 as maximum
  e.insert(2000);
  for(int i=1;i<=1000;i++)
     e.insert(rand()%1000+550);
  assert(e.MAX()==2000);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
leaq -0x28(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x11d0
movq -0x100(%rbp), %rdi
movsd 0x16ee(%rip), %xmm0     # 0x3008
callq 0x12d0
jmp 0x1921
leaq -0x28(%rbp), %rdi
callq 0x1450
movsd 0x16d6(%rip), %xmm1     # 0x3008
ucomisd %xmm1, %xmm0
jne 0x193c
jp 0x193c
jmp 0x196c
leaq 0x17b2(%rip), %rdi      # 0x30f5
leaq 0x1759(%rip), %rsi      # 0x30a3
movl $0x2d, %edx
leaq 0x17aa(%rip), %rcx      # 0x3100
callq 0x1040
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1cdc
leaq -0x60(%rbp), %rdi
callq 0x11d0
jmp 0x1977
movl $0x1, -0x64(%rbp)
cmpl $0x64, -0x64(%rbp)
jge 0x19b2
cvtsi2sdl -0x64(%rbp), %xmm0
leaq -0x60(%rbp), %rdi
callq 0x12d0
jmp 0x1994
jmp 0x1996
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x197e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1cd3
leaq -0x60(%rbp), %rdi
callq 0x1450
movsd 0x165d(%rip), %xmm1     # 0x3020
ucomisd %xmm1, %xmm0
jne 0x19cd
jp 0x19cd
jmp 0x19ec
leaq 0x173c(%rip), %rdi      # 0x3110
leaq 0x16c8(%rip), %rsi      # 0x30a3
movl $0x32, %edx
leaq 0x1719(%rip), %rcx      # 0x3100
callq 0x1040
leaq -0x90(%rbp), %rdi
callq 0x11d0
jmp 0x19fa
movl $0xf4240, -0x94(%rbp)   # imm = 0xF4240
cmpl $0x1, -0x94(%rbp)
jl 0x1a47
cvtsi2sdl -0x94(%rbp), %xmm0
leaq -0x90(%rbp), %rdi
callq 0x12d0
jmp 0x1a23
jmp 0x1a25
movl -0x94(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x1a04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1cc7
leaq -0x90(%rbp), %rdi
callq 0x1450
movsd 0x15cd(%rip), %xmm1     # 0x3028
ucomisd %xmm1, %xmm0
jne 0x1a65
jp 0x1a65
jmp 0x1a84
leaq 0x16b0(%rip), %rdi      # 0x311c
leaq 0x1630(%rip), %rsi      # 0x30a3
movl $0x37, %edx
leaq 0x1681(%rip), %rcx      # 0x3100
callq 0x1040
leaq -0xc0(%rbp), %rdi
callq 0x11d0
jmp 0x1a92
movl $0x1, -0xc4(%rbp)
cmpl $0x186a0, -0xc4(%rbp)   # imm = 0x186A0
jg 0x1ae9
movl -0xc4(%rbp), %ecx
movl %ecx, %eax
leal (%rax,%rax,2), %eax
cvtsi2sd %eax, %xmm0
leaq -0xc0(%rbp), %rdi
callq 0x12d0
jmp 0x1ac5
jmp 0x1ac7
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x1a9c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1cbb
leaq -0xc0(%rbp), %rdi
callq 0x1450
movsd 0x1533(%rip), %xmm1     # 0x3030
ucomisd %xmm1, %xmm0
jne 0x1b07
jp 0x1b07
jmp 0x1b26
leaq 0x161f(%rip), %rdi      # 0x312d
leaq 0x158e(%rip), %rsi      # 0x30a3
movl $0x3c, %edx
leaq 0x15df(%rip), %rcx      # 0x3100
callq 0x1040
leaq -0xf0(%rbp), %rdi
callq 0x11d0
jmp 0x1b34
movl $0x1, -0xf4(%rbp)
cmpl $0x2710, -0xf4(%rbp)    # imm = 0x2710
jg 0x1bbd
callq 0x1030
movl %eax, %ecx
movslq %ecx, %rax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rax
addl %edx, %eax
imull $0x3e8, %eax, %edx      # imm = 0x3E8
movl %ecx, %eax
negl %edx
movl %edx, %ecx
leal 0xfa(%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
leaq -0xf0(%rbp), %rdi
callq 0x12d0
jmp 0x1b8d
jmp 0x1b8f
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x1b3e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x22f0
jmp 0x1cbb
leaq -0xf0(%rbp), %rdi
movsd 0x146c(%rip), %xmm0     # 0x3038
callq 0x12d0
jmp 0x1bd3
movl $0x1, -0xf8(%rbp)
cmpl $0x3e8, -0xf8(%rbp)     # imm = 0x3E8
jg 0x1c3f
callq 0x1030
movl %eax, %ecx
movslq %ecx, %rax
imulq $0x10624dd3, %rax, %rax # imm = 0x10624DD3
movq %rax, %rdx
shrq $0x3f, %rdx
sarq $0x26, %rax
addl %edx, %eax
imull $0x3e8, %eax, %edx      # imm = 0x3E8
movl %ecx, %eax
negl %edx
movl %edx, %ecx
leal 0x226(%rax,%rcx), %eax
cvtsi2sd %eax, %xmm0
leaq -0xf0(%rbp), %rdi
callq 0x12d0
jmp 0x1c2c
jmp 0x1c2e
movl -0xf8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf8(%rbp)
jmp 0x1bdd
leaq -0xf0(%rbp), %rdi
callq 0x1450
movsd 0x13e5(%rip), %xmm1     # 0x3038
ucomisd %xmm1, %xmm0
jne 0x1c5d
jp 0x1c5d
jmp 0x1c7c
leaq 0x14d9(%rip), %rdi      # 0x313d
leaq 0x1438(%rip), %rsi      # 0x30a3
movl $0x44, %edx
leaq 0x1489(%rip), %rcx      # 0x3100
callq 0x1040
leaq -0xf0(%rbp), %rdi
callq 0x22f0
leaq -0xc0(%rbp), %rdi
callq 0x22f0
leaq -0x90(%rbp), %rdi
callq 0x22f0
leaq -0x60(%rbp), %rdi
callq 0x22f0
leaq -0x28(%rbp), %rdi
callq 0x22f0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0xc0(%rbp), %rdi
callq 0x22f0
leaq -0x90(%rbp), %rdi
callq 0x22f0
leaq -0x60(%rbp), %rdi
callq 0x22f0
leaq -0x28(%rbp), %rdi
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0x1080
nop