// File: ashlall[P]StreamStats/Test/GK_test.cpp
// Function: test_GK(int, int)
void test_GK(int stream_size, int sample_size)
{
	double epsilon = log(stream_size)/sample_size;
	
	double quantA,quantB,quantC,quantD,quantE,quantF,quantG,quantH;
	bool condA,condB,condC,condD,condE,condF,condG,condH;
	double upper,lower;
	
	int random_fix1 = rand()% RAND_MAX;
 	int random_fix2 = rand()% RAND_MAX;
 	int random_fix3 = rand()% RAND_MAX;
        
    	GK a(sample_size);
 	GK b(sample_size);
	GK c(sample_size);
	GK d(sample_size);
 	GK e(sample_size);
	GK f(sample_size);
	GK g(sample_size);
 	GK h(sample_size);

	
	for (double j = 0; j <= stream_size; j++) //inserting in decreasing order
   	{	
  		a.insert(j); 
    	}
    	bool condA1;
	int LA = a.get_stream_size(); //test the function get_stream_size()
	condA1= (LA == stream_size+1);
	assert(condA1 == true);

	for (double i = stream_size; i >= 0; i--) //inserting in desceding order
    	{
  		b.insert(i); 
    	}
    	bool condB1;
	int LB = b.get_stream_size(); //test the function get_stream_size()
	condB1= (LB == stream_size+1);
	assert(condB1 == true);

	/*
	Generate three uniform distribution with the following range. In order to have a "good" uniform distribution, recommend large stream size.
	*/
	int uni_lower_bound1 = 500;
	int uni_upper_bound1 = 1000;

	int uni_lower_bound2 = 1234;
	int uni_upper_bound2 = 5678;

	int uni_lower_bound3 = 0;
	int uni_upper_bound3 = 5000;
	for (int m = 1; m <= 3; m++) //create 3 "random" sequences that holds their randomness every time runs the code
  	{
		double data;
  		if (m == 1)
  		{	
			default_random_engine generator(5);
			uniform_real_distribution<double> distribution(uni_lower_bound1,uni_upper_bound1);
			for (int i = 0; i <= stream_size; i++)
			{
   				data = distribution(generator);
  				c.insert(data);
			} 
  		}
  		
  		else if(m == 2)
  		{
			default_random_engine generator(10);
			uniform_real_distribution<double> distribution(uni_lower_bound2,uni_upper_bound2);
			for (int i = 0; i <= stream_size; i++)
			{
   				data = distribution(generator);
  				d.insert(data);
			}
  		}	
  		
  		else 
  		{	
			default_random_engine generator(20);
			uniform_real_distribution<double> distribution(uni_lower_bound3,uni_upper_bound3);
			for (int i = 0; i <= stream_size; i++)
			{
   				data = distribution(generator);
  				e.insert(data);
			}
  		}
  	}
  	
  	  f.insert(random_fix1); //test corner case where n = 1
  	  g.insert(random_fix2); 
  	  h.insert(random_fix3);   	
  	  bool condF1,condG1,condH1;
	  long LF = f.get_stream_size(); //test the function get_stream_size()
	  long LG = g.get_stream_size();
 	  long LH = h.get_stream_size();
          condF1 = (LF == 1);
     	  condG1 = (LG == 1);
	  condH1 = (LH == 1);
	  assert(condF1 == true);
	  assert(condG1 == true);
	  assert(condH1 == true);  
	  	
  for (float i=1;i<=stream_size;i++)
  {
  	  double interval=i/stream_size; //getting each probabilty interval
  	  
  	  quantA=a.getQuantile(interval); //getting quantile for each probability interval
  	  quantB=b.getQuantile(interval);
  	  quantC=c.getQuantile(interval);
  	  quantD=d.getQuantile(interval);
  	  quantE=e.getQuantile(interval);
  	  quantF=f.getQuantile(interval);
  	  quantG=g.getQuantile(interval);
  	  quantH=h.getQuantile(interval);
  	  
  	  lower=(interval-epsilon)*stream_size;//Used for first two cases.
  	  upper=(interval+epsilon)*stream_size;
  	  //cout << "l: " << lower << "  " << "u: " << upper <<endl;

  	  condA= ((lower<=quantA) && (upper>=quantA));
  	  condB= ((lower<=quantB) && (upper >=quantB));
  	  //checking if quantile is within error range
  	  
	
	 // cout << "cao:" << quantD<<endl;
	  //cout << (uni_lower_bound2 + (uni_upper_bound2-uni_lower_bound2)*interval)+epsilon*stream_size << endl;
 	 //cout << (uni_lower_bound2 + (uni_upper_bound2 - uni_lower_bound2)*interval)-epsilon*stream_size << endl;
	 //cout << "" <<endl;

	 condC = (quantC >= (uni_lower_bound1+(uni_upper_bound1 - uni_lower_bound1)*interval)- epsilon*stream_size) && (quantC <= (uni_lower_bound1+(uni_upper_bound1 - uni_lower_bound1)*interval) + epsilon*stream_size);
	 condD = (quantD >= (uni_lower_bound2+(uni_upper_bound2 - uni_lower_bound2)*interval)- epsilon*stream_size) && (quantD <= (uni_lower_bound2+(uni_upper_bound2 - uni_lower_bound2)*interval) + epsilon*stream_size);
	 condE = (quantE >= (uni_lower_bound3+(uni_upper_bound3 - uni_lower_bound3)*interval)- epsilon*stream_size) && (quantE <= (uni_lower_bound3+(uni_upper_bound3 - uni_lower_bound3)*interval) + epsilon*stream_size);
  	  //checking if quantile is within error range
  	  
  	  
  	  condF= (random_fix1 == quantF);
  	  condG= (random_fix2 == quantG);
  	  condH= (random_fix3 == quantH);
  	  //checking if the condition holds in the corner case where stream size = 1

  	  
  	  assert(condA==true);
  	  assert(condB==true);
  	  assert(condC==true);
  	  assert(condD==true);
  	  assert(condE==true);
  	  assert(condF==true);
  	  assert(condG==true);
  	  assert(condH==true);
  } 	  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x320, %rsp            # imm = 0x320
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl -0x4(%rbp), %edi
callq 0x2d50
cvtsi2sdl -0x8(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
callq 0x1050
movslq %eax, %rdx
movq %rdx, %rcx
shlq $0x1e, %rcx
addq %rcx, %rdx
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x3d, %rdx
addl %ecx, %edx
movl %edx, %ecx
shll $0x1f, %ecx
addl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x6c(%rbp)
callq 0x1050
movslq %eax, %rdx
movq %rdx, %rcx
shlq $0x1e, %rcx
addq %rcx, %rdx
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x3d, %rdx
addl %ecx, %edx
movl %edx, %ecx
shll $0x1f, %ecx
addl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x70(%rbp)
callq 0x1050
movslq %eax, %rdx
movq %rdx, %rcx
shlq $0x1e, %rcx
addq %rcx, %rdx
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x3d, %rdx
addl %ecx, %edx
movl %edx, %ecx
shll $0x1f, %ecx
addl %edx, %ecx
addl %ecx, %eax
movl %eax, -0x74(%rbp)
movl -0x8(%rbp), %esi
leaq -0xa8(%rbp), %rdi
callq 0x12e0
movl -0x8(%rbp), %esi
leaq -0xd8(%rbp), %rdi
callq 0x12e0
jmp 0x1ac8
movl -0x8(%rbp), %esi
leaq -0x118(%rbp), %rdi
callq 0x12e0
jmp 0x1ad9
movl -0x8(%rbp), %esi
leaq -0x148(%rbp), %rdi
callq 0x12e0
jmp 0x1aea
movl -0x8(%rbp), %esi
leaq -0x178(%rbp), %rdi
callq 0x12e0
jmp 0x1afb
movl -0x8(%rbp), %esi
leaq -0x1a8(%rbp), %rdi
callq 0x12e0
jmp 0x1b0c
movl -0x8(%rbp), %esi
leaq -0x1d8(%rbp), %rdi
callq 0x12e0
jmp 0x1b1d
movl -0x8(%rbp), %esi
leaq -0x208(%rbp), %rdi
callq 0x12e0
jmp 0x1b2e
xorps %xmm0, %xmm0
movsd %xmm0, -0x210(%rbp)
movsd -0x210(%rbp), %xmm1
cvtsi2sdl -0x4(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x1c46
movsd -0x210(%rbp), %xmm0
leaq -0xa8(%rbp), %rdi
callq 0x1450
jmp 0x1b66
jmp 0x1b68
movsd 0x2498(%rip), %xmm0     # 0x4008
addsd -0x210(%rbp), %xmm0
movsd %xmm0, -0x210(%rbp)
jmp 0x1b39
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x27a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x2798
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x278c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x2780
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x2774
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x2768
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
jmp 0x275c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xe0(%rbp)
movl %eax, -0xe4(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x13c0
jmp 0x275c
leaq -0xa8(%rbp), %rdi
callq 0x2d70
movq %rax, -0x2e0(%rbp)
jmp 0x1c5b
movq -0x2e0(%rbp), %rax
movl %eax, -0x218(%rbp)
movl -0x218(%rbp), %eax
movl -0x4(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, -0x211(%rbp)
movb -0x211(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x1c93
jmp 0x1cb2
leaq 0x23d6(%rip), %rdi      # 0x4070
leaq 0x23de(%rip), %rsi      # 0x407f
movl $0x2c, %edx
leaq 0x23de(%rip), %rcx      # 0x408b
callq 0x1070
cvtsi2sdl -0x4(%rbp), %xmm0
movsd %xmm0, -0x220(%rbp)
movsd -0x220(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x1d02
movsd -0x220(%rbp), %xmm0
leaq -0xd8(%rbp), %rdi
callq 0x1450
jmp 0x1ce6
jmp 0x1ce8
movsd 0x2320(%rip), %xmm0     # 0x4010
addsd -0x220(%rbp), %xmm0
movsd %xmm0, -0x220(%rbp)
jmp 0x1cbf
leaq -0xd8(%rbp), %rdi
callq 0x2d70
movq %rax, -0x2e8(%rbp)
jmp 0x1d17
movq -0x2e8(%rbp), %rax
movl %eax, -0x228(%rbp)
movl -0x228(%rbp), %eax
movl -0x4(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
sete %al
andb $0x1, %al
movb %al, -0x221(%rbp)
movb -0x221(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x1d4f
jmp 0x1d6e
leaq 0x234c(%rip), %rdi      # 0x40a2
leaq 0x2322(%rip), %rsi      # 0x407f
movl $0x35, %edx
leaq 0x2322(%rip), %rcx      # 0x408b
callq 0x1070
movl $0x1f4, -0x22c(%rbp)    # imm = 0x1F4
movl $0x3e8, -0x230(%rbp)    # imm = 0x3E8
movl $0x4d2, -0x234(%rbp)    # imm = 0x4D2
movl $0x162e, -0x238(%rbp)   # imm = 0x162E
movl $0x0, -0x23c(%rbp)
movl $0x1388, -0x240(%rbp)   # imm = 0x1388
movl $0x1, -0x244(%rbp)
cmpl $0x3, -0x244(%rbp)
jg 0x1fd3
cmpl $0x1, -0x244(%rbp)
jne 0x1e6f
leaq -0x258(%rbp), %rdi
movl $0x5, %esi
callq 0x2d90
jmp 0x1de1
cvtsi2sdl -0x22c(%rbp), %xmm0
cvtsi2sdl -0x230(%rbp), %xmm1
leaq -0x268(%rbp), %rdi
callq 0x2dc0
jmp 0x1dff
movl $0x0, -0x26c(%rbp)
movl -0x26c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jg 0x1e6a
leaq -0x268(%rbp), %rdi
leaq -0x258(%rbp), %rsi
callq 0x2df0
movsd %xmm0, -0x2f0(%rbp)
jmp 0x1e31
movsd -0x2f0(%rbp), %xmm0
movsd %xmm0, -0x250(%rbp)
movsd -0x250(%rbp), %xmm0
leaq -0x118(%rbp), %rdi
callq 0x1450
jmp 0x1e57
jmp 0x1e59
movl -0x26c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x26c(%rbp)
jmp 0x1e09
jmp 0x1fbd
cmpl $0x2, -0x244(%rbp)
jne 0x1f1d
leaq -0x278(%rbp), %rdi
movl $0xa, %esi
callq 0x2d90
jmp 0x1e8f
cvtsi2sdl -0x234(%rbp), %xmm0
cvtsi2sdl -0x238(%rbp), %xmm1
leaq -0x288(%rbp), %rdi
callq 0x2dc0
jmp 0x1ead
movl $0x0, -0x28c(%rbp)
movl -0x28c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jg 0x1f18
leaq -0x288(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x2df0
movsd %xmm0, -0x2f8(%rbp)
jmp 0x1edf
movsd -0x2f8(%rbp), %xmm0
movsd %xmm0, -0x250(%rbp)
movsd -0x250(%rbp), %xmm0
leaq -0x148(%rbp), %rdi
callq 0x1450
jmp 0x1f05
jmp 0x1f07
movl -0x28c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28c(%rbp)
jmp 0x1eb7
jmp 0x1fbb
leaq -0x298(%rbp), %rdi
movl $0x14, %esi
callq 0x2d90
jmp 0x1f30
cvtsi2sdl -0x23c(%rbp), %xmm0
cvtsi2sdl -0x240(%rbp), %xmm1
leaq -0x2a8(%rbp), %rdi
callq 0x2dc0
jmp 0x1f4e
movl $0x0, -0x2ac(%rbp)
movl -0x2ac(%rbp), %eax
cmpl -0x4(%rbp), %eax
jg 0x1fb9
leaq -0x2a8(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x2df0
movsd %xmm0, -0x300(%rbp)
jmp 0x1f80
movsd -0x300(%rbp), %xmm0
movsd %xmm0, -0x250(%rbp)
movsd -0x250(%rbp), %xmm0
leaq -0x178(%rbp), %rdi
callq 0x1450
jmp 0x1fa6
jmp 0x1fa8
movl -0x2ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2ac(%rbp)
jmp 0x1f58
jmp 0x1fbb
jmp 0x1fbd
jmp 0x1fbf
movl -0x244(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x244(%rbp)
jmp 0x1db4
cvtsi2sdl -0x6c(%rbp), %xmm0
leaq -0x1a8(%rbp), %rdi
callq 0x1450
jmp 0x1fe6
cvtsi2sdl -0x70(%rbp), %xmm0
leaq -0x1d8(%rbp), %rdi
callq 0x1450
jmp 0x1ff9
cvtsi2sdl -0x74(%rbp), %xmm0
leaq -0x208(%rbp), %rdi
callq 0x1450
jmp 0x200c
leaq -0x1a8(%rbp), %rdi
callq 0x2d70
movq %rax, -0x308(%rbp)
jmp 0x2021
movq -0x308(%rbp), %rax
movq %rax, -0x2b8(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x2d70
movq %rax, -0x310(%rbp)
jmp 0x2044
movq -0x310(%rbp), %rax
movq %rax, -0x2c0(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x2d70
movq %rax, -0x318(%rbp)
jmp 0x2067
movq -0x318(%rbp), %rax
movq %rax, -0x2c8(%rbp)
cmpq $0x1, -0x2b8(%rbp)
sete %al
andb $0x1, %al
movb %al, -0x2ad(%rbp)
cmpq $0x1, -0x2c0(%rbp)
sete %al
andb $0x1, %al
movb %al, -0x2ae(%rbp)
cmpq $0x1, -0x2c8(%rbp)
sete %al
andb $0x1, %al
movb %al, -0x2af(%rbp)
movb -0x2ad(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x20c0
jmp 0x20df
leaq 0x1fea(%rip), %rdi      # 0x40b1
leaq 0x1fb1(%rip), %rsi      # 0x407f
movl $0x71, %edx
leaq 0x1fb1(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x2ae(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x20f1
jmp 0x2110
leaq 0x1fc8(%rip), %rdi      # 0x40c0
leaq 0x1f80(%rip), %rsi      # 0x407f
movl $0x72, %edx
leaq 0x1f80(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x2af(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2122
jmp 0x2141
leaq 0x1fa6(%rip), %rdi      # 0x40cf
leaq 0x1f4f(%rip), %rsi      # 0x407f
movl $0x73, %edx
leaq 0x1f4f(%rip), %rcx      # 0x408b
callq 0x1070
movss 0x1eef(%rip), %xmm0     # 0x4038
movss %xmm0, -0x2cc(%rbp)
movss -0x2cc(%rbp), %xmm1
cvtsi2ssl -0x4(%rbp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x26f3
movss -0x2cc(%rbp), %xmm0
cvtsi2ssl -0x4(%rbp), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x2d8(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0xa8(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x18(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0xd8(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x20(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0x118(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x28(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0x148(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x30(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0x178(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x38(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0x1a8(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x40(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0x1d8(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x48(%rbp)
movsd -0x2d8(%rbp), %xmm0
leaq -0x208(%rbp), %rdi
callq 0x1900
movsd %xmm0, -0x50(%rbp)
movsd -0x2d8(%rbp), %xmm0
subsd -0x10(%rbp), %xmm0
cvtsi2sdl -0x4(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x2d8(%rbp), %xmm0
addsd -0x10(%rbp), %xmm0
cvtsi2sdl -0x4(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x68(%rbp), %xmm1
movsd -0x18(%rbp), %xmm0
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x319(%rbp)
jb 0x22ad
movsd -0x60(%rbp), %xmm0
ucomisd -0x18(%rbp), %xmm0
setae %al
movb %al, -0x319(%rbp)
movb -0x319(%rbp), %al
andb $0x1, %al
movb %al, -0x51(%rbp)
movsd -0x68(%rbp), %xmm1
movsd -0x20(%rbp), %xmm0
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x31a(%rbp)
jb 0x22e3
movsd -0x60(%rbp), %xmm0
ucomisd -0x20(%rbp), %xmm0
setae %al
movb %al, -0x31a(%rbp)
movb -0x31a(%rbp), %al
andb $0x1, %al
movb %al, -0x52(%rbp)
movsd -0x28(%rbp), %xmm0
cvtsi2sdl -0x22c(%rbp), %xmm1
movl -0x230(%rbp), %eax
subl -0x22c(%rbp), %eax
cvtsi2sd %eax, %xmm2
movsd -0x2d8(%rbp), %xmm3
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movsd -0x10(%rbp), %xmm1
cvtsi2sdl -0x4(%rbp), %xmm3
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x31b(%rbp)
jb 0x239e
movsd -0x28(%rbp), %xmm1
cvtsi2sdl -0x22c(%rbp), %xmm0
movl -0x230(%rbp), %eax
subl -0x22c(%rbp), %eax
cvtsi2sd %eax, %xmm2
movsd -0x2d8(%rbp), %xmm3
mulsd %xmm3, %xmm2
addsd %xmm0, %xmm2
movsd -0x10(%rbp), %xmm0
cvtsi2sdl -0x4(%rbp), %xmm3
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
setae %al
movb %al, -0x31b(%rbp)
movb -0x31b(%rbp), %al
andb $0x1, %al
movb %al, -0x53(%rbp)
movsd -0x30(%rbp), %xmm0
cvtsi2sdl -0x234(%rbp), %xmm1
movl -0x238(%rbp), %eax
subl -0x234(%rbp), %eax
cvtsi2sd %eax, %xmm2
movsd -0x2d8(%rbp), %xmm3
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movsd -0x10(%rbp), %xmm1
cvtsi2sdl -0x4(%rbp), %xmm3
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x31c(%rbp)
jb 0x2459
movsd -0x30(%rbp), %xmm1
cvtsi2sdl -0x234(%rbp), %xmm0
movl -0x238(%rbp), %eax
subl -0x234(%rbp), %eax
cvtsi2sd %eax, %xmm2
movsd -0x2d8(%rbp), %xmm3
mulsd %xmm3, %xmm2
addsd %xmm0, %xmm2
movsd -0x10(%rbp), %xmm0
cvtsi2sdl -0x4(%rbp), %xmm3
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
setae %al
movb %al, -0x31c(%rbp)
movb -0x31c(%rbp), %al
andb $0x1, %al
movb %al, -0x54(%rbp)
movsd -0x38(%rbp), %xmm0
cvtsi2sdl -0x23c(%rbp), %xmm1
movl -0x240(%rbp), %eax
subl -0x23c(%rbp), %eax
cvtsi2sd %eax, %xmm2
movsd -0x2d8(%rbp), %xmm3
mulsd %xmm3, %xmm2
addsd %xmm1, %xmm2
movsd -0x10(%rbp), %xmm1
cvtsi2sdl -0x4(%rbp), %xmm3
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm0
movb %al, -0x31d(%rbp)
jb 0x2514
movsd -0x38(%rbp), %xmm1
cvtsi2sdl -0x23c(%rbp), %xmm0
movl -0x240(%rbp), %eax
subl -0x23c(%rbp), %eax
cvtsi2sd %eax, %xmm2
movsd -0x2d8(%rbp), %xmm3
mulsd %xmm3, %xmm2
addsd %xmm0, %xmm2
movsd -0x10(%rbp), %xmm0
cvtsi2sdl -0x4(%rbp), %xmm3
mulsd %xmm3, %xmm0
addsd %xmm2, %xmm0
ucomisd %xmm1, %xmm0
setae %al
movb %al, -0x31d(%rbp)
movb -0x31d(%rbp), %al
andb $0x1, %al
movb %al, -0x55(%rbp)
cvtsi2sdl -0x6c(%rbp), %xmm0
ucomisd -0x40(%rbp), %xmm0
sete %al
setnp %cl
andb %cl, %al
andb $0x1, %al
movb %al, -0x56(%rbp)
cvtsi2sdl -0x70(%rbp), %xmm0
ucomisd -0x48(%rbp), %xmm0
sete %al
setnp %cl
andb %cl, %al
andb $0x1, %al
movb %al, -0x57(%rbp)
cvtsi2sdl -0x74(%rbp), %xmm0
ucomisd -0x50(%rbp), %xmm0
sete %al
setnp %cl
andb %cl, %al
andb $0x1, %al
movb %al, -0x58(%rbp)
movb -0x51(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2573
jmp 0x2592
leaq 0x1b64(%rip), %rdi      # 0x40de
leaq 0x1afe(%rip), %rsi      # 0x407f
movl $0x9c, %edx
leaq 0x1afe(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x52(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x25a1
jmp 0x25c0
leaq 0x1b42(%rip), %rdi      # 0x40ea
leaq 0x1ad0(%rip), %rsi      # 0x407f
movl $0x9d, %edx
leaq 0x1ad0(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x53(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x25cf
jmp 0x25ee
leaq 0x1b20(%rip), %rdi      # 0x40f6
leaq 0x1aa2(%rip), %rsi      # 0x407f
movl $0x9e, %edx
leaq 0x1aa2(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x54(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x25fd
jmp 0x261c
leaq 0x1afe(%rip), %rdi      # 0x4102
leaq 0x1a74(%rip), %rsi      # 0x407f
movl $0x9f, %edx
leaq 0x1a74(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x55(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x262b
jmp 0x264a
leaq 0x1adc(%rip), %rdi      # 0x410e
leaq 0x1a46(%rip), %rsi      # 0x407f
movl $0xa0, %edx
leaq 0x1a46(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x56(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2659
jmp 0x2678
leaq 0x1aba(%rip), %rdi      # 0x411a
leaq 0x1a18(%rip), %rsi      # 0x407f
movl $0xa1, %edx
leaq 0x1a18(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x57(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x2687
jmp 0x26a6
leaq 0x1a98(%rip), %rdi      # 0x4126
leaq 0x19ea(%rip), %rsi      # 0x407f
movl $0xa2, %edx
leaq 0x19ea(%rip), %rcx      # 0x408b
callq 0x1070
movb -0x58(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x26b5
jmp 0x26d4
leaq 0x1a76(%rip), %rdi      # 0x4132
leaq 0x19bc(%rip), %rsi      # 0x407f
movl $0xa3, %edx
leaq 0x19bc(%rip), %rcx      # 0x408b
callq 0x1070
jmp 0x26d6
movss 0x195a(%rip), %xmm0     # 0x4038
addss -0x2cc(%rbp), %xmm0
movss %xmm0, -0x2cc(%rbp)
jmp 0x2151
leaq -0x208(%rbp), %rdi
callq 0x13c0
leaq -0x1d8(%rbp), %rdi
callq 0x13c0
leaq -0x1a8(%rbp), %rdi
callq 0x13c0
leaq -0x178(%rbp), %rdi
callq 0x13c0
leaq -0x148(%rbp), %rdi
callq 0x13c0
leaq -0x118(%rbp), %rdi
callq 0x13c0
leaq -0xd8(%rbp), %rdi
callq 0x13c0
leaq -0xa8(%rbp), %rdi
callq 0x13c0
addq $0x320, %rsp            # imm = 0x320
popq %rbp
retq
leaq -0x1d8(%rbp), %rdi
callq 0x13c0
leaq -0x1a8(%rbp), %rdi
callq 0x13c0
leaq -0x178(%rbp), %rdi
callq 0x13c0
leaq -0x148(%rbp), %rdi
callq 0x13c0
leaq -0x118(%rbp), %rdi
callq 0x13c0
leaq -0xd8(%rbp), %rdi
callq 0x13c0
leaq -0xa8(%rbp), %rdi
callq 0x13c0
movq -0xe0(%rbp), %rdi
callq 0x1100
nopl (%rax)