// File: /workspace/github_cpp_makefile_star2_O1/enbock[P]Warp10Server/ulib/src/EventDispatcher.cpp
// Function: u::EventDispatcher::dispatchEvent(u::Event*)
Event* EventDispatcher::dispatchEvent(Event *event)
{
	lock();

	Vector<Callback>* pVec = getEventVector(event->_type);
	if(pVec != null)
	{
		Vector<Callback> vec = *pVec;
		unlock();

		int64 i=0, l = vec.size();
		for(i=0; i<l; i++)
		{
			Callback cb = vec.at(i);
			trace(
				"DispatchEvent: " + *(event->_type)
				+ "\033[36m -> "+cb.toString()
			);
			Event* ev = event->clone();
			ev->_target = this;
			cb.arg = ev;

			if(ThreadSystem::create(&cb) == false)
			{
				// thread system is terminating
				ev->destroy();
			}
		}

		return event;
	}
	else
	{
		trace(
			"\033[32mNo listener for " + *event->type()
			+ " on target "+ toString() + "."
		);
	}
	unlock();
	return event;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %rbx
movq %rdi, %r14
callq 0x4098c2
movq 0x38(%rbx), %rsi
movq %r14, 0x40(%rsp)
movq %r14, %rdi
callq 0x407a60
testq %rax, %rax
je 0x40810a
movq %rax, %r14
leaq 0x88(%rsp), %r15
movq %rax, %rsi
addq $0x38, %rsi
movq %r15, %rdi
callq 0x409108
leaq 0x50(%rsp), %rdi
movq %r14, %rsi
callq 0x409ad6
movq %rbx, 0x48(%rsp)
leaq 0x1fc94d(%rip), %rax    # 0x604708
movq %rax, 0x50(%rsp)
movq 0x40(%rsp), %rdi
callq 0x40987a
movq 0x90(%rsp), %rax
subq 0x88(%rsp), %rax
testq %rax, %rax
jle 0x4080e9
movabsq $0x2e8ba2e8ba2e8ba3, %rcx # imm = 0x2E8BA2E8BA2E8BA3
mulq %rcx
shrq $0x4, %rdx
leaq 0x30(%rsp), %r12
cmpq $0x2, %rdx
movl $0x1, %eax
cmovgeq %rdx, %rax
movq %rax, 0xa0(%rsp)
xorl %r14d, %r14d
leaq 0x120(%rsp), %r13
movq $0x60f6a0, %rbp         # imm = 0x60F6A0
xorl %r15d, %r15d
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
subq %rsi, %rdx
sarq $0x3, %rdx
movabsq $0x2e8ba2e8ba2e8ba3, %rax # imm = 0x2E8BA2E8BA2E8BA3
imulq %rax, %rdx
cmpq %r15, %rdx
jbe 0x4083d0
addq %r14, %rsi
movq %r13, %rdi
callq 0x40598e
movl $0x4, %edx
movq %rbp, %rdi
leaq 0x19120e(%rip), %rsi    # 0x599079
callq 0x477930
movq 0x48(%rsp), %rax
movq 0x38(%rax), %rdx
addq $0x38, %rdx
leaq 0x100(%rsp), %rbx
movq %rbx, %rdi
leaq 0x191348(%rip), %rsi    # 0x5991d7
callq 0x4062b5
movq %rbx, %rdi
leaq 0x191349(%rip), %rsi    # 0x5991e7
callq 0x489510
movq %r12, 0x20(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x407ec6
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x407ece
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xa8(%rsp), %rdi
movq %r13, %rsi
callq 0x405a54
movq 0x20(%rsp), %rcx
movl $0xf, %esi
cmpq %r12, %rcx
je 0x407f0a
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %r8
movq 0xe8(%rsp), %rdx
leaq (%rdx,%r8), %rax
cmpq %rsi, %rax
jbe 0x407f44
movl $0xf, %esi
leaq 0xf0(%rsp), %rdi
cmpq %rdi, 0xe0(%rsp)
je 0x407f3f
movq 0xf0(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x407f58
movq 0xe0(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x4893d0
jmp 0x407f69
leaq 0xe0(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x488d50
leaq 0x10(%rsp), %rsi
movq %rsi, (%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x407f8c
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x407f92
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbp, %r12
movq %rbp, %rdi
callq 0x477930
movq %rax, %rbp
movl $0x4, %edx
movq %rax, %rdi
leaq 0x1910b0(%rip), %rsi    # 0x599085
callq 0x477930
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x458a80
movsbl %al, %esi
movq %rbp, %rdi
callq 0x477430
movq %rax, %rdi
callq 0x476a00
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x40801d
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x40dd10
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x408042
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0xa8(%rsp), %rdi
callq 0x4099d0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x40806b
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x40dd10
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x408090
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x40dd10
movq 0x48(%rsp), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movq %rax, %rbp
movq 0x40(%rsp), %rax
movq %rax, 0x40(%rbp)
movq %rbp, 0x170(%rsp)
movq %r13, %rdi
callq 0x40b928
testb %al, %al
jne 0x4080c4
movq (%rbp), %rax
movq %rbp, %rdi
callq *(%rax)
movq %r13, %rdi
callq 0x4099d0
incq %r15
addq $0x58, %r14
cmpq %r15, 0xa0(%rsp)
movq %r12, %rbp
leaq 0x30(%rsp), %r12
jne 0x407e23
leaq 0x50(%rsp), %rdi
callq 0x4099d0
leaq 0x88(%rsp), %rdi
callq 0x408760
movq 0x48(%rsp), %rbx
jmp 0x4083bb
movq $0x60f6a0, %rdi         # imm = 0x60F6A0
leaq 0x190f61(%rip), %rsi    # 0x599079
movl $0x4, %edx
callq 0x477930
movq %rbx, %rdi
callq 0x405f82
leaq 0x38(%rax), %rdx
leaq 0x1910bc(%rip), %rsi    # 0x5991f1
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x4062b5
leaq 0x1910be(%rip), %rsi    # 0x599207
movq %r14, %rdi
callq 0x489510
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x408177
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x40817e
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x40(%rsp), %rsi
movq (%rsi), %rax
leaq 0x120(%rsp), %rdi
callq *0x18(%rax)
movq (%rsp), %rcx
movq 0x8(%rsp), %r8
movq 0x160(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r15, %rcx
je 0x4081cd
movq 0x10(%rsp), %rsi
leaq 0x168(%rsp), %r12
cmpq %rsi, %rax
jbe 0x4081f6
movl $0xf, %esi
cmpq %r12, 0x158(%rsp)
je 0x4081f1
movq 0x168(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x408208
movq 0x158(%rsp), %rsi
movq %rsp, %rdi
callq 0x4893d0
jmp 0x408219
leaq 0x158(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x488d50
leaq 0x60(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x40823d
movq %rsi, 0x50(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x60(%rsp)
jmp 0x408243
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x58(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
leaq 0x1951e6(%rip), %rsi    # 0x59d44d
leaq 0x50(%rsp), %rdi
callq 0x489510
leaq 0xb8(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4082a1
movq %rdx, 0xa8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0xb8(%rsp)
jmp 0x4082a9
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0xb0(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0xa8(%rsp), %rsi
movq 0xb0(%rsp), %rdx
movq $0x60f6a0, %rdi         # imm = 0x60F6A0
callq 0x477930
movq %rax, %r14
leaq 0x190d9b(%rip), %rsi    # 0x599085
movl $0x4, %edx
movq %rax, %rdi
callq 0x477930
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x458a80
movsbl %al, %esi
movq %r14, %rdi
callq 0x477430
movq %rax, %rdi
callq 0x476a00
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x40833b
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x408356
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x40dd10
movq 0x158(%rsp), %rdi
cmpq %r12, %rdi
je 0x408373
movq 0x168(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0x120(%rsp), %rdi
callq 0x4099d0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x408396
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4083b1
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x40dd10
movq 0x40(%rsp), %rdi
callq 0x40987a
movq %rbx, %rax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x190e79(%rip), %rdi    # 0x599250
movq %r15, %rsi
xorl %eax, %eax
callq 0x458590
movq %rax, %rbx
jmp 0x408425
movq %rax, %rbx
jmp 0x408440
movq %rax, %rbx
jmp 0x40844d
movq %rax, %rbx
jmp 0x408463
jmp 0x408489
movq %rax, %rbx
movq %r15, %rdi
jmp 0x408537
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
cmpq %r13, %rdi
je 0x408425
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x408440
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0x120(%rsp), %rdi
callq 0x404a8a
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x408463
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x40853c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x40dd10
jmp 0x40853c
jmp 0x408489
movq %rax, %rbx
jmp 0x408522
jmp 0x4084a4
jmp 0x4084a4
movq %rax, %rbx
jmp 0x4084f0
movq %rax, %rbx
jmp 0x4084d4
movq %rax, %rbx
jmp 0x4084c7
movq %rax, %rbx
jmp 0x408515
movq %rax, %rbx
movq (%rsp), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x4084c7
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0xa8(%rsp), %rdi
callq 0x404a8a
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x4084f0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x40dd10
movq 0x100(%rsp), %rdi
leaq 0x110(%rsp), %rax
cmpq %rax, %rdi
je 0x408515
movq 0x110(%rsp), %rsi
incq %rsi
callq 0x40dd10
leaq 0x120(%rsp), %rdi
callq 0x4099d0
leaq 0x88(%rsp), %r14
leaq 0x50(%rsp), %rdi
callq 0x4099d0
movq %r14, %rdi
callq 0x408760
movq %rbx, %rdi
callq 0x4b7f40