// File: nwieder[P]SSTS/src/Events/Diffusion_Evt.cpp
// Function: nw::Diffusion_Evt::execute()
void Diffusion_Evt::execute(){
//	update diffusion origin voxel with the inverse state change vector
	tv_vec[nextVoxel].v->update_state(sc_vec);

//	choose diffusion partner
	double r = rg->get_Uni_Rnd();
	double d; // temp
	for (size_t i = 0; i < tv_vec[nextVoxel].v->get_diff_vec()->size(); ++i){
		d = (double)(i+1)/tv_vec[nextVoxel].v->get_diff_vec()->size();
		if(r-d < 0){
			tv_vec[nextVoxel].v->get_diff_vec()->at(i)->update_state(inv_sc_vec);
			break;
		}
	}

//	set dirty flag to indicate that dependent events have to be updated properly
	for(size_t i = 0; i < dep_list.size(); i++){
		dep_list[i]->set_flag(true);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq %rax, %rdi
addq $0x50, %rdi
movq 0x70(%rax), %rsi
callq 0x6050
movq -0x80(%rbp), %rsi
movq (%rax), %rax
movq %rax, -0x78(%rbp)
addq $0x38, %rsi
leaq -0x20(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x79e0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0x72d6
leaq -0x20(%rbp), %rdi
callq 0x61a0
movq -0x80(%rbp), %rax
movq 0x68(%rax), %rdi
movq (%rdi), %rax
callq *(%rax)
movsd %xmm0, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x80(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, -0x88(%rbp)
movq %rax, %rdi
addq $0x50, %rdi
movq 0x70(%rax), %rsi
callq 0x6050
movq (%rax), %rdi
callq 0x7ad0
movq %rax, %rdi
callq 0x7af0
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
jae 0x74a6
movq -0x80(%rbp), %rax
movq -0x48(%rbp), %rcx
incq %rcx
movq %rcx, %xmm0
movaps 0x3dd5e(%rip), %xmm1    # 0x450b0
movaps %xmm1, -0xb0(%rbp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x3dd5b(%rip), %xmm1    # 0x450c0
movaps %xmm1, -0xa0(%rbp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movq %rax, %rdi
addq $0x50, %rdi
movq 0x70(%rax), %rsi
callq 0x6050
movq (%rax), %rdi
callq 0x7ad0
movq %rax, %rdi
callq 0x7af0
movaps -0xb0(%rbp), %xmm3
movaps -0xa0(%rbp), %xmm2
movsd -0x90(%rbp), %xmm0
movq %rax, %xmm1
punpckldq %xmm3, %xmm1    # xmm1 = xmm1[0],xmm3[0],xmm1[1],xmm3[1]
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x38(%rbp), %xmm1
subsd -0x40(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x7493
movq -0x80(%rbp), %rax
movq %rax, %rdi
addq $0x50, %rdi
movq 0x70(%rax), %rsi
callq 0x6050
movq (%rax), %rdi
callq 0x7ad0
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x7b10
movq -0x80(%rbp), %rsi
movq (%rax), %rax
movq %rax, -0xc0(%rbp)
addq $0xa0, %rsi
leaq -0x60(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x79e0
movq -0xc0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0x7457
leaq -0x60(%rbp), %rdi
callq 0x61a0
jmp 0x74a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x61a0
jmp 0x7510
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x61a0
jmp 0x7510
jmp 0x7495
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x72f9
movq $0x0, -0x68(%rbp)
movq -0x80(%rbp), %rdi
movq -0x68(%rbp), %rax
movq %rax, -0xc8(%rbp)
addq $0x88, %rdi
callq 0x7b50
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jae 0x7507
movq -0x80(%rbp), %rdi
addq $0x88, %rdi
movq -0x68(%rbp), %rsi
callq 0x7b70
movq (%rax), %rdi
movl $0x1, %esi
callq 0x7b90
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x74ae
addq $0xd0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x5650
nopl (%rax)