// File: /workspace/github_cpp_makefile_star2_O3/sorazy[P]canny/main.cpp
// Function: main
int main(int argc, char **argv)
{
	// Exit program if proper arguments are not provided by user
	if (argc != 4)
	{
		cout << "Proper syntax: ./a.out <input_filename> <high_threshold> <sigma_value>" << endl;
		return 0;
	}

	// Exit program if file doesn't open
	string filename(argv[1]);
	string path = "./input_images/" + filename;
	ifstream infile(path, ios::binary);
	if (!infile.is_open())
	{
		cout << "File " << path << " not found in directory." << endl;
		return 0;
	}	

	// Opening output files
	ofstream img1("./output_images/canny_mag.pgm", ios::binary);
	ofstream img2("./output_images/canny_peaks.pgm", ios::binary);		
	ofstream img3("./output_images/canny_final.pgm", ios::binary);

	::hi = stoi(argv[2]);
	::lo = .35 * hi;
	::sig = stoi(argv[3]);

	// Storing header information and copying into the new ouput images
	infile >> ::type >> ::width >> ::height >> ::intensity;
	img1 << type << endl << width << " " << height << endl << intensity << endl;
	img2 << type << endl << width << " " << height << endl << intensity << endl;
	img3 << type << endl << width << " " << height << endl << intensity << endl;

	// These matrices will hold the integer values of the input image and masks.
	// I'm dynamically allocating arrays to easily pass them into functions.
	double **pic = new double*[height], **mag = new double*[height], **final = new double*[height];
	double **x = new double*[height], **y = new double*[height];

	for (int i = 0; i < height; i++)
	{
		pic[i] = new double[width];
		mag[i] = new double[width];
		final[i] = new double[width];
		x[i] = new double[width];
		y[i] = new double[width];
	}

	// Reading in the input image as integers
	for (int i = 0; i < height; i++)
		for (int j = 0; j < width; j++)
			pic[i][j] = (int)infile.get();

	// Create the magniute matrix
	magnitude_matrix(pic, mag, x, y);

	// Get all the peaks and store them in vector
	HashMap *peaks = new HashMap();
	vector<Point*> v = peak_detection(mag, peaks, x, y);

	// Go through the vector and call the recursive function and each point. If the value
	// in the mag matrix is hi, then immediately accept it in final. If lo, then immediately
	// reject. If between lo and hi, then check if it's next to a hi pixel using recursion
	HashMap *h = new HashMap();
	int a, b;
	for (int i = 0; i < v.size(); i++)
	{
		a = v.at(i)->x;
		b = v.at(i)->y;

		if (mag[a][b] >= hi)
			final[a][b] = 255;
		else if (mag[a][b] < lo)
			final[a][b] = 0;
		else
			recursiveDT(mag, final, h, peaks, a, b, 0);
	}

	// ================================= IMAGE OUTPUT =================================
	// Outputting the 'mag' matrix to img1. It's very important to cast it to a char.
	// To make sure that the decimal doesn't produce any wonky results, cast to an int
	// ================================= IMAGE OUTPUT =================================
	for (int i = 0; i < height; i++)
		for (int j = 0; j < width; j++)
			img1 << (char)((int)mag[i][j]);

	// Outputting the points stored in the vector to img2
	int k = 0;
	for (int i = 0; i < v.size(); i++)
	{
		while(k++ != (v.at(i)->x * height + v.at(i)->y - 1))
			img2 << (char)(0);

		img2 << (char)(255);
	}

	// Output the 'final' matrix to img1
	for (int i = 0; i < height; i++)
		for (int j = 0; j < width; j++)
			img3 << (char)((int)final[i][j]);		

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x898, %rsp            # imm = 0x898
cmpl $0x4, %edi
jne 0x2dcf
movq %rsi, %rbx
movq 0x8(%rsi), %rsi
leaq -0xb0(%rbp), %r14
leaq -0x2b8(%rbp), %rdx
movq %r14, %rdi
callq 0x3088
leaq 0x2bca(%rip), %rsi      # 0x5057
leaq -0x90(%rbp), %rdi
movq %r14, %rdx
callq 0x30c5
leaq -0x2b8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x4, %edx
callq 0x2220
leaq -0x240(%rbp), %rdi
callq 0x2070
testb %al, %al
je 0x2e16
leaq 0x2bb7(%rip), %rsi      # 0x5086
leaq -0x8b8(%rbp), %rdi
movl $0x4, %edx
callq 0x2190
leaq 0x2bbd(%rip), %rsi      # 0x50a4
leaq -0x6b8(%rbp), %rdi
movl $0x4, %edx
callq 0x2190
leaq 0x2bc5(%rip), %rsi      # 0x50c4
leaq -0x4b8(%rbp), %rdi
movl $0x4, %edx
callq 0x2190
movq 0x10(%rbx), %rsi
leaq -0x58(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3088
movq -0x58(%rbp), %r15
callq 0x2050
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
leaq -0x38(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xa, %edx
callq 0x21c0
cmpq %r15, (%r12)
je 0x2f24
movslq %eax, %rcx
cmpq %rax, %rcx
jne 0x2f30
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x2f30
testl %ecx, %ecx
jne 0x2573
movl %r13d, (%r14)
movl %eax, 0x4c0f(%rip)      # 0x7188
leaq -0x48(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x2599
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2180
movl 0x4bef(%rip), %eax      # 0x7188
cvtsi2sd %eax, %xmm0
mulsd 0x2a63(%rip), %xmm0     # 0x5008
cvttsd2si %xmm0, %eax
movl %eax, 0x4bdd(%rip)      # 0x718c
movq 0x18(%rbx), %rsi
leaq -0x58(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x3088
movq -0x58(%rbp), %rbx
movl (%r14), %r13d
movl $0x0, (%r14)
leaq -0x38(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x21c0
cmpq %rbx, (%r15)
je 0x2f3c
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
leaq -0x80000000(%rax), %rdx
cmpq %rcx, %rdx
jb 0x2f48
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x2f48
testl %ecx, %ecx
jne 0x2618
movl %r13d, (%r14)
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, 0x4b69(%rip)     # 0x7190
movq -0x58(%rbp), %rdi
cmpq %r12, %rdi
je 0x263c
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x2b8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq -0x2a8(%rbp,%rax), %rbx
leaq 0x4b18(%rip), %rsi      # 0x7171
movl $0xa, %edx
callq 0x2250
movq -0x2b8(%rbp), %rax
movq -0x18(%rax), %rax
cmpl $0x0, -0x298(%rbp,%rax)
jne 0x2698
addq $-0xb, %rbx
cmpq $-0xb, %rbx
ja 0x2698
movq -0x1d0(%rbp,%rax), %rdi
movq 0x10(%rdi), %rax
cmpq 0x18(%rdi), %rax
jae 0x2eef
leaq 0x4ae1(%rip), %rsi      # 0x7180
leaq -0x2b8(%rbp), %rdi
callq 0x20f0
leaq 0x4aca(%rip), %rsi      # 0x717c
movq %rax, %rdi
callq 0x20f0
leaq 0x4ac3(%rip), %rsi      # 0x7184
movq %rax, %rdi
callq 0x20f0
leaq 0x4aa1(%rip), %r14      # 0x7171
movq %r14, %rdi
callq 0x20c0
leaq -0x8b8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x21a0
movq -0x8b8(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
leaq -0x8b8(%rbp), %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl 0x4a5e(%rip), %esi      # 0x7180
movq %rax, %rdi
callq 0x2260
movq %rax, %rbx
leaq 0x2adb(%rip), %rsi      # 0x520f
movl $0x1, %edx
movq %rax, %rdi
callq 0x21a0
movl 0x4a35(%rip), %esi      # 0x717c
movq %rbx, %rdi
callq 0x2260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl 0x4a05(%rip), %esi      # 0x7184
movq %rax, %rdi
callq 0x2260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq 0x49b9(%rip), %r14      # 0x7171
movq %r14, %rdi
callq 0x20c0
leaq -0x6b8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x21a0
movq -0x6b8(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
leaq -0x6b8(%rbp), %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl 0x4976(%rip), %esi      # 0x7180
movq %rax, %rdi
callq 0x2260
movq %rax, %rbx
leaq 0x29f3(%rip), %rsi      # 0x520f
movl $0x1, %edx
movq %rax, %rdi
callq 0x21a0
movl 0x494d(%rip), %esi      # 0x717c
movq %rbx, %rdi
callq 0x2260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl 0x491d(%rip), %esi      # 0x7184
movq %rax, %rdi
callq 0x2260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq 0x48d1(%rip), %r14      # 0x7171
movq %r14, %rdi
callq 0x20c0
leaq -0x4b8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x21a0
movq -0x4b8(%rbp), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
leaq -0x4b8(%rbp), %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl 0x488e(%rip), %esi      # 0x7180
movq %rax, %rdi
callq 0x2260
movq %rax, %rbx
leaq 0x290b(%rip), %rsi      # 0x520f
movl $0x1, %edx
movq %rax, %rdi
callq 0x21a0
movl 0x4865(%rip), %esi      # 0x717c
movq %rbx, %rdi
callq 0x2260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl 0x4835(%rip), %esi      # 0x7184
movq %rax, %rdi
callq 0x2260
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movslq 0x47f4(%rip), %rcx      # 0x717c
leaq (,%rcx,8), %rax
movq %rcx, %r12
testq %rcx, %rcx
movq $-0x1, %rbx
cmovnsq %rax, %rbx
movq %rbx, %rdi
callq 0x2030
movq %rax, %r14
movq %rbx, %rdi
callq 0x2030
movq %rax, %r13
movq %rbx, %rdi
callq 0x2030
movq %rax, -0x60(%rbp)
movq %rbx, %rdi
callq 0x2030
movq %rax, -0x70(%rbp)
movq %rbx, %rdi
callq 0x2030
movq %rax, -0x68(%rbp)
testl %r12d, %r12d
jle 0x2aab
movslq 0x4795(%rip), %rax      # 0x7180
leaq (,%rax,8), %rcx
testq %rax, %rax
movq $-0x1, %rbx
cmovnsq %rcx, %rbx
xorl %r15d, %r15d
movq %rbx, %rdi
callq 0x2030
movq %rax, (%r14,%r15,8)
movq %rbx, %rdi
callq 0x2030
movq %rax, (%r13,%r15,8)
movq %rbx, %rdi
callq 0x2030
movq -0x60(%rbp), %rcx
movq %rax, (%rcx,%r15,8)
movq %rbx, %rdi
callq 0x2030
movq -0x70(%rbp), %rcx
movq %rax, (%rcx,%r15,8)
movq %rbx, %rdi
callq 0x2030
movq -0x68(%rbp), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
cmpq %r15, %r12
jne 0x2a04
testl %r12d, %r12d
jle 0x2aab
movl 0x4720(%rip), %eax      # 0x7180
xorl %r15d, %r15d
leaq -0x2b8(%rbp), %rbx
testl %eax, %eax
jle 0x2aa0
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x21b0
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movq (%r14,%r15,8), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
movslq 0x46ec(%rip), %rax      # 0x7180
cmpq %rax, %r12
jl 0x2a71
movl 0x46dc(%rip), %r12d     # 0x717c
incq %r15
movslq %r12d, %rcx
cmpq %rcx, %r15
jl 0x2a6a
movq %r14, %rdi
movq %r13, %rsi
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rcx
callq 0x31f8
movl $0x40, %edi
callq 0x2170
movq %rax, %r12
movq %rax, %rdi
callq 0x3c6a
leaq -0x58(%rbp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movq -0x70(%rbp), %rcx
movq -0x68(%rbp), %r8
callq 0x35f1
movl $0x40, %edi
callq 0x2170
movq %rax, %r15
movq %rax, %rdi
callq 0x3c6a
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
cmpq %rdi, %rdx
je 0x2bab
xorl %ebx, %ebx
movabsq $0x406fe00000000000, %r14 # imm = 0x406FE00000000000
movq (%rdi,%rbx,8), %rax
movslq (%rax), %r8
movslq 0x4(%rax), %r9
movq (%r13,%r8,8), %rax
movsd (%rax,%r9,8), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl 0x464b(%rip), %xmm1 # 0x7188
ucomisd %xmm1, %xmm0
jae 0x2b66
xorps %xmm1, %xmm1
cvtsi2sdl 0x463e(%rip), %xmm1 # 0x718c
ucomisd %xmm0, %xmm1
jbe 0x2b74
movq -0x60(%rbp), %rax
movq (%rax,%r8,8), %rax
movq $0x0, (%rax,%r9,8)
jmp 0x2b95
movq -0x60(%rbp), %rax
movq (%rax,%r8,8), %rax
movq %r14, (%rax,%r9,8)
jmp 0x2b95
movl $0x0, (%rsp)
movq %r13, %rdi
movq -0x60(%rbp), %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c7
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
incq %rbx
movq %rdx, %rax
subq %rdi, %rax
sarq $0x3, %rax
cmpq %rbx, %rax
ja 0x2b1c
movl 0x45cb(%rip), %eax      # 0x717c
testl %eax, %eax
jle 0x2c16
movl 0x45c5(%rip), %ecx      # 0x7180
xorl %r15d, %r15d
leaq -0x8b8(%rbp), %rbx
leaq -0x38(%rbp), %r14
testl %ecx, %ecx
jle 0x2c03
xorl %r12d, %r12d
movq (%r13,%r15,8), %rax
cvttsd2si (%rax,%r12,8), %eax
movb %al, -0x38(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21a0
incq %r12
movslq 0x4588(%rip), %rcx      # 0x7180
cmpq %rcx, %r12
jl 0x2bd0
movl 0x4579(%rip), %eax      # 0x717c
incq %r15
movslq %eax, %rdx
cmpq %rdx, %r15
jl 0x2bc9
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
cmpq %rdi, %rdx
je 0x2cbf
xorl %ebx, %ebx
leaq -0x6b8(%rbp), %r14
leaq -0x38(%rbp), %r15
xorl %r13d, %r13d
subq %rdi, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
jbe 0x2ede
incl %r13d
movq (%rdi,%rbx,8), %rax
movl 0x4530(%rip), %ecx      # 0x717c
imull (%rax), %ecx
addl 0x4(%rax), %ecx
cmpl %ecx, %r13d
je 0x2c87
movb $0x0, -0x38(%rbp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x21a0
incl %r13d
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
ja 0x2c42
jmp 0x2ede
movb $-0x1, -0x38(%rbp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x21a0
incq %rbx
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
movq %rdx, %rax
subq %rdi, %rax
sarq $0x3, %rax
cmpq %rbx, %rax
ja 0x2c2f
movl 0x44bd(%rip), %eax      # 0x717c
testl %eax, %eax
movq -0x60(%rbp), %r13
jle 0x2d24
movl 0x44b3(%rip), %ecx      # 0x7180
xorl %r15d, %r15d
leaq -0x4b8(%rbp), %rbx
leaq -0x38(%rbp), %r14
testl %ecx, %ecx
jle 0x2d15
xorl %r12d, %r12d
movq (%r13,%r15,8), %rax
cvttsd2si (%rax,%r12,8), %eax
movb %al, -0x38(%rbp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x21a0
incq %r12
movslq 0x4476(%rip), %rcx      # 0x7180
cmpq %rcx, %r12
jl 0x2ce2
movl 0x4467(%rip), %eax      # 0x717c
incq %r15
movslq %eax, %rdx
cmpq %rdx, %r15
jl 0x2cdb
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x2d35
movq -0x48(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
movq 0x4294(%rip), %rax      # 0x6fd0
movq (%rax), %rbx
movq 0x18(%rax), %r14
leaq -0x4b0(%rbp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, -0x4b8(%rbp,%rax)
callq 0x2140
movl $0xf8, %r15d
leaq -0x4b8(%rbp), %rdi
addq %r15, %rdi
callq 0x20a0
leaq -0x6b0(%rbp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, -0x6b8(%rbp,%rax)
callq 0x2140
leaq -0x6b8(%rbp), %rdi
addq %r15, %rdi
callq 0x20a0
leaq -0x8b0(%rbp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, -0x8b8(%rbp,%rax)
callq 0x2140
leaq -0x8b8(%rbp), %rdi
addq %r15, %rdi
callq 0x20a0
jmp 0x2e86
movq 0x4202(%rip), %rbx      # 0x6fd8
leaq 0x2233(%rip), %rsi      # 0x5010
movl $0x46, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
jmp 0x2eca
movq 0x41bb(%rip), %rdi      # 0x6fd8
leaq 0x2243(%rip), %rsi      # 0x5067
movl $0x5, %edx
callq 0x21a0
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
movq 0x4195(%rip), %rdi      # 0x6fd8
callq 0x21a0
movq %rax, %rbx
leaq 0x221b(%rip), %rsi      # 0x506d
movl $0x18, %edx
movq %rax, %rdi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq -0x2b8(%rbp), %rdi
callq 0x2080
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2eab
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2eca
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2180
xorl %eax, %eax
addq $0x898, %rsp            # imm = 0x898
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x222e(%rip), %rdi      # 0x5113
movq %rbx, %rsi
xorl %eax, %eax
callq 0x21f0
movq (%rdi), %rax
callq *0x48(%rax)
cmpl $-0x1, %eax
jne 0x2698
movq -0x2b8(%rbp), %rax
movq -0x18(%rax), %rax
leaq (%rax,%rbp), %rdi
addq $-0x2b8, %rdi           # imm = 0xFD48
movl 0x20(%rdi), %esi
orl $0x2, %esi
callq 0x2240
jmp 0x2698
leaq 0x21b9(%rip), %rdi      # 0x50e4
callq 0x20e0
leaq 0x21ad(%rip), %rdi      # 0x50e4
callq 0x21d0
leaq 0x21a1(%rip), %rdi      # 0x50e4
callq 0x20e0
leaq 0x2195(%rip), %rdi      # 0x50e4
callq 0x21d0
movq %rax, %rbx
movl $0x40, %esi
movq %r15, %rdi
callq 0x2180
jmp 0x3003
jmp 0x3000
jmp 0x2ff5
movq %rax, %rbx
movl $0x40, %esi
movq %r12, %rdi
jmp 0x3013
jmp 0x2ff5
jmp 0x2ff5
jmp 0x2ff5
jmp 0x2ff5
jmp 0x2ff5
jmp 0x2ff5
jmp 0x2ff5
movq %rax, %rbx
jmp 0x3024
movq %rax, %rbx
jmp 0x3030
jmp 0x2fea
jmp 0x2ff5
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x2fb1
movl %r13d, (%r14)
movq -0x58(%rbp), %rdi
cmpq %r12, %rdi
jne 0x2fd5
jmp 0x3018
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x2fc8
movl %r13d, (%r14)
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3018
movq -0x48(%rbp), %rsi
incq %rsi
jmp 0x3013
movq %rax, %rbx
jmp 0x3048
movq %rax, %rbx
jmp 0x3061
jmp 0x3000
movq %rax, %rbx
jmp 0x303c
jmp 0x3000
jmp 0x2ff5
jmp 0x2ff5
movq %rax, %rbx
jmp 0x3018
jmp 0x3000
jmp 0x3000
jmp 0x3000
movq %rax, %rbx
movq -0x58(%rbp), %rdi
testq %rdi, %rdi
je 0x3018
movq -0x48(%rbp), %rsi
subq %rdi, %rsi
callq 0x2180
leaq -0x4b8(%rbp), %rdi
callq 0x21e0
leaq -0x6b8(%rbp), %rdi
callq 0x21e0
leaq -0x8b8(%rbp), %rdi
callq 0x21e0
leaq -0x2b8(%rbp), %rdi
callq 0x2080
leaq -0x80(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3061
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3080
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2180
movq %rbx, %rdi
callq 0x2270