// File: rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::apply_artistic_effect(char const*, char const*, int, int, float, float, float, int, int, int, int)
void ImageProc::apply_artistic_effect(const char *infile, const char *outfile, int width, int height, float tau, float epsilon, float phi, int window_size, int sigma_dist, int sigma_simi, int iter)
{
	Image img_orig("color", width, height);
	Image img_orig_rgb("color", width, height);
	Image img_orig_bw("bw", width, height);
	Image img_orig_bw_bf("bw", width, height);
	Image img_modified("bw", width, height);
	Image img_bilateral_color("color", width, height);
	Image img_modified_color("color", width, height);
	img_orig.read_image(infile, img_orig.cols, img_orig.rows);

	for(int i = 0; i < img_orig.rows; i++)
		for(int j = 0; j < img_orig.cols; j++)
			img_orig_bw.setvalue(i,j,0,((img_orig.getvalue(i,j,0)*0.21)\
								  	   +(img_orig.getvalue(i,j,1)*0.72)\
								  	   +(img_orig.getvalue(i,j,2)*0.07)));

	//rgb2cielab(img_orig, img_modified);

	//	//Bilateral Filter
	for(int i = 0; i < iter; i++)
	{
		bilateral_filter(img_orig, img_bilateral_color, window_size, sigma_dist, sigma_simi);
		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.setvalue(i,j,k,img_bilateral_color.getvalue(i,j,k));
			 	}
	}

	img_bilateral_color.write_image("../output_images/bilateral_art_effect.raw", img_bilateral_color.cols, img_bilateral_color.rows);
	//cielab2rgb(img_modified_color2, img_orig_rgb);

	//img_modified_color.write_image(outfile, img_modified.cols, img_modified.rows);

	for(int i = 0; i < img_orig_bw.rows; i++)
		for(int j = 0; j < img_orig_bw.cols; j++)
			for(int k = 0; k < img_orig_bw.channels; k++)
				img_orig_bw.setvalue(i,j,k,((img_orig.getvalue(i,j,0)*0.21)\
									  +(img_orig.getvalue(i,j,1)*0.72)\
									  +(img_orig.getvalue(i,j,2)*0.07)));

	Image img_sigma_small("bw", width, height);
	Image img_sigma_large("bw", width, height);
	Image img_xDoG("bw", width, height);

	int sigma = 1;

	gaussian_filter(img_orig_bw, img_sigma_small, 9, sigma);
	gaussian_filter(img_orig_bw, img_sigma_large, 9, sigma*sqrt(1.6));

	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_xDoG.setvalue(i,j,k,(int)((float)img_sigma_small.getvalue(i,j,k) - (float)(1.0*tau*img_sigma_large.getvalue(i,j,k))));
				//img_xDoG.setvalue(i,j,k,(int)((float)img_sigma_small.getvalue(i,j,k) - (float)(1.0*img_sigma_large.getvalue(i,j,k))));
	img_xDoG.write_image("../output_images/xDoG_art_effect.raw", img_xDoG.cols, img_xDoG.rows);

	float xDoG_val, value;
	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++)
			{
				value = (float)img_xDoG.getvalue(i,j,k)/255.0;
				if(value > epsilon)
					img_modified.setvalue(i,j,k,0);
				else
				{
					value = 1.0 + tanh(phi*(((float)img_sigma_small.getvalue(i,j,k) - (float)(1.0*tau*img_sigma_large.getvalue(i,j,k))) - epsilon));
					img_modified.setvalue(i,j,k,(int)(value*255.0));
				}

			}

	img_modified.write_image("../output_images/contours_art_effect.raw", img_modified.cols, img_modified.rows);

	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++)
				if(img_modified.getvalue(i,j,k) == 0)
					img_modified.setvalue(i,j,k,0);
				else
					img_modified.setvalue(i,j,k,1);

//	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++)
//				if(img_xDoG.getvalue(i,j,k) == 255)
//					img_modified.setvalue(i,j,k,0);
//				else
//					img_modified.setvalue(i,j,k,1);


	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_modified_color.setvalue(i,j,k,(int)((img_bilateral_color.getvalue(i,j,k) * (img_modified.getvalue(i,j,0)))));
	img_modified_color.write_image(outfile, img_modified.cols, img_modified.rows);


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movl 0x18(%rbp), %eax
movl 0x10(%rbp), %eax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movss %xmm0, -0x1c(%rbp)
movss %xmm1, -0x20(%rbp)
movss %xmm2, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movl %r9d, -0x2c(%rbp)
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x6405(%rip), %rsi      # 0x1c5e8
movq %rsi, -0x1f0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x7eb0
movq -0x1f0(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq -0x70(%rbp), %rdi
callq 0x7eb0
jmp 0x1620b
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x73bc(%rip), %rsi      # 0x1d5d4
leaq -0xa0(%rbp), %rdi
callq 0x7eb0
jmp 0x16226
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x73a1(%rip), %rsi      # 0x1d5d4
leaq -0xc0(%rbp), %rdi
callq 0x7eb0
jmp 0x16241
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x7386(%rip), %rsi      # 0x1d5d4
leaq -0xe0(%rbp), %rdi
callq 0x7eb0
jmp 0x1625c
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x637f(%rip), %rsi      # 0x1c5e8
leaq -0x100(%rbp), %rdi
callq 0x7eb0
jmp 0x16277
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x6364(%rip), %rsi      # 0x1c5e8
leaq -0x120(%rbp), %rdi
callq 0x7eb0
jmp 0x16292
movq -0x8(%rbp), %rsi
movl -0x48(%rbp), %edx
movl -0x44(%rbp), %ecx
leaq -0x50(%rbp), %rdi
callq 0x7f70
jmp 0x162a7
movl $0x0, -0x124(%rbp)
movl -0x124(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x16454
movl $0x0, -0x128(%rbp)
movl -0x128(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x1643e
movl -0x124(%rbp), %eax
movl %eax, -0x1f8(%rbp)
movl -0x128(%rbp), %eax
movl %eax, -0x1f4(%rbp)
movl -0x124(%rbp), %esi
movl -0x128(%rbp), %edx
leaq -0x50(%rbp), %rdi
xorl %ecx, %ecx
callq 0x83b0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x208(%rbp)
movl -0x124(%rbp), %esi
movl -0x128(%rbp), %edx
leaq -0x50(%rbp), %rdi
movl $0x1, %ecx
callq 0x83b0
movsd -0x208(%rbp), %xmm0
cvtsi2sd %eax, %xmm1
movsd 0x617e(%rip), %xmm2     # 0x1c4c0
mulsd %xmm2, %xmm1
movsd 0x616a(%rip), %xmm2     # 0x1c4b8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x200(%rbp)
movl -0x124(%rbp), %esi
movl -0x128(%rbp), %edx
leaq -0x50(%rbp), %rdi
movl $0x2, %ecx
callq 0x83b0
movsd -0x200(%rbp), %xmm1
movl -0x1f8(%rbp), %esi
movl -0x1f4(%rbp), %edx
cvtsi2sd %eax, %xmm0
movsd 0x6118(%rip), %xmm2     # 0x1c4b0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r8d
leaq -0xa0(%rbp), %rdi
xorl %ecx, %ecx
callq 0x83f0
movl -0x128(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x128(%rbp)
jmp 0x162ca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16ec8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16ebf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16eb3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16ea7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16e9b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16e8f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16e83
jmp 0x16440
movl -0x124(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x124(%rbp)
jmp 0x162b1
movl $0x0, -0x12c(%rbp)
movl -0x12c(%rbp), %eax
cmpl 0x18(%rbp), %eax
jge 0x16583
movl -0x28(%rbp), %edx
movl -0x2c(%rbp), %ecx
movl 0x10(%rbp), %r8d
leaq -0x50(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0xf680
jmp 0x16489
movl $0x0, -0x130(%rbp)
movl -0x130(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x1656d
movl $0x0, -0x134(%rbp)
movl -0x134(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x16557
movl $0x0, -0x138(%rbp)
movl -0x138(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x16541
movl -0x130(%rbp), %eax
movl %eax, -0x214(%rbp)
movl -0x134(%rbp), %eax
movl %eax, -0x210(%rbp)
movl -0x138(%rbp), %eax
movl %eax, -0x20c(%rbp)
movl -0x130(%rbp), %esi
movl -0x134(%rbp), %edx
movl -0x138(%rbp), %ecx
leaq -0x100(%rbp), %rdi
callq 0x83b0
movl -0x214(%rbp), %esi
movl -0x210(%rbp), %edx
movl -0x20c(%rbp), %ecx
movl %eax, %r8d
leaq -0x50(%rbp), %rdi
callq 0x83f0
movl -0x138(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x138(%rbp)
jmp 0x164c5
jmp 0x16543
movl -0x134(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x134(%rbp)
jmp 0x164ac
jmp 0x16559
movl -0x130(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x130(%rbp)
jmp 0x16493
jmp 0x1656f
movl -0x12c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
jmp 0x1645e
movl -0xf8(%rbp), %edx
movl -0xf4(%rbp), %ecx
leaq 0x6711(%rip), %rsi      # 0x1cca7
leaq -0x100(%rbp), %rdi
callq 0x8150
jmp 0x165a4
movl $0x0, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpl -0x94(%rbp), %eax
jge 0x16722
movl $0x0, -0x140(%rbp)
movl -0x140(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0x1670c
movl $0x0, -0x144(%rbp)
movl -0x144(%rbp), %eax
cmpl -0x90(%rbp), %eax
jge 0x166f6
movl -0x13c(%rbp), %eax
movl %eax, -0x220(%rbp)
movl -0x140(%rbp), %eax
movl %eax, -0x21c(%rbp)
movl -0x144(%rbp), %eax
movl %eax, -0x218(%rbp)
movl -0x13c(%rbp), %esi
movl -0x140(%rbp), %edx
leaq -0x50(%rbp), %rdi
xorl %ecx, %ecx
callq 0x83b0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x230(%rbp)
movl -0x13c(%rbp), %esi
movl -0x140(%rbp), %edx
leaq -0x50(%rbp), %rdi
movl $0x1, %ecx
callq 0x83b0
movsd -0x230(%rbp), %xmm0
cvtsi2sd %eax, %xmm1
movsd 0x5e53(%rip), %xmm2     # 0x1c4c0
mulsd %xmm2, %xmm1
movsd 0x5e3f(%rip), %xmm2     # 0x1c4b8
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x228(%rbp)
movl -0x13c(%rbp), %esi
movl -0x140(%rbp), %edx
leaq -0x50(%rbp), %rdi
movl $0x2, %ecx
callq 0x83b0
movsd -0x228(%rbp), %xmm1
movl -0x220(%rbp), %esi
movl -0x21c(%rbp), %edx
movl -0x218(%rbp), %ecx
cvtsi2sd %eax, %xmm0
movsd 0x5de7(%rip), %xmm2     # 0x1c4b0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r8d
leaq -0xa0(%rbp), %rdi
callq 0x83f0
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0x165e6
jmp 0x166f8
movl -0x140(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x140(%rbp)
jmp 0x165ca
jmp 0x1670e
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x165ae
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x6ea5(%rip), %rsi      # 0x1d5d4
leaq -0x168(%rbp), %rdi
callq 0x7eb0
jmp 0x1673d
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x6e8a(%rip), %rsi      # 0x1d5d4
leaq -0x188(%rbp), %rdi
callq 0x7eb0
jmp 0x16758
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x6e6f(%rip), %rsi      # 0x1d5d4
leaq -0x1a8(%rbp), %rdi
callq 0x7eb0
jmp 0x16773
movl $0x1, -0x1ac(%rbp)
cvtsi2ssl -0x1ac(%rbp), %xmm0
leaq -0xa0(%rbp), %rdi
leaq -0x168(%rbp), %rsi
movl $0x9, %edx
callq 0xdf80
cvtsi2sdl -0x1ac(%rbp), %xmm0
movsd %xmm0, -0x238(%rbp)
movsd 0x5d43(%rip), %xmm0     # 0x1c4f8
callq 0x2150
movaps %xmm0, %xmm1
movsd -0x238(%rbp), %xmm0
mulsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
leaq -0xa0(%rbp), %rdi
leaq -0x188(%rbp), %rsi
movl $0x9, %edx
callq 0xdf80
movl $0x0, -0x1b0(%rbp)
movl -0x1b0(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x1695e
movl $0x0, -0x1b4(%rbp)
movl -0x1b4(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x16948
movl $0x0, -0x1b8(%rbp)
movl -0x1b8(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x16932
movl -0x1b0(%rbp), %eax
movl %eax, -0x244(%rbp)
movl -0x1b4(%rbp), %eax
movl %eax, -0x240(%rbp)
movl -0x1b8(%rbp), %eax
movl %eax, -0x23c(%rbp)
movl -0x1b0(%rbp), %esi
movl -0x1b4(%rbp), %edx
movl -0x1b8(%rbp), %ecx
leaq -0x168(%rbp), %rdi
callq 0x83b0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x248(%rbp)
movss -0x1c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x59d9(%rip), %xmm0     # 0x1c268
mulsd %xmm1, %xmm0
movsd %xmm0, -0x250(%rbp)
movl -0x1b0(%rbp), %esi
movl -0x1b4(%rbp), %edx
movl -0x1b8(%rbp), %ecx
leaq -0x188(%rbp), %rdi
callq 0x83b0
movsd -0x250(%rbp), %xmm1
movss -0x248(%rbp), %xmm0
movl -0x244(%rbp), %esi
movl -0x240(%rbp), %edx
movl -0x23c(%rbp), %ecx
cvtsi2sd %eax, %xmm2
mulsd %xmm2, %xmm1
cvtsd2ss %xmm1, %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %r8d
leaq -0x1a8(%rbp), %rdi
callq 0x83f0
movl -0x1b8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b8(%rbp)
jmp 0x16821
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16e77
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x16e6b
jmp 0x16934
movl -0x1b4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b4(%rbp)
jmp 0x16808
jmp 0x1694a
movl -0x1b0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1b0(%rbp)
jmp 0x167ef
movl -0x1a0(%rbp), %edx
movl -0x19c(%rbp), %ecx
leaq 0x6360(%rip), %rsi      # 0x1ccd1
leaq -0x1a8(%rbp), %rdi
callq 0x8150
jmp 0x1697f
movl $0x0, -0x1c4(%rbp)
movl -0x1c4(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x16ba4
movl $0x0, -0x1c8(%rbp)
movl -0x1c8(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x16b8e
movl $0x0, -0x1cc(%rbp)
movl -0x1cc(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x16b78
movl -0x1c4(%rbp), %esi
movl -0x1c8(%rbp), %edx
movl -0x1cc(%rbp), %ecx
leaq -0x1a8(%rbp), %rdi
callq 0x83b0
cvtsi2ss %eax, %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x5ad0(%rip), %xmm1     # 0x1c4c8
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x1c0(%rbp)
movss -0x1c0(%rbp), %xmm0
ucomiss -0x20(%rbp), %xmm0
jbe 0x16a59
movl -0x1c4(%rbp), %esi
movl -0x1c8(%rbp), %edx
movl -0x1cc(%rbp), %ecx
leaq -0xe0(%rbp), %rdi
xorl %r8d, %r8d
callq 0x83f0
jmp 0x16b62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x1a8(%rbp), %rdi
callq 0x1b2c0
jmp 0x16e6b
movss -0x24(%rbp), %xmm0
movss %xmm0, -0x258(%rbp)
movl -0x1c4(%rbp), %esi
movl -0x1c8(%rbp), %edx
movl -0x1cc(%rbp), %ecx
leaq -0x168(%rbp), %rdi
callq 0x83b0
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x25c(%rbp)
movss -0x1c(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x268(%rbp)
movl -0x1c4(%rbp), %esi
movl -0x1c8(%rbp), %edx
movl -0x1cc(%rbp), %ecx
leaq -0x188(%rbp), %rdi
callq 0x83b0
movsd -0x268(%rbp), %xmm2
movss -0x25c(%rbp), %xmm1
movss -0x258(%rbp), %xmm0
cvtsi2sd %eax, %xmm3
mulsd %xmm3, %xmm2
cvtsd2ss %xmm2, %xmm2
subss %xmm2, %xmm1
movss -0x20(%rbp), %xmm2
subss %xmm2, %xmm1
mulss %xmm1, %xmm0
callq 0x1b470
movss %xmm0, -0x254(%rbp)
jmp 0x16b03
movss -0x254(%rbp), %xmm0
cvtss2sd %xmm0, %xmm1
movsd 0x5751(%rip), %xmm0     # 0x1c268
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x1c0(%rbp)
movl -0x1c4(%rbp), %esi
movl -0x1c8(%rbp), %edx
movl -0x1cc(%rbp), %ecx
movss -0x1c0(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd 0x597b(%rip), %xmm1     # 0x1c4c8
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %r8d
leaq -0xe0(%rbp), %rdi
callq 0x83f0
jmp 0x16b64
movl -0x1cc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1cc(%rbp)
jmp 0x169bb
jmp 0x16b7a
movl -0x1c8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c8(%rbp)
jmp 0x169a2
jmp 0x16b90
movl -0x1c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c4(%rbp)
jmp 0x16989
movl -0xd8(%rbp), %edx
movl -0xd4(%rbp), %ecx
leaq 0x613f(%rip), %rsi      # 0x1ccf6
leaq -0xe0(%rbp), %rdi
callq 0x8150
jmp 0x16bc5
movl $0x0, -0x1d0(%rbp)
movl -0x1d0(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x16cbc
movl $0x0, -0x1d4(%rbp)
movl -0x1d4(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x16ca6
movl $0x0, -0x1d8(%rbp)
movl -0x1d8(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x16c90
movl -0x1d0(%rbp), %esi
movl -0x1d4(%rbp), %edx
movl -0x1d8(%rbp), %ecx
leaq -0xe0(%rbp), %rdi
callq 0x83b0
cmpl $0x0, %eax
jne 0x16c56
movl -0x1d0(%rbp), %esi
movl -0x1d4(%rbp), %edx
movl -0x1d8(%rbp), %ecx
leaq -0xe0(%rbp), %rdi
xorl %r8d, %r8d
callq 0x83f0
jmp 0x16c7a
movl -0x1d0(%rbp), %esi
movl -0x1d4(%rbp), %edx
movl -0x1d8(%rbp), %ecx
leaq -0xe0(%rbp), %rdi
movl $0x1, %r8d
callq 0x83f0
jmp 0x16c7c
movl -0x1d8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d8(%rbp)
jmp 0x16c01
jmp 0x16c92
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x16be8
jmp 0x16ca8
movl -0x1d0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d0(%rbp)
jmp 0x16bcf
movl $0x0, -0x1dc(%rbp)
movl -0x1dc(%rbp), %eax
cmpl -0x44(%rbp), %eax
jge 0x16dd2
movl $0x0, -0x1e0(%rbp)
movl -0x1e0(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x16dbc
movl $0x0, -0x1e4(%rbp)
movl -0x1e4(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x16da6
movl -0x1dc(%rbp), %eax
movl %eax, -0x274(%rbp)
movl -0x1e0(%rbp), %eax
movl %eax, -0x270(%rbp)
movl -0x1e4(%rbp), %eax
movl %eax, -0x26c(%rbp)
movl -0x1dc(%rbp), %esi
movl -0x1e0(%rbp), %edx
movl -0x1e4(%rbp), %ecx
leaq -0x100(%rbp), %rdi
callq 0x83b0
movl %eax, -0x278(%rbp)
movl -0x1dc(%rbp), %esi
movl -0x1e0(%rbp), %edx
leaq -0xe0(%rbp), %rdi
xorl %ecx, %ecx
callq 0x83b0
movl -0x278(%rbp), %r8d
movl -0x274(%rbp), %esi
movl -0x270(%rbp), %edx
movl -0x26c(%rbp), %ecx
imull %eax, %r8d
leaq -0x120(%rbp), %rdi
callq 0x83f0
movl -0x1e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1e4(%rbp)
jmp 0x16cf8
jmp 0x16da8
movl -0x1e0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1e0(%rbp)
jmp 0x16cdf
jmp 0x16dbe
movl -0x1dc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1dc(%rbp)
jmp 0x16cc6
movq -0x10(%rbp), %rsi
movl -0xd8(%rbp), %edx
movl -0xd4(%rbp), %ecx
leaq -0x120(%rbp), %rdi
callq 0x8150
jmp 0x16df0
leaq -0x1a8(%rbp), %rdi
callq 0x1b2c0
leaq -0x188(%rbp), %rdi
callq 0x1b2c0
leaq -0x168(%rbp), %rdi
callq 0x1b2c0
leaq -0x120(%rbp), %rdi
callq 0x1b2c0
leaq -0x100(%rbp), %rdi
callq 0x1b2c0
leaq -0xe0(%rbp), %rdi
callq 0x1b2c0
leaq -0xc0(%rbp), %rdi
callq 0x1b2c0
leaq -0xa0(%rbp), %rdi
callq 0x1b2c0
leaq -0x70(%rbp), %rdi
callq 0x1b2c0
leaq -0x50(%rbp), %rdi
callq 0x1b2c0
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
leaq -0x188(%rbp), %rdi
callq 0x1b2c0
leaq -0x168(%rbp), %rdi
callq 0x1b2c0
leaq -0x120(%rbp), %rdi
callq 0x1b2c0
leaq -0x100(%rbp), %rdi
callq 0x1b2c0
leaq -0xe0(%rbp), %rdi
callq 0x1b2c0
leaq -0xc0(%rbp), %rdi
callq 0x1b2c0
leaq -0xa0(%rbp), %rdi
callq 0x1b2c0
leaq -0x70(%rbp), %rdi
callq 0x1b2c0
leaq -0x50(%rbp), %rdi
callq 0x1b2c0
movq -0x78(%rbp), %rdi
callq 0x2360
nopw (%rax,%rax)