// File: /workspace/github_cpp_makefile_star2_O2/rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::mbvq_error_diffusion(Image&, Image&)
void ImageProc::mbvq_error_diffusion(Image &img_orig, Image &img_modified)
{
	float diffusionError[3], distance[6];
	int direction, quad, vertex_number;
	float img_orig_float[img_orig.rows][img_orig.cols][img_orig.channels];

	for(int i = 0; i < img_orig.rows; i++)
		for(int j = 0; j < img_orig.cols; j++)
			for(int k = 0; k < img_orig.channels; k++)
			{
				img_orig_float[i][j][k] = float(img_orig.getvalue(i,j,k)/255.0);
			}


	for(int i = 0; i < img_modified.rows-1; i++)
	{
		if(i%2 == 0)
		{
			direction = LEFT2RIGHT;
			for(int j = 0; j < img_modified.cols; j++)
			{
				int R = img_orig.getvalue(i,j,0);
				int G = img_orig.getvalue(i,j,1);
				int B = img_orig.getvalue(i,j,2);
				int r = img_orig_float[i][j][0];
				int g = img_orig_float[i][j][1];
				int b = img_orig_float[i][j][2];
				if((R+G) > 255)
					if((G+B) > 255)
						if((R+G+B) > 510) 	quad = CMYW;
						else 				quad = MYGC;
					else quad = RGMY;
				else if(!((G+B) > 255))
					if(!((R+G+B) > 255)) 	quad = KRGB;
					else 					quad = RGBM;
				else quad = CMBG;

				distance[0] = distance_from_vertex(r,g,b,'C');
				distance[1] = distance_from_vertex(r,g,b,'M');
				distance[2] = distance_from_vertex(r,g,b,'Y');
				distance[3] = distance_from_vertex(r,g,b,'W');
				distance[4] = distance_from_vertex(r,g,b,'R');
				distance[5] = distance_from_vertex(r,g,b,'G');
				distance[6] = distance_from_vertex(r,g,b,'B');
				distance[7] = distance_from_vertex(r,g,b,'K');

				if(quad == CMYW)
					vertex_number = nearest_vertex(distance,0,1,2,3);
				else if(quad == MYGC)
					vertex_number = nearest_vertex(distance,1,2,5,0);
				else if(quad == RGMY)
					vertex_number = nearest_vertex(distance,4,5,1,2);
				else if(quad == CMBG)
					vertex_number = nearest_vertex(distance,0,1,6,5);
				else if(quad == RGBM)
					vertex_number = nearest_vertex(distance,4,5,6,1);
				else if(quad == KRGB)
					vertex_number = nearest_vertex(distance,7,4,5,6);

				switch(vertex_number)
				{
					case 0:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,255);
						break;
					case 1:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,255);
						break;
					case 2:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,0);
						break;
					case 3:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,255);
						break;
					case 4:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,0);
						break;
					case 5:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,0);
						break;
					case 6:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,255);
						break;
					case 7:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,0);
						break;
					default:
						break;
				}

				for(int k = 0; k < 3; k++)
				{
					img_orig_float[i][j+1][k] = img_orig_float[i][j+1][k]+(diffusionError[k]*7.0/16);
					img_orig_float[i+1][j+1][k] = img_orig_float[i+1][j+1][k]+(diffusionError[k]*1.0/16);
					img_orig_float[i+1][j][k] = img_orig_float[i+1][j][k]+(diffusionError[k]*5.0/16);
					img_orig_float[i+1][j-1][k] = img_orig_float[i+1][j-1][k]+(diffusionError[k]*3.0/16);
				}

			}
		}

		else
		{
			direction = RIGHT2LEFT;
			for(int j = img_modified.cols - 1; j >= 0; j--)
			{
				int R = img_orig.getvalue(i,j,0);
				int G = img_orig.getvalue(i,j,1);
				int B = img_orig.getvalue(i,j,2);
				int r = img_orig_float[i][j][0];
				int g = img_orig_float[i][j][1];
				int b = img_orig_float[i][j][2];
				if((R+G) > 255)
					if((G+B) > 255)
						if((R+G+B) > 510) 	quad = CMYW;
						else 				quad = MYGC;
					else quad = RGMY;
				else if(!((G+B) > 255))
					if(!((R+G+B) > 255)) 	quad = KRGB;
					else 					quad = RGBM;
				else quad = CMBG;

				distance[0] = distance_from_vertex(r,g,b,'C');
				distance[1] = distance_from_vertex(r,g,b,'M');
				distance[2] = distance_from_vertex(r,g,b,'Y');
				distance[3] = distance_from_vertex(r,g,b,'W');
				distance[4] = distance_from_vertex(r,g,b,'R');
				distance[5] = distance_from_vertex(r,g,b,'G');
				distance[6] = distance_from_vertex(r,g,b,'B');
				distance[7] = distance_from_vertex(r,g,b,'K');

				if(quad == CMYW)
					vertex_number = nearest_vertex(distance,0,1,2,3);
				else if(quad == MYGC)
					vertex_number = nearest_vertex(distance,1,2,5,0);
				else if(quad == RGMY)
					vertex_number = nearest_vertex(distance,4,5,1,2);
				else if(quad == CMBG)
					vertex_number = nearest_vertex(distance,0,1,6,5);
				else if(quad == RGBM)
					vertex_number = nearest_vertex(distance,4,5,6,1);
				else if(quad == KRGB)
					vertex_number = nearest_vertex(distance,7,4,5,6);

				switch(vertex_number)
				{
					case 0:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,255);
						break;
					case 1:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,255);
						break;
					case 2:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,0);
						break;
					case 3:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,255);
						break;
					case 4:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 1.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,255);
						img_modified.setvalue(i,j,2,0);
						break;
					case 5:
						diffusionError[0] = r - 1.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,255);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,0);
						break;
					case 6:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 1.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,255);
						break;
					case 7:
						diffusionError[0] = r - 0.0;
						diffusionError[1] = g - 0.0;
						diffusionError[2] = b - 0.0;
						img_modified.setvalue(i,j,0,0);
						img_modified.setvalue(i,j,1,0);
						img_modified.setvalue(i,j,2,0);
						break;
					default:
						break;
				}

				for(int k = 0; k < 3; k++)
				{
					img_orig_float[i][j-1][k] = img_orig_float[i][j-1][k]+(diffusionError[k]*7.0/16);
					img_orig_float[i+1][j-1][k] = img_orig_float[i+1][j-1][k]+(diffusionError[k]*1.0/16);
					img_orig_float[i+1][j][k] = img_orig_float[i+1][j][k]+(diffusionError[k]*5.0/16);
					img_orig_float[i+1][j+1][k] = img_orig_float[i+1][j+1][k]+(diffusionError[k]*3.0/16);
				}
			}

		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rsi, -0xa8(%rbp)
movq %rsp, -0x128(%rbp)
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %r10d
movq %r10, %r11
movq %rcx, -0xb8(%rbp)
imulq %rcx, %r11
imulq %r11, %rax
leaq 0xf(,%rax,4), %rax
andq $-0x10, %rax
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
movl 0x8(%rdi), %ecx
movl 0xc(%rdi), %eax
movl 0x10(%rdi), %edx
movq %rdi, -0x100(%rbp)
movq 0x18(%rdi), %rsi
xorl %edi, %edi
testl %edx, %edx
movl $0x0, %r8d
cmovgl %edx, %r8d
testl %ecx, %ecx
movl $0x0, %r9d
cmovgl %ecx, %r9d
testl %eax, %eax
cmovlel %edi, %eax
movq %rax, -0x30(%rbp)
imull %edx, %ecx
movq %r11, -0xf0(%rbp)
leaq (,%r11,4), %rax
movq %rax, -0xf8(%rbp)
movq %r10, -0xb0(%rbp)
leaq (,%r10,4), %rax
movq %rax, -0xc8(%rbp)
movsd 0x5469(%rip), %xmm0     # 0x104b0
movq %rbx, -0xe8(%rbp)
movq %rbx, %r10
xorl %r11d, %r11d
cmpq -0x30(%rbp), %r11
je 0xb0af
movq %r10, %rbx
movl %edi, %r14d
xorl %r15d, %r15d
cmpq %r9, %r15
je 0xb0a1
movslq %r14d, %r12
addq %rsi, %r12
xorl %r13d, %r13d
cmpq %r13, %r8
je 0xb092
movzbl (%r12,%r13), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm1
movss %xmm1, (%rbx,%r13,4)
incq %r13
jmp 0xb071
incq %r15
addl %edx, %r14d
addq -0xc8(%rbp), %rbx
jmp 0xb063
incq %r11
addl %ecx, %edi
addq -0xf8(%rbp), %r10
jmp 0xb054
shlq $0x2, -0xb8(%rbp)
movq -0xc8(%rbp), %rax
negq %rax
movq %rax, -0x138(%rbp)
xorl %r9d, %r9d
movq -0xa8(%rbp), %rax
movslq 0xc(%rax), %rax
decq %rax
cmpq %rax, %r9
jge 0xbc99
testb $0x1, %r9b
movq %r9, -0x108(%rbp)
jne 0xb6bd
movq -0xf0(%rbp), %rax
imulq %r9, %rax
movq -0xe8(%rbp), %rdx
leaq (%rdx,%rax,4), %rax
movq %rax, -0xc0(%rbp)
leaq 0x1(%r9), %rsi
movq -0xb8(%rbp), %rax
movq %rax, %r13
imulq %rsi, %r13
leaq -0x4(%r13), %r14
movq -0xb0(%rbp), %rcx
imulq %rcx, %r14
addq %rdx, %r14
movq -0xf8(%rbp), %r12
movq %rsi, -0x130(%rbp)
imulq %rsi, %r12
addq %rdx, %r12
addq $0x4, %r13
imulq %rcx, %r13
addq %rdx, %r13
movq %r9, %r15
imulq %rax, %r15
addq $0x4, %r15
imulq %rcx, %r15
addq %rdx, %r15
xorl %r10d, %r10d
movq -0xa8(%rbp), %rax
movslq 0x8(%rax), %rbx
cmpq %rbx, %r10
jge 0xbc81
movq -0x100(%rbp), %rcx
movl 0x8(%rcx), %eax
imull %r9d, %eax
addl %r10d, %eax
imull 0x10(%rcx), %eax
movq 0x18(%rcx), %rcx
movslq %eax, %rsi
movzbl (%rcx,%rsi), %eax
movzbl 0x1(%rcx,%rsi), %edx
movzbl 0x2(%rcx,%rsi), %ecx
addl %edx, %eax
addl %ecx, %edx
cmpl $0x100, %eax            # imm = 0x100
jb 0xb1d9
cmpl $0x100, %edx            # imm = 0x100
jb 0xb200
addl %ecx, %eax
cmpl $0x1ff, %eax            # imm = 0x1FF
setae %al
movl %eax, -0xe0(%rbp)
setb %al
movl %eax, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
jmp 0xb216
cmpl $0xff, %edx
jbe 0xb229
movb $0x1, %al
movl %eax, -0x34(%rbp)
movl $0x0, -0xe0(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
jmp 0xb21d
movb $0x1, %al
movl %eax, -0x38(%rbp)
movl $0x0, -0xe0(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x98(%rbp)
jmp 0xb258
addl %ecx, %eax
cmpl $0x100, %eax            # imm = 0x100
setae %al
movl %eax, -0x98(%rbp)
movl $0x0, -0xe0(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
movq %r10, -0xa0(%rbp)
movq %r10, %rax
imulq -0xb0(%rbp), %rax
movq -0xc0(%rbp), %rcx
cvttss2si 0x8(%rcx,%rax,4), %edx
movsd (%rcx,%rax,4), %xmm0
cvttps2dq %xmm0, %xmm0
movaps %xmm0, -0x120(%rbp)
cvtdq2ps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
movaps %xmm1, -0x70(%rbp)
movl %edx, -0x4c(%rbp)
cvtsi2ss %edx, %xmm2
movss %xmm2, -0x30(%rbp)
pushq $0x43
popq %rdi
callq 0xbcb0
movss %xmm0, -0x90(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x4d
popq %rdi
callq 0xbcb0
movss %xmm0, -0x8c(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x59
popq %rdi
callq 0xbcb0
movss %xmm0, -0x88(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x57
popq %rdi
callq 0xbcb0
movss %xmm0, -0x84(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x52
popq %rdi
callq 0xbcb0
movss %xmm0, -0x80(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x47
popq %rdi
callq 0xbcb0
movss %xmm0, -0x7c(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x42
popq %rdi
callq 0xbcb0
movss %xmm0, -0x78(%rbp)
movaps -0x60(%rbp), %xmm0
movapd -0x70(%rbp), %xmm1
movd -0x30(%rbp), %xmm2
pushq $0x4b
popq %rdi
callq 0xbcb0
movss %xmm0, -0x74(%rbp)
cmpb $0x0, -0xe0(%rbp)
je 0xb393
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
pushq $0x3
popq %r8
jmp 0xb3b0
cmpb $0x0, -0x3c(%rbp)
je 0xb44c
leaq -0x90(%rbp), %rdi
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x5
popq %rcx
xorl %r8d, %r8d
callq 0xbd04
cmpl $0x7, %eax
movq -0x108(%rbp), %r9
movsd 0x5111(%rip), %xmm3     # 0x104d8
movsd 0x5111(%rip), %xmm4     # 0x104e0
movsd 0x5111(%rip), %xmm5     # 0x104e8
movsd 0x4eb1(%rip), %xmm6     # 0x10290
movq -0xa0(%rbp), %r10
ja 0xb5b8
movl %eax, %eax
leaq 0x527b(%rip), %rdx      # 0x10670
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
cvtsi2sdl -0x4c(%rbp), %xmm0
movdqa -0x120(%rbp), %xmm7
cvtdq2pd %xmm7, %xmm1
pshufd $0x55, %xmm7, %xmm2     # xmm2 = xmm7[1,1,1,1]
movd %xmm7, %eax
jmpq *%rcx
cvtsi2sd %eax, %xmm1
movsd 0x4e5c(%rip), %xmm2     # 0x10280
addsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
movss %xmm1, -0x48(%rbp)
addsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movapd -0x70(%rbp), %xmm1
movss %xmm1, -0x44(%rbp)
movb $-0x1, %al
xorl %ecx, %ecx
jmp 0xb533
cmpb $0x0, -0x38(%rbp)
je 0xb469
leaq -0x90(%rbp), %rdi
pushq $0x4
popq %rsi
pushq $0x5
popq %rdx
pushq $0x1
popq %rcx
pushq $0x2
jmp 0xb38f
cmpb $0x0, -0x34(%rbp)
je 0xb686
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
pushq $0x6
popq %rcx
pushq $0x5
jmp 0xb38f
movd %xmm2, %eax
cvtsi2sd %eax, %xmm0
movapd -0x60(%rbp), %xmm1
movss %xmm1, -0x48(%rbp)
addsd 0x4ddd(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x44(%rbp)
movb $-0x1, %cl
xorl %eax, %eax
jmp 0xb559
addpd 0x5143(%rip), %xmm1     # 0x10600
cvtpd2ps %xmm1, %xmm0
movlpd %xmm0, -0x48(%rbp)
movb $-0x1, %al
xorl %edx, %edx
movb $-0x1, %cl
jmp 0xb55b
addpd 0x5127(%rip), %xmm1     # 0x10600
cvtpd2ps %xmm1, %xmm1
addsd 0x4d9b(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movlpd %xmm1, -0x48(%rbp)
movb $-0x1, %al
movb $-0x1, %cl
jmp 0xb533
movaps -0x60(%rbp), %xmm0
movlps %xmm0, -0x48(%rbp)
xorl %eax, %eax
jmp 0xb557
movd %xmm2, %eax
cvtsi2sd %eax, %xmm1
movsd 0x4d70(%rip), %xmm2     # 0x10280
addsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
movdqa -0x60(%rbp), %xmm7
movd %xmm7, -0x48(%rbp)
addsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm1, -0x44(%rbp)
movb $-0x1, %cl
xorl %eax, %eax
movb $-0x1, %dl
jmp 0xb560
cvtsi2sd %eax, %xmm0
addsd 0x4d3d(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x48(%rbp)
movaps -0x70(%rbp), %xmm0
movss %xmm0, -0x44(%rbp)
movb $-0x1, %al
xorl %ecx, %ecx
xorl %edx, %edx
movss -0x30(%rbp), %xmm0
movss %xmm0, -0x40(%rbp)
movq -0xa8(%rbp), %r8
movq 0x18(%r8), %rsi
imull %r9d, %ebx
addl %r10d, %ebx
imull 0x10(%r8), %ebx
movslq %ebx, %rdi
movb %al, (%rsi,%rdi)
movq 0x18(%r8), %rax
movl 0x8(%r8), %esi
imull %r9d, %esi
addl %r10d, %esi
imull 0x10(%r8), %esi
movslq %esi, %rsi
movb %cl, 0x1(%rax,%rsi)
movq 0x18(%r8), %rax
movl 0x8(%r8), %ecx
imull %r9d, %ecx
addl %r10d, %ecx
imull 0x10(%r8), %ecx
movslq %ecx, %rcx
movb %dl, 0x2(%rax,%rcx)
incq %r10
xorl %eax, %eax
cmpq $0xc, %rax
je 0xb64d
cvtss2sd (%r15,%rax), %xmm0
cvtss2sd -0x48(%rbp,%rax), %xmm1
movaps %xmm1, %xmm2
mulsd %xmm3, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm0
movss %xmm0, (%r15,%rax)
cvtss2sd (%r13,%rax), %xmm0
movaps %xmm1, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm0
movss %xmm0, (%r13,%rax)
cvtss2sd (%r12,%rax), %xmm0
movaps %xmm1, %xmm2
mulsd %xmm5, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm0
movss %xmm0, (%r12,%rax)
cvtss2sd (%r14,%rax), %xmm0
mulsd %xmm6, %xmm1
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, (%r14,%rax)
addq $0x4, %rax
jmp 0xb5bd
movq -0xc8(%rbp), %rax
addq %rax, %r14
addq %rax, %r12
addq %rax, %r13
addq %rax, %r15
jmp 0xb169
addsd 0x4c13(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movapd -0x60(%rbp), %xmm1
movlpd %xmm1, -0x48(%rbp)
movb $-0x1, %dl
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0xb560
cmpb $0x0, -0x98(%rbp)
je 0xb6a6
leaq -0x90(%rbp), %rdi
pushq $0x4
popq %rsi
pushq $0x5
popq %rdx
pushq $0x6
popq %rcx
pushq $0x1
jmp 0xb38f
leaq -0x90(%rbp), %rdi
pushq $0x7
popq %rsi
pushq $0x4
popq %rdx
pushq $0x5
popq %rcx
pushq $0x6
jmp 0xb38f
movq -0xa8(%rbp), %rax
movslq 0x8(%rax), %r14
movq -0xf0(%rbp), %rax
imulq %r9, %rax
movq -0xe8(%rbp), %rsi
leaq (%rsi,%rax,4), %rax
movq %rax, -0x98(%rbp)
leaq 0x1(%r9), %rdx
movq -0xb8(%rbp), %rcx
movq %rcx, %rax
movq %rdx, -0xc0(%rbp)
imulq %rdx, %rax
leaq (%rax,%r14,4), %r13
movq -0xb0(%rbp), %rdx
imulq %rdx, %r13
addq %rsi, %r13
leaq (%rax,%r14,4), %r12
addq $-0x4, %r12
imulq %rdx, %r12
addq %rsi, %r12
leaq (%rax,%r14,4), %r15
addq $-0x8, %r15
imulq %rdx, %r15
addq %rsi, %r15
movq %r9, %rax
imulq %rcx, %rax
leaq (%rax,%r14,4), %rbx
addq $-0x8, %rbx
imulq %rdx, %rbx
addq %rsi, %rbx
movq %r14, %rax
decq %r14
testq %rax, %rax
jle 0xbc8d
movq -0x100(%rbp), %rcx
movl 0x8(%rcx), %eax
imull %r9d, %eax
addl %r14d, %eax
imull 0x10(%rcx), %eax
movq 0x18(%rcx), %rcx
movslq %eax, %rsi
movzbl (%rcx,%rsi), %eax
movzbl 0x1(%rcx,%rsi), %edx
movzbl 0x2(%rcx,%rsi), %ecx
addl %edx, %eax
addl %ecx, %edx
cmpl $0x100, %eax            # imm = 0x100
jb 0xb7af
cmpl $0x100, %edx            # imm = 0x100
jb 0xb7d6
addl %ecx, %eax
cmpl $0x1ff, %eax            # imm = 0x1FF
setae %al
movl %eax, -0xa0(%rbp)
setb %al
movl %eax, -0x4c(%rbp)
movl $0x0, -0x3c(%rbp)
jmp 0xb7ec
cmpl $0xff, %edx
jbe 0xb7fc
movb $0x1, %al
movl %eax, -0x38(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x3c(%rbp)
jmp 0xb7f3
movb $0x1, %al
movl %eax, -0x3c(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
jmp 0xb828
addl %ecx, %eax
cmpl $0x100, %eax            # imm = 0x100
setae %al
movl %eax, -0x34(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movq %r14, %rax
imulq -0xb0(%rbp), %rax
movq -0x98(%rbp), %rcx
cvttss2si 0x8(%rcx,%rax,4), %edx
movsd (%rcx,%rax,4), %xmm0
cvttps2dq %xmm0, %xmm0
movaps %xmm0, -0xe0(%rbp)
cvtdq2ps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
movaps %xmm1, -0x70(%rbp)
movl %edx, -0x120(%rbp)
cvtsi2ss %edx, %xmm2
movss %xmm2, -0x30(%rbp)
pushq $0x43
popq %rdi
callq 0xbcb0
movss %xmm0, -0x90(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x4d
popq %rdi
callq 0xbcb0
movss %xmm0, -0x8c(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x59
popq %rdi
callq 0xbcb0
movss %xmm0, -0x88(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x57
popq %rdi
callq 0xbcb0
movss %xmm0, -0x84(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x52
popq %rdi
callq 0xbcb0
movss %xmm0, -0x80(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x47
popq %rdi
callq 0xbcb0
movss %xmm0, -0x7c(%rbp)
movaps -0x60(%rbp), %xmm0
movaps -0x70(%rbp), %xmm1
movss -0x30(%rbp), %xmm2
pushq $0x42
popq %rdi
callq 0xbcb0
movss %xmm0, -0x78(%rbp)
movaps -0x60(%rbp), %xmm0
movapd -0x70(%rbp), %xmm1
movd -0x30(%rbp), %xmm2
pushq $0x4b
popq %rdi
callq 0xbcb0
movss %xmm0, -0x74(%rbp)
cmpb $0x0, -0xa0(%rbp)
je 0xb95f
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
pushq $0x3
popq %r8
jmp 0xb97c
cmpb $0x0, -0x4c(%rbp)
je 0xba14
leaq -0x90(%rbp), %rdi
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
pushq $0x5
popq %rcx
xorl %r8d, %r8d
callq 0xbd04
cmpl $0x7, %eax
movq -0x108(%rbp), %r9
movsd 0x4b45(%rip), %xmm3     # 0x104d8
movsd 0x4b45(%rip), %xmm4     # 0x104e0
movsd 0x4b45(%rip), %xmm5     # 0x104e8
movsd 0x48e5(%rip), %xmm6     # 0x10290
ja 0xbb84
movl %eax, %eax
leaq 0x4c96(%rip), %rdx      # 0x10650
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
cvtsi2sdl -0x120(%rbp), %xmm0
movdqa -0xe0(%rbp), %xmm7
cvtdq2pd %xmm7, %xmm1
pshufd $0x55, %xmm7, %xmm2     # xmm2 = xmm7[1,1,1,1]
movd %xmm7, %eax
jmpq *%rcx
cvtsi2sd %eax, %xmm1
movsd 0x4894(%rip), %xmm2     # 0x10280
addsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
movss %xmm1, -0x48(%rbp)
addsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movapd -0x70(%rbp), %xmm1
movss %xmm1, -0x44(%rbp)
movb $-0x1, %al
xorl %ecx, %ecx
jmp 0xbafb
cmpb $0x0, -0x3c(%rbp)
je 0xba31
leaq -0x90(%rbp), %rdi
pushq $0x4
popq %rsi
pushq $0x5
popq %rdx
pushq $0x1
popq %rcx
pushq $0x2
jmp 0xb95b
cmpb $0x0, -0x38(%rbp)
je 0xbc4d
leaq -0x90(%rbp), %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
pushq $0x6
popq %rcx
pushq $0x5
jmp 0xb95b
movd %xmm2, %eax
cvtsi2sd %eax, %xmm0
movapd -0x60(%rbp), %xmm1
movss %xmm1, -0x48(%rbp)
addsd 0x4815(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x44(%rbp)
movb $-0x1, %cl
xorl %eax, %eax
jmp 0xbb21
addpd 0x4b7b(%rip), %xmm1     # 0x10600
cvtpd2ps %xmm1, %xmm0
movlpd %xmm0, -0x48(%rbp)
movb $-0x1, %al
xorl %edx, %edx
movb $-0x1, %cl
jmp 0xbb23
addpd 0x4b5f(%rip), %xmm1     # 0x10600
cvtpd2ps %xmm1, %xmm1
addsd 0x47d3(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movlpd %xmm1, -0x48(%rbp)
movb $-0x1, %al
movb $-0x1, %cl
jmp 0xbafb
movaps -0x60(%rbp), %xmm0
movlps %xmm0, -0x48(%rbp)
xorl %eax, %eax
jmp 0xbb1f
movd %xmm2, %eax
cvtsi2sd %eax, %xmm1
movsd 0x47a8(%rip), %xmm2     # 0x10280
addsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
movdqa -0x60(%rbp), %xmm7
movd %xmm7, -0x48(%rbp)
addsd %xmm2, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm1, -0x44(%rbp)
movb $-0x1, %cl
xorl %eax, %eax
movb $-0x1, %dl
jmp 0xbb28
cvtsi2sd %eax, %xmm0
addsd 0x4775(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x48(%rbp)
movaps -0x70(%rbp), %xmm0
movss %xmm0, -0x44(%rbp)
movb $-0x1, %al
xorl %ecx, %ecx
xorl %edx, %edx
movss -0x30(%rbp), %xmm0
movss %xmm0, -0x40(%rbp)
movq -0xa8(%rbp), %r8
movq 0x18(%r8), %rsi
movl 0x8(%r8), %edi
imull %r9d, %edi
addl %r14d, %edi
imull 0x10(%r8), %edi
movslq %edi, %rdi
movb %al, (%rsi,%rdi)
movq 0x18(%r8), %rax
movl 0x8(%r8), %esi
imull %r9d, %esi
addl %r14d, %esi
imull 0x10(%r8), %esi
movslq %esi, %rsi
movb %cl, 0x1(%rax,%rsi)
movq 0x18(%r8), %rax
movl 0x8(%r8), %ecx
imull %r9d, %ecx
addl %r14d, %ecx
imull 0x10(%r8), %ecx
movslq %ecx, %rcx
movb %dl, 0x2(%rax,%rcx)
xorl %eax, %eax
cmpq $0xc, %rax
je 0xbc14
cvtss2sd (%rbx,%rax), %xmm0
cvtss2sd -0x48(%rbp,%rax), %xmm1
movaps %xmm1, %xmm2
mulsd %xmm3, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm0
movss %xmm0, (%rbx,%rax)
cvtss2sd (%r15,%rax), %xmm0
movaps %xmm1, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm0
movss %xmm0, (%r15,%rax)
cvtss2sd (%r12,%rax), %xmm0
movaps %xmm1, %xmm2
mulsd %xmm5, %xmm2
mulsd %xmm4, %xmm2
addsd %xmm0, %xmm2
cvtsd2ss %xmm2, %xmm0
movss %xmm0, (%r12,%rax)
cvtss2sd (%r13,%rax), %xmm0
mulsd %xmm6, %xmm1
mulsd %xmm4, %xmm1
addsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm0
movss %xmm0, (%r13,%rax)
addq $0x4, %rax
jmp 0xbb86
movq -0x138(%rbp), %rax
addq %rax, %r13
addq %rax, %r12
addq %rax, %r15
addq %rax, %rbx
jmp 0xb744
addsd 0x464c(%rip), %xmm0     # 0x10280
cvtsd2ss %xmm0, %xmm0
movapd -0x60(%rbp), %xmm1
movlpd %xmm1, -0x48(%rbp)
movb $-0x1, %dl
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0xbb28
cmpb $0x0, -0x34(%rbp)
je 0xbc6a
leaq -0x90(%rbp), %rdi
pushq $0x4
popq %rsi
pushq $0x5
popq %rdx
pushq $0x6
popq %rcx
pushq $0x1
jmp 0xb95b
leaq -0x90(%rbp), %rdi
pushq $0x7
popq %rsi
pushq $0x4
popq %rdx
pushq $0x5
popq %rcx
pushq $0x6
jmp 0xb95b
movq -0x130(%rbp), %r9
jmp 0xb0cb
movq -0xc0(%rbp), %r9
jmp 0xb0cb
movq -0x128(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop