// File: /workspace/github_cpp_makefile_star2_O1/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 $0x88, %rsp
movq %r9, %rbp
movq %r8, %r15
movq %rcx, %rbx
movq %rdi, %r14
leaq 0x24938(%rip), %rax     # 0x32ae8
movq %rax, (%rdi)
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
xorl %eax, %eax
movq %rax, 0x18(%rdi)
movsd %xmm0, 0x28(%rdi)
movsd %xmm1, 0x30(%rdi)
leaq 0x50(%rdi), %r13
leaq 0x60(%rdi), %r12
xorpd %xmm0, %xmm0
movupd %xmm0, 0x38(%rdi)
movq %rax, 0x48(%rdi)
movq %r12, 0x50(%rdi)
movq (%r9), %rsi
movq 0x8(%r9), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0xd022
leaq 0x70(%r14), %rdi
movq %rdi, 0x50(%rsp)
movq %r12, 0x60(%rsp)
movq %r13, 0x58(%rsp)
callq 0x41a0
leaq 0x1f8(%r14), %rdi
movq %rdi, 0x48(%rsp)
callq 0x41a0
leaq 0x380(%r14), %rdi
movq %rdi, 0x40(%rsp)
callq 0x41a0
leaq 0x508(%r14), %rdi
movq %rdi, 0x38(%rsp)
callq 0x41a0
leaq 0x690(%r14), %rdi
movq %rdi, 0x30(%rsp)
callq 0x44d0
leaq 0x890(%r14), %rdi
movq %rdi, 0x28(%rsp)
callq 0x44d0
leaq 0xa90(%r14), %rdi
movq %rdi, 0x20(%rsp)
callq 0x44d0
leaq 0xc90(%r14), %r13
movq %r13, %rdi
callq 0x44d0
movq 0xc0(%rsp), %rsi
leaq 0xe90(%r14), %rax
movq %rax, 0x10(%rsp)
leaq 0xea8(%r14), %rax
movq %rax, 0x8(%rsp)
leaq 0xec0(%r14), %rdi
xorpd %xmm0, %xmm0
movupd %xmm0, 0xeb0(%r14)
movupd %xmm0, 0xea0(%r14)
movupd %xmm0, 0xe90(%r14)
movq %rdi, 0x18(%rsp)
callq 0x65fa
movq 0xc8(%rsp), %rsi
leaq 0xed8(%r14), %r12
movq %r12, %rdi
callq 0x65fa
movq %rbx, 0xef0(%r14)
movq %r15, 0xef8(%r14)
movq 0x8(%rbx), %rsi
subq (%rbx), %rsi
sarq $0x3, %rsi
leaq 0x68(%rsp), %rdx
movq $0x0, (%rdx)
movq 0x10(%rsp), %rdi
callq 0x66c4
leaq 0x68(%rsp), %rdx
movq $0x0, (%rdx)
movl $0x1f4, %esi            # imm = 0x1F4
movq 0x8(%rsp), %rdi
callq 0x66c4
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0xe360
xorl %r15d, %r15d
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
incq %r15
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r15
jb 0xe340
movq $0x0, 0x48(%r14)
movq 0xef0(%r14), %rcx
movq (%rcx), %rax
cmpq %rax, 0x8(%rcx)
je 0xe3ad
xorl %ebx, %ebx
movq (%rax,%rbx,8), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
addsd 0x48(%r14), %xmm0
movsd %xmm0, 0x48(%r14)
incq %rbx
movq 0xef0(%r14), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbx
jb 0xe37a
movq 0x8(%r14), %rax
cmpq $0x1, %rax
je 0xe3c3
xorpd %xmm0, %xmm0
cmpq $0x2, %rax
je 0xe3d1
jmp 0xe3d7
movsd 0x165a5(%rip), %xmm0    # 0x24970
divsd 0x48(%r14), %xmm0
movsd %xmm0, 0x30(%r14)
leaq 0x518(%r14), %rdi
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
callq 0x42f0
leaq 0x1658e(%rip), %rsi     # 0x24980
movl $0xc, %edx
movq %rax, %rdi
callq 0x42f0
leaq 0x520(%r14), %rsi
leaq 0x68(%rsp), %rdi
callq 0x4460
movq 0x68(%rsp), %rsi
movq %r13, %rdi
movl $0x10, %edx
callq 0x4050
leaq 0x16564(%rip), %rsi     # 0x2498d
movl $0xb, %edx
movq %r13, %rdi
callq 0x42f0
movsd 0x1653a(%rip), %xmm0    # 0x24978
divsd 0x48(%r14), %xmm0
movq %r13, %rdi
callq 0x4480
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
leaq 0x16519(%rip), %rsi     # 0x24999
movl $0x5, %edx
movq %rax, %rdi
callq 0x42f0
movsd 0x30(%r14), %xmm0
movq %rbx, %rdi
callq 0x4480
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
leaq 0x164d0(%rip), %rsi     # 0x2499f
movl $0x9, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x4180
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
leaq 0x1648d(%rip), %rsi     # 0x249a9
movl $0x8, %edx
movq %rax, %rdi
callq 0x42f0
movsd 0x28(%r14), %xmm0
movq %rbx, %rdi
callq 0x4480
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %r13, %rdi
callq 0x43e0
movq 0x24a2e(%rip), %rdi     # 0x32fc8
leaq 0x16411(%rip), %rsi     # 0x249b2
movl $0x1b, %edx
callq 0x42f0
movq 0x24a16(%rip), %rdi     # 0x32fc8
leaq 0x163d4(%rip), %rsi     # 0x2498d
movl $0xb, %edx
callq 0x42f0
movsd 0x163ad(%rip), %xmm0    # 0x24978
divsd 0x48(%r14), %xmm0
movq 0x249f0(%rip), %rdi     # 0x32fc8
callq 0x4480
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
leaq 0x16388(%rip), %rsi     # 0x24999
movl $0x5, %edx
movq %rax, %rdi
callq 0x42f0
movsd 0x30(%r14), %xmm0
movq %rbx, %rdi
callq 0x4480
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
leaq 0x1633f(%rip), %rsi     # 0x2499f
movl $0x9, %edx
movq %rax, %rdi
callq 0x42f0
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x4180
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
leaq 0x162fc(%rip), %rsi     # 0x249a9
movl $0x8, %edx
movq %rax, %rdi
callq 0x42f0
movsd 0x28(%r14), %xmm0
movq %rbx, %rdi
callq 0x4480
movq %rax, %rbx
leaq 0x162fc(%rip), %rsi     # 0x249ce
movl $0x17, %edx
movq %rax, %rdi
callq 0x42f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4280
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4190
movq $0x0, 0x20(%r14)
movq %r14, %rdi
callq 0xe918
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe75b
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42c0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe7c7
jmp 0xe7c7
jmp 0xe7c7
movq %rax, %rbp
jmp 0xe802
movq %rax, %rbp
jmp 0xe81e
movq %rax, %rbp
jmp 0xe85e
movq %rax, %rbp
jmp 0xe868
movq %rax, %rbp
jmp 0xe872
movq %rax, %rbp
jmp 0xe87c
movq %rax, %rbp
jmp 0xe899
movq %rax, %rbp
jmp 0xe8b6
movq %rax, %rbp
jmp 0xe8d3
movq %rax, %rbp
jmp 0xe8f3
jmp 0xe7c7
jmp 0xe7c7
movq %rax, %rbp
jmp 0xe7ea
movq %rax, %rbp
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xe7ea
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42c0
movq (%r12), %rdi
testq %rdi, %rdi
je 0xe802
movq 0xee8(%r14), %rsi
subq %rdi, %rsi
callq 0x42c0
movq 0x18(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xe81e
movq 0xed0(%r14), %rsi
subq %rdi, %rsi
callq 0x42c0
movq 0x8(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xe83a
movq 0xeb8(%r14), %rsi
subq %rdi, %rsi
callq 0x42c0
movq 0x10(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xe856
movq 0xea0(%r14), %rsi
subq %rdi, %rsi
callq 0x42c0
movq %r13, %rdi
callq 0x4410
movq 0x20(%rsp), %rdi
callq 0x4410
movq 0x28(%rsp), %rdi
callq 0x4410
movq 0x30(%rsp), %rdi
callq 0x4410
movq 0x2470d(%rip), %rsi     # 0x32f90
movq 0x38(%rsp), %rdi
callq 0x41c0
leaq 0x588(%r14), %rdi
callq 0x40c0
movq 0x246f0(%rip), %rsi     # 0x32f90
movq 0x40(%rsp), %rdi
callq 0x41c0
leaq 0x400(%r14), %rdi
callq 0x40c0
movq 0x246d3(%rip), %rsi     # 0x32f90
movq 0x48(%rsp), %rdi
callq 0x41c0
leaq 0x278(%r14), %rdi
callq 0x40c0
movq 0x246b6(%rip), %rsi     # 0x32f90
movq 0x50(%rsp), %rdi
callq 0x41c0
addq $0xf0, %r14
movq %r14, %rdi
callq 0x40c0
movq 0x58(%rsp), %rax
movq (%rax), %rdi
movq 0x60(%rsp), %rax
cmpq %rax, %rdi
je 0xe910
movq (%rax), %rsi
incq %rsi
callq 0x42c0
movq %rbp, %rdi
callq 0x4510