// File: /workspace/github_cpp_makefile_star2_O2/tonymuu[P]distributed-kv-store/Application.cpp
// Function: Application::updateTest()
void Application::updateTest() {
	// Step 0. Key to be updated
	// This key is used for all update tests
	map<string, string>::iterator it = testKVPairs.begin();
	it++;
	string newValue = "newValue";
	int number;
	vector<Node> replicas;
	int replicaIdToFail = TERTIARY;
	int nodeToFail;
	bool failedOneNode = false;

	/**
	 * Test 1: Test if value is updated correctly in quorum number of nodes
	 */
	if ( par->getcurrtime() == TEST_TIME ) {
		// Step 1.a. Find a node that is alive
		number = findARandomNodeThatIsAlive();

		// Step 1.b Do a update operation
		cout<<endl<<"Updating a valid key.... ... .. . ."<<endl;
		log->LOG(&mp2[number]->getMemberNode()->addr, "UPDATE OPERATION KEY: %s VALUE: %s at time: %d", it->first.c_str(), newValue.c_str(), par->getcurrtime());
		mp2[number]->clientUpdate(it->first, newValue);
	}

	/** end of test 1 **/

	/**
	 * Test 2: FAIL ONE REPLICA. Test if value is updated correctly in quorum number of nodes after ONE OF THE REPLICAS IS FAILED
	 */
	if ( par->getcurrtime() == (TEST_TIME + FIRST_FAIL_TIME) ) {
		// Step 2.a Find a node that is alive and assign it as number
		number = findARandomNodeThatIsAlive();

		// Step 2.b Find the replicas of this key
		replicas.clear();
		replicas = mp2[number]->findNodes(it->first);
		// if quorum replicas are not found then exit
		if ( replicas.size() < RF-1 ) {
			log->LOG(&mp2[number]->getMemberNode()->addr, "Could not find at least quorum replicas for this key. Exiting!!! size of replicas vector: %d", replicas.size());
			cout<<endl<<"Could not find at least quorum replicas for this key. Exiting!!! size of replicas vector: "<<replicas.size()<<endl;
			exit(1);
		}

		// Step 2.c Fail a replica
		for ( int i = 0; i < par->EN_GPSZ; i++ ) {
			if ( mp2[i]->getMemberNode()->addr.getAddress() == replicas.at(replicaIdToFail).getAddress()->getAddress() ) {
				if ( !mp2[i]->getMemberNode()->bFailed ) {
					nodeToFail = i;
					failedOneNode = true;
					break;
				}
				else {
					// Since we fail at most two nodes, one of the replicas must be alive
					if ( replicaIdToFail > 0 ) {
						replicaIdToFail--;
					}
					else {
						failedOneNode = false;
					}
				}
			}
		}
		if ( failedOneNode ) {
			log->LOG(&mp2[nodeToFail]->getMemberNode()->addr, "Node failed at time=%d", par->getcurrtime());
			mp2[nodeToFail]->getMemberNode()->bFailed = true;
			mp1[nodeToFail]->getMemberNode()->bFailed = true;
			cout<<endl<<"Failed a replica node"<<endl;
		}
		else {
			// The code can never reach here
			log->LOG(&mp2[number]->getMemberNode()->addr, "Could not fail a node");
			cout<<"Could not fail a node. Exiting!!!";
			exit(1);
		}

		number = findARandomNodeThatIsAlive();

		// Step 2.d Issue a update
		cout<<endl<<"Updating a valid key.... ... .. . ."<<endl;
		log->LOG(&mp2[number]->getMemberNode()->addr, "UPDATE OPERATION KEY: %s VALUE: %s at time: %d", it->first.c_str(), newValue.c_str(), par->getcurrtime());
		mp2[number]->clientUpdate(it->first, newValue);

		failedOneNode = false;
	}

	/** end of test 2 **/

	/**
	 * Test 3 part 1: Fail two replicas. Test if value is updated correctly in quorum number of nodes after TWO OF THE REPLICAS ARE FAILED
	 */
	if ( par->getcurrtime() >= (TEST_TIME + FIRST_FAIL_TIME + STABILIZE_TIME) ) {

		vector<int> nodesToFail;
		nodesToFail.clear();
		int count = 0;

		if ( par->getcurrtime() == (TEST_TIME + FIRST_FAIL_TIME + STABILIZE_TIME) ) {
			// Step 3.a. Find a node that is alive
			number = findARandomNodeThatIsAlive();

			// Get the keys replicas
			replicas.clear();
			replicas = mp2[number]->findNodes(it->first);

			// Step 3.b. Fail two replicas
			if ( replicas.size() > 2 ) {
				replicaIdToFail = TERTIARY;
				while ( count != 2 ) {
					int i = 0;
					while ( i != par->EN_GPSZ ) {
						if ( mp2[i]->getMemberNode()->addr.getAddress() == replicas.at(replicaIdToFail).getAddress()->getAddress() ) {
							if ( !mp2[i]->getMemberNode()->bFailed ) {
								nodesToFail.emplace_back(i);
								replicaIdToFail--;
								count++;
								break;
							}
							else {
								// Since we fail at most two nodes, one of the replicas must be alive
								if ( replicaIdToFail > 0 ) {
									replicaIdToFail--;
								}
							}
						}
						i++;
					}
				}
			}
			else {
				// If the code reaches here. Test your stabilization protocol
				cout<<endl<<"Not enough replicas to fail two nodes. Exiting test case !! "<<endl;
			}
			if ( count == 2 ) {
				for ( int i = 0; i < (int)nodesToFail.size(); i++ ) {
					// Fail a node
					log->LOG(&mp2[nodesToFail.at(i)]->getMemberNode()->addr, "Node failed at time=%d", par->getcurrtime());
					mp2[nodesToFail.at(i)]->getMemberNode()->bFailed = true;
					mp1[nodesToFail.at(i)]->getMemberNode()->bFailed = true;
					cout<<endl<<"Failed a replica node"<<endl;
				}
			}
			else {
				// The code can never reach here
				log->LOG(&mp2[number]->getMemberNode()->addr, "Could not fail two nodes");
				cout<<"Could not fail two nodes. Exiting!!!";
				exit(1);
			}

			number = findARandomNodeThatIsAlive();

			// Step 3.c Issue an update
			cout<<endl<<"Updating a valid key.... ... .. . ."<<endl;
			log->LOG(&mp2[number]->getMemberNode()->addr, "UPDATE OPERATION KEY: %s VALUE: %s at time: %d", it->first.c_str(), newValue.c_str(), par->getcurrtime());
			// This update should fail since at least quorum nodes are not alive
			mp2[number]->clientUpdate(it->first, newValue);
		}

		/**
		 * TEST 3 part 2: After failing two replicas and waiting for STABILIZE_TIME, issue an update
		 */
		// Step 3.d Wait for stabilization protocol to kick in
		if ( par->getcurrtime() == (TEST_TIME + FIRST_FAIL_TIME + STABILIZE_TIME + STABILIZE_TIME) ) {
			number = findARandomNodeThatIsAlive();
			// Step 3.e Issue a update
			cout<<endl<<"Updating a valid key.... ... .. . ."<<endl;
			log->LOG(&mp2[number]->getMemberNode()->addr, "UPDATE OPERATION KEY: %s VALUE: %s at time: %d", it->first.c_str(), newValue.c_str(), par->getcurrtime());
			// This update should be successful
			mp2[number]->clientUpdate(it->first, newValue);
		}
	}

	/** end of test 3 **/

	/**
	 * Test 4: FAIL A NON-REPLICA. Test if value is read correctly in quorum number of nodes after a NON-REPLICA IS FAILED
	 */
	if ( par->getcurrtime() == (TEST_TIME + FIRST_FAIL_TIME + STABILIZE_TIME + STABILIZE_TIME + LAST_FAIL_TIME ) ) {
		// Step 4.a. Find a node that is alive
		number = findARandomNodeThatIsAlive();

		// Step 4.b Find a non - replica for this key
		replicas.clear();
		replicas = mp2[number]->findNodes(it->first);
		for ( int i = 0; i < par->EN_GPSZ; i++ ) {
			if ( !mp2[i]->getMemberNode()->bFailed ) {
				if ( mp2[i]->getMemberNode()->addr.getAddress() != replicas.at(PRIMARY).getAddress()->getAddress() &&
					 mp2[i]->getMemberNode()->addr.getAddress() != replicas.at(SECONDARY).getAddress()->getAddress() &&
					 mp2[i]->getMemberNode()->addr.getAddress() != replicas.at(TERTIARY).getAddress()->getAddress() ) {
					// Step 4.c Fail a non-replica node
					log->LOG(&mp2[i]->getMemberNode()->addr, "Node failed at time=%d", par->getcurrtime());
					mp2[i]->getMemberNode()->bFailed = true;
					mp1[i]->getMemberNode()->bFailed = true;
					failedOneNode = true;
					cout<<endl<<"Failed a non-replica node"<<endl;
					break;
				}
			}
		}

		if ( !failedOneNode ) {
			// The code can never reach here
			log->LOG(&mp2[number]->getMemberNode()->addr, "Could not fail a node(non-replica)");
			cout<<"Could not fail a node(non-replica). Exiting!!!";
			exit(1);
		}

		number = findARandomNodeThatIsAlive();

		// Step 4.d Issue a update operation
		cout<<endl<<"Updating a valid key.... ... .. . ."<<endl;
		log->LOG(&mp2[number]->getMemberNode()->addr, "UPDATE OPERATION KEY: %s VALUE: %s at time: %d", it->first.c_str(), newValue.c_str(), par->getcurrtime());
		// This read should fail since at least quorum nodes are not alive
		mp2[number]->clientUpdate(it->first, newValue);
	}

	/** end of test 4 **/

	/**
	 * Test 5: Udpate a non-existent key.
	 */
	if ( par->getcurrtime() == (TEST_TIME + FIRST_FAIL_TIME + STABILIZE_TIME + STABILIZE_TIME + LAST_FAIL_TIME ) ) {
		string invalidKey = "invalidKey";
		string invalidValue = "invalidValue";

		// Step 5.a Find a node that is alive
		number = findARandomNodeThatIsAlive();

		// Step 5.b Issue a read operation
		cout<<endl<<"Updating a valid key.... ... .. . ."<<endl;
		log->LOG(&mp2[number]->getMemberNode()->addr, "UPDATE OPERATION KEY: %s VALUE: %s at time: %d", invalidKey.c_str(), invalidValue.c_str(), par->getcurrtime());
		// This read should fail since at least quorum nodes are not alive
		mp2[number]->clientUpdate(invalidKey, invalidValue);
	}

	/** end of test 5 **/

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movq %rdi, %rbx
movq 0x78(%rdi), %rdi
callq 0x31d0
movq %rax, 0x8(%rsp)
leaq 0xb2e9(%rip), %rsi      # 0x136d0
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x4bc2
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq 0x58(%rbx), %rdi
callq 0xabe4
cmpl $0x96, %eax
jne 0x84f2
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
movq 0x14b97(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xb2a4(%rip), %rsi      # 0x136d9
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq 0x38(%rbx), %r14
movq 0x48(%rbx), %rax
movslq %ebp, %rbp
movq (%rax,%rbp,8), %rax
movq 0x50(%rax), %r13
movq 0x8(%rsp), %rax
movq 0x20(%rax), %r15
movq 0x60(%rsp), %r12
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %r13
leaq 0xb283(%rip), %rdx      # 0x136fd
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
movq %r12, %r8
movl %eax, %r9d
xorl %eax, %eax
callq 0xa106
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %rsi
movq 0x48(%rbx), %rax
movq (%rax,%rbp,8), %r14
leaq 0x2c8(%rsp), %rdi
callq 0x33a0
leaq 0x2a8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x33a0
leaq 0x2c8(%rsp), %rsi
leaq 0x2a8(%rsp), %rdx
movq %r14, %rdi
callq 0xddfe
leaq 0x2a8(%rsp), %rdi
callq 0x3120
leaq 0x2c8(%rsp), %rdi
callq 0x3120
movq 0x58(%rbx), %rdi
callq 0xabe4
cmpl $0xaf, %eax
jne 0x877c
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x97f0
movq 0x48(%rbx), %rax
movslq %ebp, %r15
movq (%rax,%r15,8), %r14
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %rsi
leaq 0x288(%rsp), %rdi
movq %rsi, 0x18(%rsp)
callq 0x33a0
leaq 0x40(%rsp), %rdi
leaq 0x288(%rsp), %rdx
movq %r14, %rsi
callq 0xd97e
movq %r15, 0x10(%rsp)
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x9eb4
movq %r12, %rdi
callq 0x97f8
leaq 0x288(%rsp), %rdi
callq 0x3120
movq 0x8(%r14), %rcx
subq (%r14), %rcx
sarq $0x5, %rcx
cmpq $0x2, %rcx
jb 0x9142
pushq $0x2
popq %r12
xorl %r15d, %r15d
leaq 0x40(%rsp), %r14
leaq 0xa8(%rsp), %r13
movq 0x58(%rbx), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %r15
jge 0x9100
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
movq %r14, %rdi
callq 0x9666
movslq %r12d, %rsi
leaq 0x20(%rsp), %rdi
callq 0x981a
movq %rax, %rdi
callq 0x10686
movq %r13, %rdi
movq %rax, %rsi
callq 0x9666
movq %r14, %rdi
movq %r13, %rsi
callq 0x56e4
movl %eax, %ebp
movq %r13, %rdi
callq 0x3120
movq %r14, %rdi
callq 0x3120
testb %bpl, %bpl
je 0x8635
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x50(%rax), %rbp
cmpb $0x0, 0x10(%rbp)
je 0x863d
xorl %eax, %eax
testl %r12d, %r12d
setg %al
subl %eax, %r12d
incq %r15
jmp 0x85ad
movq 0x38(%rbx), %r14
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %rbp
leaq 0xacb7(%rip), %rdx      # 0x1330c
movq %r14, %rdi
movq %rbp, %rsi
movl %eax, %ecx
xorl %eax, %eax
callq 0xa106
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x50(%rax), %rax
movb $0x1, %cl
movb %cl, 0x10(%rax)
movq 0x40(%rbx), %rax
movq (%rax,%r15,8), %rax
movq 0x20(%rax), %rax
movb %cl, 0x10(%rax)
movq 0x14935(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xaeb0(%rip), %rsi      # 0x13547
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
movq 0x14908(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xb015(%rip), %rsi      # 0x136d9
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq 0x38(%rbx), %r14
movq 0x48(%rbx), %rax
movslq %ebp, %r15
movq (%rax,%r15,8), %rax
movq 0x50(%rax), %rbp
movq 0x18(%rsp), %rax
movq (%rax), %r12
movq 0x60(%rsp), %r13
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %rbp
leaq 0xaff5(%rip), %rdx      # 0x136fd
movq %r14, %rdi
movq %rbp, %rsi
movq %r12, %rcx
movq %r13, %r8
movl %eax, %r9d
xorl %eax, %eax
callq 0xa106
movq 0x48(%rbx), %rax
movq (%rax,%r15,8), %r14
leaq 0x268(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x33a0
leaq 0x248(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x33a0
leaq 0x268(%rsp), %rsi
leaq 0x248(%rsp), %rdx
movq %r14, %rdi
callq 0xddfe
leaq 0x248(%rsp), %rdi
callq 0x3120
leaq 0x268(%rsp), %rdi
callq 0x3120
movq 0x58(%rbx), %rdi
callq 0xabe4
cmpl $0xe1, %eax
jl 0x8bc8
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
andq $0x0, 0x90(%rsp)
movq 0x58(%rbx), %rdi
callq 0xabe4
cmpl $0xe1, %eax
jne 0x8acd
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x97f0
movq 0x48(%rbx), %rax
movslq %ebp, %r12
movq (%rax,%r12,8), %r14
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %rsi
leaq 0x228(%rsp), %rdi
movq %rsi, 0x10(%rsp)
callq 0x33a0
leaq 0x40(%rsp), %rdi
leaq 0x228(%rsp), %rdx
movq %r14, %rsi
callq 0xd97e
leaq 0x20(%rsp), %r14
leaq 0x40(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x9eb4
movq %r15, %rdi
callq 0x97f8
leaq 0x228(%rsp), %rdi
callq 0x3120
movq 0x8(%r14), %rax
subq (%r14), %rax
cmpq $0x41, %rax
jb 0x91a4
pushq $0x2
popq %r15
movl $0x0, 0x18(%rsp)
leaq 0x40(%rsp), %r14
leaq 0x20(%rsp), %r12
leaq 0xa8(%rsp), %r13
cmpl $0x2, 0x18(%rsp)
je 0x8924
xorl %eax, %eax
movl %eax, 0xc8(%rsp)
movq 0x58(%rbx), %rcx
cmpl 0x18(%rcx), %eax
je 0x8860
movq 0x48(%rbx), %rcx
cltq
movq (%rcx,%rax,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
movq %r14, %rdi
callq 0x9666
movslq %r15d, %rsi
movq %r12, %rdi
callq 0x981a
movq %rax, %rdi
callq 0x10686
movq %r13, %rdi
movq %rax, %rsi
callq 0x9666
movq %r14, %rdi
movq %r13, %rsi
callq 0x56e4
movl %eax, %ebp
movq %r13, %rdi
callq 0x3120
movq %r14, %rdi
callq 0x3120
movslq 0xc8(%rsp), %rax
testb %bpl, %bpl
je 0x88fc
movq 0x48(%rbx), %rcx
movq (%rcx,%rax,8), %rcx
movq 0x50(%rcx), %rcx
cmpb $0x0, 0x10(%rcx)
je 0x8903
xorl %ecx, %ecx
testl %r15d, %r15d
setg %cl
subl %ecx, %r15d
incl %eax
jmp 0x886d
leaq 0x80(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x983c
decl %r15d
incl 0x18(%rsp)
jmp 0x8860
leaq 0x80(%rsp), %r14
leaq 0xac14(%rip), %r13      # 0x13547
xorl %ebp, %ebp
movq 0x88(%rsp), %rax
subq 0x80(%rsp), %rax
shrq $0x2, %rax
cltq
cmpq %rax, %rbp
jge 0x89f8
movq 0x38(%rbx), %r15
movq 0x48(%rbx), %r12
movq %r14, %rdi
movq %rbp, %rsi
callq 0x9870
movslq (%rax), %rax
movq (%r12,%rax,8), %rax
movq 0x50(%rax), %r12
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %r12
movq %r15, %rdi
movq %r12, %rsi
leaq 0xa980(%rip), %rdx      # 0x1330c
movl %eax, %ecx
xorl %eax, %eax
callq 0xa106
movq 0x48(%rbx), %r15
movq %r14, %rdi
movq %rbp, %rsi
callq 0x9870
movslq (%rax), %rax
movq (%r15,%rax,8), %rax
movq 0x50(%rax), %rax
movb $0x1, 0x10(%rax)
movq 0x40(%rbx), %r15
movq %r14, %rdi
movq %rbp, %rsi
callq 0x9870
movslq (%rax), %rax
movq (%r15,%rax,8), %rax
movq 0x20(%rax), %rax
movb $0x1, 0x10(%rax)
movq 0x145e8(%rip), %rdi     # 0x1cfc0
callq 0x3140
movq %rax, %rdi
movq %r13, %rsi
callq 0x3290
movq %rax, %rdi
callq 0x3140
incq %rbp
jmp 0x8935
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
movq 0x145b7(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xacc4(%rip), %rsi      # 0x136d9
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq 0x38(%rbx), %r14
movq 0x48(%rbx), %rax
movslq %ebp, %rbp
movq (%rax,%rbp,8), %rax
movq 0x50(%rax), %r13
movq 0x10(%rsp), %rax
movq (%rax), %r15
movq 0x60(%rsp), %r12
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %r13
leaq 0xaca4(%rip), %rdx      # 0x136fd
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
movq %r12, %r8
movl %eax, %r9d
xorl %eax, %eax
callq 0xa106
movq 0x48(%rbx), %rax
movq (%rax,%rbp,8), %r14
leaq 0x208(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x33a0
leaq 0x1e8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x33a0
leaq 0x208(%rsp), %rsi
leaq 0x1e8(%rsp), %rdx
movq %r14, %rdi
callq 0xddfe
leaq 0x1e8(%rsp), %rdi
callq 0x3120
leaq 0x208(%rsp), %rdi
callq 0x3120
movq 0x58(%rbx), %rdi
callq 0xabe4
cmpl $0x113, %eax            # imm = 0x113
jne 0x8bbb
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
movq 0x144ce(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xabdb(%rip), %rsi      # 0x136d9
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq 0x38(%rbx), %r14
movq 0x48(%rbx), %rax
movslq %ebp, %rbp
movq (%rax,%rbp,8), %rax
movq 0x50(%rax), %r13
movq 0x8(%rsp), %rax
movq 0x20(%rax), %r15
movq 0x60(%rsp), %r12
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %r13
leaq 0xabba(%rip), %rdx      # 0x136fd
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
movq %r12, %r8
movl %eax, %r9d
xorl %eax, %eax
callq 0xa106
movq 0x8(%rsp), %rax
leaq 0x20(%rax), %rsi
movq 0x48(%rbx), %rax
movq (%rax,%rbp,8), %r14
leaq 0x1c8(%rsp), %rdi
callq 0x33a0
leaq 0x1a8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x33a0
leaq 0x1c8(%rsp), %rsi
leaq 0x1a8(%rsp), %rdx
movq %r14, %rdi
callq 0xddfe
leaq 0x1a8(%rsp), %rdi
callq 0x3120
leaq 0x1c8(%rsp), %rdi
callq 0x3120
leaq 0x80(%rsp), %rdi
callq 0x9f26
movq 0x58(%rbx), %rdi
callq 0xabe4
cmpl $0x11d, %eax            # imm = 0x11D
jne 0x8f66
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x97f0
movq 0x48(%rbx), %rax
movslq %ebp, %r15
movq (%rax,%r15,8), %r14
movq 0x8(%rsp), %rsi
addq $0x20, %rsi
leaq 0x188(%rsp), %rdi
movq %rsi, 0x8(%rsp)
callq 0x33a0
movq %r15, 0x10(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x188(%rsp), %rdx
movq %r14, %rsi
callq 0xd97e
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %r14
movq %r14, %rsi
callq 0x9eb4
movq %r14, %rdi
callq 0x97f8
leaq 0x188(%rsp), %rdi
callq 0x3120
xorl %r14d, %r14d
leaq 0xa8(%rsp), %r12
leaq 0x80(%rsp), %rbp
leaq 0xc8(%rsp), %r13
movq 0x58(%rbx), %rax
movslq 0x18(%rax), %rax
cmpq %rax, %r14
jge 0x90c4
movq 0x48(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x50(%rax), %rsi
cmpb $0x0, 0x10(%rsi)
jne 0x8e13
addq $0x8, %rsi
leaq 0x40(%rsp), %rdi
callq 0x9666
leaq 0x20(%rsp), %rdi
xorl %esi, %esi
callq 0x981a
movq %rax, %rdi
callq 0x10686
movq %r12, %rdi
movq %rax, %rsi
callq 0x9666
movq %rbx, %r15
movq %r12, %rbx
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9891
testb %al, %al
je 0x8dd6
movq 0x48(%r15), %rax
movq (%rax,%r14,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
movq %rbp, %rdi
callq 0x9666
leaq 0x20(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x981a
movq %rax, %rdi
callq 0x10686
movq %r13, %rdi
movq %rax, %rsi
callq 0x9666
movq %rbp, %rdi
movq %r13, %r12
movq %r13, %rsi
callq 0x9891
testb %al, %al
je 0x8de8
movq 0x48(%r15), %rax
movq (%rax,%r14,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq 0x168(%rsp), %rdi
callq 0x9666
leaq 0x20(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x981a
movq %rax, %rdi
callq 0x10686
leaq 0x2e8(%rsp), %rdi
movq %rax, %rsi
callq 0x9666
leaq 0x168(%rsp), %rdi
leaq 0x2e8(%rsp), %r12
movq %r12, %rsi
callq 0x9891
movb %al, 0x18(%rsp)
movq %r12, %rdi
callq 0x3120
leaq 0x168(%rsp), %rdi
callq 0x3120
movq %r13, %rdi
callq 0x3120
movq %rbp, %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3120
leaq 0x40(%rsp), %rdi
callq 0x3120
cmpb $0x0, 0x18(%rsp)
movq %rbx, %r12
movq %r15, %rbx
je 0x8e13
jmp 0x8e1b
movq %rbx, %rdi
callq 0x3120
movq %r12, %rdi
callq 0x3120
jmp 0x8e0d
movq %r12, %rdi
callq 0x3120
movq %rbp, %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3120
leaq 0x40(%rsp), %rdi
callq 0x3120
movq %r12, %r13
movq %rbx, %r12
movq %r15, %rbx
incq %r14
jmp 0x8c72
movq 0x38(%rbx), %r12
movq 0x48(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x50(%rax), %r15
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %r15
leaq 0xa4cd(%rip), %rdx      # 0x1330c
movq %r12, %rdi
movq %r15, %rsi
movl %eax, %ecx
xorl %eax, %eax
callq 0xa106
movq 0x48(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x50(%rax), %rax
movb $0x1, %cl
movb %cl, 0x10(%rax)
movq 0x40(%rbx), %rax
movq (%rax,%r14,8), %rax
movq 0x20(%rax), %rax
movb %cl, 0x10(%rax)
movq 0x1414b(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xa79a(%rip), %rsi      # 0x1361b
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
movq 0x1411e(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xa82b(%rip), %rsi      # 0x136d9
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq 0x38(%rbx), %r14
movq 0x48(%rbx), %rax
movslq %ebp, %rbp
movq (%rax,%rbp,8), %rax
movq 0x50(%rax), %r13
movq 0x8(%rsp), %rax
movq (%rax), %r15
movq 0x60(%rsp), %r12
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %r13
leaq 0xa80b(%rip), %rdx      # 0x136fd
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
movq %r12, %r8
movl %eax, %r9d
xorl %eax, %eax
callq 0xa106
movq 0x48(%rbx), %rax
movq (%rax,%rbp,8), %r14
leaq 0x148(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x33a0
leaq 0x128(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x33a0
leaq 0x148(%rsp), %rsi
leaq 0x128(%rsp), %rdx
movq %r14, %rdi
callq 0xddfe
leaq 0x128(%rsp), %rdi
callq 0x3120
leaq 0x148(%rsp), %rdi
callq 0x3120
movq 0x58(%rbx), %rdi
callq 0xabe4
cmpl $0x11d, %eax            # imm = 0x11D
jne 0x909e
leaq 0xa48e(%rip), %rsi      # 0x1340f
leaq 0x40(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x4bc2
leaq 0xa7cf(%rip), %rsi      # 0x13769
leaq 0xa8(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x4bc2
movq %rbx, %rdi
callq 0x94fc
movl %eax, %ebp
movq 0x14000(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xa70d(%rip), %rsi      # 0x136d9
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq 0x38(%rbx), %r14
movq 0x48(%rbx), %rax
movslq %ebp, %rbp
movq (%rax,%rbp,8), %rax
movq 0x50(%rax), %r13
movq 0x40(%rsp), %r15
movq 0xa8(%rsp), %r12
movq 0x58(%rbx), %rdi
callq 0xabe4
addq $0x8, %r13
leaq 0xa6ed(%rip), %rdx      # 0x136fd
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
movq %r12, %r8
movl %eax, %r9d
xorl %eax, %eax
callq 0xa106
movq 0x48(%rbx), %rax
movq (%rax,%rbp,8), %rbx
leaq 0x108(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x33a0
leaq 0xe8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x33a0
leaq 0x108(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
movq %rbx, %rdi
callq 0xddfe
leaq 0xe8(%rsp), %rdi
callq 0x3120
leaq 0x108(%rsp), %rdi
callq 0x3120
leaq 0xa8(%rsp), %rdi
callq 0x3120
leaq 0x40(%rsp), %rdi
callq 0x3120
leaq 0x20(%rsp), %rdi
callq 0x97f8
leaq 0x60(%rsp), %rdi
callq 0x3120
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38(%rbx), %rdi
movq 0x48(%rbx), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq 0xa551(%rip), %rdx      # 0x13635
xorl %eax, %eax
callq 0xa106
movq 0x13ece(%rip), %rdi     # 0x1cfc0
leaq 0xa55f(%rip), %rsi      # 0x13658
callq 0x3290
jmp 0x913a
movq 0x38(%rbx), %rdi
movq 0x48(%rbx), %rax
movq 0x10(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq 0xa43d(%rip), %rdx      # 0x1355d
xorl %eax, %eax
callq 0xa106
movq 0x13e92(%rip), %rdi     # 0x1cfc0
leaq 0xa43e(%rip), %rsi      # 0x13573
callq 0x3290
pushq $0x1
popq %rdi
callq 0x3350
movq 0x38(%rbx), %rdi
movq 0x48(%rbx), %rax
movq 0x10(%rsp), %rdx
movq (%rax,%rdx,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq 0xa388(%rip), %rdx      # 0x134ea
xorl %eax, %eax
callq 0xa106
movq 0x13e50(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xa313(%rip), %rsi      # 0x1348f
movq %rax, %rdi
callq 0x3290
movq 0x28(%rsp), %rsi
subq 0x20(%rsp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x31c0
movq %rax, %rdi
callq 0x3140
jmp 0x913a
movq 0x13e15(%rip), %rdi     # 0x1cfc0
callq 0x3140
leaq 0xa575(%rip), %rsi      # 0x1372c
movq %rax, %rdi
callq 0x3290
movq %rax, %rdi
callq 0x3140
movq 0x38(%rbx), %rdi
movq 0x48(%rbx), %rax
movq (%rax,%r12,8), %rax
movq 0x50(%rax), %rsi
addq $0x8, %rsi
leaq 0xa3fb(%rip), %rdx      # 0x135dd
xorl %eax, %eax
callq 0xa106
movq 0x13dd0(%rip), %rdi     # 0x1cfc0
leaq 0xa3ff(%rip), %rsi      # 0x135f6
callq 0x3290
jmp 0x913a
movq %rax, %rbx
leaq 0x1e8(%rsp), %rdi
callq 0x3120
jmp 0x9216
movq %rax, %rbx
leaq 0x208(%rsp), %rdi
jmp 0x9386
movq %rax, %rbx
leaq 0x1a8(%rsp), %rdi
callq 0x3120
jmp 0x9238
movq %rax, %rbx
leaq 0x1c8(%rsp), %rdi
jmp 0x9386
movq %rax, %rbx
leaq 0x228(%rsp), %rdi
jmp 0x9386
jmp 0x936a
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x3120
jmp 0x926f
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
jmp 0x9377
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
callq 0x3120
jmp 0x9291
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x934f
jmp 0x936f
jmp 0x9365
movq %rax, %rbx
leaq 0x188(%rsp), %rdi
jmp 0x9377
jmp 0x9365
movq %rax, %rbx
leaq 0x248(%rsp), %rdi
callq 0x3120
jmp 0x92d2
movq %rax, %rbx
leaq 0x268(%rsp), %rdi
jmp 0x9377
movq %rax, %rbx
leaq 0x2a8(%rsp), %rdi
callq 0x3120
jmp 0x9301
movq %rax, %rbx
leaq 0x288(%rsp), %rdi
jmp 0x9377
movq %rax, %rbx
leaq 0x2c8(%rsp), %rdi
jmp 0x9377
jmp 0x9365
jmp 0x9365
jmp 0x936a
jmp 0x931a
jmp 0x936a
movq %rax, %rbx
jmp 0x9331
movq %rax, %rbx
jmp 0x9354
jmp 0x9365
movq %rax, %rbx
leaq 0x168(%rsp), %rdi
callq 0x3120
leaq 0xc8(%rsp), %rdi
callq 0x3120
jmp 0x9347
jmp 0x936a
jmp 0x9365
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x3120
leaq 0xa8(%rsp), %rdi
callq 0x3120
jmp 0x9372
jmp 0x936f
movq %rax, %rbx
jmp 0x9398
movq %rax, %rbx
jmp 0x938b
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3120
jmp 0x9398
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3120
leaq 0x80(%rsp), %rdi
callq 0x9f26
leaq 0x20(%rsp), %rdi
callq 0x97f8
leaq 0x60(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3490