// File: rishabh-battulwar[P]imageprocessing/./include/ImageProc.h
// Function: ImageProc::shrink(Image&, Image&)
void ImageProc::shrink(Image &img_binary, Image &img_shrinked)
{
	Image img_after_first("bw", img_binary.rows, img_binary.cols);
	Image img_count_ridge_length("bw", img_binary.rows, img_binary.cols);

	for(int i = 0; i < img_binary.rows; i++)
		for(int j = 0; j < img_binary.cols; j++)
			for(int k = 0; k < img_binary.channels; k++)
				img_count_ridge_length.setvalue(i,j,k,255);


	int index  = 0, superflag = 1, flag = 0, black_pixel_count = 0, pixel_count = 0;
	std::string target;
	//char *target_char_arr = new char[9];

	for(int i = 0; i < img_binary.rows; i++)
		for(int j = 0; j < img_binary.cols; j++)
			for(int k = 0; k < img_binary.channels; k++)
				img_shrinked.setvalue(i,j,k,img_binary.getvalue(i,j,k));

	for(int i = 0+1; i < img_shrinked.rows-1; i++)
		for(int j = 0+1; j < img_shrinked.cols-1; j++)
			for(int k = 0; k < img_shrinked.channels; k++)
				if(img_shrinked.getvalue(i,j,k) == 0) pixel_count++;
	black_pixel_count = pixel_count;

	

	while(superflag == 1)
	{
		for(int i = 0; i < img_shrinked.rows; i++)
			for(int j = 0; j < img_shrinked.cols; j++)
				for(int k = 0; k < img_shrinked.channels; k++)
					img_after_first.setvalue(i,j,k,255);

		for(int i = 0+1; i < img_shrinked.rows-1; i++)
			for(int j = 0+1; j < img_shrinked.cols-1; j++)
				for(int k = 0; k < img_shrinked.channels; k++)
				{
					if(img_shrinked.getvalue(i,j,k) == 0)
					{
						index = -1; flag = 0;
						target.clear();
						for(int p = i-1; p <= i+1; p++)
							for(int q = j-1; q <= j+1; q++)
							{
								//std::cout << img_shrinked.getvalue(p,q,k)/255 << std::endl;
								if(!(p==i && q==j))
									if(img_shrinked.getvalue(p,q,0) == 0)
										target.append("1");
									else
										target.append("0");
								else
									continue;
							}
						//target_char_arr[8] = NULL;
						//target(target_char_arr);
						//std::cout << "target 1:" << target << std::endl;

						//std::string target_str(target);
						for(int t = 0; t < SHRINK_FIRST_PATTERNS; t++)
						{
							std::string testpattern(shrink_first[t]);
							flag = 0;
							if(testpattern.find('D') == std::string::npos)
							{
								if(target.compare(testpattern) == 0)
								{
									//std::cout << "pattern match" << std::endl;
									flag = 1;
								}
								else
								{
									//std::cout << "pattern nomatch" << std::endl;
									flag = 0;
								}
							}
							else
							{
								for(int j = 0; j < 8; j++)
								{
									if(testpattern[j] == 'D')
										continue;
									else if(target[j] != testpattern[j])
									{
										//std::cout << target << " hey " << testpattern << std::endl;
										flag = 0;
										break;
									}
									else
										flag = 1;
								}
							}

							if(flag == 1)
								break;
							else
								continue;

						}

						if(flag == 1)
							img_after_first.setvalue(i,j,k,0*255);
						else
							img_after_first.setvalue(i,j,k,1*255);

					}
				}

			for(int i = 0+1; i < img_after_first.rows-1; i++)
				for(int j = 0+1; j < img_after_first.cols-1; j++)
					for(int k = 0; k < img_after_first.channels; k++)
					{
						if(img_after_first.getvalue(i,j,k) == 0)
						{
							target.clear();
							index = -1; flag = 0;
							for(int p = i-1; p <= i+1; p++)
								for(int q = j-1; q <= j+1; q++)
								{
									if(!(p==i && q==j))
										if(img_after_first.getvalue(p,q,0) == 0)
											target.append("M");
										else
											target.append("0");
								}

							//std::cout << "target1: " << target;

							for(int t = 0; t < SHRINK_THIN_SECOND_PATTERNS; t++)
							{
								std::string testpattern(shrink__thin_second[t]);
								flag = 1;
								//std::cout << " " << testpattern << std::endl;
								if(testpattern.find('D') == std::string::npos)
								{

									if(target.compare(testpattern) == 0)
									{
										//std::cout << "hi" << std::endl;
										flag = 1;
										break;
									}
									else
										flag = 0;
								}
								else
								{
									for(int j = 0; j < 8; j++)
									{
										if(testpattern[j] == 'D')
											continue;
										else if(target[j] == testpattern[j])
										{
											flag = 1;
											//std::cout << "match" << std::endl;
										}
										else
										{
											//std::cout << "breakpoint" << std::endl;
											flag = 0;
											break;
										}
									}
								}

								if(flag == 0)
									continue;
								else
									break;
							}
							//std::cout << flag << std::endl;
							if(flag == 0)
							{
								//std::cout << "reducing" << std::endl;
								img_shrinked.setvalue(i,j,k,1*255);
							}
							else
								img_shrinked.setvalue(i,j,k,img_shrinked.getvalue(i,j,k));
						}


					}

		pixel_count = 0;
		for(int i = 0+1; i < img_shrinked.rows-1; i++)
			for(int j = 0+1; j < img_shrinked.cols-1; j++)
				for(int k = 0; k < img_shrinked.channels; k++)
					if(img_shrinked.getvalue(i,j,k) == 0) pixel_count++;

		if(pixel_count == black_pixel_count) superflag = 0;
		else								 black_pixel_count = pixel_count;
		//std::cout << black_pixel_count << std::endl;


	}
	std::cout << "Total number of ridges: " << black_pixel_count << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movl 0xc(%rax), %edx
leaq 0x5c10(%rip), %rsi      # 0x1d5d4
movq %rsi, -0x158(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x7eb0
movq -0x158(%rbp), %rsi
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movl 0xc(%rax), %edx
leaq -0x50(%rbp), %rdi
callq 0x7eb0
jmp 0x179f0
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x17a77
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x17a6a
movl $0x0, -0x68(%rbp)
movl -0x68(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x17a5d
movl -0x60(%rbp), %esi
movl -0x64(%rbp), %edx
movl -0x68(%rbp), %ecx
leaq -0x50(%rbp), %rdi
movl $0xff, %r8d
callq 0x83f0
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x17a1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x18683
jmp 0x17a5f
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x17a0a
jmp 0x17a6c
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x179f7
movl $0x0, -0x6c(%rbp)
movl $0x1, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x2290
movl $0x0, -0xa4(%rbp)
movl -0xa4(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x17ba4
movl $0x0, -0xa8(%rbp)
movl -0xa8(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x17b8e
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x17b78
movq -0x10(%rbp), %rax
movq %rax, -0x170(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, -0x164(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x160(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0x15c(%rbp)
movq -0x8(%rbp), %rdi
movl -0xa4(%rbp), %esi
movl -0xa8(%rbp), %edx
movl -0xac(%rbp), %ecx
callq 0x83b0
movq -0x170(%rbp), %rdi
movl -0x164(%rbp), %esi
movl -0x160(%rbp), %edx
movl -0x15c(%rbp), %ecx
movl %eax, %r8d
callq 0x83f0
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x17aea
jmp 0x17b7a
movl -0xa8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x17acd
jmp 0x17b90
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x17ab0
movl $0x1, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x17c62
movl $0x1, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x17c4c
movl $0x0, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x17c39
movq -0x10(%rbp), %rdi
movl -0xb0(%rbp), %esi
movl -0xb4(%rbp), %edx
movl -0xb8(%rbp), %ecx
callq 0x83b0
cmpl $0x0, %eax
jne 0x17c26
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x17c28
movl -0xb8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x17bee
jmp 0x17c3b
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x17bd0
jmp 0x17c4e
movl -0xb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb0(%rbp)
jmp 0x17bae
movl -0x7c(%rbp), %eax
movl %eax, -0x78(%rbp)
cmpl $0x1, -0x70(%rbp)
jne 0x185fe
movl $0x0, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0xc(%rcx), %eax
jge 0x17d1c
movl $0x0, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x17d06
movl $0x0, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x17cf3
movl -0xbc(%rbp), %esi
movl -0xc0(%rbp), %edx
movl -0xc4(%rbp), %ecx
leaq -0x30(%rbp), %rdi
movl $0xff, %r8d
callq 0x83f0
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0x17cb2
jmp 0x17cf5
movl -0xc0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x17c99
jmp 0x17d08
movl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xbc(%rbp)
jmp 0x17c7c
movl $0x1, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x18100
movl $0x1, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x180ea
movl $0x0, -0xd0(%rbp)
movl -0xd0(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x180d4
movq -0x10(%rbp), %rdi
movl -0xc8(%rbp), %esi
movl -0xcc(%rbp), %edx
movl -0xd0(%rbp), %ecx
callq 0x83b0
cmpl $0x0, %eax
jne 0x180be
movl $0xffffffff, -0x6c(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x74(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x2280
movl -0xc8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xd4(%rbp)
movl -0xd4(%rbp), %eax
movl -0xc8(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x17eae
movl -0xcc(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xd8(%rbp)
movl -0xd8(%rbp), %eax
movl -0xcc(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x17e98
movl -0xd4(%rbp), %eax
cmpl -0xc8(%rbp), %eax
jne 0x17e23
movl -0xd8(%rbp), %eax
cmpl -0xcc(%rbp), %eax
je 0x17e80
movq -0x10(%rbp), %rdi
movl -0xd4(%rbp), %esi
movl -0xd8(%rbp), %edx
xorl %ecx, %ecx
callq 0x83b0
cmpl $0x0, %eax
jne 0x17e67
leaq 0x49ea(%rip), %rsi      # 0x1c830
leaq -0xa0(%rbp), %rdi
callq 0x23c0
jmp 0x17e54
jmp 0x17e7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x1866e
leaq 0x49b0(%rip), %rsi      # 0x1c81e
leaq -0xa0(%rbp), %rdi
callq 0x23c0
jmp 0x17e7c
jmp 0x17e7e
jmp 0x17e82
jmp 0x17e84
jmp 0x17e84
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x17df0
jmp 0x17e9a
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x17dca
movl $0x0, -0xdc(%rbp)
cmpl $0x3e, -0xdc(%rbp)
jge 0x18075
movslq -0xdc(%rbp), %rax
shlq $0x5, %rax
leaq 0x9369(%rip), %rsi      # 0x21240
addq %rax, %rsi
leaq -0x100(%rbp), %rdi
callq 0x20d0
jmp 0x17ee8
movl $0x0, -0x74(%rbp)
leaq -0x100(%rbp), %rdi
movl $0x44, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x2270
cmpq $-0x1, %rax
jne 0x17f62
leaq -0xa0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x2040
movl %eax, -0x174(%rbp)
jmp 0x17f25
movl -0x174(%rbp), %eax
cmpl $0x0, %eax
jne 0x17f56
movl $0x1, -0x74(%rbp)
jmp 0x17f5d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2110
jmp 0x1866e
movl $0x0, -0x74(%rbp)
jmp 0x1802c
movl $0x0, -0x104(%rbp)
cmpl $0x8, -0x104(%rbp)
jge 0x1802a
movslq -0x104(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x23f0
movq %rax, -0x180(%rbp)
jmp 0x17f95
movq -0x180(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x44, %eax
jne 0x17fa6
jmp 0x18016
movslq -0x104(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x23f0
movq %rax, -0x188(%rbp)
jmp 0x17fc2
movq -0x188(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x194(%rbp)
movslq -0x104(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x23f0
movq %rax, -0x190(%rbp)
jmp 0x17fee
movl -0x194(%rbp), %eax
movq -0x190(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0x1800b
movl $0x0, -0x74(%rbp)
jmp 0x1802a
movl $0x1, -0x74(%rbp)
jmp 0x18014
jmp 0x18016
movl -0x104(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x104(%rbp)
jmp 0x17f6c
jmp 0x1802c
cmpl $0x1, -0x74(%rbp)
jne 0x1803e
movl $0x37, -0x108(%rbp)
jmp 0x18048
movl $0x39, -0x108(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x2110
movl -0x108(%rbp), %eax
subl $0x37, %eax
je 0x18075
jmp 0x18061
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x17eb8
cmpl $0x1, -0x74(%rbp)
jne 0x1809b
movl -0xc8(%rbp), %esi
movl -0xcc(%rbp), %edx
movl -0xd0(%rbp), %ecx
leaq -0x30(%rbp), %rdi
xorl %r8d, %r8d
callq 0x83f0
jmp 0x180bc
movl -0xc8(%rbp), %esi
movl -0xcc(%rbp), %edx
movl -0xd0(%rbp), %ecx
leaq -0x30(%rbp), %rdi
movl $0xff, %r8d
callq 0x83f0
jmp 0x180be
jmp 0x180c0
movl -0xd0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd0(%rbp)
jmp 0x17d6a
jmp 0x180d6
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x17d48
jmp 0x180ec
movl -0xc8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc8(%rbp)
jmp 0x17d26
movl $0x1, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x1851d
movl $0x1, -0x110(%rbp)
movl -0x110(%rbp), %eax
movl -0x28(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x18507
movl $0x0, -0x114(%rbp)
movl -0x114(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x184f1
movl -0x10c(%rbp), %esi
movl -0x110(%rbp), %edx
movl -0x114(%rbp), %ecx
leaq -0x30(%rbp), %rdi
callq 0x83b0
cmpl $0x0, %eax
jne 0x184db
leaq -0xa0(%rbp), %rdi
callq 0x2280
movl $0xffffffff, -0x6c(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x74(%rbp)
movl -0x10c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x118(%rbp)
movl -0x118(%rbp), %eax
movl -0x10c(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x1826f
movl -0x110(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x11c(%rbp)
movl -0x11c(%rbp), %eax
movl -0x110(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x18259
movl -0x118(%rbp), %eax
cmpl -0x10c(%rbp), %eax
jne 0x181f7
movl -0x11c(%rbp), %eax
cmpl -0x110(%rbp), %eax
je 0x18243
movl -0x118(%rbp), %esi
movl -0x11c(%rbp), %edx
leaq -0x30(%rbp), %rdi
xorl %ecx, %ecx
callq 0x83b0
cmpl $0x0, %eax
jne 0x1822a
leaq 0x481f(%rip), %rsi      # 0x1ca39
leaq -0xa0(%rbp), %rdi
callq 0x23c0
jmp 0x18228
jmp 0x18241
leaq 0x45ed(%rip), %rsi      # 0x1c81e
leaq -0xa0(%rbp), %rdi
callq 0x23c0
jmp 0x1823f
jmp 0x18241
jmp 0x18243
jmp 0x18245
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0x181c8
jmp 0x1825b
movl -0x118(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x118(%rbp)
jmp 0x181a2
movl $0x0, -0x120(%rbp)
cmpl $0x31, -0x120(%rbp)
jge 0x18445
movslq -0x120(%rbp), %rax
shlq $0x5, %rax
leaq 0xa228(%rip), %rsi      # 0x224c0
addq %rax, %rsi
leaq -0x140(%rbp), %rdi
callq 0x20d0
jmp 0x182a9
movl $0x1, -0x74(%rbp)
leaq -0x140(%rbp), %rdi
movl $0x44, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x2270
cmpq $-0x1, %rax
jne 0x18330
leaq -0xa0(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x2040
movl %eax, -0x198(%rbp)
jmp 0x182e6
movl -0x198(%rbp), %eax
cmpl $0x0, %eax
jne 0x18324
movl $0x1, -0x74(%rbp)
movl $0x4c, -0x108(%rbp)
jmp 0x18418
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x2110
jmp 0x1866e
movl $0x0, -0x74(%rbp)
jmp 0x183fc
movl $0x0, -0x144(%rbp)
cmpl $0x8, -0x144(%rbp)
jge 0x183fa
movslq -0x144(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0x23f0
movq %rax, -0x1a0(%rbp)
jmp 0x18363
movq -0x1a0(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x44, %eax
jne 0x18374
jmp 0x183e6
movslq -0x144(%rbp), %rsi
leaq -0xa0(%rbp), %rdi
callq 0x23f0
movq %rax, -0x1a8(%rbp)
jmp 0x18390
movq -0x1a8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x1b4(%rbp)
movslq -0x144(%rbp), %rsi
leaq -0x140(%rbp), %rdi
callq 0x23f0
movq %rax, -0x1b0(%rbp)
jmp 0x183bc
movl -0x1b4(%rbp), %eax
movq -0x1b0(%rbp), %rcx
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x183d9
movl $0x1, -0x74(%rbp)
jmp 0x183e2
movl $0x0, -0x74(%rbp)
jmp 0x183fa
jmp 0x183e4
jmp 0x183e6
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x144(%rbp)
jmp 0x1833a
jmp 0x183fc
cmpl $0x0, -0x74(%rbp)
jne 0x1840e
movl $0x4e, -0x108(%rbp)
jmp 0x18418
movl $0x4c, -0x108(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x2110
movl -0x108(%rbp), %eax
subl $0x4c, %eax
je 0x18445
jmp 0x18431
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0x18279
cmpl $0x0, -0x74(%rbp)
jne 0x1846e
movq -0x10(%rbp), %rdi
movl -0x10c(%rbp), %esi
movl -0x110(%rbp), %edx
movl -0x114(%rbp), %ecx
movl $0xff, %r8d
callq 0x83f0
jmp 0x184d9
movq -0x10(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movl -0x10c(%rbp), %eax
movl %eax, -0x1c0(%rbp)
movl -0x110(%rbp), %eax
movl %eax, -0x1bc(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0x1b8(%rbp)
movq -0x10(%rbp), %rdi
movl -0x10c(%rbp), %esi
movl -0x110(%rbp), %edx
movl -0x114(%rbp), %ecx
callq 0x83b0
movq -0x1c8(%rbp), %rdi
movl -0x1c0(%rbp), %esi
movl -0x1bc(%rbp), %edx
movl -0x1b8(%rbp), %ecx
movl %eax, %r8d
callq 0x83f0
jmp 0x184db
jmp 0x184dd
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0x18146
jmp 0x184f3
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x18128
jmp 0x18509
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x1810a
movl $0x0, -0x7c(%rbp)
movl $0x1, -0x148(%rbp)
movl -0x148(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0xc(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x185e2
movl $0x1, -0x14c(%rbp)
movl -0x14c(%rbp), %eax
movq -0x10(%rbp), %rcx
movl 0x8(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x185cc
movl $0x0, -0x150(%rbp)
movl -0x150(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x185b9
movq -0x10(%rbp), %rdi
movl -0x148(%rbp), %esi
movl -0x14c(%rbp), %edx
movl -0x150(%rbp), %ecx
callq 0x83b0
cmpl $0x0, %eax
jne 0x185a6
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x185a8
movl -0x150(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x150(%rbp)
jmp 0x1856e
jmp 0x185bb
movl -0x14c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14c(%rbp)
jmp 0x18550
jmp 0x185ce
movl -0x148(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x148(%rbp)
jmp 0x1852e
movl -0x7c(%rbp), %eax
cmpl -0x78(%rbp), %eax
jne 0x185f3
movl $0x0, -0x70(%rbp)
jmp 0x185f9
movl -0x7c(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0x17c68
movq 0x89c3(%rip), %rdi      # 0x20fc8
leaq 0x47e2(%rip), %rsi      # 0x1cdee
callq 0x21c0
movq %rax, -0x1d0(%rbp)
jmp 0x1861a
movq -0x1d0(%rbp), %rdi
movl -0x78(%rbp), %esi
callq 0x2340
movq %rax, -0x1d8(%rbp)
jmp 0x18632
movq -0x1d8(%rbp), %rdi
movq 0x8978(%rip), %rsi      # 0x20fb8
callq 0x21e0
jmp 0x18647
leaq -0xa0(%rbp), %rdi
callq 0x2110
leaq -0x50(%rbp), %rdi
callq 0x1b2c0
leaq -0x30(%rbp), %rdi
callq 0x1b2c0
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
leaq -0xa0(%rbp), %rdi
callq 0x2110
leaq -0x50(%rbp), %rdi
callq 0x1b2c0
leaq -0x30(%rbp), %rdi
callq 0x1b2c0
movq -0x58(%rbp), %rdi
callq 0x2360
nopw %cs:(%rax,%rax)