// File: nwieder[P]SSTS/src/Events/Reaction_Evt.cpp
// Function: nw::Reaction_Evt::update(double)
double Reaction_Evt::update(double last_tau){

	double minTau = INFINITY;

//	check if this event depends on the last executed event
	if(this->dirty_flag){
//		run through the tv vector
		for (size_t i = 0; i < tv_vec.size(); ++i){
//			check for voxel that have been affected by last executed event
			if (tv_vec[i].v->get_dirty_flag()){
//				find smallest tau value (->next voxel) for this event
				if(calc_tau(i) < minTau){
					minTau = tv_vec[i].t;
					nextVoxel = i;
				}
//			voxel has not been affected by last event
			} else {
//				adjust tau value to global times scale
				tv_vec[i].t -= last_tau;
//				find smallest tau value (->next voxel) for this event
				if(tv_vec[i].t < minTau){
					minTau = tv_vec[i].t;
					nextVoxel = i;
				}
			}
		}
//  event has not been affected by last event
	} else  {
//		adjust tau values to global times scale
		for (size_t i = 0; i < tv_vec.size(); ++i) {
			tv_vec[i].t -= last_tau;
			if(tv_vec[i].t < minTau){
				minTau = tv_vec[i].t;
				nextVoxel = i;
			}
		}
	}

	this->dirty_flag = false;
	return minTau;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movsd 0x3c4c7(%rip), %xmm0    # 0x45008
movsd %xmm0, -0x18(%rbp)
testb $0x1, 0x80(%rax)
je 0x8c79
movq $0x0, -0x20(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
addq $0x50, %rdi
callq 0x5fd0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cmpq %rcx, %rax
jae 0x8c74
movq -0x30(%rbp), %rdi
addq $0x50, %rdi
movq -0x20(%rbp), %rsi
callq 0x6050
movq (%rax), %rdi
callq 0x6030
testb $0x1, %al
jne 0x8b9f
jmp 0x8be6
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x8d50
movaps %xmm0, %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x8be4
movq -0x30(%rbp), %rdi
addq $0x50, %rdi
movq -0x20(%rbp), %rsi
callq 0x6050
movq %rax, %rcx
movq -0x30(%rbp), %rax
movsd 0x8(%rcx), %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x70(%rax)
jmp 0x8c61
movq -0x30(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
addq $0x50, %rdi
movq -0x20(%rbp), %rsi
callq 0x6050
movsd -0x40(%rbp), %xmm1
movq -0x30(%rbp), %rdi
movsd 0x8(%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rax)
addq $0x50, %rdi
movq -0x20(%rbp), %rsi
callq 0x6050
movsd 0x8(%rax), %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x8c5f
movq -0x30(%rbp), %rdi
addq $0x50, %rdi
movq -0x20(%rbp), %rsi
callq 0x6050
movq %rax, %rcx
movq -0x30(%rbp), %rax
movsd 0x8(%rcx), %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x20(%rbp), %rcx
movq %rcx, 0x70(%rax)
jmp 0x8c61
jmp 0x8c63
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8b5b
jmp 0x8d34
movq $0x0, -0x28(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
addq $0x50, %rdi
callq 0x5fd0
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x8d32
movq -0x30(%rbp), %rdi
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
callq 0x6050
movsd -0x50(%rbp), %xmm1
movq -0x30(%rbp), %rdi
movsd 0x8(%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rax)
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
callq 0x6050
movsd 0x8(%rax), %xmm1
movsd -0x18(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x8d1f
movq -0x30(%rbp), %rdi
addq $0x50, %rdi
movq -0x28(%rbp), %rsi
callq 0x6050
movq %rax, %rcx
movq -0x30(%rbp), %rax
movsd 0x8(%rcx), %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x28(%rbp), %rcx
movq %rcx, 0x70(%rax)
jmp 0x8d21
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x8c81
jmp 0x8d34
movq -0x30(%rbp), %rax
movb $0x0, 0x80(%rax)
movsd -0x18(%rbp), %xmm0
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)