// File: Ripser[P]ripser/ripser.cpp
// Function: main
int main(int argc, char** argv) {
	const char* filename = nullptr;

	file_format format = DISTANCE_MATRIX;

	index_t dim_max = 1;
	value_t threshold = std::numeric_limits<value_t>::max();
	float ratio = 1;
	coefficient_t modulus = 2;

	for (index_t i = 1; i < argc; ++i) {
		const std::string arg(argv[i]);
		if (arg == "--help") {
			print_usage_and_exit(0);
		} else if (arg == "--dim") {
			std::string parameter = std::string(argv[++i]);
			size_t next_pos;
			dim_max = std::stol(parameter, &next_pos);
			if (next_pos != parameter.size()) print_usage_and_exit(-1);
		} else if (arg == "--threshold") {
			std::string parameter = std::string(argv[++i]);
			size_t next_pos;
			threshold = std::stof(parameter, &next_pos);
			if (next_pos != parameter.size()) print_usage_and_exit(-1);
		} else if (arg == "--ratio") {
			std::string parameter = std::string(argv[++i]);
			size_t next_pos;
			ratio = std::stof(parameter, &next_pos);
			if (next_pos != parameter.size()) print_usage_and_exit(-1);
		} else if (arg == "--format") {
			std::string parameter = std::string(argv[++i]);
			if (parameter.rfind("lower", 0) == 0)
				format = LOWER_DISTANCE_MATRIX;
			else if (parameter.rfind("upper", 0) == 0)
				format = UPPER_DISTANCE_MATRIX;
			else if (parameter.rfind("dist", 0) == 0)
				format = DISTANCE_MATRIX;
			else if (parameter.rfind("point", 0) == 0)
				format = POINT_CLOUD;
			else if (parameter == "dipha")
				format = DIPHA;
			else if (parameter == "sparse")
				format = SPARSE;
			else if (parameter == "binary")
				format = BINARY;
			else
				print_usage_and_exit(-1);
#ifdef USE_COEFFICIENTS
		} else if (arg == "--modulus") {
			std::string parameter = std::string(argv[++i]);
			size_t next_pos;
			modulus = std::stol(parameter, &next_pos);
			if (next_pos != parameter.size() || !is_prime(modulus)) print_usage_and_exit(-1);
#endif
		} else {
			if (filename) { print_usage_and_exit(-1); }
			filename = argv[i];
		}
	}

	std::ifstream file_stream(filename);
	if (filename && file_stream.fail()) {
		std::cerr << "couldn't open file " << filename << std::endl;
		exit(-1);
	}

	if (format == SPARSE) {
		sparse_distance_matrix dist =
		    read_sparse_distance_matrix(filename ? file_stream : std::cin);
		std::cout << "sparse distance matrix with " << dist.size() << " points and "
		          << dist.num_edges << "/" << (dist.size() * (dist.size() - 1)) / 2 << " entries"
		          << std::endl;

		ripser<sparse_distance_matrix>(std::move(dist), dim_max, threshold, ratio, modulus)
		    .compute_barcodes();
	} else if (format == POINT_CLOUD && threshold < std::numeric_limits<value_t>::max()) {
		sparse_distance_matrix dist(read_point_cloud(filename ? file_stream : std::cin), threshold);
		ripser<sparse_distance_matrix>(std::move(dist), dim_max, threshold, ratio, modulus)
				.compute_barcodes();
	} else {
		compressed_lower_distance_matrix dist =
		    read_file(filename ? file_stream : std::cin, format);

		value_t min = std::numeric_limits<value_t>::infinity(),
		        max = -std::numeric_limits<value_t>::infinity(), max_finite = max;
		int num_edges = 0;

		value_t enclosing_radius = std::numeric_limits<value_t>::infinity();
		if (threshold == std::numeric_limits<value_t>::max()) {
			for (size_t i = 0; i < dist.size(); ++i) {
				value_t r_i = -std::numeric_limits<value_t>::infinity();
				for (size_t j = 0; j < dist.size(); ++j) r_i = std::max(r_i, dist(i, j));
				enclosing_radius = std::min(enclosing_radius, r_i);
			}
		}

		for (auto d : dist.distances) {
			min = std::min(min, d);
			max = std::max(max, d);
			if (d != std::numeric_limits<value_t>::infinity()) max_finite = std::max(max_finite, d);
			if (d <= threshold) ++num_edges;
		}
		std::cout << "value range: [" << min << "," << max_finite << "]" << std::endl;

		if (threshold == std::numeric_limits<value_t>::max()) {
			std::cout << "distance matrix with " << dist.size()
			          << " points, using threshold at enclosing radius " << enclosing_radius
			          << std::endl;
			ripser<compressed_lower_distance_matrix>(std::move(dist), dim_max, enclosing_radius,
			                                         ratio, modulus)
			    .compute_barcodes();
		} else {
			std::cout << "sparse distance matrix with " << dist.size() << " points and "
			          << num_edges << "/" << (dist.size() * (dist.size() - 1)) / 2 << " entries"
			          << std::endl;

			ripser<sparse_distance_matrix>(sparse_distance_matrix(std::move(dist), threshold),
			                               dim_max, threshold, ratio, modulus)
			    .compute_barcodes();
		}
		exit(0);
	}
}

// Assembly:
subq $0x918, %rsp            # imm = 0x918
movl $0x0, 0x914(%rsp)
movl %edi, 0x910(%rsp)
movq %rsi, 0x908(%rsp)
movq $0x0, 0x900(%rsp)
movl $0x2, 0x8fc(%rsp)
movq $0x1, 0x8f0(%rsp)
callq 0x6fc0
movss %xmm0, 0x8ec(%rsp)
movss 0x1de3e(%rip), %xmm0    # 0x22038
movss %xmm0, 0x8e8(%rsp)
movw $0x2, 0x8e6(%rsp)
movq $0x1, 0x8d8(%rsp)
movq 0x8d8(%rsp), %rax
movslq 0x910(%rsp), %rcx
cmpq %rcx, %rax
jge 0x4a5f
movq 0x908(%rsp), %rax
movq 0x8d8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x240(%rsp)
leaq 0x8b7(%rsp), %rdi
movq %rdi, 0x248(%rsp)
callq 0x2390
movq 0x240(%rsp), %rsi
movq 0x248(%rsp), %rdx
leaq 0x8b8(%rsp), %rdi
callq 0x22b0
jmp 0x4282
leaq 0x8b7(%rsp), %rdi
callq 0x2260
leaq 0x1e238(%rip), %rsi     # 0x224ce
leaq 0x8b8(%rsp), %rdi
callq 0x6fd0
movb %al, 0x23f(%rsp)
jmp 0x42ac
movb 0x23f(%rsp), %al
testb $0x1, %al
jne 0x42b9
jmp 0x4306
xorl %edi, %edi
callq 0x3f90
jmp 0x42c2
jmp 0x4a27
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x8b7(%rsp), %rdi
callq 0x2260
jmp 0x56be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
jmp 0x4a4d
leaq 0x1e1c8(%rip), %rsi     # 0x224d5
leaq 0x8b8(%rsp), %rdi
callq 0x6fd0
movb %al, 0x23e(%rsp)
jmp 0x4323
movb 0x23e(%rsp), %al
testb $0x1, %al
jne 0x4333
jmp 0x446c
movq 0x908(%rsp), %rax
movq 0x8d8(%rsp), %rcx
movq %rcx, %rdx
incq %rdx
movq %rdx, 0x8d8(%rsp)
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x228(%rsp)
leaq 0x87f(%rsp), %rdi
movq %rdi, 0x230(%rsp)
callq 0x2390
movq 0x228(%rsp), %rsi
movq 0x230(%rsp), %rdx
leaq 0x880(%rsp), %rdi
callq 0x22b0
jmp 0x4392
leaq 0x87f(%rsp), %rdi
callq 0x2260
leaq 0x880(%rsp), %rdi
leaq 0x870(%rsp), %rsi
movl $0xa, %edx
callq 0x7000
movq %rax, 0x220(%rsp)
jmp 0x43c3
movq 0x220(%rsp), %rax
movq %rax, 0x8f0(%rsp)
movq 0x870(%rsp), %rax
movq %rax, 0x218(%rsp)
leaq 0x880(%rsp), %rdi
callq 0x21b0
movq %rax, %rcx
movq 0x218(%rsp), %rax
cmpq %rcx, %rax
je 0x445a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3f90
jmp 0x440c
jmp 0x445a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x87f(%rsp), %rdi
callq 0x2260
jmp 0x4a4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x880(%rsp), %rdi
callq 0x2448
jmp 0x4a4d
leaq 0x880(%rsp), %rdi
callq 0x2448
jmp 0x4a25
leaq 0x1e068(%rip), %rsi     # 0x224db
leaq 0x8b8(%rsp), %rdi
callq 0x6fd0
movb %al, 0x217(%rsp)
jmp 0x4489
movb 0x217(%rsp), %al
testb $0x1, %al
jne 0x4499
jmp 0x45d0
movq 0x908(%rsp), %rax
movq 0x8d8(%rsp), %rcx
movq %rcx, %rdx
incq %rdx
movq %rdx, 0x8d8(%rsp)
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x200(%rsp)
leaq 0x84f(%rsp), %rdi
movq %rdi, 0x208(%rsp)
callq 0x2390
movq 0x200(%rsp), %rsi
movq 0x208(%rsp), %rdx
leaq 0x850(%rsp), %rdi
callq 0x22b0
jmp 0x44f8
leaq 0x84f(%rsp), %rdi
callq 0x2260
leaq 0x850(%rsp), %rdi
leaq 0x840(%rsp), %rsi
callq 0x7050
movss %xmm0, 0x1fc(%rsp)
jmp 0x4525
movss 0x1fc(%rsp), %xmm0
movss %xmm0, 0x8ec(%rsp)
movq 0x840(%rsp), %rax
movq %rax, 0x1f0(%rsp)
leaq 0x850(%rsp), %rdi
callq 0x21b0
movq %rax, %rcx
movq 0x1f0(%rsp), %rax
cmpq %rcx, %rax
je 0x45be
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3f90
jmp 0x4570
jmp 0x45be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x84f(%rsp), %rdi
callq 0x2260
jmp 0x4a4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x850(%rsp), %rdi
callq 0x2448
jmp 0x4a4d
leaq 0x850(%rsp), %rdi
callq 0x2448
jmp 0x4a23
leaq 0x1df10(%rip), %rsi     # 0x224e7
leaq 0x8b8(%rsp), %rdi
callq 0x6fd0
movb %al, 0x1ef(%rsp)
jmp 0x45ed
movb 0x1ef(%rsp), %al
testb $0x1, %al
jne 0x45fd
jmp 0x4734
movq 0x908(%rsp), %rax
movq 0x8d8(%rsp), %rcx
movq %rcx, %rdx
incq %rdx
movq %rdx, 0x8d8(%rsp)
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x1d8(%rsp)
leaq 0x81f(%rsp), %rdi
movq %rdi, 0x1e0(%rsp)
callq 0x2390
movq 0x1d8(%rsp), %rsi
movq 0x1e0(%rsp), %rdx
leaq 0x820(%rsp), %rdi
callq 0x22b0
jmp 0x465c
leaq 0x81f(%rsp), %rdi
callq 0x2260
leaq 0x820(%rsp), %rdi
leaq 0x810(%rsp), %rsi
callq 0x7050
movss %xmm0, 0x1d4(%rsp)
jmp 0x4689
movss 0x1d4(%rsp), %xmm0
movss %xmm0, 0x8e8(%rsp)
movq 0x810(%rsp), %rax
movq %rax, 0x1c8(%rsp)
leaq 0x820(%rsp), %rdi
callq 0x21b0
movq %rax, %rcx
movq 0x1c8(%rsp), %rax
cmpq %rcx, %rax
je 0x4722
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3f90
jmp 0x46d4
jmp 0x4722
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x81f(%rsp), %rdi
callq 0x2260
jmp 0x4a4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x820(%rsp), %rdi
callq 0x2448
jmp 0x4a4d
leaq 0x820(%rsp), %rdi
callq 0x2448
jmp 0x4a21
leaq 0x1ddb4(%rip), %rsi     # 0x224ef
leaq 0x8b8(%rsp), %rdi
callq 0x6fd0
movb %al, 0x1c7(%rsp)
jmp 0x4751
movb 0x1c7(%rsp), %al
testb $0x1, %al
jne 0x4761
jmp 0x49ea
movq 0x908(%rsp), %rax
movq 0x8d8(%rsp), %rcx
movq %rcx, %rdx
incq %rdx
movq %rdx, 0x8d8(%rsp)
movq 0x8(%rax,%rcx,8), %rax
movq %rax, 0x1b0(%rsp)
leaq 0x7ef(%rsp), %rdi
movq %rdi, 0x1b8(%rsp)
callq 0x2390
movq 0x1b0(%rsp), %rsi
movq 0x1b8(%rsp), %rdx
leaq 0x7f0(%rsp), %rdi
callq 0x22b0
jmp 0x47c0
leaq 0x7ef(%rsp), %rdi
callq 0x2260
leaq 0x1dd24(%rip), %rsi     # 0x224f8
xorl %eax, %eax
movl %eax, %edx
leaq 0x7f0(%rsp), %rdi
callq 0x2350
movq %rax, 0x1a8(%rsp)
jmp 0x47ef
movq 0x1a8(%rsp), %rax
cmpq $0x0, %rax
jne 0x4859
movl $0x0, 0x8fc(%rsp)
jmp 0x49db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x7ef(%rsp), %rdi
callq 0x2260
jmp 0x4a4d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x7f0(%rsp), %rdi
callq 0x2448
jmp 0x4a4d
leaq 0x1dc9e(%rip), %rsi     # 0x224fe
xorl %eax, %eax
movl %eax, %edx
leaq 0x7f0(%rsp), %rdi
callq 0x2350
movq %rax, 0x1a0(%rsp)
jmp 0x487b
movq 0x1a0(%rsp), %rax
cmpq $0x0, %rax
jne 0x4899
movl $0x1, 0x8fc(%rsp)
jmp 0x49d9
leaq 0x1dc64(%rip), %rsi     # 0x22504
xorl %eax, %eax
movl %eax, %edx
leaq 0x7f0(%rsp), %rdi
callq 0x2350
movq %rax, 0x198(%rsp)
jmp 0x48bb
movq 0x198(%rsp), %rax
cmpq $0x0, %rax
jne 0x48d9
movl $0x2, 0x8fc(%rsp)
jmp 0x49d7
leaq 0x1dc29(%rip), %rsi     # 0x22509
xorl %eax, %eax
movl %eax, %edx
leaq 0x7f0(%rsp), %rdi
callq 0x2350
movq %rax, 0x190(%rsp)
jmp 0x48fb
movq 0x190(%rsp), %rax
cmpq $0x0, %rax
jne 0x4919
movl $0x3, 0x8fc(%rsp)
jmp 0x49d5
leaq 0x1dbef(%rip), %rsi     # 0x2250f
leaq 0x7f0(%rsp), %rdi
callq 0x6fd0
movb %al, 0x18f(%rsp)
jmp 0x4936
movb 0x18f(%rsp), %al
testb $0x1, %al
jne 0x4943
jmp 0x4953
movl $0x4, 0x8fc(%rsp)
jmp 0x49d3
leaq 0x1dbbb(%rip), %rsi     # 0x22515
leaq 0x7f0(%rsp), %rdi
callq 0x6fd0
movb %al, 0x18e(%rsp)
jmp 0x4970
movb 0x18e(%rsp), %al
testb $0x1, %al
jne 0x497d
jmp 0x498a
movl $0x5, 0x8fc(%rsp)
jmp 0x49d1
leaq 0x1db8b(%rip), %rsi     # 0x2251c
leaq 0x7f0(%rsp), %rdi
callq 0x6fd0
movb %al, 0x18d(%rsp)
jmp 0x49a7
movb 0x18d(%rsp), %al
testb $0x1, %al
jne 0x49b4
jmp 0x49c1
movl $0x6, 0x8fc(%rsp)
jmp 0x49cf
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3f90
jmp 0x49cd
jmp 0x49cf
jmp 0x49d1
jmp 0x49d3
jmp 0x49d5
jmp 0x49d7
jmp 0x49d9
jmp 0x49db
leaq 0x7f0(%rsp), %rdi
callq 0x2448
jmp 0x4a1f
cmpq $0x0, 0x900(%rsp)
je 0x4a03
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3f90
jmp 0x4a01
jmp 0x4a03
movq 0x908(%rsp), %rax
movq 0x8d8(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x900(%rsp)
jmp 0x4a21
jmp 0x4a23
jmp 0x4a25
jmp 0x4a27
leaq 0x8b8(%rsp), %rdi
callq 0x2448
movq 0x8d8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8d8(%rsp)
jmp 0x4219
leaq 0x8b8(%rsp), %rdi
callq 0x2448
jmp 0x56be
movq 0x900(%rsp), %rsi
leaq 0x5e0(%rsp), %rdi
movl $0x8, %edx
callq 0x23e0
cmpq $0x0, 0x900(%rsp)
je 0x4b2c
movq 0x5e0(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x5e0(%rsp,%rax), %rdi
callq 0x2030
movb %al, 0x18c(%rsp)
jmp 0x4aaa
movb 0x18c(%rsp), %al
testb $0x1, %al
jne 0x4ab7
jmp 0x4b2c
movq 0x2a532(%rip), %rdi     # 0x2eff0
leaq 0x1da5e(%rip), %rsi     # 0x22523
callq 0x2230
movq %rax, 0x180(%rsp)
jmp 0x4ad4
movq 0x180(%rsp), %rdi
movq 0x900(%rsp), %rsi
callq 0x2230
movq %rax, 0x178(%rsp)
jmp 0x4af3
movq 0x178(%rsp), %rdi
movq 0x2a48e(%rip), %rsi     # 0x2ef90
callq 0x2250
jmp 0x4b09
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x2270
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
jmp 0x56b1
cmpl $0x5, 0x8fc(%rsp)
jne 0x4d70
cmpq $0x0, 0x900(%rsp)
je 0x4b57
leaq 0x5e0(%rsp), %rax
movq %rax, 0x170(%rsp)
jmp 0x4b68
movq 0x2a47a(%rip), %rax     # 0x2efd8
movq %rax, 0x170(%rsp)
jmp 0x4b68
movq 0x170(%rsp), %rsi
leaq 0x5c0(%rsp), %rdi
callq 0x3490
jmp 0x4b7f
movq 0x2a432(%rip), %rdi     # 0x2efb8
leaq 0x1d9aa(%rip), %rsi     # 0x22537
callq 0x2230
movq %rax, 0x168(%rsp)
jmp 0x4b9c
leaq 0x5c0(%rsp), %rdi
callq 0x7090
movq %rax, 0x160(%rsp)
jmp 0x4bb3
movq 0x160(%rsp), %rsi
movq 0x168(%rsp), %rdi
callq 0x2090
movq %rax, 0x158(%rsp)
jmp 0x4bd2
movq 0x158(%rsp), %rdi
leaq 0x1d973(%rip), %rsi     # 0x22554
callq 0x2230
movq %rax, 0x150(%rsp)
jmp 0x4bf0
movq 0x150(%rsp), %rdi
movq 0x5d8(%rsp), %rsi
callq 0x23d0
movq %rax, 0x148(%rsp)
jmp 0x4c0f
movq 0x148(%rsp), %rdi
leaq 0x1d943(%rip), %rsi     # 0x22561
callq 0x2230
movq %rax, 0x140(%rsp)
jmp 0x4c2d
leaq 0x5c0(%rsp), %rdi
callq 0x7090
movq %rax, 0x138(%rsp)
jmp 0x4c44
leaq 0x5c0(%rsp), %rdi
callq 0x7090
movq %rax, 0x130(%rsp)
jmp 0x4c5b
movq 0x140(%rsp), %rdi
movq 0x138(%rsp), %rsi
movq 0x130(%rsp), %rax
decq %rax
imulq %rax, %rsi
shrq %rsi
callq 0x2090
movq %rax, 0x128(%rsp)
jmp 0x4c8c
movq 0x128(%rsp), %rdi
leaq 0x1d8c8(%rip), %rsi     # 0x22563
callq 0x2230
movq %rax, 0x120(%rsp)
jmp 0x4caa
movq 0x120(%rsp), %rdi
movq 0x2a2d7(%rip), %rsi     # 0x2ef90
callq 0x2250
jmp 0x4cc0
movq 0x8f0(%rsp), %rdx
movss 0x8ec(%rsp), %xmm0
movss 0x8e8(%rsp), %xmm1
movzwl 0x8e6(%rsp), %ecx
leaq 0x520(%rsp), %rdi
leaq 0x5c0(%rsp), %rsi
callq 0x70a0
jmp 0x4cf9
leaq 0x520(%rsp), %rdi
callq 0x71f0
jmp 0x4d08
leaq 0x520(%rsp), %rdi
callq 0x7360
leaq 0x5c0(%rsp), %rdi
callq 0x73c0
jmp 0x5695
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
jmp 0x4d5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x520(%rsp), %rdi
callq 0x7360
leaq 0x5c0(%rsp), %rdi
callq 0x73c0
jmp 0x56b1
cmpl $0x3, 0x8fc(%rsp)
jne 0x4eef
movss 0x8ec(%rsp), %xmm0
movss %xmm0, 0x11c(%rsp)
callq 0x6fc0
movss 0x11c(%rsp), %xmm1
ucomiss %xmm1, %xmm0
jbe 0x4eef
cmpq $0x0, 0x900(%rsp)
je 0x4dc4
leaq 0x5e0(%rsp), %rax
movq %rax, 0x110(%rsp)
jmp 0x4dd5
movq 0x2a20d(%rip), %rax     # 0x2efd8
movq %rax, 0x110(%rsp)
jmp 0x4dd5
movq 0x110(%rsp), %rsi
leaq 0x4e8(%rsp), %rdi
callq 0x31a0
jmp 0x4dec
movss 0x8ec(%rsp), %xmm0
leaq 0x500(%rsp), %rdi
leaq 0x4e8(%rsp), %rsi
callq 0x73d0
jmp 0x4e0c
leaq 0x4e8(%rsp), %rdi
callq 0x6450
movq 0x8f0(%rsp), %rdx
movss 0x8ec(%rsp), %xmm0
movss 0x8e8(%rsp), %xmm1
movzwl 0x8e6(%rsp), %ecx
leaq 0x448(%rsp), %rdi
leaq 0x500(%rsp), %rsi
callq 0x70a0
jmp 0x4e52
leaq 0x448(%rsp), %rdi
callq 0x71f0
jmp 0x4e61
leaq 0x448(%rsp), %rdi
callq 0x7360
leaq 0x500(%rsp), %rdi
callq 0x73c0
jmp 0x5693
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x4e8(%rsp), %rdi
callq 0x6450
jmp 0x56b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
jmp 0x4edd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x448(%rsp), %rdi
callq 0x7360
leaq 0x500(%rsp), %rdi
callq 0x73c0
jmp 0x56b1
cmpq $0x0, 0x900(%rsp)
je 0x4f0c
leaq 0x5e0(%rsp), %rax
movq %rax, 0x108(%rsp)
jmp 0x4f1d
movq 0x2a0c5(%rip), %rax     # 0x2efd8
movq %rax, 0x108(%rsp)
jmp 0x4f1d
movq 0x108(%rsp), %rsi
movl 0x8fc(%rsp), %edx
leaq 0x418(%rsp), %rdi
callq 0x3e90
jmp 0x4f3b
callq 0x75c0
movss %xmm0, 0x414(%rsp)
callq 0x75c0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, 0x410(%rsp)
movss 0x410(%rsp), %xmm0
movss %xmm0, 0x40c(%rsp)
movl $0x0, 0x408(%rsp)
callq 0x75c0
movss %xmm0, 0x404(%rsp)
movss 0x8ec(%rsp), %xmm0
movss %xmm0, 0x104(%rsp)
callq 0x6fc0
movaps %xmm0, %xmm1
movss 0x104(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jne 0x514f
jp 0x514f
movq $0x0, 0x3f8(%rsp)
movq 0x3f8(%rsp), %rax
movq %rax, 0xf0(%rsp)
leaq 0x418(%rsp), %rdi
callq 0x5bf0
movq %rax, 0xf8(%rsp)
jmp 0x4ff4
movq 0xf0(%rsp), %rax
movq 0xf8(%rsp), %rcx
cmpq %rcx, %rax
jae 0x514d
callq 0x75c0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movss %xmm0, 0x3f4(%rsp)
movq $0x0, 0x3e8(%rsp)
movq 0x3e8(%rsp), %rax
movq %rax, 0xe0(%rsp)
leaq 0x418(%rsp), %rdi
callq 0x5bf0
movq %rax, 0xe8(%rsp)
jmp 0x505b
movq 0xe0(%rsp), %rax
movq 0xe8(%rsp), %rcx
cmpq %rcx, %rax
jae 0x5100
movq 0x3f8(%rsp), %rsi
movq 0x3e8(%rsp), %rdx
leaq 0x418(%rsp), %rdi
callq 0x2c40
movss %xmm0, 0x3e4(%rsp)
leaq 0x3f4(%rsp), %rdi
leaq 0x3e4(%rsp), %rsi
callq 0x75d0
movq %rax, 0xd8(%rsp)
jmp 0x50b9
movq 0xd8(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x3f4(%rsp)
movq 0x3e8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x3e8(%rsp)
jmp 0x5034
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
jmp 0x5684
leaq 0x404(%rsp), %rdi
leaq 0x3f4(%rsp), %rsi
callq 0x7610
movq %rax, 0xd0(%rsp)
jmp 0x511f
movq 0xd0(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x404(%rsp)
movq 0x3f8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x3f8(%rsp)
jmp 0x4fcd
jmp 0x514f
leaq 0x418(%rsp), %rax
movq %rax, 0x3d8(%rsp)
movq 0x3d8(%rsp), %rdi
callq 0x7650
movq %rax, 0x3d0(%rsp)
movq 0x3d8(%rsp), %rdi
callq 0x7680
movq %rax, 0x3c8(%rsp)
leaq 0x3d0(%rsp), %rdi
leaq 0x3c8(%rsp), %rsi
callq 0x76b0
testb $0x1, %al
jne 0x51a7
jmp 0x52c5
leaq 0x3d0(%rsp), %rdi
callq 0x76f0
movss (%rax), %xmm0
movss %xmm0, 0x3c4(%rsp)
leaq 0x414(%rsp), %rdi
leaq 0x3c4(%rsp), %rsi
callq 0x7610
movq %rax, 0xc8(%rsp)
jmp 0x51e0
movq 0xc8(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x414(%rsp)
leaq 0x410(%rsp), %rdi
leaq 0x3c4(%rsp), %rsi
callq 0x75d0
movq %rax, 0xc0(%rsp)
jmp 0x5214
movq 0xc0(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x410(%rsp)
movss 0x3c4(%rsp), %xmm0
movss %xmm0, 0xbc(%rsp)
callq 0x75c0
movaps %xmm0, %xmm1
movss 0xbc(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jne 0x5255
jp 0x5255
jmp 0x5289
leaq 0x40c(%rsp), %rdi
leaq 0x3c4(%rsp), %rsi
callq 0x75d0
movq %rax, 0xb0(%rsp)
jmp 0x5274
movq 0xb0(%rsp), %rax
movss (%rax), %xmm0
movss %xmm0, 0x40c(%rsp)
movss 0x3c4(%rsp), %xmm1
movss 0x8ec(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jb 0x52b1
movl 0x408(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x408(%rsp)
jmp 0x52b3
leaq 0x3d0(%rsp), %rdi
callq 0x7700
jmp 0x5189
movq 0x29cec(%rip), %rdi     # 0x2efb8
leaq 0x1d299(%rip), %rsi     # 0x2256c
callq 0x2230
movq %rax, 0xa8(%rsp)
jmp 0x52e2
movq 0xa8(%rsp), %rdi
movss 0x414(%rsp), %xmm0
callq 0x21e0
movq %rax, 0xa0(%rsp)
jmp 0x5302
movq 0xa0(%rsp), %rdi
leaq 0x1d32a(%rip), %rsi     # 0x2263b
callq 0x2230
movq %rax, 0x98(%rsp)
jmp 0x5320
movq 0x98(%rsp), %rdi
movss 0x40c(%rsp), %xmm0
callq 0x21e0
movq %rax, 0x90(%rsp)
jmp 0x5340
movq 0x90(%rsp), %rdi
leaq 0x1ce16(%rip), %rsi     # 0x22165
callq 0x2230
movq %rax, 0x88(%rsp)
jmp 0x535e
movq 0x88(%rsp), %rdi
movq 0x29c23(%rip), %rsi     # 0x2ef90
callq 0x2250
jmp 0x5374
movss 0x8ec(%rsp), %xmm0
movss %xmm0, 0x84(%rsp)
callq 0x6fc0
movaps %xmm0, %xmm1
movss 0x84(%rsp), %xmm0
ucomiss %xmm1, %xmm0
jne 0x54af
jp 0x54af
movq 0x29c0b(%rip), %rdi     # 0x2efb8
leaq 0x1d18a(%rip), %rsi     # 0x2253e
callq 0x2230
movq %rax, 0x78(%rsp)
jmp 0x53c0
leaq 0x418(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x70(%rsp)
jmp 0x53d4
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdi
callq 0x2090
movq %rax, 0x68(%rsp)
jmp 0x53ea
movq 0x68(%rsp), %rdi
leaq 0x1d185(%rip), %rsi     # 0x2257b
callq 0x2230
movq %rax, 0x60(%rsp)
jmp 0x5402
movq 0x60(%rsp), %rdi
movss 0x404(%rsp), %xmm0
callq 0x21e0
movq %rax, 0x58(%rsp)
jmp 0x541c
movq 0x58(%rsp), %rdi
movq 0x29b68(%rip), %rsi     # 0x2ef90
callq 0x2250
jmp 0x542f
movq 0x8f0(%rsp), %rdx
movss 0x404(%rsp), %xmm0
movss 0x8e8(%rsp), %xmm1
movzwl 0x8e6(%rsp), %ecx
leaq 0x310(%rsp), %rdi
leaq 0x418(%rsp), %rsi
callq 0x7720
jmp 0x5468
leaq 0x310(%rsp), %rdi
callq 0x7860
jmp 0x5477
leaq 0x310(%rsp), %rdi
callq 0x79d0
jmp 0x567d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x310(%rsp), %rdi
callq 0x79d0
jmp 0x5684
movq 0x29b02(%rip), %rdi     # 0x2efb8
leaq 0x1d07a(%rip), %rsi     # 0x22537
callq 0x2230
movq %rax, 0x50(%rsp)
jmp 0x54c9
leaq 0x418(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x48(%rsp)
jmp 0x54dd
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdi
callq 0x2090
movq %rax, 0x40(%rsp)
jmp 0x54f3
movq 0x40(%rsp), %rdi
leaq 0x1d055(%rip), %rsi     # 0x22554
callq 0x2230
movq %rax, 0x38(%rsp)
jmp 0x550b
movq 0x38(%rsp), %rdi
movl 0x408(%rsp), %esi
callq 0x2370
movq %rax, 0x30(%rsp)
jmp 0x5523
movq 0x30(%rsp), %rdi
leaq 0x1d032(%rip), %rsi     # 0x22561
callq 0x2230
movq %rax, 0x28(%rsp)
jmp 0x553b
leaq 0x418(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x20(%rsp)
jmp 0x554f
leaq 0x418(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x18(%rsp)
jmp 0x5563
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rsi
movq 0x18(%rsp), %rax
decq %rax
imulq %rax, %rsi
shrq %rsi
callq 0x2090
movq %rax, 0x10(%rsp)
jmp 0x5588
movq 0x10(%rsp), %rdi
leaq 0x1cfcf(%rip), %rsi     # 0x22563
callq 0x2230
movq %rax, 0x8(%rsp)
jmp 0x55a0
movq 0x8(%rsp), %rdi
movq 0x299e4(%rip), %rsi     # 0x2ef90
callq 0x2250
jmp 0x55b3
movss 0x8ec(%rsp), %xmm0
leaq 0x250(%rsp), %rdi
leaq 0x418(%rsp), %rsi
callq 0x7a30
jmp 0x55d3
movq 0x8f0(%rsp), %rdx
movss 0x8ec(%rsp), %xmm0
movss 0x8e8(%rsp), %xmm1
movzwl 0x8e6(%rsp), %ecx
leaq 0x270(%rsp), %rdi
leaq 0x250(%rsp), %rsi
callq 0x70a0
jmp 0x560c
leaq 0x270(%rsp), %rdi
callq 0x71f0
jmp 0x561b
leaq 0x270(%rsp), %rdi
callq 0x7360
leaq 0x250(%rsp), %rdi
callq 0x73c0
jmp 0x567d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
jmp 0x566e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x8a8(%rsp)
movl %eax, 0x8a4(%rsp)
leaq 0x270(%rsp), %rdi
callq 0x7360
leaq 0x250(%rsp), %rdi
callq 0x73c0
jmp 0x5684
xorl %edi, %edi
callq 0x2270
leaq 0x418(%rsp), %rdi
callq 0x7c00
jmp 0x56b1
jmp 0x5695
leaq 0x5e0(%rsp), %rdi
callq 0x20b0
movl 0x914(%rsp), %eax
addq $0x918, %rsp            # imm = 0x918
retq
leaq 0x5e0(%rsp), %rdi
callq 0x20b0
movq 0x8a8(%rsp), %rdi
callq 0x2380
nopl (%rax,%rax)