// File: /workspace/github_cpp_makefile_star2_O2/nwieder[P]SSTS/src/System/Gillespie_Sys.cpp
// Function: nw::Gillespie_Sys::Gillespie_Sys(long, long, double, double, std::vector<nw::_Event*, std::allocator<nw::_Event*>>*, std::vector<nw::_Voxel*, std::allocator<nw::_Voxel*>>*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<long, std::allocator<long>>, std::vector<long, std::allocator<long>>)
Gillespie_Sys::Gillespie_Sys(long output_mode, long n_steps, double max_Sim_Time,
	double rec_interval, EventVector* evt_vec, VoxelVector* vxl_vec,
	string output_dir_path, vector<long> osid, vector<long> ovid):
	output_mode(output_mode),
	n_steps(n_steps),
	opcntr(0),
	max_Sim_Time(max_Sim_Time),
	rec_interval(rec_interval),
	curr_time(0),
	rec_time(0),
	a_0(0),
	output_dir_path(output_dir_path),
	osid(osid),
	ovid(ovid),
	evt_vec(evt_vec),
	vxl_vec(vxl_vec)
{

//	initialize event counter vector
	evt_cntr.assign(evt_vec->size(), 0);
//  initialize distribution vector
	distr_vec.assign(500, 0);

//	initialize all Events
	for (size_t i = 0; i < evt_vec->size(); ++i) {
		evt_vec->at(i)->init();
	}

	this->a_0 = 0;
//	Calculate a_0 from all system events
	for (size_t i = 0; i < this->evt_vec->size() ;++i){
		this->a_0 += this->evt_vec->at(i)->get_a();
	}

//	Adapt exit conditions and record interval according to the timing_mode
	if (this->output_mode == 1){
		// set the record interval to 10 * average system waiting time
		this->rec_interval = 10 / a_0;
	} else if (this->output_mode == 2){
		this->rec_interval = 0;
	}

//	print data output parameters for data analysis
	this->dcol_path << output_dir_path << "sim_param.py";
	const string &tmp_dcol = this->dcol_path.str();
	this->dcol_file.open(tmp_dcol.c_str());
	this->dcol_file << "mean_tau = " << 1/this->a_0 << endl << "dt = "
					<< this->rec_interval << endl << "n_steps= " << this->n_steps
					<< endl << "T_max = " << this->max_Sim_Time << endl << endl;
	this->dcol_file.close();
	cout 	<< "\n### Timing Parameters ###\n" << "mean_tau = " << 1/this->a_0
			<< endl << "dt = " << this->rec_interval << endl << "n_steps= "
			<< this->n_steps << endl << "T_max = " << this->max_Sim_Time
			<< "\n######################" << endl << endl;

//	initialize channel state log
	channel_state = 0;

//	build the dependency graph
	build_dep_graph();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, %r13
movq %r8, %rbx
movq %rcx, %rbp
movq %rdi, %r12
leaq 0x23677(%rip), %rax     # 0x2eaf8
movq %rax, (%rdi)
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
movsd %xmm0, 0x28(%rdi)
movsd %xmm1, 0x30(%rdi)
leaq 0x50(%rdi), %r14
xorpd %xmm0, %xmm0
movupd %xmm0, 0x38(%rdi)
andq $0x0, 0x48(%rdi)
movq %r14, %rdi
movq %r9, %rsi
callq 0x4380
leaq 0x70(%r12), %r15
movq %r15, %rdi
callq 0x4170
leaq 0x1f8(%r12), %rdi
movq %rdi, (%rsp)
callq 0x4170
leaq 0x380(%r12), %rdi
movq %rdi, 0x8(%rsp)
callq 0x4170
leaq 0x508(%r12), %rdi
movq %rdi, 0x10(%rsp)
callq 0x4170
leaq 0x690(%r12), %rdi
movq %rdi, 0x50(%rsp)
callq 0x44b0
leaq 0x890(%r12), %rdi
movq %rdi, 0x48(%rsp)
callq 0x44b0
movq %r15, 0x20(%rsp)
leaq 0xa90(%r12), %rdi
movq %rdi, 0x40(%rsp)
callq 0x44b0
leaq 0xc90(%r12), %r15
movq %r15, %rdi
callq 0x44b0
movq %r14, 0x18(%rsp)
movq 0xb0(%rsp), %rsi
leaq 0xe90(%r12), %rax
movq %rax, 0x30(%rsp)
leaq 0xea8(%r12), %rax
movq %rax, 0x28(%rsp)
leaq 0xec0(%r12), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0xeb0(%r12)
movupd %xmm0, 0xea0(%r12)
movupd %xmm0, 0xe90(%r12)
movq %rdi, 0x38(%rsp)
callq 0x525c
movq 0xb8(%rsp), %rsi
leaq 0xed8(%r12), %r14
movq %r14, %rdi
callq 0x525c
movq %rbp, 0xef0(%r12)
movq %rbx, 0xef8(%r12)
movq 0x8(%rbp), %rsi
subq (%rbp), %rsi
sarq $0x3, %rsi
leaq 0x58(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x30(%rsp), %rdi
callq 0x534e
leaq 0x58(%rsp), %rdx
andq $0x0, (%rdx)
movl $0x1f4, %esi            # imm = 0x1F4
movq 0x28(%rsp), %rdi
callq 0x534e
xorl %ebx, %ebx
movq 0x8(%rbp), %rax
subq (%rbp), %rax
sarq $0x3, %rax
cmpq %rax, %rbx
jae 0xb62b
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x970e
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
incq %rbx
jmp 0xb601
andq $0x0, 0x48(%r12)
xorpd %xmm0, %xmm0
xorl %ebx, %ebx
movq 0xef0(%r12), %rdi
movq 0x8(%rdi), %rax
subq (%rdi), %rax
sarq $0x3, %rax
cmpq %rax, %rbx
jae 0xb673
movq %rbx, %rsi
callq 0x970e
movq (%rax), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
addsd 0x48(%r12), %xmm0
movsd %xmm0, 0x48(%r12)
incq %rbx
jmp 0xb637
movq 0x8(%r12), %rax
cmpq $0x1, %rax
je 0xb68a
xorpd %xmm1, %xmm1
cmpq $0x2, %rax
je 0xb696
jmp 0xb69d
movsd 0x132de(%rip), %xmm1    # 0x1e970
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%r12)
leaq 0x518(%r12), %rdi
movq %r13, %rsi
callq 0x4210
leaq 0x132cc(%rip), %rsi     # 0x1e980
movq %rax, %rdi
callq 0x4240
leaq 0x520(%r12), %rsi
leaq 0x58(%rsp), %rdi
callq 0x4440
movq 0x58(%rsp), %rsi
pushq $0x10
popq %rdx
movq %r15, %rdi
callq 0x4040
leaq 0x132a8(%rip), %rsi     # 0x1e98d
movq %r15, %rdi
callq 0x4240
movsd 0x13283(%rip), %xmm0    # 0x1e978
divsd 0x48(%r12), %xmm0
movq %rax, %rdi
callq 0x4460
movq %rax, %rdi
callq 0x4100
leaq 0x13286(%rip), %rsi     # 0x1e999
movq %rax, %rdi
callq 0x4240
movsd 0x30(%r12), %xmm0
movq %rax, %rdi
callq 0x4460
movq %rax, %rdi
callq 0x4100
leaq 0x13266(%rip), %rsi     # 0x1e99f
movq %rax, %rdi
callq 0x4240
movq 0x10(%r12), %rsi
movq %rax, %rdi
callq 0x4160
movq %rax, %rdi
callq 0x4100
leaq 0x1324c(%rip), %rsi     # 0x1e9a9
movq %rax, %rdi
callq 0x4240
movsd 0x28(%r12), %xmm0
movq %rax, %rdi
callq 0x4460
movq %rax, %rdi
callq 0x4100
movq %rax, %rdi
callq 0x4100
movq %r15, %rdi
callq 0x43b0
movq 0x23835(%rip), %rdi     # 0x2efc8
leaq 0x13218(%rip), %rsi     # 0x1e9b2
callq 0x4240
leaq 0x131e7(%rip), %rsi     # 0x1e98d
movq %rax, %rdi
callq 0x4240
movsd 0x131c2(%rip), %xmm0    # 0x1e978
divsd 0x48(%r12), %xmm0
movq %rax, %rdi
callq 0x4460
movq %rax, %rdi
callq 0x4100
leaq 0x131c5(%rip), %rsi     # 0x1e999
movq %rax, %rdi
callq 0x4240
movsd 0x30(%r12), %xmm0
movq %rax, %rdi
callq 0x4460
movq %rax, %rdi
callq 0x4100
leaq 0x131a5(%rip), %rsi     # 0x1e99f
movq %rax, %rdi
callq 0x4240
movq 0x10(%r12), %rsi
movq %rax, %rdi
callq 0x4160
movq %rax, %rdi
callq 0x4100
leaq 0x1318b(%rip), %rsi     # 0x1e9a9
movq %rax, %rdi
callq 0x4240
movsd 0x28(%r12), %xmm0
movq %rax, %rdi
callq 0x4460
leaq 0x13192(%rip), %rsi     # 0x1e9ce
movq %rax, %rdi
callq 0x4240
movq %rax, %rdi
callq 0x4100
movq %rax, %rdi
callq 0x4100
andq $0x0, 0x20(%r12)
movq %r12, %rdi
callq 0xb9f0
leaq 0x58(%rsp), %rdi
callq 0x4568
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb958
jmp 0xb958
jmp 0xb958
movq %rax, %r12
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
jmp 0xb971
movq %rax, %r12
movq 0x18(%rsp), %r14
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
jmp 0xb980
movq %rax, %r12
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
jmp 0xb99c
movq %rax, %r12
movq 0x20(%rsp), %r15
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
jmp 0xb9ab
movq %rax, %r12
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
jmp 0xb9b5
movq %rax, %r12
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
jmp 0xb9bf
movq %rax, %r12
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
jmp 0xb9c7
movq %rax, %r12
movq (%rsp), %rbx
jmp 0xb9cf
movq %rax, %r12
jmp 0xb9d7
movq %rax, %r12
jmp 0xb9df
jmp 0xb958
movq %rax, %r12
leaq 0x58(%rsp), %rdi
callq 0x4568
jmp 0xb95b
jmp 0xb958
movq %rax, %r12
movq (%rsp), %rbx
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbp
movq %r14, %rdi
callq 0x4b54
movq 0x38(%rsp), %rdi
callq 0x4b54
movq 0x18(%rsp), %r14
movq 0x28(%rsp), %rdi
callq 0x4b54
movq 0x30(%rsp), %rdi
callq 0x4b54
movq %r15, %rdi
callq 0x43f0
movq 0x40(%rsp), %rdi
callq 0x43f0
movq 0x20(%rsp), %r15
movq 0x48(%rsp), %rdi
callq 0x43f0
movq 0x50(%rsp), %rdi
callq 0x43f0
movq %rbp, %rdi
callq 0x41a0
movq %r13, %rdi
callq 0x41a0
movq %rbx, %rdi
callq 0x41a0
movq %r15, %rdi
callq 0x41a0
movq %r14, %rdi
callq 0x4568
movq %r12, %rdi
callq 0x44f0
nop