// File: uclaopt[P]AsyncQVI/src/test.cc
// Function: main
int main(int argc, char** argv){
	
	/* Step 0: load parameters from makefile.(defined in util.h) */
	Params params;
	parse_input_argv(&params, argc, argv);
	params.time = get_wall_time(); 
	cout<<"iter time reward flag"<<endl;
	
	/* Step 1: choose an algorithm in makefile 
	   -algo 0 is AsyncQVI, 
	         1 is Qlearning,
			 2 is VRVI 
			 3 is VRQVI  */
	
	// policy vector
	std::vector<int> pi(params.len_state, 0.);
	pthread_barrier_init(&barrier, &attr, params.total_num_threads);
	
	 if(params.algo == 0){ // run AsyncQVI
		// state value, V[i] = max_a Q(i,a)
		std::vector<double> V(params.len_state, 0.); 
		
		// QVI object (defined in algo.h)
		QVI obj(&V, &pi, &params);
		
		// launch parallel threads
		std::vector<std::thread> mythreads;
		for (size_t i = 0; i < params.total_num_threads; i++) {
			mythreads.push_back(std::thread(asyncQVI, i, obj, &params));
		} 
		for (size_t i = 0; i < params.total_num_threads; i++) {
			mythreads[i].join();
		}
	}
	
	else if(params.algo == 1){ // run Async Q-learning
		// Q value
		std::vector<std::vector<double>> Q(params.len_state, std::vector<double>(params.len_action, 0.));
		// state value, V[i] = max_a Q(i,a)
		std::vector<double> V(params.len_state);
		
		// Qlearning object (defined in algo.h)
		Qlearning obj(&Q, &V, &pi, &params);
		
		// launch parallel threads
		std::vector<std::thread> mythreads;
		for (size_t i = 0; i < params.total_num_threads; i++) {
			mythreads.push_back(std::thread(asyncQL, i, obj, &params));
		} 
		for (size_t i = 0; i < params.total_num_threads; i++) {
			mythreads[i].join();
		}
	}
	
	else if(params.algo == 2){ // run VRVI: Variance Reduced Value Iteration..., Sidford et al. 2018
		// \tilde{x} in Alg.8 
		std::vector<std::vector<double>> x(params.len_state, std::vector<double>(params.len_action, 0.));
		// v_k in Alg.9
		std::vector<double> v_outer(params.len_state, 0.);
		// v_t in Alg.8
		std::vector<double> v_inner(params.len_state, 0.);
		
		// VRVI object (defined in algo.h)
		VRVI obj(&x, &v_outer, &v_inner, &pi, &params); 
		obj.solve();
	}
	
	else{ // run VRQVI: Near-Optimal Time and Sample Complexities..., Sidford et al. 2018
		// Q, w in Alg.1
		std::vector<std::vector<double>> Q(params.len_state, std::vector<double>(params.len_action, 0.));
		std::vector<std::vector<double>> w(params.len_state, std::vector<double>(params.len_action, 0.));		
		// v^i in Alg.2
		std::vector<double> v_outer(params.len_state, 0.);
		// v^i in Alg.1
		std::vector<double> v_inner(params.len_state, 0.);
		
		// VRQVI object (defined in algo.h)
		VRQVI obj(&Q, &w, &v_outer, &v_inner, &pi, &params); 
		obj.solve();
	}
	
	// Step 2: save results
	if(params.save){
		std::ofstream outFile("policy.txt");
		for (int i = 0; i < params.len_state; i++){
			outFile << pi[i] << "\n";
		}
		outFile.close();
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5a20, %rsp           # imm = 0x5A20
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x98(%rbp), %rdi
movq %rdi, -0x5930(%rbp)
callq 0x5690
movq -0x5930(%rbp), %rdi
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
callq 0x25a0
callq 0x3860
movsd %xmm0, -0x20(%rbp)
movq 0xf2c8(%rip), %rdi      # 0x12fd8
leaq 0x94e8(%rip), %rsi      # 0xd1ff
callq 0x21d0
movq %rax, %rdi
movq 0xf29a(%rip), %rsi      # 0x12fc0
callq 0x2200
movslq -0x98(%rbp), %rax
movq %rax, -0x5928(%rbp)
movl $0x0, -0xb4(%rbp)
leaq -0xb5(%rbp), %rdi
movq %rdi, -0x5920(%rbp)
callq 0x5740
movq -0x5928(%rbp), %rsi
movq -0x5920(%rbp), %rcx
leaq -0xb0(%rbp), %rdi
leaq -0xb4(%rbp), %rdx
callq 0x5760
jmp 0x3d79
leaq -0xb5(%rbp), %rdi
callq 0x57e0
movl -0x68(%rbp), %edx
leaq 0x10821(%rip), %rdi     # 0x145b0
leaq 0x10862(%rip), %rsi     # 0x145f8
callq 0x2330
cmpl $0x0, -0x70(%rbp)
jne 0x3fda
movslq -0x98(%rbp), %rax
movq %rax, -0x5940(%rbp)
movq $0x0, -0xe8(%rbp)
leaq -0xe9(%rbp), %rdi
movq %rdi, -0x5938(%rbp)
callq 0x5800
movq -0x5940(%rbp), %rsi
movq -0x5938(%rbp), %rcx
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rdx
callq 0x5820
jmp 0x3df4
leaq -0xe9(%rbp), %rdi
callq 0x58a0
leaq -0x15e0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x58c0
jmp 0x3e23
leaq -0x15f8(%rbp), %rdi
callq 0x5940
movq $0x0, -0x1600(%rbp)
movq -0x1600(%rbp), %rax
movslq -0x68(%rbp), %rcx
cmpq %rcx, %rax
jae 0x3f52
leaq -0x98(%rbp), %rax
movq %rax, -0x1610(%rbp)
leaq -0x3a3(%rip), %rsi      # 0x3ac0
leaq -0x1608(%rbp), %rdi
leaq -0x1600(%rbp), %rdx
leaq -0x15e0(%rbp), %rcx
leaq -0x1610(%rbp), %r8
callq 0x5990
jmp 0x3e86
leaq -0x15f8(%rbp), %rdi
leaq -0x1608(%rbp), %rsi
callq 0x5960
jmp 0x3e9b
leaq -0x1608(%rbp), %rdi
callq 0x5a60
movq -0x1600(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1600(%rbp)
jmp 0x3e3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0xb5(%rbp), %rdi
callq 0x57e0
jmp 0x4a88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0xe9(%rbp), %rdi
callq 0x58a0
jmp 0x4a7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x3fc9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x3fbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x1608(%rbp), %rdi
callq 0x5a60
jmp 0x3fbd
movq $0x0, -0x1618(%rbp)
movq -0x1618(%rbp), %rax
movslq -0x68(%rbp), %rcx
cmpq %rcx, %rax
jae 0x3fa0
movq -0x1618(%rbp), %rsi
leaq -0x15f8(%rbp), %rdi
callq 0x5a90
movq %rax, %rdi
callq 0x2370
jmp 0x3f8a
jmp 0x3f8c
movq -0x1618(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1618(%rbp)
jmp 0x3f5d
leaq -0x15f8(%rbp), %rdi
callq 0x5ab0
leaq -0xe0(%rbp), %rdi
callq 0x5b10
jmp 0x497d
leaq -0x15f8(%rbp), %rdi
callq 0x5ab0
leaq -0xe0(%rbp), %rdi
callq 0x5b10
jmp 0x4a7c
cmpl $0x1, -0x70(%rbp)
jne 0x4309
movslq -0x98(%rbp), %rax
movq %rax, -0x5958(%rbp)
movslq -0x94(%rbp), %rax
movq %rax, -0x5950(%rbp)
movq $0x0, -0x1650(%rbp)
leaq -0x1651(%rbp), %rdi
movq %rdi, -0x5948(%rbp)
callq 0x5800
movq -0x5950(%rbp), %rsi
movq -0x5948(%rbp), %rcx
leaq -0x1648(%rbp), %rdi
leaq -0x1650(%rbp), %rdx
callq 0x5820
jmp 0x4041
leaq -0x1652(%rbp), %rdi
movq %rdi, -0x5960(%rbp)
callq 0x5b70
movq -0x5958(%rbp), %rsi
movq -0x5960(%rbp), %rcx
leaq -0x1630(%rbp), %rdi
leaq -0x1648(%rbp), %rdx
callq 0x5b90
jmp 0x4077
leaq -0x1652(%rbp), %rdi
callq 0x5c10
leaq -0x1648(%rbp), %rdi
callq 0x5b10
leaq -0x1651(%rbp), %rdi
callq 0x58a0
movslq -0x98(%rbp), %rax
movq %rax, -0x5970(%rbp)
leaq -0x1671(%rbp), %rdi
movq %rdi, -0x5968(%rbp)
callq 0x5800
movq -0x5970(%rbp), %rsi
movq -0x5968(%rbp), %rdx
leaq -0x1670(%rbp), %rdi
callq 0x5c30
jmp 0x40d8
leaq -0x1671(%rbp), %rdi
callq 0x58a0
leaq -0x2b68(%rbp), %rdi
leaq -0x1630(%rbp), %rsi
leaq -0x1670(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
leaq -0x98(%rbp), %r8
callq 0x5ca0
jmp 0x410e
leaq -0x2b80(%rbp), %rdi
callq 0x5940
movq $0x0, -0x2b88(%rbp)
movq -0x2b88(%rbp), %rax
movslq -0x68(%rbp), %rcx
cmpq %rcx, %rax
jae 0x4269
leaq -0x98(%rbp), %rax
movq %rax, -0x2b98(%rbp)
leaq -0x58e(%rip), %rsi      # 0x3bc0
leaq -0x2b90(%rbp), %rdi
leaq -0x2b88(%rbp), %rdx
leaq -0x2b68(%rbp), %rcx
leaq -0x2b98(%rbp), %r8
callq 0x5d40
jmp 0x4171
leaq -0x2b80(%rbp), %rdi
leaq -0x2b90(%rbp), %rsi
callq 0x5960
jmp 0x4186
leaq -0x2b90(%rbp), %rdi
callq 0x5a60
movq -0x2b88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2b88(%rbp)
jmp 0x4125
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x41e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x1652(%rbp), %rdi
callq 0x5c10
leaq -0x1648(%rbp), %rdi
callq 0x5b10
leaq -0x1651(%rbp), %rdi
callq 0x58a0
jmp 0x4a7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x1671(%rbp), %rdi
callq 0x58a0
jmp 0x42f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x42ec
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x42e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x2b90(%rbp), %rdi
callq 0x5a60
jmp 0x42e0
movq $0x0, -0x2ba0(%rbp)
movq -0x2ba0(%rbp), %rax
movslq -0x68(%rbp), %rcx
cmpq %rcx, %rax
jae 0x42b7
movq -0x2ba0(%rbp), %rsi
leaq -0x2b80(%rbp), %rdi
callq 0x5a90
movq %rax, %rdi
callq 0x2370
jmp 0x42a1
jmp 0x42a3
movq -0x2ba0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x2ba0(%rbp)
jmp 0x4274
leaq -0x2b80(%rbp), %rdi
callq 0x5ab0
leaq -0x1670(%rbp), %rdi
callq 0x5b10
leaq -0x1630(%rbp), %rdi
callq 0x5e10
jmp 0x497b
leaq -0x2b80(%rbp), %rdi
callq 0x5ab0
leaq -0x1670(%rbp), %rdi
callq 0x5b10
leaq -0x1630(%rbp), %rdi
callq 0x5e10
jmp 0x4a7c
cmpl $0x2, -0x70(%rbp)
jne 0x45b2
movslq -0x98(%rbp), %rax
movq %rax, -0x5988(%rbp)
movslq -0x94(%rbp), %rax
movq %rax, -0x5980(%rbp)
movq $0x0, -0x2bd8(%rbp)
leaq -0x2bd9(%rbp), %rdi
movq %rdi, -0x5978(%rbp)
callq 0x5800
movq -0x5980(%rbp), %rsi
movq -0x5978(%rbp), %rcx
leaq -0x2bd0(%rbp), %rdi
leaq -0x2bd8(%rbp), %rdx
callq 0x5820
jmp 0x4370
leaq -0x2bda(%rbp), %rdi
movq %rdi, -0x5990(%rbp)
callq 0x5b70
movq -0x5988(%rbp), %rsi
movq -0x5990(%rbp), %rcx
leaq -0x2bb8(%rbp), %rdi
leaq -0x2bd0(%rbp), %rdx
callq 0x5b90
jmp 0x43a6
leaq -0x2bda(%rbp), %rdi
callq 0x5c10
leaq -0x2bd0(%rbp), %rdi
callq 0x5b10
leaq -0x2bd9(%rbp), %rdi
callq 0x58a0
movslq -0x98(%rbp), %rax
movq %rax, -0x59a0(%rbp)
movq $0x0, -0x2c00(%rbp)
leaq -0x2c01(%rbp), %rdi
movq %rdi, -0x5998(%rbp)
callq 0x5800
movq -0x59a0(%rbp), %rsi
movq -0x5998(%rbp), %rcx
leaq -0x2bf8(%rbp), %rdi
leaq -0x2c00(%rbp), %rdx
callq 0x5820
jmp 0x4419
leaq -0x2c01(%rbp), %rdi
callq 0x58a0
movslq -0x98(%rbp), %rax
movq %rax, -0x59b0(%rbp)
movq $0x0, -0x2c28(%rbp)
leaq -0x2c29(%rbp), %rdi
movq %rdi, -0x59a8(%rbp)
callq 0x5800
movq -0x59b0(%rbp), %rsi
movq -0x59a8(%rbp), %rcx
leaq -0x2c20(%rbp), %rdi
leaq -0x2c28(%rbp), %rdx
callq 0x5820
jmp 0x4474
leaq -0x2c29(%rbp), %rdi
callq 0x58a0
leaq -0x4130(%rbp), %rdi
leaq -0x2bb8(%rbp), %rsi
leaq -0x2bf8(%rbp), %rdx
leaq -0x2c20(%rbp), %rcx
leaq -0xb0(%rbp), %r8
leaq -0x98(%rbp), %r9
callq 0x5e70
jmp 0x44b1
leaq -0x4130(%rbp), %rdi
callq 0x5f20
jmp 0x44bf
leaq -0x2c20(%rbp), %rdi
callq 0x5b10
leaq -0x2bf8(%rbp), %rdi
callq 0x5b10
leaq -0x2bb8(%rbp), %rdi
callq 0x5e10
jmp 0x4979
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x4526
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x2bda(%rbp), %rdi
callq 0x5c10
leaq -0x2bd0(%rbp), %rdi
callq 0x5b10
leaq -0x2bd9(%rbp), %rdi
callq 0x58a0
jmp 0x4a7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x2c01(%rbp), %rdi
callq 0x58a0
jmp 0x45a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x2c29(%rbp), %rdi
callq 0x58a0
jmp 0x4595
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x2c20(%rbp), %rdi
callq 0x5b10
leaq -0x2bf8(%rbp), %rdi
callq 0x5b10
leaq -0x2bb8(%rbp), %rdi
callq 0x5e10
jmp 0x4a7c
movslq -0x98(%rbp), %rax
movq %rax, -0x59c8(%rbp)
movslq -0x94(%rbp), %rax
movq %rax, -0x59c0(%rbp)
movq $0x0, -0x4168(%rbp)
leaq -0x4169(%rbp), %rdi
movq %rdi, -0x59b8(%rbp)
callq 0x5800
movq -0x59c0(%rbp), %rsi
movq -0x59b8(%rbp), %rcx
leaq -0x4160(%rbp), %rdi
leaq -0x4168(%rbp), %rdx
callq 0x5820
jmp 0x460f
leaq -0x416a(%rbp), %rdi
movq %rdi, -0x59d0(%rbp)
callq 0x5b70
movq -0x59c8(%rbp), %rsi
movq -0x59d0(%rbp), %rcx
leaq -0x4148(%rbp), %rdi
leaq -0x4160(%rbp), %rdx
callq 0x5b90
jmp 0x4645
leaq -0x416a(%rbp), %rdi
callq 0x5c10
leaq -0x4160(%rbp), %rdi
callq 0x5b10
leaq -0x4169(%rbp), %rdi
callq 0x58a0
movslq -0x98(%rbp), %rax
movq %rax, -0x59e8(%rbp)
movslq -0x94(%rbp), %rax
movq %rax, -0x59e0(%rbp)
movq $0x0, -0x41a8(%rbp)
leaq -0x41a9(%rbp), %rdi
movq %rdi, -0x59d8(%rbp)
callq 0x5800
movq -0x59e0(%rbp), %rsi
movq -0x59d8(%rbp), %rcx
leaq -0x41a0(%rbp), %rdi
leaq -0x41a8(%rbp), %rdx
callq 0x5820
jmp 0x46c6
leaq -0x41aa(%rbp), %rdi
movq %rdi, -0x59f0(%rbp)
callq 0x5b70
movq -0x59e8(%rbp), %rsi
movq -0x59f0(%rbp), %rcx
leaq -0x4188(%rbp), %rdi
leaq -0x41a0(%rbp), %rdx
callq 0x5b90
jmp 0x46fc
leaq -0x41aa(%rbp), %rdi
callq 0x5c10
leaq -0x41a0(%rbp), %rdi
callq 0x5b10
leaq -0x41a9(%rbp), %rdi
callq 0x58a0
movslq -0x98(%rbp), %rax
movq %rax, -0x5a00(%rbp)
movq $0x0, -0x41d0(%rbp)
leaq -0x41d1(%rbp), %rdi
movq %rdi, -0x59f8(%rbp)
callq 0x5800
movq -0x5a00(%rbp), %rsi
movq -0x59f8(%rbp), %rcx
leaq -0x41c8(%rbp), %rdi
leaq -0x41d0(%rbp), %rdx
callq 0x5820
jmp 0x476f
leaq -0x41d1(%rbp), %rdi
callq 0x58a0
movslq -0x98(%rbp), %rax
movq %rax, -0x5a10(%rbp)
movq $0x0, -0x41f8(%rbp)
leaq -0x41f9(%rbp), %rdi
movq %rdi, -0x5a08(%rbp)
callq 0x5800
movq -0x5a10(%rbp), %rsi
movq -0x5a08(%rbp), %rcx
leaq -0x41f0(%rbp), %rdi
leaq -0x41f8(%rbp), %rdx
callq 0x5820
jmp 0x47ca
leaq -0x41f9(%rbp), %rdi
callq 0x58a0
movq %rsp, %rax
leaq -0x98(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x5710(%rbp), %rdi
leaq -0x4148(%rbp), %rsi
leaq -0x4188(%rbp), %rdx
leaq -0x41c8(%rbp), %rcx
leaq -0x41f0(%rbp), %r8
leaq -0xb0(%rbp), %r9
callq 0x63e0
jmp 0x4814
leaq -0x5710(%rbp), %rdi
callq 0x64a0
jmp 0x4822
leaq -0x41f0(%rbp), %rdi
callq 0x5b10
leaq -0x41c8(%rbp), %rdi
callq 0x5b10
leaq -0x4188(%rbp), %rdi
callq 0x5e10
leaq -0x4148(%rbp), %rdi
callq 0x5e10
jmp 0x4979
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x4895
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x416a(%rbp), %rdi
callq 0x5c10
leaq -0x4160(%rbp), %rdi
callq 0x5b10
leaq -0x4169(%rbp), %rdi
callq 0x58a0
jmp 0x4a7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x48e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x41aa(%rbp), %rdi
callq 0x5c10
leaq -0x41a0(%rbp), %rdi
callq 0x5b10
leaq -0x41a9(%rbp), %rdi
callq 0x58a0
jmp 0x4968
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x41d1(%rbp), %rdi
callq 0x58a0
jmp 0x495c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x41f9(%rbp), %rdi
callq 0x58a0
jmp 0x4950
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x41f0(%rbp), %rdi
callq 0x5b10
leaq -0x41c8(%rbp), %rdi
callq 0x5b10
leaq -0x4188(%rbp), %rdi
callq 0x5e10
leaq -0x4148(%rbp), %rdi
callq 0x5e10
jmp 0x4a7c
jmp 0x497b
jmp 0x497d
cmpl $0x0, -0x30(%rbp)
je 0x4a5d
leaq 0x8887(%rip), %rsi      # 0xd215
leaq -0x5910(%rbp), %rdi
movl $0x10, %edx
callq 0x2230
jmp 0x49a1
movl $0x0, -0x5914(%rbp)
movl -0x5914(%rbp), %eax
cmpl -0x98(%rbp), %eax
jge 0x4a43
movslq -0x5914(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x4e40
movl (%rax), %esi
leaq -0x5910(%rbp), %rdi
callq 0x2380
movq %rax, -0x5a18(%rbp)
jmp 0x49e7
movq -0x5a18(%rbp), %rdi
leaq 0x882b(%rip), %rsi      # 0xd220
callq 0x21d0
jmp 0x49fc
jmp 0x49fe
movl -0x5914(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5914(%rbp)
jmp 0x49ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
jmp 0x4a7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xc0(%rbp)
movl %eax, -0xc4(%rbp)
leaq -0x5910(%rbp), %rdi
callq 0x22e0
jmp 0x4a7c
leaq -0x5910(%rbp), %rdi
callq 0x22b0
jmp 0x4a51
leaq -0x5910(%rbp), %rdi
callq 0x22e0
movl $0x0, -0x4(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x6e50
movl -0x4(%rbp), %eax
addq $0x5a20, %rsp           # imm = 0x5A20
popq %rbp
retq
leaq -0xb0(%rbp), %rdi
callq 0x6e50
movq -0xc0(%rbp), %rdi
callq 0x23a0
nopw %cs:(%rax,%rax)
nop