// File: nikosgalanis[P]Vectors-Similarity-Search-and-Clustering/programs/Hypercube/../../algorithms/Search/Hypercube/headers/hypercube.h
// Function: Hypercube<double>::kNearestNeighbour[abi:cxx11](std::vector<double, std::allocator<double>>, int)
list<pair<int,T>> kNearestNeighbour(std::vector<T> query_vector, int k) {

			list<pair<int,T>> result;
			
			//the greatest of the k min distances
			T kth_min_distance = (T) INT_MAX;

			uint32_t visited = 0;
			uint32_t probes_checked = 0;

			/**
			 Step 1: Hash the given vector with the random projection technique
			**/
			int bucket_int = hash_to_hypercube(query_vector);

			/**
			 Step 2: Search in the bucket that the query hashes for neighbors
			**/
			list<int> bucket = hypercube[bucket_int];

			for (std::list<int>::iterator bucket_it = bucket.begin(); bucket_it != bucket.end(); bucket_it++) {

				visited++;

				// distance between vectors
				T distance =  metrics::ManhatanDistance(feature_vectors.at(*bucket_it), query_vector, space_dim);
				
				// if the element is already in the list, skip the checks
				pair<int, T> new_pair = make_pair(*bucket_it, distance);
				
				if (find(result.begin(), result.end(), new_pair) != result.end()) {
					continue;
				}

				// insert the pair into the list if it's distance is less than the kth_min
				if (result.size() > 0 && result.size() < (uint64_t) k) {
					// size < k so we just insert it
					
					if (distance >= kth_min_distance) {
						// insert at back if distance > kth_min_distance
						// kth_min_distance is the distance of the last element
						kth_min_distance = distance;
						result.push_back(new_pair);
					} else {
						// iterate through the list to insert it in the right position
						typename std::list<std::pair<int,T>>::iterator pair_it;
						for ( pair_it = result.begin(); pair_it !=result.end(); pair_it++) {
							if ( distance < pair_it->second) {
								result.insert(pair_it, new_pair);
								break;
							}
						}
					}
				} else if (result.size() > 0 && (result.size() == (uint64_t)k)) {
					// insert, pop the last, and make the kth_min the new last
					if (distance < kth_min_distance) {
						// iterate through the list to insert it in the right position
						for (typename std::list<pair<int,T>>::iterator pair_it = result.begin(); pair_it !=result.end(); pair_it++) {
							if ( distance < pair_it->second) {
								result.insert(pair_it, new_pair);
								break;
							}
						}
						result.pop_back();
						kth_min_distance = result.back().second;
					}
				} else if (result.size() == 0) {
					// size is 0, insert 1st element
					kth_min_distance = distance;
					result.push_back(new_pair);
				} else {
					exit(EXIT_FAILURE);
				}

				// if we've reached the threshold, just return the result list
				if (visited >= threshold) 
					return result;
			}

			// return if max probes were traversed
			if (++probes_checked >= max_probes)
				return result;
			
			/**
			 Step 3 .. n: If necessary, check all the buckets with hamming distance 1 .. n
						until the threshold is reached.
			**/
			// set the desired hamming distance to 1 initially
			int dist_count = 1;
			// while we are under the threshold
			while (true) {
				// parse through all the buckets
				for (uint32_t i = 0; i < n_buckets; i++) {
					// if the hamming distance from the bucket_int is the desired
					if (our_math::hamming_distance(i, bucket_int) == dist_count) {
						// check the bucket for neighbors in the range given
						list<int> bucket = hypercube[i];
						for (std::list<int>::iterator bucket_it = bucket.begin(); bucket_it != bucket.end(); bucket_it++) {

							visited++;

							// distance between vectors
							T distance =  metrics::ManhatanDistance(feature_vectors.at(*bucket_it), query_vector, space_dim);
							
							// if the element is already in the list, skip the checks
							pair<int, T> new_pair = make_pair(*bucket_it, distance);
							
							if (find(result.begin(), result.end(), new_pair) != result.end()) {
								continue;
							}

							// insert the pair into the list if it's distance is less than the kth_min
							if (result.size() > 0 && result.size() < (uint64_t) k) {
								// size < k so we just insert it
								
								if (distance >= kth_min_distance) {
									// insert at back if distance > kth_min_distance
									// kth_min_distance is the distance of the last element
									kth_min_distance = distance;
									result.push_back(new_pair);
								} else {
									// iterate through the list to insert it in the right position
									typename std::list<std::pair<int,T>>::iterator pair_it;
									for ( pair_it = result.begin(); pair_it !=result.end(); pair_it++) {
										if ( distance < pair_it->second) {
											result.insert(pair_it, new_pair);
											break;
										}
									}
								}
							} else if (result.size() > 0 && (result.size() == (uint64_t) k)) {
								// insert, pop the last, and make the kth_min the new last
								if (distance < kth_min_distance) {
									// iterate through the list to insert it in the right position
									for (typename std::list<pair<int,T>>::iterator pair_it = result.begin(); pair_it !=result.end(); pair_it++) {
										if ( distance < pair_it->second) {
											result.insert(pair_it, new_pair);
											break;
										}
									}
									result.pop_back();
									kth_min_distance = result.back().second;
								}
							} else if (result.size() == 0) {
								// size is 0, insert 1st element
								kth_min_distance = distance;
								result.push_back(new_pair);
							} else {
								exit(EXIT_FAILURE);
							}

							// if we've reached the threshold, just return the result list
							if (visited >= threshold) 
								return result;
						}
						// return if max probes were traversed
						if (++probes_checked >= max_probes)
							return result;
					}
				}
				// again, if necessary, increase the hamming distance, so we check further buckets
				dist_count++;
			}
		}

// Assembly:
subq $0x328, %rsp            # imm = 0x328
movq %rdx, 0xd0(%rsp)
movq %rdi, 0xb8(%rsp)
movq %rdi, %rax
movq %rax, 0xc0(%rsp)
movq %rdi, 0x320(%rsp)
movq %rsi, 0x318(%rsp)
movq %rdx, 0x310(%rsp)
movl %ecx, 0x30c(%rsp)
movq 0x318(%rsp), %rax
movq %rax, 0xc8(%rsp)
movb $0x0, 0x30b(%rsp)
callq 0x92c0
movq 0xd0(%rsp), %rsi
movabsq $0x41dfffffffc00000, %rax # imm = 0x41DFFFFFFFC00000
movq %rax, 0x300(%rsp)
movl $0x0, 0x2fc(%rsp)
movl $0x0, 0x2f8(%rsp)
leaq 0x2d8(%rsp), %rdi
callq 0x4560
jmp 0x6e0d
movq 0xc8(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
callq 0xa0c0
movl %eax, 0xb4(%rsp)
jmp 0x6e2b
leaq 0x2d8(%rsp), %rdi
callq 0x3510
movl 0xb4(%rsp), %eax
movq 0xc8(%rsp), %rdi
movl %eax, 0x2f4(%rsp)
addq $0x28, %rdi
movslq 0x2f4(%rsp), %rsi
callq 0xa2e0
movq %rax, %rsi
leaq 0x2b0(%rsp), %rdi
callq 0xc4d0
jmp 0x6e71
leaq 0x2b0(%rsp), %rdi
callq 0x11990
movq %rax, 0x2a8(%rsp)
leaq 0x2b0(%rsp), %rdi
callq 0xc8c0
movq %rax, 0x2a0(%rsp)
leaq 0x2a8(%rsp), %rdi
leaq 0x2a0(%rsp), %rsi
callq 0x119c0
testb $0x1, %al
jne 0x6eb9
jmp 0x7474
movq 0xc8(%rsp), %rax
movl 0x2fc(%rsp), %ecx
incl %ecx
movl %ecx, 0x2fc(%rsp)
addq $0x40, %rax
movq %rax, 0xa0(%rsp)
leaq 0x2a8(%rsp), %rdi
callq 0x119e0
movq 0xa0(%rsp), %rdi
movslq (%rax), %rsi
callq 0x6640
movq %rax, 0xa8(%rsp)
jmp 0x6f04
movq 0xa8(%rsp), %rsi
leaq 0x280(%rsp), %rdi
callq 0x4560
jmp 0x6f1b
movq 0xd0(%rsp), %rsi
leaq 0x268(%rsp), %rdi
callq 0x4560
jmp 0x6f32
movq 0xc8(%rsp), %rax
movl 0x20(%rax), %edx
leaq 0x280(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0x92d0
movsd %xmm0, 0x98(%rsp)
jmp 0x6f5d
leaq 0x268(%rsp), %rdi
callq 0x3510
leaq 0x280(%rsp), %rdi
callq 0x3510
movsd 0x98(%rsp), %xmm0
movsd %xmm0, 0x298(%rsp)
leaq 0x2a8(%rsp), %rdi
callq 0x119e0
movq %rax, %rdi
leaq 0x298(%rsp), %rsi
callq 0x11a00
movsd %xmm0, 0x88(%rsp)
movl %eax, 0x94(%rsp)
jmp 0x6fb8
movq 0xb8(%rsp), %rdi
movsd 0x88(%rsp), %xmm0
movl 0x94(%rsp), %eax
movl %eax, 0x258(%rsp)
movsd %xmm0, 0x260(%rsp)
callq 0x81d0
movq 0xb8(%rsp), %rdi
movq %rax, 0x248(%rsp)
callq 0x8220
movq %rax, 0x240(%rsp)
movq 0x248(%rsp), %rdi
movq 0x240(%rsp), %rsi
leaq 0x258(%rsp), %rdx
callq 0x11a40
movq %rax, 0x80(%rsp)
jmp 0x7029
movq 0xb8(%rsp), %rdi
movq 0x80(%rsp), %rax
movq %rax, 0x250(%rsp)
callq 0x8220
movq %rax, 0x238(%rsp)
leaq 0x250(%rsp), %rdi
leaq 0x238(%rsp), %rsi
callq 0x8200
testb $0x1, %al
jne 0x706c
jmp 0x7112
jmp 0x7458
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x7ba6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x2d8(%rsp), %rdi
callq 0x3510
jmp 0x7ba6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x7b7a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x7100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x268(%rsp), %rdi
callq 0x3510
leaq 0x280(%rsp), %rdi
callq 0x3510
jmp 0x7b7a
movq 0xb8(%rsp), %rdi
callq 0x93e0
cmpq $0x0, %rax
jbe 0x7288
movq 0xb8(%rsp), %rdi
callq 0x93e0
movslq 0x30c(%rsp), %rcx
cmpq %rcx, %rax
jae 0x7288
movsd 0x298(%rsp), %xmm0
ucomisd 0x300(%rsp), %xmm0
jb 0x7189
movq 0xb8(%rsp), %rdi
movsd 0x298(%rsp), %xmm0
movsd %xmm0, 0x300(%rsp)
leaq 0x258(%rsp), %rsi
callq 0x9410
jmp 0x7184
jmp 0x7283
leaq 0x230(%rsp), %rdi
callq 0x9450
movq 0xb8(%rsp), %rdi
callq 0x81d0
movq %rax, 0x228(%rsp)
movq 0x228(%rsp), %rax
movq %rax, 0x230(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x8220
movq %rax, 0x220(%rsp)
leaq 0x230(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x8200
testb $0x1, %al
jne 0x71ee
jmp 0x7281
movsd 0x298(%rsp), %xmm0
movsd %xmm0, 0x78(%rsp)
leaq 0x230(%rsp), %rdi
callq 0x8250
movsd 0x78(%rsp), %xmm1
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7263
leaq 0x218(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0x94f0
movq 0xb8(%rsp), %rdi
movq 0x218(%rsp), %rsi
leaq 0x258(%rsp), %rdx
callq 0x9470
movq %rax, 0x70(%rsp)
jmp 0x7254
movq 0x70(%rsp), %rax
movq %rax, 0x210(%rsp)
jmp 0x7281
jmp 0x7265
leaq 0x230(%rsp), %rdi
xorl %esi, %esi
callq 0x8270
movq %rax, 0x208(%rsp)
jmp 0x71bb
jmp 0x7283
jmp 0x742a
movq 0xb8(%rsp), %rdi
callq 0x93e0
cmpq $0x0, %rax
jbe 0x73de
movq 0xb8(%rsp), %rdi
callq 0x93e0
movslq 0x30c(%rsp), %rcx
cmpq %rcx, %rax
jne 0x73de
movsd 0x298(%rsp), %xmm1
movsd 0x300(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x73dc
movq 0xb8(%rsp), %rdi
callq 0x81d0
movq %rax, 0x200(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x8220
movq %rax, 0x1f8(%rsp)
leaq 0x200(%rsp), %rdi
leaq 0x1f8(%rsp), %rsi
callq 0x8200
testb $0x1, %al
jne 0x7321
jmp 0x73b4
movsd 0x298(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
leaq 0x200(%rsp), %rdi
callq 0x8250
movsd 0x68(%rsp), %xmm1
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7396
leaq 0x1f0(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x94f0
movq 0xb8(%rsp), %rdi
movq 0x1f0(%rsp), %rsi
leaq 0x258(%rsp), %rdx
callq 0x9470
movq %rax, 0x60(%rsp)
jmp 0x7387
movq 0x60(%rsp), %rax
movq %rax, 0x1e8(%rsp)
jmp 0x73b4
jmp 0x7398
leaq 0x200(%rsp), %rdi
xorl %esi, %esi
callq 0x8270
movq %rax, 0x1e0(%rsp)
jmp 0x72ee
movq 0xb8(%rsp), %rdi
callq 0x9510
movq 0xb8(%rsp), %rdi
callq 0x8a30
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x300(%rsp)
jmp 0x7428
movq 0xb8(%rsp), %rdi
callq 0x93e0
cmpq $0x0, %rax
jne 0x741c
movq 0xb8(%rsp), %rdi
movsd 0x298(%rsp), %xmm0
movsd %xmm0, 0x300(%rsp)
leaq 0x258(%rsp), %rsi
callq 0x9410
jmp 0x741a
jmp 0x7426
movl $0x1, %edi
callq 0x2220
jmp 0x7428
jmp 0x742a
movq 0xc8(%rsp), %rcx
movl 0x2fc(%rsp), %eax
cmpl 0x10(%rcx), %eax
jb 0x7456
movb $0x1, 0x30b(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x7b61
jmp 0x7458
leaq 0x2a8(%rsp), %rdi
xorl %esi, %esi
callq 0x11aa0
movq %rax, 0x1d0(%rsp)
jmp 0x6e86
movq 0xc8(%rsp), %rcx
movl 0x2f8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2f8(%rsp)
cmpl 0x14(%rcx), %eax
jb 0x74aa
movb $0x1, 0x30b(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x7b61
movl $0x1, 0x1cc(%rsp)
jmp 0x74b7
movl $0x0, 0x1c8(%rsp)
movq 0xc8(%rsp), %rcx
movl 0x1c8(%rsp), %eax
cmpl 0x24(%rcx), %eax
jae 0x7b4b
movl 0x1c8(%rsp), %edi
movl 0x2f4(%rsp), %esi
callq 0x11ad0
movl %eax, 0x5c(%rsp)
jmp 0x74f3
movl 0x5c(%rsp), %eax
cmpl 0x1cc(%rsp), %eax
jne 0x7b33
movq 0xc8(%rsp), %rdi
addq $0x28, %rdi
movl 0x1c8(%rsp), %eax
movl %eax, %esi
callq 0xa2e0
movq %rax, %rsi
leaq 0x1b0(%rsp), %rdi
callq 0xc4d0
jmp 0x7530
leaq 0x1b0(%rsp), %rdi
callq 0x11990
movq %rax, 0x1a8(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0xc8c0
movq %rax, 0x1a0(%rsp)
leaq 0x1a8(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x119c0
testb $0x1, %al
jne 0x7578
jmp 0x7aca
movq 0xc8(%rsp), %rax
movl 0x2fc(%rsp), %ecx
incl %ecx
movl %ecx, 0x2fc(%rsp)
addq $0x40, %rax
movq %rax, 0x48(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x119e0
movq 0x48(%rsp), %rdi
movslq (%rax), %rsi
callq 0x6640
movq %rax, 0x50(%rsp)
jmp 0x75ba
movq 0x50(%rsp), %rsi
leaq 0x180(%rsp), %rdi
callq 0x4560
jmp 0x75ce
movq 0xd0(%rsp), %rsi
leaq 0x168(%rsp), %rdi
callq 0x4560
jmp 0x75e5
movq 0xc8(%rsp), %rax
movl 0x20(%rax), %edx
leaq 0x180(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x92d0
movsd %xmm0, 0x40(%rsp)
jmp 0x760d
leaq 0x168(%rsp), %rdi
callq 0x3510
leaq 0x180(%rsp), %rdi
callq 0x3510
movsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x198(%rsp)
leaq 0x1a8(%rsp), %rdi
callq 0x119e0
movq %rax, %rdi
leaq 0x198(%rsp), %rsi
callq 0x11a00
movsd %xmm0, 0x30(%rsp)
movl %eax, 0x3c(%rsp)
jmp 0x765f
movq 0xb8(%rsp), %rdi
movsd 0x30(%rsp), %xmm0
movl 0x3c(%rsp), %eax
movl %eax, 0x158(%rsp)
movsd %xmm0, 0x160(%rsp)
callq 0x81d0
movq 0xb8(%rsp), %rdi
movq %rax, 0x148(%rsp)
callq 0x8220
movq %rax, 0x140(%rsp)
movq 0x148(%rsp), %rdi
movq 0x140(%rsp), %rsi
leaq 0x158(%rsp), %rdx
callq 0x11a40
movq %rax, 0x28(%rsp)
jmp 0x76c7
movq 0xb8(%rsp), %rdi
movq 0x28(%rsp), %rax
movq %rax, 0x150(%rsp)
callq 0x8220
movq %rax, 0x138(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0x138(%rsp), %rsi
callq 0x8200
testb $0x1, %al
jne 0x7704
jmp 0x776b
jmp 0x7aae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x7b24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
jmp 0x7759
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2d0(%rsp)
movl %eax, 0x2cc(%rsp)
leaq 0x168(%rsp), %rdi
callq 0x3510
leaq 0x180(%rsp), %rdi
callq 0x3510
jmp 0x7b24
movq 0xb8(%rsp), %rdi
callq 0x93e0
cmpq $0x0, %rax
jbe 0x78e1
movq 0xb8(%rsp), %rdi
callq 0x93e0
movslq 0x30c(%rsp), %rcx
cmpq %rcx, %rax
jae 0x78e1
movsd 0x198(%rsp), %xmm0
ucomisd 0x300(%rsp), %xmm0
jb 0x77e2
movq 0xb8(%rsp), %rdi
movsd 0x198(%rsp), %xmm0
movsd %xmm0, 0x300(%rsp)
leaq 0x158(%rsp), %rsi
callq 0x9410
jmp 0x77dd
jmp 0x78dc
leaq 0x130(%rsp), %rdi
callq 0x9450
movq 0xb8(%rsp), %rdi
callq 0x81d0
movq %rax, 0x128(%rsp)
movq 0x128(%rsp), %rax
movq %rax, 0x130(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x8220
movq %rax, 0x120(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x8200
testb $0x1, %al
jne 0x7847
jmp 0x78da
movsd 0x198(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
leaq 0x130(%rsp), %rdi
callq 0x8250
movsd 0x20(%rsp), %xmm1
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x78bc
leaq 0x118(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x94f0
movq 0xb8(%rsp), %rdi
movq 0x118(%rsp), %rsi
leaq 0x158(%rsp), %rdx
callq 0x9470
movq %rax, 0x18(%rsp)
jmp 0x78ad
movq 0x18(%rsp), %rax
movq %rax, 0x110(%rsp)
jmp 0x78da
jmp 0x78be
leaq 0x130(%rsp), %rdi
xorl %esi, %esi
callq 0x8270
movq %rax, 0x108(%rsp)
jmp 0x7814
jmp 0x78dc
jmp 0x7a83
movq 0xb8(%rsp), %rdi
callq 0x93e0
cmpq $0x0, %rax
jbe 0x7a37
movq 0xb8(%rsp), %rdi
callq 0x93e0
movslq 0x30c(%rsp), %rcx
cmpq %rcx, %rax
jne 0x7a37
movsd 0x198(%rsp), %xmm1
movsd 0x300(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7a35
movq 0xb8(%rsp), %rdi
callq 0x81d0
movq %rax, 0x100(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x8220
movq %rax, 0xf8(%rsp)
leaq 0x100(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x8200
testb $0x1, %al
jne 0x797a
jmp 0x7a0d
movsd 0x198(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x8250
movsd 0x10(%rsp), %xmm1
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x79ef
leaq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x94f0
movq 0xb8(%rsp), %rdi
movq 0xf0(%rsp), %rsi
leaq 0x158(%rsp), %rdx
callq 0x9470
movq %rax, 0x8(%rsp)
jmp 0x79e0
movq 0x8(%rsp), %rax
movq %rax, 0xe8(%rsp)
jmp 0x7a0d
jmp 0x79f1
leaq 0x100(%rsp), %rdi
xorl %esi, %esi
callq 0x8270
movq %rax, 0xe0(%rsp)
jmp 0x7947
movq 0xb8(%rsp), %rdi
callq 0x9510
movq 0xb8(%rsp), %rdi
callq 0x8a30
movsd 0x8(%rax), %xmm0
movsd %xmm0, 0x300(%rsp)
jmp 0x7a81
movq 0xb8(%rsp), %rdi
callq 0x93e0
cmpq $0x0, %rax
jne 0x7a75
movq 0xb8(%rsp), %rdi
movsd 0x198(%rsp), %xmm0
movsd %xmm0, 0x300(%rsp)
leaq 0x158(%rsp), %rsi
callq 0x9410
jmp 0x7a73
jmp 0x7a7f
movl $0x1, %edi
callq 0x2220
jmp 0x7a81
jmp 0x7a83
movq 0xc8(%rsp), %rcx
movl 0x2fc(%rsp), %eax
cmpl 0x10(%rcx), %eax
jb 0x7aac
movb $0x1, 0x30b(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x7b08
jmp 0x7aae
leaq 0x1a8(%rsp), %rdi
xorl %esi, %esi
callq 0x11aa0
movq %rax, 0xd8(%rsp)
jmp 0x7545
movq 0xc8(%rsp), %rcx
movl 0x2f8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2f8(%rsp)
cmpl 0x14(%rcx), %eax
jb 0x7afd
movb $0x1, 0x30b(%rsp)
movl $0x1, 0x1dc(%rsp)
jmp 0x7b08
movl $0x0, 0x1dc(%rsp)
leaq 0x1b0(%rsp), %rdi
callq 0x9e60
movl 0x1dc(%rsp), %eax
testl %eax, %eax
jne 0x7b61
jmp 0x7b22
jmp 0x7b33
leaq 0x1b0(%rsp), %rdi
callq 0x9e60
jmp 0x7b7a
jmp 0x7b35
movl 0x1c8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c8(%rsp)
jmp 0x74c2
movl 0x1cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1cc(%rsp)
jmp 0x74b5
leaq 0x2b0(%rsp), %rdi
callq 0x9e60
testb $0x1, 0x30b(%rsp)
jne 0x7b96
jmp 0x7b89
leaq 0x2b0(%rsp), %rdi
callq 0x9e60
jmp 0x7ba6
movq 0xb8(%rsp), %rdi
callq 0x89b0
movq 0xc0(%rsp), %rax
addq $0x328, %rsp            # imm = 0x328
retq
movq 0xb8(%rsp), %rdi
callq 0x89b0
movq 0x2d0(%rsp), %rdi
callq 0x23c0