// File: TBody[P]atomicpp/Prad.cpp
// Function: main
int main(){
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//Setup the atomicpp::ImpuritySpecies object
	const std::string expt_results_json="sd1d-case-05.json";
	std::string impurity_symbol="c";
	std::string hydrogen_symbol="h";

	atomicpp::ImpuritySpecies impurity(impurity_symbol);
	atomicpp::ImpuritySpecies hydrogen(hydrogen_symbol);

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Process the expt_results_json to extract
	// 	density(s) 					= electron density (in m^-3)
	// 	temperature(s)				= electron/ion temperature (in eV)
	// 	neutral_fraction(s)			= neutral density/electron density (no units)
	// where s is 1D distance index. Time is already contracted (using final time-step)
	// Second argument is impurity fraction
	atomicpp::SD1DData experiment(expt_results_json, 1e-2);
	// N.b. This is only for training the data

	//Cast the SD1D data into a form which is like how the function will be called by SD1D
	//This is all not required for SD1D -- it's just to train the code with reasonable numbers
		// const double mz = impurity.get_mass(); //amu

		int constant_position_index = 0;
		double Te = experiment.get_temperature()[constant_position_index];
		double Ne = experiment.get_density()[constant_position_index];
		double Vi = 3.10080599e-01 * 69205.6142373; //Picked random values from SD1D output. Using rho_s0 * Omega_ci to normalise (probably wrong!!)
		double Vn = 1.32440666e-01 * 69205.6142373; //Picked random values from SD1D output. Using rho_s0 * Omega_ci to normalise (probably wrong!!)
		double neutral_fraction = experiment.get_neutral_fraction()[constant_position_index];
		double Nn = Ne * neutral_fraction;
		
		double Nz = experiment.get_impurity_density()[constant_position_index];
		// Compute the iz-stage-distribution to create the Nzk (charged-resolved impurity) density std::vector
		std::vector<double> iz_stage_distribution = computeIonisationDistribution(impurity, Te, Ne, Nz, Nn);
		std::vector<double> Nzk(impurity.get_atomic_number()+1);
		for(int k=0; k<=impurity.get_atomic_number(); ++k){
			// Use the plasma temperature, and then add a scaling based on the charge so that there's different velocities for each charge
			// (so that momentum transfer results in an observable effect)
			Nzk[k] = Nz * iz_stage_distribution[k];
			// std::printf("Nzk^%d: %e \n", k, Nzk[k]); //To train python data
		}
		std::vector<double> Vzk(impurity.get_atomic_number()+1);
		for(int k=0; k<=impurity.get_atomic_number(); ++k){
			Vzk[k] = Vi;
			// sqrt(2 * Te * eV_to_J / (mz * amu_to_kg));
			// std::printf("Vz_i^(%i):  %+.2e [m/s]\n",k ,Vzk[k]);
		}

		std::vector<double> Nhk(hydrogen.get_atomic_number()+1);
		Nhk[0] = Nn;
		Nhk[1] = Ne;
		std::vector<double> Vhk(hydrogen.get_atomic_number()+1);
		for(int k=0; k<=hydrogen.get_atomic_number(); ++k){
			Vhk[k] = Vi;
		}
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Time dependant solver code
	
	atomicpp::RateEquations impurity_derivatives(impurity); //Organised as a atomicpp::RateEquations object for cleanliness
	impurity_derivatives.setThresholdDensity(0); //Density threshold - ignore ionisation stages which don't have at least this density
	impurity_derivatives.setDominantIonMass(1.0); //Dominant ion mass in amu, for the stopping time calculation

	atomicpp::DerivStruct derivative_struct = impurity_derivatives.computeDerivs(50, 1e19, Vi, Nn, Vn, Nzk, Vzk);
	// double Pcool             = derivative_struct.Pcool;
	// double Prad              = derivative_struct.Prad;
	// std::vector<double> dNzk = derivative_struct.dNzk;
	// std::vector<double> F_zk = derivative_struct.F_zk;
	// double dNe               = derivative_struct.dNe;
	// double F_i               = derivative_struct.F_i;
	// double dNn               = derivative_struct.dNn;
	// double F_n               = derivative_struct.F_n;
	
	std::printf("\nDerivatives for %s\n",impurity.get_name().c_str());
	impurity_derivatives.printDerivativeStruct(derivative_struct);

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// atomicpp::RateEquations hydrogen_derivatives(hydrogen); //Organised as a atomicpp::RateEquations object for cleanliness
	// hydrogen_derivatives.setThresholdDensity(0.0); //Density threshold - ignore ionisation stages which don't have at least this density

	// atomicpp::DerivStruct derivative_struct_H = hydrogen_derivatives.computeDerivsHydrogen(6309.573445, 1e19, Nhk, Vhk);
	
	// std::printf("\nDerivatives for %s\n",hydrogen.get_name().c_str());
	// hydrogen_derivatives.printDerivativeStruct(derivative_struct_H);

	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


	// Comparison to Post PSI
	// Ne = 1e18;
	// Te = 6;
	// Nn = 0;
	// total_power = computeRadiatedPower(impurity, Te, Ne, Nz, Nn);
	// std::cout << "Comparison to PSI paper:" << total_power << "W/m3" << std::endl;
	// std::cout << "Comparison to PSI paper:" << total_power/(Nz*Ne) << "Wm3" << std::endl;


	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// std::pair<int, double> Te_interp, Ne_interp;
	// Te_interp = findSharedInterpolation(impurity.get_rate_coefficient("blank")->get_log_temp(), Te);
	// Ne_interp = findSharedInterpolation(impurity.get_rate_coefficient("blank")->get_log_dens(), Ne);

	// int Z = impurity.get_atomic_number();
	// const double eV_to_J = 1.60217662e-19; //J per eV

	// if (impurity.get_has_charge_exchange()){
	// 	std::vector<double> dNn_from_stage(impurity.get_atomic_number(), 0.0);
	// 	std::vector<double>   cx_rec_to_below(Z+1, 0.0);
	// 	std::vector<double> cx_rec_from_above(Z+1, 0.0);

	// 	std::shared_ptr<atomicpp::RateCoefficient> cx_recombination_coefficient = impurity.get_rate_coefficient("cx_rec");
	// 	std::shared_ptr<atomicpp::RateCoefficient> cx_power_coefficient = impurity.get_rate_coefficient("cx_power");

	// 	for(int k=0; k < Z; ++k){//N.b. iterating over all data indicies of the rate coefficient, hence the <
	// 		// m^-3 s^-1
	// 		double cx_recombination_coefficient_evaluated = cx_recombination_coefficient->call0D(k, Te_interp, Ne_interp);
	// 		double cx_recombination_rate = cx_recombination_coefficient_evaluated * Nn * Nzk[k+1];

	// 		// W m^-3
	// 		double cx_power_coefficient_evaluated = cx_power_coefficient->call0D(k, Te_interp, Ne_interp);
	// 		double cx_power_rate = cx_power_coefficient_evaluated * Nn * Nzk[k+1] / eV_to_J;

	// 		std::printf("cx: %e [m^-3 s^-1], cx_power: %e [eV m^-3 s^-1], per transition: %e [eV] \n", cx_recombination_rate, cx_power_rate, cx_power_rate/cx_recombination_rate);
	// 	}
	// }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x620, %rsp            # imm = 0x620
movl $0x0, -0x4(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x518(%rbp)
callq 0x45f0
movq -0x518(%rbp), %rdx
leaq 0x31189(%rip), %rsi     # 0x36049
leaq -0x28(%rbp), %rdi
callq 0x44d0
jmp 0x4ecb
leaq -0x29(%rbp), %rdi
callq 0x4410
leaq -0x61(%rbp), %rdi
movq %rdi, -0x520(%rbp)
callq 0x45f0
movq -0x520(%rbp), %rdx
leaq 0x32a3c(%rip), %rsi     # 0x3792e
leaq -0x60(%rbp), %rdi
callq 0x44d0
jmp 0x4efd
leaq -0x61(%rbp), %rdi
callq 0x4410
leaq -0x89(%rbp), %rdi
movq %rdi, -0x528(%rbp)
callq 0x45f0
movq -0x528(%rbp), %rdx
leaq 0x31134(%rip), %rsi     # 0x3605b
leaq -0x88(%rbp), %rdi
callq 0x44d0
jmp 0x4f35
leaq -0x89(%rbp), %rdi
callq 0x4410
leaq -0x148(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x108a0
jmp 0x4f53
leaq -0x200(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x108a0
jmp 0x4f68
leaq -0x268(%rbp), %rdi
leaq -0x28(%rbp), %rsi
movsd 0x31095(%rip), %xmm0    # 0x36010
callq 0x2ff50
jmp 0x4f82
movl $0x0, -0x26c(%rbp)
leaq -0x290(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x307e0
jmp 0x4fa1
movslq -0x26c(%rbp), %rsi
leaq -0x290(%rbp), %rdi
movq %rdi, -0x538(%rbp)
callq 0x5950
movq -0x538(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x530(%rbp)
callq 0x59b0
movsd -0x530(%rbp), %xmm0
movsd %xmm0, -0x278(%rbp)
leaq -0x2b0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x30810
jmp 0x4ff8
movslq -0x26c(%rbp), %rsi
leaq -0x2b0(%rbp), %rdi
movq %rdi, -0x548(%rbp)
callq 0x5950
movq -0x548(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x540(%rbp)
callq 0x59b0
movsd -0x540(%rbp), %xmm0
movsd %xmm0, -0x298(%rbp)
movabsq $0x40d4f4d45f4db325, %rax # imm = 0x40D4F4D45F4DB325
movq %rax, -0x2b8(%rbp)
movabsq $0x40c1e6d19e346d3d, %rax # imm = 0x40C1E6D19E346D3D
movq %rax, -0x2c0(%rbp)
leaq -0x2e0(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x30840
jmp 0x5071
movslq -0x26c(%rbp), %rsi
leaq -0x2e0(%rbp), %rdi
movq %rdi, -0x558(%rbp)
callq 0x5950
movq -0x558(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x550(%rbp)
callq 0x59b0
movsd -0x550(%rbp), %xmm0
movsd %xmm0, -0x2c8(%rbp)
movsd -0x298(%rbp), %xmm0
movsd -0x2c8(%rbp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x2e8(%rbp)
leaq -0x308(%rbp), %rdi
leaq -0x268(%rbp), %rsi
callq 0x30890
jmp 0x50e4
movslq -0x26c(%rbp), %rsi
leaq -0x308(%rbp), %rdi
movq %rdi, -0x568(%rbp)
callq 0x5950
movq -0x568(%rbp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, -0x560(%rbp)
callq 0x59b0
movsd -0x560(%rbp), %xmm0
movsd %xmm0, -0x2f0(%rbp)
movsd -0x278(%rbp), %xmm0
movsd -0x298(%rbp), %xmm1
movsd -0x2f0(%rbp), %xmm2
movsd -0x2e8(%rbp), %xmm3
leaq -0x320(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x4a80
jmp 0x515b
leaq -0x148(%rbp), %rdi
callq 0x11f10
movl %eax, -0x56c(%rbp)
jmp 0x516f
movl -0x56c(%rbp), %eax
incl %eax
cltq
movq %rax, -0x580(%rbp)
leaq -0x339(%rbp), %rdi
movq %rdi, -0x578(%rbp)
callq 0x58a0
movq -0x580(%rbp), %rsi
movq -0x578(%rbp), %rdx
leaq -0x338(%rbp), %rdi
callq 0x58c0
jmp 0x51af
leaq -0x339(%rbp), %rdi
callq 0x5930
movl $0x0, -0x340(%rbp)
movl -0x340(%rbp), %eax
movl %eax, -0x588(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x11f10
movl %eax, -0x584(%rbp)
jmp 0x51e5
movl -0x588(%rbp), %eax
movl -0x584(%rbp), %ecx
cmpl %ecx, %eax
jg 0x5337
movsd -0x2f0(%rbp), %xmm0
movsd %xmm0, -0x598(%rbp)
movslq -0x340(%rbp), %rsi
leaq -0x320(%rbp), %rdi
callq 0x5950
movsd -0x598(%rbp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, -0x590(%rbp)
movslq -0x340(%rbp), %rsi
leaq -0x338(%rbp), %rdi
callq 0x5950
movsd -0x590(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x340(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x340(%rbp)
jmp 0x51c5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x4410
jmp 0x5891
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x61(%rbp), %rdi
callq 0x4410
jmp 0x5888
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x89(%rbp), %rdi
callq 0x4410
jmp 0x587f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5873
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5867
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x585b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x584f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x339(%rbp), %rdi
callq 0x5930
jmp 0x5843
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5837
leaq -0x148(%rbp), %rdi
callq 0x11f10
movl %eax, -0x59c(%rbp)
jmp 0x534b
movl -0x59c(%rbp), %eax
incl %eax
cltq
movq %rax, -0x5b0(%rbp)
leaq -0x359(%rbp), %rdi
movq %rdi, -0x5a8(%rbp)
callq 0x58a0
movq -0x5b0(%rbp), %rsi
movq -0x5a8(%rbp), %rdx
leaq -0x358(%rbp), %rdi
callq 0x58c0
jmp 0x538b
leaq -0x359(%rbp), %rdi
callq 0x5930
movl $0x0, -0x360(%rbp)
movl -0x360(%rbp), %eax
movl %eax, -0x5b8(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x11f10
movl %eax, -0x5b4(%rbp)
jmp 0x53c1
movl -0x5b8(%rbp), %eax
movl -0x5b4(%rbp), %ecx
cmpl %ecx, %eax
jg 0x543f
movsd -0x2b8(%rbp), %xmm0
movsd %xmm0, -0x5c0(%rbp)
movslq -0x360(%rbp), %rsi
leaq -0x358(%rbp), %rdi
callq 0x5950
movsd -0x5c0(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x360(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x360(%rbp)
jmp 0x53a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x359(%rbp), %rdi
callq 0x5930
jmp 0x5837
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x582b
leaq -0x200(%rbp), %rdi
callq 0x11f10
movl %eax, -0x5c4(%rbp)
jmp 0x5453
movl -0x5c4(%rbp), %eax
incl %eax
cltq
movq %rax, -0x5d8(%rbp)
leaq -0x379(%rbp), %rdi
movq %rdi, -0x5d0(%rbp)
callq 0x58a0
movq -0x5d8(%rbp), %rsi
movq -0x5d0(%rbp), %rdx
leaq -0x378(%rbp), %rdi
callq 0x58c0
jmp 0x5493
leaq -0x379(%rbp), %rdi
callq 0x5930
movsd -0x2e8(%rbp), %xmm0
movsd %xmm0, -0x5f8(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x378(%rbp), %rdi
movq %rdi, -0x5f0(%rbp)
callq 0x5950
movsd -0x5f8(%rbp), %xmm0
movq -0x5f0(%rbp), %rdi
movsd %xmm0, (%rax)
movsd -0x298(%rbp), %xmm0
movsd %xmm0, -0x5e8(%rbp)
movl $0x1, %esi
callq 0x5950
movsd -0x5e8(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x200(%rbp), %rdi
callq 0x11f10
movl %eax, -0x5dc(%rbp)
jmp 0x5513
movl -0x5dc(%rbp), %eax
incl %eax
cltq
movq %rax, -0x608(%rbp)
leaq -0x399(%rbp), %rdi
movq %rdi, -0x600(%rbp)
callq 0x58a0
movq -0x608(%rbp), %rsi
movq -0x600(%rbp), %rdx
leaq -0x398(%rbp), %rdi
callq 0x58c0
jmp 0x5553
leaq -0x399(%rbp), %rdi
callq 0x5930
movl $0x0, -0x3a0(%rbp)
movl -0x3a0(%rbp), %eax
movl %eax, -0x610(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x11f10
movl %eax, -0x60c(%rbp)
jmp 0x5589
movl -0x610(%rbp), %eax
movl -0x60c(%rbp), %ecx
cmpl %ecx, %eax
jg 0x5639
movsd -0x2b8(%rbp), %xmm0
movsd %xmm0, -0x618(%rbp)
movslq -0x3a0(%rbp), %rsi
leaq -0x398(%rbp), %rdi
callq 0x5950
movsd -0x618(%rbp), %xmm0
movsd %xmm0, (%rax)
movl -0x3a0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3a0(%rbp)
jmp 0x5569
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x379(%rbp), %rdi
callq 0x5930
jmp 0x582b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x581f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x399(%rbp), %rdi
callq 0x5930
jmp 0x581f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5813
leaq -0x490(%rbp), %rdi
leaq -0x148(%rbp), %rsi
movsd 0x309c9(%rip), %xmm0    # 0x36018
movsd 0x309b1(%rip), %xmm1    # 0x36008
callq 0x31f20
jmp 0x565e
leaq -0x490(%rbp), %rdi
xorps %xmm0, %xmm0
callq 0x323c0
jmp 0x566f
leaq -0x490(%rbp), %rdi
movsd 0x3098a(%rip), %xmm0    # 0x36008
callq 0x323e0
jmp 0x5685
movsd -0x2b8(%rbp), %xmm2
movsd -0x2e8(%rbp), %xmm3
movsd -0x2c0(%rbp), %xmm4
leaq -0x4f0(%rbp), %rdi
leaq -0x490(%rbp), %rsi
movsd 0x3096d(%rip), %xmm0    # 0x36020
movsd 0x3096d(%rip), %xmm1    # 0x36028
leaq -0x338(%rbp), %rdx
leaq -0x358(%rbp), %rcx
callq 0x32490
jmp 0x56d0
leaq -0x510(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x11ec0
jmp 0x56e5
leaq -0x510(%rbp), %rdi
callq 0x4180
movq %rax, %rsi
leaq 0x30962(%rip), %rdi     # 0x3605d
xorl %eax, %eax
callq 0x4080
jmp 0x5704
leaq -0x510(%rbp), %rdi
callq 0x4220
leaq -0x490(%rbp), %rdi
leaq -0x4f0(%rbp), %rsi
callq 0x355d0
jmp 0x5725
leaq -0x4f0(%rbp), %rdi
callq 0x5a10
leaq -0x490(%rbp), %rdi
callq 0x5a40
leaq -0x398(%rbp), %rdi
callq 0x59b0
leaq -0x378(%rbp), %rdi
callq 0x59b0
leaq -0x358(%rbp), %rdi
callq 0x59b0
leaq -0x338(%rbp), %rdi
callq 0x59b0
leaq -0x320(%rbp), %rdi
callq 0x59b0
leaq -0x268(%rbp), %rdi
callq 0x5aa0
leaq -0x200(%rbp), %rdi
callq 0x5af0
leaq -0x148(%rbp), %rdi
callq 0x5af0
leaq -0x88(%rbp), %rdi
callq 0x4220
leaq -0x60(%rbp), %rdi
callq 0x4220
leaq -0x28(%rbp), %rdi
callq 0x4220
movl -0x4(%rbp), %eax
addq $0x620, %rsp            # imm = 0x620
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x5807
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x57fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x510(%rbp), %rdi
callq 0x4220
leaq -0x4f0(%rbp), %rdi
callq 0x5a10
leaq -0x490(%rbp), %rdi
callq 0x5a40
leaq -0x398(%rbp), %rdi
callq 0x59b0
leaq -0x378(%rbp), %rdi
callq 0x59b0
leaq -0x358(%rbp), %rdi
callq 0x59b0
leaq -0x338(%rbp), %rdi
callq 0x59b0
leaq -0x320(%rbp), %rdi
callq 0x59b0
leaq -0x268(%rbp), %rdi
callq 0x5aa0
leaq -0x200(%rbp), %rdi
callq 0x5af0
leaq -0x148(%rbp), %rdi
callq 0x5af0
leaq -0x88(%rbp), %rdi
callq 0x4220
leaq -0x60(%rbp), %rdi
callq 0x4220
leaq -0x28(%rbp), %rdi
callq 0x4220
movq -0x38(%rbp), %rdi
callq 0x45e0
nopw (%rax,%rax)