// File: /workspace/github_cpp_makefile_star2_O1/nikosgalanis[P]Vectors-Similarity-Search-and-Clustering/programs/Hypercube/hypercube_main.cc
// Function: main
int main(int argc, char* argv[]) {
    // parsing the arguments

    char* input_file = NULL, *query_file = NULL, *output_file = NULL;
	int k, M, probes, n_neighbors, radius;
	double sum1 = 0, sum2 = 0;

	parse_hc_args(argc, argv, &input_file, &output_file, &query_file, &k, &M, &probes, &n_neighbors, &radius);

    // parse the dataset in order to get a vector of our feature vector
	vector<vector<double>> feature_vectors = parse_input(input_file);

	// parse the query set in order to find all of the queries that the user wants to ask
	vector<vector<double>> query_vectors = parse_input(query_file);

	// make sure that there is at least one element in the dataset and the queryset
	assert(feature_vectors.size() && query_vectors.size());

	// create the output file that we are going to use to print the Hypercube results
	ofstream output;
	output.open(output_file);

    // default hypercube values
    uint64_t m = pow(2,32) - 5;
    uint32_t w = 20 * our_math::compute_w_value(feature_vectors, 1000);
	uint32_t c = 1; 

    int correct_computed = 0;

    int n_points = feature_vectors.size();
	int space_dimension = feature_vectors.at(0).size();

    // Initialize hypercube class
    Hypercube<double> hypercube_instant(k, m, M, probes, n_points, w, space_dimension, feature_vectors);

    // initialize our brute force class, in order to find the true distance of the query and its neighbors
	BruteForce<double> bf_instant(n_points, space_dimension, feature_vectors);

    // run all the queries with Hypercube
    for (uint64_t i = 0; i < query_vectors.size(); i++) {
		// output the query number in the file
		output << "Query: " << i << endl;

		auto k_start = std::chrono::high_resolution_clock::now();
		// run the k-nearest neighbor algorithm, in order to obtain n neighbors
		list<pair<int,double>> kNNs = hypercube_instant.kNearestNeighbour(query_vectors.at(i), n_neighbors);
		auto k_end = std::chrono::high_resolution_clock::now();

		duration<double> hc_time_span = duration_cast<duration<double>>(k_end - k_start);  
		
		auto b_start = std::chrono::high_resolution_clock::now();
		// run the brute force algorithm, in order to obtain the true nearest neighbors
		list<pair<int, double>> kBF = bf_instant.kNeighboursBF(query_vectors.at(i), n_neighbors);
		auto b_end = std::chrono::high_resolution_clock::now();

		duration<double> bf_time_span = duration_cast<duration<double>>(b_end - b_start);  

		// denote the number of neighbor we are dealing with
		int k_value = 0;

		// itterate the list of results of the knn
		list<pair<int,double>>::iterator knn_it = kNNs.begin();
		list<pair<int,double>>::iterator bf_it = kBF.begin();

		for (; knn_it != kNNs.end() && bf_it != kBF.end() ; bf_it++, knn_it++) {
			// hold the results of the knn here
			auto knn_tuple = knn_it;
			auto bf_tuple = bf_it;
			// output the findings of kNN
			output << "Nearest neighbor-" << k_value + 1 << ": " << knn_tuple->first << endl;
			// by the Hypercube
			output << "DistanceHypercube:" << knn_tuple->second << endl;
			// and by brute force
			output << "DistanceTrue:" << bf_tuple->second << endl;
			if (knn_tuple->second == bf_tuple->second) {
				correct_computed++;
			}

			k_value++;
		}
		
		// Print the time elapsed while computing the neighbors with kNN and BF
		output << "tHC: " << hc_time_span.count() << endl;
		output << "tTrue: " << bf_time_span.count() << endl;
		sum1 += hc_time_span.count();
		sum2 += bf_time_span.count();

		// RUn the Range Search algorithm
		list<pair<int, double>> range_search = hypercube_instant.RangeSearch(query_vectors.at(i), radius, c);

		// print in the output file all of our findings
		output << "R-near neighbors:" << endl;
		for (list<pair<int,double>>::iterator it = range_search.begin(); it != range_search.end(); it++) {
			output << it->first << endl;
		}
		
		output << "\n\n\n";
	}
	cout << "mean hc time " << sum1 / query_vectors.size() << endl;
	cout << "mean bf time " << sum2 / query_vectors.size() << endl;

    cout << "corectly computed neighbours " << correct_computed  << " out of " << n_neighbors * query_vectors.size() << endl;

	output.close();

	free(input_file);
	free(query_file);
	free(output_file);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x458, %rsp            # imm = 0x458
xorl %eax, %eax
leaq 0xa8(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x88(%rsp), %r8
movq %rax, (%r8)
leaq 0x80(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x40(%rsp), %rax
leaq 0xc(%rsp), %r10
leaq 0x44(%rsp), %r11
leaq 0x48(%rsp), %r14
leaq 0x4c(%rsp), %r9
movq %rbx, %rdx
pushq %rax
pushq %r10
pushq %r11
pushq %r14
callq 0x2a26
addq $0x20, %rsp
movq (%rbx), %rsi
leaq 0x1b0(%rsp), %rdi
leaq 0x1d0(%rsp), %rdx
callq 0x20d0
leaq 0x50(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x262c
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39f8
callq 0x2220
movq 0x88(%rsp), %rsi
leaq 0x190(%rsp), %rdi
leaq 0x1d0(%rsp), %rdx
callq 0x20d0
leaq 0x10(%rsp), %rdi
leaq 0x190(%rsp), %rsi
callq 0x262c
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a3d
callq 0x2220
movq 0x58(%rsp), %rax
cmpq 0x50(%rsp), %rax
je 0x4425
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x4425
leaq 0x1d0(%rsp), %rdi
callq 0x23d0
movq 0x80(%rsp), %rsi
leaq 0x1d0(%rsp), %rdi
movl $0x10, %edx
callq 0x2040
leaq 0xf8(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x47dc
leaq 0xf8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x460c
movsd %xmm0, 0x28(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x3578
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
movq %rcx, %rbx
subq %rax, %rbx
sarq $0x3, %rbx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rbx
cmpq %rax, %rcx
je 0x4444
movq 0x8(%rax), %r15
subq (%rax), %r15
movl 0x4c(%rsp), %ebp
movl 0x48(%rsp), %r14d
movl 0x44(%rsp), %r12d
leaq 0x178(%rsp), %r13
leaq 0x50(%rsp), %rsi
movq %r13, %rdi
callq 0x47dc
movsd 0x28(%rsp), %xmm0
mulsd 0x46c2(%rip), %xmm0     # 0x81e0
cvttsd2si %xmm0, %rax
shrq $0x3, %r15
subq $0x8, %rsp
leaq 0x3d8(%rsp), %rdi
movl $0xfffffffb, %edx       # imm = 0xFFFFFFFB
movl %ebp, %esi
movl %r14d, %ecx
movl %r12d, %r8d
movl %ebx, %r9d
pushq %r13
pushq %r15
pushq %rax
callq 0x486e
addq $0x20, %rsp
leaq 0x178(%rsp), %rdi
callq 0x3578
leaq 0xe0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x47dc
leaq 0x160(%rsp), %rdi
movl %ebx, -0x8(%rdi)
movl %r15d, -0x4(%rdi)
leaq 0xe0(%rsp), %rsi
callq 0x47dc
leaq 0xe0(%rsp), %rdi
callq 0x3578
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x416d
movq $0x0, (%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
leaq 0xc8(%rsp), %r14
leaq 0xb0(%rsp), %r12
movsd %xmm0, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movl $0x7, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x46f6(%rip), %rsi      # 0x82e3
callq 0x2260
leaq 0x1d0(%rsp), %rdi
movq (%rsp), %rsi
callq 0x2170
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
callq 0x2050
movq %rax, %r13
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
movq (%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x4405
leaq (%rsi,%rsi,2), %rcx
movq %rcx, 0x78(%rsp)
leaq (%rax,%rcx,8), %rsi
leaq 0x140(%rsp), %rbx
movq %rbx, %rdi
callq 0x3860
movl 0xc(%rsp), %ecx
movq %r14, %rdi
leaq 0x3d0(%rsp), %rsi
movq %rbx, %rdx
callq 0x4d86
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x3ca7
callq 0x2220
callq 0x2050
subq %r13, %rax
cvtsi2sd %rax, %xmm0
mulsd 0x452c(%rip), %xmm0     # 0x81e8
movsd %xmm0, 0x70(%rsp)
callq 0x2050
movq %rax, %r13
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq (%rsp), %rdx
jbe 0x43f3
movq 0x78(%rsp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq 0x128(%rsp), %rbx
movq %rbx, %rdi
callq 0x3860
movl 0xc(%rsp), %ecx
movq %r12, %rdi
leaq 0x158(%rsp), %rsi
movq %rbx, %rdx
callq 0x55c0
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x3d35
callq 0x2220
callq 0x2050
subq %r13, %rax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
mulsd 0x449b(%rip), %xmm0     # 0x81e8
movsd %xmm0, 0x68(%rsp)
movq 0xc8(%rsp), %r15
movq 0xb0(%rsp), %rbp
cmpq %r14, %r15
setne %al
cmpq %r12, %rbp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3ed2
movl $0x1, %r13d
movl $0x11, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x4557(%rip), %rsi      # 0x82eb
callq 0x2260
leaq 0x1d0(%rsp), %rdi
movl %r13d, %esi
callq 0x23f0
movq %rax, %rbx
movl $0x2, %edx
movq %rax, %rdi
leaq 0x4566(%rip), %rsi      # 0x8321
callq 0x2260
movl 0x10(%r15), %esi
movq %rbx, %rdi
callq 0x23f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movl $0x12, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x44f3(%rip), %rsi      # 0x82fd
callq 0x2260
movsd 0x18(%r15), %xmm0
leaq 0x1d0(%rsp), %rdi
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movl $0xd, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x44b0(%rip), %rsi      # 0x8310
callq 0x2260
movsd 0x18(%rbp), %xmm0
leaq 0x1d0(%rsp), %rdi
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movsd 0x18(%r15), %xmm0
xorl %eax, %eax
ucomisd 0x18(%rbp), %xmm0
sete %al
addl %eax, 0x28(%rsp)
movq (%r15), %r15
movq (%rbp), %rbp
cmpq %r12, %rbp
setne %al
cmpq %r14, %r15
je 0x3ed2
incl %r13d
testb %al, %al
jne 0x3d80
movl $0x5, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x4438(%rip), %rsi      # 0x831e
callq 0x2260
leaq 0x1d0(%rsp), %rdi
movsd 0x70(%rsp), %xmm0
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movl $0x7, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x43e8(%rip), %rsi      # 0x8324
callq 0x2260
leaq 0x1d0(%rsp), %rdi
movsd 0x68(%rsp), %xmm0
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq (%rsp), %rdx
jbe 0x4413
movq 0x78(%rsp), %rcx
leaq (%rax,%rcx,8), %rsi
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
callq 0x3860
xorps %xmm0, %xmm0
cvtsi2sdl 0x40(%rsp), %xmm0
leaq 0x90(%rsp), %rdi
leaq 0x3d0(%rsp), %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x58ba
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x3ff8
callq 0x2220
movl $0x11, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x4320(%rip), %rsi      # 0x832c
callq 0x2260
movq 0x1d0(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x1d0(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
leaq 0x1d0(%rsp), %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movsd 0x38(%rsp), %xmm0
addsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x30(%rsp), %xmm0
addsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
leaq 0x90(%rsp), %r15
movq (%r15), %r15
leaq 0x90(%rsp), %rax
cmpq %rax, %r15
je 0x40c3
movl 0x10(%r15), %esi
leaq 0x1d0(%rsp), %rdi
callq 0x23f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
jmp 0x4076
movl $0x3, %edx
leaq 0x1d0(%rsp), %rdi
leaq 0x4267(%rip), %rsi      # 0x833e
callq 0x2260
movq 0x90(%rsp), %rdi
leaq 0x90(%rsp), %r15
cmpq %r15, %rdi
je 0x4101
movq (%rdi), %rbx
callq 0x2220
movq %rbx, %rdi
cmpq %r15, %rbx
jne 0x40f1
movq 0xb0(%rsp), %rdi
cmpq %r12, %rdi
je 0x411e
movq (%rdi), %rbx
callq 0x2220
movq %rbx, %rdi
cmpq %r12, %rbx
jne 0x410e
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x413b
movq (%rdi), %rbx
callq 0x2220
movq %rbx, %rdi
cmpq %r14, %rbx
jne 0x412b
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
movq (%rsp), %rdx
incq %rdx
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rdx, (%rsp)
cmpq %rax, %rdx
jb 0x3bd9
jmp 0x4185
xorpd %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movsd %xmm0, 0x38(%rsp)
movq 0x7e4c(%rip), %rdi      # 0xbfd8
leaq 0x41af(%rip), %rsi      # 0x8342
movl $0xd, %edx
callq 0x2260
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rax, %xmm0
punpckldq 0x404a(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x4052(%rip), %xmm0     # 0x8220
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0x7ded(%rip), %rdi      # 0xbfd8
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movq 0x7db7(%rip), %rdi      # 0xbfd8
leaq 0x4128(%rip), %rsi      # 0x8350
movl $0xd, %edx
callq 0x2260
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rax, %xmm0
punpckldq 0x3fb5(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3fbd(%rip), %xmm0     # 0x8220
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x30(%rsp), %xmm0
divsd %xmm1, %xmm0
movq 0x7d58(%rip), %rdi      # 0xbfd8
callq 0x2350
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
movq 0x7d22(%rip), %rdi      # 0xbfd8
leaq 0x40a1(%rip), %rsi      # 0x835e
movl $0x1d, %edx
callq 0x2260
movq 0x7d0a(%rip), %rdi      # 0xbfd8
movl 0x28(%rsp), %esi
callq 0x23f0
movq %rax, %rbx
leaq 0x409b(%rip), %rsi      # 0x837c
movl $0x8, %edx
movq %rax, %rdi
callq 0x2260
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
movslq 0xc(%rsp), %rsi
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rsi
imulq %rax, %rsi
movq %rbx, %rdi
callq 0x2170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2230
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2180
leaq 0x1d0(%rsp), %rdi
callq 0x22e0
movq 0xa8(%rsp), %rdi
callq 0x2280
movq 0x88(%rsp), %rdi
callq 0x2280
movq 0x80(%rsp), %rdi
callq 0x2280
leaq 0x160(%rsp), %rdi
callq 0x3578
leaq 0x3d0(%rsp), %rdi
callq 0x5e14
movq 0x7c36(%rip), %rax      # 0xbfd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x1d8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x1d0(%rsp,%rcx)
callq 0x21d0
leaq 0x2c8(%rsp), %rdi
callq 0x20b0
leaq 0x10(%rsp), %rdi
callq 0x3578
leaq 0x50(%rsp), %rdi
callq 0x3578
xorl %eax, %eax
addq $0x458, %rsp            # imm = 0x458
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f8b(%rip), %rdi      # 0x8385
movq (%rsp), %rsi
xorl %eax, %eax
callq 0x2320
leaq 0x3f79(%rip), %rdi      # 0x8385
xorl %eax, %eax
callq 0x2320
leaq 0x3f6b(%rip), %rdi      # 0x8385
movq (%rsp), %rsi
xorl %eax, %eax
callq 0x2320
leaq 0x3e4c(%rip), %rdi      # 0x8278
leaq 0x3e74(%rip), %rsi      # 0x82a7
leaq 0x3e92(%rip), %rcx      # 0x82cc
movl $0x25, %edx
callq 0x2160
leaq 0x3f3a(%rip), %rdi      # 0x8385
xorl %esi, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2320
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
jmp 0x45d1
movq %rax, %rbx
jmp 0x45d6
movq %rax, %rbx
leaq 0x178(%rsp), %rdi
jmp 0x448b
jmp 0x4497
jmp 0x4497
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x3578
jmp 0x45e3
jmp 0x4497
movq %rax, %rbx
jmp 0x45e3
movq %rax, %rbx
jmp 0x45f0
movq %rax, %rbx
leaq 0x1a0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x45fa
callq 0x2220
jmp 0x45fa
movq %rax, %rbx
jmp 0x45fa
movq %rax, %rbx
leaq 0x1c0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4604
callq 0x2220
jmp 0x4604
movq %rax, %rbx
jmp 0x4604
jmp 0x4560
jmp 0x458c
jmp 0x458c
movq %rax, %rbx
movq 0x110(%rsp), %rdi
testq %rdi, %rdi
je 0x458f
callq 0x2220
jmp 0x458f
jmp 0x4560
jmp 0x4560
movq %rax, %rbx
movq 0x140(%rsp), %rdi
testq %rdi, %rdi
je 0x45c9
callq 0x2220
jmp 0x45c9
jmp 0x4542
movq %rax, %rbx
jmp 0x45ac
movq %rax, %rbx
movq 0x128(%rsp), %rdi
testq %rdi, %rdi
je 0x45ac
callq 0x2220
jmp 0x45ac
jmp 0x4567
movq %rax, %rbx
jmp 0x45c9
jmp 0x458c
movq %rax, %rbx
leaq 0x90(%rsp), %r15
movq (%r15), %rdi
cmpq %r15, %rdi
je 0x458f
movq (%rdi), %r13
callq 0x2220
movq %r13, %rdi
cmpq %r15, %r13
jne 0x457a
jmp 0x458f
movq %rax, %rbx
movq 0xb0(%rsp), %rdi
cmpq %r12, %rdi
je 0x45ac
movq (%rdi), %r15
callq 0x2220
movq %r15, %rdi
cmpq %r12, %r15
jne 0x459c
movq 0xc8(%rsp), %rdi
cmpq %r14, %rdi
je 0x45c9
movq (%rdi), %r15
callq 0x2220
movq %r15, %rdi
cmpq %r14, %r15
jne 0x45b9
leaq 0x160(%rsp), %rdi
callq 0x3578
leaq 0x3d0(%rsp), %rdi
callq 0x5e14
leaq 0x1d0(%rsp), %rdi
callq 0x2310
leaq 0x10(%rsp), %rdi
callq 0x3578
leaq 0x50(%rsp), %rdi
callq 0x3578
movq %rbx, %rdi
callq 0x2400