// File: /workspace/github_cpp_makefile_star2_O1/shuwenyue[P]MD_code_cell_list/main.cpp
// Function: main
int main () 
{
	// define parameters
	int NParticles; // number of particles in box
	double T; // temperature in reduced units
	double density; // density = Number of Particles / Volume of Box
	double cutoff; // maximum distance between any two particles where interaction energy is explicitly calculated
	double cellist; // algorithm that reduces calculation time from N2 to N
	double BoxLength;
	double tmax; // total run time
	double dt; // time step

	// set configuration parameters in reduced units 
	cout << "-------------------------------------------------------------------" << endl;
	cout << "Enter Parameters for 3D Lennard Jones Molecular Dynamics Simulation" << endl;
	cout << "(in reduced units)" << endl;
	cout << "-------------------------------------------------------------------" << endl;
	cout << "Number of Particles (only perfect cube numbers e.g. 512, 10648, 27000):";
	cin >> NParticles;
	cout << "Temperature (e.g. 1):";
	cin >> T;
	cout << "Density (e.g. 0.5):";
	cin >> density;
	cout << "Cutoff distance (e.g. 3):";
	cin >> cutoff;
	cout << "Run Time (e.g. 5 seconds):";
	cin >> tmax;
	cout << "Time Step (e.g. 0.005):";
	cin >> dt;
	cout << "Use cellist? (0 for NO, 1 for YES)";
	cin >> cellist;
	BoxLength = pow((NParticles/density), 1.0/3.0);
	cout << "BoxLength: " << BoxLength << endl;
	cout << "-------------------------------------------------------------------" << endl;

	// pre-assigned parameters
    /*T = 1.6; 
    NParticles = 512; 
	density = 0.7;
    cutoff = 3;
	BoxLength = pow((NParticles/density), 1.0/3.0);
	cellist = 1; // 0 for no cellist, 1 for cellist
	tmax = 1; // total run time
    dt = 0.005; // time step*/

	cout << "BoxLength: " << BoxLength << endl;
    
	double energy;
	double ETotal;
	double rtotal;

	// print to output file
    ofstream trajFile;
    trajFile.open("traj.xyz"); // trajectory file (position coordinates of every particle at every timestep, can view movie in VMD)
    ofstream logFile;
    logFile.open("test.log"); // output of temperature and energy at each timestep

	// clock (to calculate total run time of simulation)
	clock_t start, end;

	// define objects to use functions in other classes 
	particle particleObj;
	box boxObj;
	force forceObj;

	// initialize positions of particles on a lattice in a box and initialize velocities
    particleObj.initialize(BoxLength, NParticles, T, dt); 
	vector<double3> initial = particleObj.getpositionVector(); // save initial positions of particles

	// start clock
	start = clock();

	// print header for screen output
	cout << "-------------------------------------------------------------------" << endl;
	cout << endl;
	cout << "Timestep" << "          Temperature" << "         Energy" << endl;
	cout << endl;
	cout << "-------------------------------------------------------------------" << endl;

    for (double t = 0; t<tmax; t=t+dt)
    {

		// call getForce (no cellist) or getForcecellist (with cellist) to calculate forces on all particles (in matrix called forceVector) and return total energy from particle interactions
		if (cellist == 0)
		{
			energy = forceObj.getForce(NParticles, BoxLength, cutoff, density, particleObj.getpositionVector());
		}

		if (cellist == 1)
		{
			energy = forceObj.getForcecellist(t, NParticles, BoxLength, cutoff, density, particleObj.getpositionVector());
		}
    
        // access forceVector from force class and place in variable called forceV
		vector<double3> forceV = forceObj.getforceVector();

		// integrate forces using verlet algorithm and return total velocity^2 squared (to be used in Temperature and Energy calculation later)
		double totalV2 = particleObj.verlet(dt, NParticles, BoxLength, forceV);

		// velocity verlet algorithm
		//double totalV2 = particleObj.velocityverlet(NParticles, BoxLength, cutoff, density, dt, cellist, forceV);

		// temperature calculation using averaged velocity: velocity^2/NParticles
		T = totalV2 / (3*NParticles);

		// total energy calculating using total velocity^2 and energy using averaged velocity
		ETotal = (energy + 0.5*totalV2)/NParticles;

		// print to screen the (1) timestep, (2) temperature, (3) energy 
		cout << "Timestep: " << t << " ---  T: " << T << " ---  E: " << ETotal << endl;

		// print to output file the (1) timestep, (2) temperature, (3) energy 
		logFile << t << "  " << T << "  " << ETotal << endl;

		// print particle positions at every time step to trajectory xyz file 
		vector<double3> positionOutput = particleObj.getpositionVector();
		trajFile << NParticles << endl;
		trajFile << endl;
		for (int i = 0; i < NParticles; i++)
		{
			trajFile << "1 " << positionOutput[i].x << " " << positionOutput[i].y << " " << positionOutput[i].z << endl;
		}
    }

	end = clock();
	// print total CPU time from simulation
	cout << "CPU time: " << ((float)(end - start)/CLOCKS_PER_SEC) << endl;

	logFile.close();
	trajFile.close();

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5e8, %rsp            # imm = 0x5E8
movq 0x4bac(%rip), %rbx      # 0x6fd0
leaq 0x2c01(%rip), %r14      # 0x502c
movl $0x43, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x2c07(%rip), %rsi      # 0x5070
movl $0x43, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x2c10(%rip), %rsi      # 0x50b4
movl $0x12, %edx
movq %rbx, %rdi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0x43, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x2bb1(%rip), %rsi      # 0x50c7
movl $0x47, %edx
movq %rbx, %rdi
callq 0x2160
movq 0x4ab6(%rip), %r12      # 0x6fe0
leaq 0x4(%rsp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x20b0
leaq 0x2bce(%rip), %rsi      # 0x510f
movl $0x15, %edx
movq %rbx, %rdi
callq 0x2160
leaq 0x28(%rsp), %rsi
movq %r12, %rdi
callq 0x20c0
leaq 0x2bc3(%rip), %rsi      # 0x5125
movl $0x13, %edx
movq %rbx, %rdi
callq 0x2160
leaq 0x68(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x20c0
leaq 0x2bb3(%rip), %rsi      # 0x5139
movl $0x19, %edx
movq %rbx, %rdi
callq 0x2160
leaq 0x60(%rsp), %rsi
movq %r12, %rdi
callq 0x20c0
leaq 0x2bac(%rip), %rsi      # 0x5153
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x2160
leaq 0x50(%rsp), %rsi
movq %r12, %rdi
callq 0x20c0
leaq 0x2ba6(%rip), %rsi      # 0x516e
movl $0x17, %edx
movq %rbx, %rdi
callq 0x2160
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x20c0
leaq 0x2b9d(%rip), %rsi      # 0x5186
movl $0x22, %edx
movq %rbx, %rdi
callq 0x2160
leaq 0x58(%rsp), %rsi
movq %r12, %rdi
callq 0x20c0
cvtsi2sdl (%r15), %xmm0
divsd (%r13), %xmm0
movsd 0x29f2(%rip), %xmm1     # 0x5008
callq 0x21f0
movsd %xmm0, 0x18(%rsp)
leaq 0x2b81(%rip), %r15      # 0x51a9
movl $0xb, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2160
movq %rbx, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x21a0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0x43, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2160
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0xb, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2160
movq %rbx, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x21a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x3e8(%rsp), %rbx
movq %rbx, %rdi
callq 0x21d0
leaq 0x2aaf(%rip), %rsi      # 0x51b5
movq %rbx, %rdi
movl $0x10, %edx
callq 0x2040
leaq 0x1e8(%rsp), %rdi
callq 0x21d0
leaq 0x2a97(%rip), %rsi      # 0x51be
leaq 0x1e8(%rsp), %rdi
movl $0x10, %edx
callq 0x2040
xorpd %xmm0, %xmm0
leaq 0xf0(%rsp), %r14
movapd %xmm0, 0x50(%r14)
movapd %xmm0, 0x40(%r14)
movapd %xmm0, 0x30(%r14)
movapd %xmm0, 0x20(%r14)
movapd %xmm0, 0x10(%r14)
movapd %xmm0, (%r14)
leaq 0x158(%rsp), %rdi
movl $0x90, %edx
xorl %esi, %esi
callq 0x20a0
movl 0x4(%rsp), %esi
movsd 0x28(%rsp), %xmm1
movsd 0x30(%rsp), %xmm2
movq %r14, %rdi
movsd 0x18(%rsp), %xmm0
callq 0x3290
leaq 0xd8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x3e6a
callq 0x20d0
movq %rax, 0x88(%rsp)
movq 0x480d(%rip), %r14      # 0x6fd0
leaq 0x2862(%rip), %rsi      # 0x502c
movl $0x43, %edx
movq %r14, %rdi
callq 0x2160
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x47db(%rip), %r14      # 0x6fd0
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x47ad(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x4799(%rip), %rdi      # 0x6fd0
leaq 0x2989(%rip), %rsi      # 0x51c7
movl $0x8, %edx
callq 0x2160
movq 0x4781(%rip), %rdi      # 0x6fd0
leaq 0x297a(%rip), %rsi      # 0x51d0
movl $0x15, %edx
callq 0x2160
movq 0x4769(%rip), %r14      # 0x6fd0
leaq 0x2978(%rip), %rsi      # 0x51e6
movl $0xf, %edx
movq %r14, %rdi
callq 0x2160
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x4737(%rip), %r14      # 0x6fd0
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x4709(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x46f5(%rip), %r14      # 0x6fd0
leaq 0x274a(%rip), %rsi      # 0x502c
movl $0x43, %edx
movq %r14, %rdi
callq 0x2160
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq 0x46c3(%rip), %rdi      # 0x6fd0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movsd 0x50(%rsp), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x2e06
leaq 0x38(%rsp), %r12
leaq 0x28de(%rip), %r15      # 0x5218
leaq 0x28d5(%rip), %rbp      # 0x5216
xorpd %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0x58(%rsp), %xmm0
ucomisd 0x26c7(%rip), %xmm0     # 0x5020
jne 0x29e9
jp 0x29e9
movl 0x4(%rsp), %r14d
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x3e6a
leaq 0x158(%rsp), %rdi
movl %r14d, %esi
movsd 0x18(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
leaq 0xc0(%rsp), %rdx
callq 0x4038
movsd %xmm0, 0x10(%rsp)
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x29e4
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
leaq 0x38(%rsp), %r12
movsd 0x58(%rsp), %xmm0
ucomisd 0x2619(%rip), %xmm0     # 0x5010
jne 0x2a8d
jp 0x2a8d
movl 0x4(%rsp), %r14d
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
leaq 0xa8(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x3e6a
leaq 0x158(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
movl %r14d, %esi
movsd 0x18(%rsp), %xmm1
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm3
leaq 0xa8(%rsp), %rdx
callq 0x43ea
movsd %xmm0, 0x10(%rsp)
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x2a88
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
leaq 0x38(%rsp), %r12
movq %r12, %rdi
leaq 0x158(%rsp), %rsi
callq 0x4b4a
movsd 0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
movl 0x4(%rsp), %r14d
leaq 0x90(%rsp), %rdi
movq %r12, %rsi
callq 0x3122
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
leaq 0xf0(%rsp), %rdi
movsd 0x8(%rsp), %xmm0
movsd 0x18(%rsp), %xmm2
leaq 0x90(%rsp), %rsi
callq 0x3660
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x2b10
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
movsd %xmm0, 0x8(%rsp)
callq 0x2150
movsd 0x8(%rsp), %xmm0
movl 0x4(%rsp), %r12d
leal (%r12,%r12,2), %eax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
movapd %xmm0, %xmm1
divsd %xmm2, %xmm1
movsd %xmm1, 0x28(%rsp)
mulsd 0x24e2(%rip), %xmm0     # 0x5018
movsd %xmm0, 0x8(%rsp)
movl $0xa, %edx
movq 0x4488(%rip), %rdi      # 0x6fd0
leaq 0x26a7(%rip), %rsi      # 0x51f6
callq 0x2160
movq 0x4475(%rip), %rdi      # 0x6fd0
movsd 0x20(%rsp), %xmm0
callq 0x21a0
movq %rax, %r14
movl $0x9, %edx
movq %rax, %rdi
leaq 0x2689(%rip), %rsi      # 0x5201
callq 0x2160
movsd 0x28(%rsp), %xmm0
movq %r14, %rdi
callq 0x21a0
movq %rax, %r14
movl $0x9, %edx
movq %rax, %rdi
leaq 0x266e(%rip), %rsi      # 0x520b
callq 0x2160
movsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r12d, %xmm1
divsd %xmm1, %xmm0
movq %r14, %rdi
movsd %xmm0, 0x8(%rsp)
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x1e8(%rsp), %rdi
movsd 0x20(%rsp), %xmm0
callq 0x21a0
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x25fe(%rip), %rsi      # 0x5215
callq 0x2160
movsd 0x28(%rsp), %xmm0
movq %r14, %rdi
callq 0x21a0
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x25d9(%rip), %rsi      # 0x5215
callq 0x2160
movq %r14, %rdi
movsd 0x8(%rsp), %xmm0
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x70(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x3e6a
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x21e0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x3e8(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
cmpl $0x0, 0x4(%rsp)
jle 0x2dae
xorl %r13d, %r13d
xorl %r12d, %r12d
movl $0x2, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2160
movq 0x70(%rsp), %rax
movsd (%rax,%r13), %xmm0
movq %rbx, %rdi
callq 0x21a0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2160
movq 0x70(%rsp), %rax
movsd 0x8(%rax,%r13), %xmm0
movq %r14, %rdi
callq 0x21a0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2160
movq 0x70(%rsp), %rax
movsd 0x10(%rax,%r13), %xmm0
movq %r14, %rdi
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
incq %r12
movslq 0x4(%rsp), %rax
addq $0x18, %r13
cmpq %rax, %r12
jl 0x2cfe
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x2dc8
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x2ddf
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movsd 0x20(%rsp), %xmm1
addsd 0x30(%rsp), %xmm1
movsd 0x50(%rsp), %xmm0
movsd %xmm1, 0x20(%rsp)
ucomisd %xmm1, %xmm0
leaq 0x38(%rsp), %r12
ja 0x294b
callq 0x20d0
movq %rax, %rbx
movq 0x41bb(%rip), %rdi      # 0x6fd0
leaq 0x23ff(%rip), %rsi      # 0x521b
movl $0xa, %edx
callq 0x2160
subq 0x88(%rsp), %rbx
xorps %xmm0, %xmm0
cvtsi2ss %rbx, %xmm0
divss 0x21ea(%rip), %xmm0     # 0x5028
cvtss2sd %xmm0, %xmm0
movq 0x4187(%rip), %rdi      # 0x6fd0
callq 0x21a0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x1e8(%rsp), %r14
movq %r14, %rdi
callq 0x2170
leaq 0x3e8(%rsp), %rbx
movq %rbx, %rdi
callq 0x2170
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x2eb5
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x1d0(%rsp), %rdi
testq %rdi, %rdi
je 0x2ed2
movq 0x1e0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x1b8(%rsp), %rdi
testq %rdi, %rdi
je 0x2eef
movq 0x1c8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x1a0(%rsp), %rdi
testq %rdi, %rdi
je 0x2f0c
movq 0x1b0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x188(%rsp), %rdi
testq %rdi, %rdi
je 0x2f29
movq 0x198(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x158(%rsp), %rdi
testq %rdi, %rdi
je 0x2f46
movq 0x168(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x2f63
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x2f80
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x2f9d
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x4024(%rip), %rax      # 0x6fc8
movq (%rax), %r15
movq 0x18(%rax), %r12
leaq 0x1f0(%rsp), %rdi
movq %r15, -0x8(%rdi)
movq -0x18(%r15), %rax
movq %r12, 0x1e8(%rsp,%rax)
callq 0x2110
movl $0xf8, %r13d
addq %r13, %r14
movq %r14, %rdi
callq 0x2060
leaq 0x3f0(%rsp), %rdi
movq %r15, -0x8(%rdi)
movq -0x18(%r15), %rax
movq %r12, 0x3e8(%rsp,%rax)
callq 0x2110
addq %r13, %rbx
movq %rbx, %rdi
callq 0x2060
xorl %eax, %eax
addq $0x5e8, %rsp            # imm = 0x5E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3017
movq %rax, %rbx
jmp 0x30e6
movq %rax, %rbx
jmp 0x3100
jmp 0x3029
movq %rax, %rbx
jmp 0x310d
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x30c9
movq 0xb8(%rsp), %rsi
jmp 0x30c1
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x30c9
movq 0xd0(%rsp), %rsi
jmp 0x30c1
jmp 0x3090
jmp 0x3089
movq %rax, %rbx
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x30b2
movq 0xa0(%rsp), %rsi
jmp 0x30aa
jmp 0x3089
movq %rax, %rbx
jmp 0x30c9
jmp 0x3095
movq %rax, %rbx
jmp 0x30b2
movq %rax, %rbx
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x30b2
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x30c9
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x30e6
movq 0xe8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2150
leaq 0x158(%rsp), %rdi
callq 0x31b2
leaq 0xf0(%rsp), %rdi
callq 0x3224
leaq 0x1e8(%rsp), %rdi
callq 0x2180
leaq 0x3e8(%rsp), %rdi
callq 0x2180
movq %rbx, %rdi
callq 0x2200