// File: /workspace/github_cpp_makefile_star2_O3/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 0x244e0(%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 0xd476
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 0x67f2
movq 0xc8(%rsp), %rsi
leaq 0xed8(%r14), %r12
movq %r12, %rdi
callq 0x67f2
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 0x68bc
leaq 0x68(%rsp), %rdx
movq $0x0, (%rdx)
movl $0x1f4, %esi            # imm = 0x1F4
movq 0x8(%rsp), %rdi
callq 0x68bc
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0xe7b8
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 0xe798
movq $0x0, 0x48(%r14)
movq 0xef0(%r14), %rcx
movq (%rcx), %rax
xorpd %xmm0, %xmm0
cmpq %rax, 0x8(%rcx)
je 0xe809
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 0xe7d6
movq 0x8(%r14), %rax
cmpq $0x1, %rax
je 0xe81f
cmpq $0x2, %rax
xorpd %xmm1, %xmm1
je 0xe82b
jmp 0xe831
movsd 0x16169(%rip), %xmm1    # 0x24990
divsd %xmm0, %xmm1
movsd %xmm1, 0x30(%r14)
leaq 0x518(%r14), %rdi
movq (%rbp), %rsi
movq 0x8(%rbp), %rdx
callq 0x42f0
leaq 0x16154(%rip), %rsi     # 0x249a0
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 0x1612a(%rip), %rsi     # 0x249ad
movl $0xb, %edx
movq %r13, %rdi
callq 0x42f0
movsd 0x16100(%rip), %xmm0    # 0x24998
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 0x160df(%rip), %rsi     # 0x249b9
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 0x16096(%rip), %rsi     # 0x249bf
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 0x16053(%rip), %rsi     # 0x249c9
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 0x245d4(%rip), %rdi     # 0x32fc8
leaq 0x15fd7(%rip), %rsi     # 0x249d2
movl $0x1b, %edx
callq 0x42f0
movq 0x245bc(%rip), %rdi     # 0x32fc8
leaq 0x15f9a(%rip), %rsi     # 0x249ad
movl $0xb, %edx
callq 0x42f0
movsd 0x15f73(%rip), %xmm0    # 0x24998
divsd 0x48(%r14), %xmm0
movq 0x24596(%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 0x15f4e(%rip), %rsi     # 0x249b9
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 0x15f05(%rip), %rsi     # 0x249bf
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 0x15ec2(%rip), %rsi     # 0x249c9
movl $0x8, %edx
movq %rax, %rdi
callq 0x42f0
movsd 0x28(%r14), %xmm0
movq %rbx, %rdi
callq 0x4480
movq %rax, %rbx
leaq 0x15ec2(%rip), %rsi     # 0x249ee
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 0xed72
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xebb5
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 0xec21
jmp 0xec21
jmp 0xec21
movq %rax, %rbp
jmp 0xec5c
movq %rax, %rbp
jmp 0xec78
movq %rax, %rbp
jmp 0xecb8
movq %rax, %rbp
jmp 0xecc2
movq %rax, %rbp
jmp 0xeccc
movq %rax, %rbp
jmp 0xecd6
movq %rax, %rbp
jmp 0xecf3
movq %rax, %rbp
jmp 0xed10
movq %rax, %rbp
jmp 0xed2d
movq %rax, %rbp
jmp 0xed4d
jmp 0xec21
jmp 0xec21
movq %rax, %rbp
jmp 0xec44
movq %rax, %rbp
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xec44
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x42c0
movq (%r12), %rdi
testq %rdi, %rdi
je 0xec5c
movq 0xee8(%r14), %rsi
subq %rdi, %rsi
callq 0x42c0
movq 0x18(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xec78
movq 0xed0(%r14), %rsi
subq %rdi, %rsi
callq 0x42c0
movq 0x8(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xec94
movq 0xeb8(%r14), %rsi
subq %rdi, %rsi
callq 0x42c0
movq 0x10(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0xecb0
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 0x242b3(%rip), %rsi     # 0x32f90
movq 0x38(%rsp), %rdi
callq 0x41c0
leaq 0x588(%r14), %rdi
callq 0x40c0
movq 0x24296(%rip), %rsi     # 0x32f90
movq 0x40(%rsp), %rdi
callq 0x41c0
leaq 0x400(%r14), %rdi
callq 0x40c0
movq 0x24279(%rip), %rsi     # 0x32f90
movq 0x48(%rsp), %rdi
callq 0x41c0
leaq 0x278(%r14), %rdi
callq 0x40c0
movq 0x2425c(%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 0xed6a
movq (%rax), %rsi
incq %rsi
callq 0x42c0
movq %rbp, %rdi
callq 0x4510