// File: /workspace/github_cpp_makefile_star2_O2/enbock[P]Warp10Server/ulib/src/EventDispatcher.cpp
// Function: u::EventDispatcher::~EventDispatcher()
u::EventDispatcher::~EventDispatcher()
{
	int8 c = 0;
	lock();
	/*
	 * Be so long alive, so long any bindings exists.
	 * DO A CLEAN PROGRMMING!
	 */
	while(hasEventListener())
	{
#ifndef NDEBUG
		if(c == 0) 
			error(className()+": Has "+int2string(_eventList.length())+" binder types.");
#endif
		int64 i,l;
		for(i=0, l=_eventList.length(); i<l; i++)
		{
			_eventVector* vec = &_eventList.at(i);
#ifndef NDEBUG
			if(c == 0)
			{
				String out = className() + ": Bind type " + int2string(i) + " is "
					+ (*vec->type) + " with "	+ int2string(vec->list.length())
					+ " binder" + (vec->list.length() > 1 ? "s" : "")
					+ " on target";
#endif
			  int64 vl, vi;
			  for(vi=0, vl = vec->list.length(); vi < vl; vi++)
			  {
			  	// autoremove on invalid target
			  	if(!valid((Object *)&(vec->list.at(vi).target)))
			  	{
#ifndef NDEBUG
			  		trace(
			  			className() + "::~EventDispatcher: Remove target "
			  			+ ptr2string(vec->list.at(vi).target) + " from list "
			  			+ (*vec->type)
					);
#endif
			  		vec->list.erase(vi);
			  		vl = vec->list.length();
			  		if(vl > 0) vi--;
			  		if(vec->list.empty())
			  		{
			  			delEventVector(vec->type);
			  			l = _eventList.length();
			  			if (l > 0) i--;
			  			break;
			  		}
			  	}
#ifndef NDEBUG
			  	else
			  	{
			  		out += " "+int2string(vi)+": "+vec->list.at(vi).target->toString();
				  	if(vi+1 != vl) out += " and";
			  	}
#endif
			  }
#ifndef NDEBUG
			  trace(out+".");
			}
#endif
		}
		unlock();
#ifndef NDEBUG
		c++;
		if(c>=90) c=0;
#endif
		usleep(1000000/FPS);
		lock();
	}
	unlock();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, %rbx
leaq 0x1fc85f(%rip), %rax    # 0x6026c0
movq %rax, (%rdi)
callq 0x407cb6
movq %rbx, (%rsp)
leaq 0x70(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x298(%rsp), %r15
leaq 0x278(%rsp), %r13
movl $0x0, 0xc(%rsp)
movq (%rsp), %rcx
movq 0x78(%rcx), %rax
subq 0x70(%rcx), %rax
testq %rax, %rax
jle 0x406508
cmpb $0x0, 0xc(%rsp)
jne 0x405fad
movq $0x60d580, %rdi         # imm = 0x60D580
leaq 0x19029d(%rip), %rsi    # 0x596159
callq 0x474850
movq %rax, %r14
movq (%rsp), %rsi
movq (%rsi), %rax
leaq 0x220(%rsp), %rdi
callq *0x8(%rax)
movq %r15, %rdi
leaq 0x258(%rsp), %rsi
leaq 0x190279(%rip), %rdx    # 0x596161
callq 0x404ec5
movq (%rsp), %rcx
movq 0x78(%rcx), %rax
subq 0x70(%rcx), %rax
cqto
pushq $0x58
popq %rcx
idivq %rcx
leaq 0x58(%rsp), %rdi
movl %eax, %esi
callq 0x407f86
leaq 0xb0(%rsp), %rdi
movq %r15, %rsi
leaq 0x90(%rsp), %rdx
callq 0x405951
leaq 0x108(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x19022c(%rip), %rdx    # 0x596168
callq 0x404ec5
movq %r14, %rdi
leaq 0x108(%rsp), %rsi
callq 0x4870d0
movq %rax, %rdi
leaq 0x19012a(%rip), %rsi    # 0x596085
callq 0x474850
movq %rax, %rdi
callq 0x474130
leaq 0x108(%rsp), %rdi
callq 0x484750
leaq 0xb0(%rsp), %rdi
callq 0x484750
leaq 0x58(%rsp), %rdi
callq 0x404ab8
movq %r15, %rdi
callq 0x484750
leaq 0x220(%rsp), %rdi
callq 0x404ab8
movq (%rsp), %rcx
movq 0x78(%rcx), %rax
subq 0x70(%rcx), %rax
cqto
pushq $0x58
popq %rcx
idivq %rcx
movq %rax, 0x18(%rsp)
xorl %esi, %esi
cmpq 0x18(%rsp), %rsi
jge 0x4064cf
movq 0x30(%rsp), %rdi
movq %rsi, 0x10(%rsp)
callq 0x406d5c
cmpb $0x0, 0xc(%rsp)
jne 0x4064c2
movq %rax, %rbx
movq (%rsp), %rsi
movq (%rsi), %rax
leaq 0x58(%rsp), %rdi
callq *0x8(%rax)
leaq 0x160(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x19016d(%rip), %rdx    # 0x596177
callq 0x404ec5
leaq 0x108(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x407f86
leaq 0x180(%rsp), %rdi
leaq 0x160(%rsp), %rsi
leaq 0x140(%rsp), %rdx
callq 0x405951
leaq 0x1a0(%rsp), %rdi
leaq 0x180(%rsp), %rsi
leaq 0x19012f(%rip), %rdx    # 0x596184
callq 0x404ec5
movq (%rbx), %rdx
addq $0x38, %rdx
leaq 0x1c0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x406d7a
leaq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
leaq 0x1900fc(%rip), %rdx    # 0x596189
callq 0x404ec5
movq 0x48(%rbx), %rax
subq 0x40(%rbx), %rax
cqto
pushq $0x58
popq %rcx
idivq %rcx
leaq 0xb0(%rsp), %rdi
movl %eax, %esi
callq 0x407f86
leaq 0x38(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0x405951
movq %r13, %rdi
leaq 0x38(%rsp), %rsi
leaq 0x1900b6(%rip), %rdx    # 0x596190
callq 0x404ec5
movq 0x48(%rbx), %rax
subq 0x40(%rbx), %rax
cmpq $0x59, %rax
leaq 0x1af5b8(%rip), %rdx    # 0x5b56aa
leaq 0x1b2736(%rip), %rax    # 0x5b882f
cmovgeq %rax, %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x404ec5
leaq 0x200(%rsp), %rdi
movq %r15, %rsi
leaq 0x19007e(%rip), %rdx    # 0x596198
callq 0x404ec5
leaq 0x220(%rsp), %rdi
leaq 0x200(%rsp), %rsi
callq 0x4081c2
leaq 0x8(%rbx), %rax
movq %rax, 0x28(%rsp)
movq %rbx, %rbp
addq $0x40, %rbp
leaq 0x200(%rsp), %rdi
callq 0x484750
movq %r15, %rdi
callq 0x484750
movq %r13, %rdi
callq 0x484750
leaq 0x38(%rsp), %rdi
callq 0x484750
leaq 0xb0(%rsp), %rdi
callq 0x404ab8
leaq 0x1e0(%rsp), %rdi
callq 0x484750
leaq 0x1c0(%rsp), %rdi
callq 0x484750
leaq 0x1a0(%rsp), %rdi
callq 0x484750
leaq 0x180(%rsp), %rdi
callq 0x484750
leaq 0x108(%rsp), %rdi
callq 0x404ab8
leaq 0x160(%rsp), %rdi
callq 0x484750
leaq 0x58(%rsp), %rdi
callq 0x404ab8
movq 0x48(%rbx), %rax
movq %rbx, 0x20(%rsp)
subq 0x40(%rbx), %rax
xorl %r12d, %r12d
cqto
pushq $0x58
popq %rcx
idivq %rcx
movq %rax, %r14
leaq -0x1(%rax), %rbx
cmpq %r14, %r12
jge 0x406458
movq %rbp, %rdi
movq %r12, %rsi
callq 0x406d9a
addq $0x38, %rax
movq %rax, %rdi
callq 0x408a2a
testb %al, %al
je 0x4062ec
leaq 0x58(%rsp), %rdi
movl %r12d, %esi
callq 0x407f86
movq %r13, %rdi
leaq 0x190357(%rip), %rsi    # 0x596585
leaq 0x90(%rsp), %rdx
callq 0x404ee4
movq %r15, %rdi
movq %r13, %rsi
leaq 0x1940a6(%rip), %rdx    # 0x59a2ee
callq 0x404ec5
movq %rbp, %rdi
movq %r12, %rsi
callq 0x406d9a
movq 0x38(%rax), %rsi
movq (%rsi), %rax
leaq 0x108(%rsp), %rdi
callq *0x18(%rax)
leaq 0xb0(%rsp), %rdi
movq %r15, %rsi
leaq 0x140(%rsp), %rdx
callq 0x405951
leaq 0x258(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x485e60
leaq 0xb0(%rsp), %rdi
callq 0x484750
leaq 0x108(%rsp), %rdi
callq 0x404ab8
movq %r15, %rdi
callq 0x484750
movq %r13, %rdi
callq 0x484750
leaq 0x58(%rsp), %rdi
callq 0x404ab8
cmpq %r12, %rbx
je 0x4062e4
leaq 0x258(%rsp), %rdi
leaq 0x18fef3(%rip), %rsi    # 0x5961d2
callq 0x485f00
incq %r12
jmp 0x4061ef
movq $0x60d6a0, %rdi         # imm = 0x60D6A0
leaq 0x18fd7f(%rip), %rsi    # 0x596079
callq 0x474850
movq %rax, %r14
movq (%rsp), %rsi
movq (%rsi), %rax
leaq 0x58(%rsp), %rdi
callq *0x8(%rax)
leaq 0x38(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x18fe7e(%rip), %rdx    # 0x5961a3
callq 0x404ec5
movq %rbp, %rdi
movq %r12, %rsi
callq 0x406d9a
movq 0x38(%rax), %rsi
leaq 0x108(%rsp), %rdi
callq 0x408010
movq %r13, %rdi
leaq 0x38(%rsp), %rsi
leaq 0x140(%rsp), %rdx
callq 0x405951
movq %r15, %rdi
movq %r13, %rsi
leaq 0x18fe5e(%rip), %rdx    # 0x5961c6
callq 0x404ec5
movq 0x20(%rsp), %rax
movq (%rax), %rdx
addq $0x38, %rdx
leaq 0xb0(%rsp), %rdi
movq %r15, %rsi
callq 0x406d7a
movq %r14, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x4870d0
movq %rax, %rdi
leaq 0x18fce2(%rip), %rsi    # 0x596085
callq 0x474850
movq %rax, %rdi
callq 0x474130
leaq 0xb0(%rsp), %rdi
callq 0x484750
movq %r15, %rdi
callq 0x484750
movq %r13, %rdi
callq 0x484750
leaq 0x108(%rsp), %rdi
callq 0x404ab8
leaq 0x38(%rsp), %rdi
callq 0x484750
leaq 0x58(%rsp), %rdi
callq 0x404ab8
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x406db8
movq 0x20(%rsp), %rdx
movq 0x40(%rdx), %rcx
movq 0x48(%rdx), %rax
cmpq %rax, %rcx
je 0x406423
subq %rcx, %rax
xorl %ecx, %ecx
testq %rax, %rax
setg %cl
subq %rcx, %r12
incq %r12
jmp 0x4061e0
movq (%rdx), %rsi
movq (%rsp), %rdi
callq 0x406558
movq (%rsp), %rax
movq 0x78(%rax), %rcx
subq 0x70(%rax), %rcx
movq %rcx, %rax
cqto
pushq $0x58
popq %rsi
idivq %rsi
movq %rax, 0x18(%rsp)
xorl %eax, %eax
testq %rcx, %rcx
setg %al
subq %rax, 0x10(%rsp)
movq $0x60d6a0, %rdi         # imm = 0x60D6A0
leaq 0x18fc13(%rip), %rsi    # 0x596079
callq 0x474850
movq %rax, %r14
leaq 0x58(%rsp), %rdi
leaq 0x258(%rsp), %rsi
leaq 0x193f6b(%rip), %rdx    # 0x59a3ed
callq 0x406dc9
movq %r14, %rdi
leaq 0x58(%rsp), %rsi
callq 0x4870d0
movq %rax, %rdi
leaq 0x18fbe7(%rip), %rsi    # 0x596085
callq 0x474850
movq %rax, %rdi
callq 0x474130
leaq 0x58(%rsp), %rdi
callq 0x484750
leaq 0x220(%rsp), %rdi
callq 0x404ab8
movq 0x10(%rsp), %rsi
incq %rsi
jmp 0x405fbc
movq (%rsp), %rdi
callq 0x407c72
movl $0x2b67, %edi           # imm = 0x2B67
callq 0x53e1e0
movl 0xc(%rsp), %ecx
incb %cl
cmpb $0x5a, %cl
movzbl %cl, %ecx
movl $0x0, %eax
cmovgel %eax, %ecx
movl %ecx, 0xc(%rsp)
movq (%rsp), %rdi
callq 0x407cb6
jmp 0x405e8e
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x407c72
leaq 0x38(%rbx), %rdi
callq 0x406d46
movq %rbx, %rdi
callq 0x407db8
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x40653f
jmp 0x40653f
jmp 0x40653f
jmp 0x40653f
movq %rax, %rdi
callq 0x404e59
nop