// File: /workspace/github_cpp_makefile_star2_O1/slafi[P]EventSystem/EventSystem/main.cpp
// Function: main
int main()
{
	cout << "Testing Event System..." << endl << endl;

	// Create a new event
	Event event{};

	// Create an event handler
	EventHandler event_handler(callback_3);

	// Add three event handlers
	event += callback_1;
	event += callback_2;	
	event.add_handler(event_handler);

	cout << "Registered event handlers: " << event.get_number_of_subscribed_handlers() << endl;

	// Create an EventArgs instance
	map<int, string> arg_list = { {1, "property1"}, {2, "property2"}, {3, "property3"} };
	int event_type = 100;

	EventArgs* args = new EventArgs(event_type, &arg_list);
	
	// Raise event
	event(args);

	cout << endl << "Event handler #3 will be discarded because it's napping!" << endl;

	// Remove second event handler
	event -= event_handler;

	cout << endl << "Registered event handlers: " << event.get_number_of_subscribed_handlers() << endl;

	// Raise event again
	event(args);

	// Pause console
	pause_console();
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq 0x5b0b(%rip), %rbx      # 0x7fd0
leaq 0x2b54(%rip), %rsi      # 0x5020
movl $0x17, %edx
movq %rbx, %rdi
callq 0x21c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0xc0(%rbp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
leaq 0x4ef(%rip), %rax       # 0x2a3d
movq %rax, (%rsi)
leaq 0xee4(%rip), %r14       # 0x343c
movq %r14, 0x18(%rsi)
leaq 0xee7(%rip), %r15       # 0x344a
movq %r15, 0x10(%rsi)
leaq -0xf0(%rbp), %rdi
callq 0x2f38
leaq 0x5bd6(%rip), %rax      # 0x8150
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movl %ecx, -0xc8(%rbp)
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x25a3
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
leaq -0xc0(%rbp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
leaq 0x4d0(%rip), %rax       # 0x2a8b
movq %rax, (%rsi)
movq %r14, 0x18(%rsi)
movq %r15, 0x10(%rsi)
leaq -0x40(%rbp), %rdi
callq 0x37e4
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x25ec
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
leaq -0xc0(%rbp), %rbx
movaps %xmm0, (%rbx)
movaps %xmm0, 0x10(%rbx)
leaq 0x6f9(%rip), %rax       # 0x2cfd
movq %rax, (%rbx)
movq %r14, 0x18(%rbx)
movq %r15, 0x10(%rbx)
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x37e4
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x2638
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0x40(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x36c8
movq 0x5981(%rip), %rdi      # 0x7fd0
leaq 0x29e2(%rip), %rsi      # 0x5038
movl $0x1b, %edx
callq 0x21c0
movq -0x38(%rbp), %rsi
subq -0x40(%rbp), %rsi
sarq $0x3, %rsi
movq 0x595d(%rip), %r14      # 0x7fd0
movq %r14, %rdi
callq 0x20d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq -0xb8(%rbp), %rdi
movl $0x1, -0x8(%rdi)
leaq -0xa8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x298f(%rip), %rsi      # 0x5054
leaq 0x2991(%rip), %rdx      # 0x505d
callq 0x2fac
leaq -0x98(%rbp), %r15
movl $0x2, (%r15)
leaq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2969(%rip), %rsi      # 0x505e
leaq 0x296b(%rip), %rdx      # 0x5067
callq 0x2fac
leaq -0x70(%rbp), %r15
movl $0x3, (%r15)
leaq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2948(%rip), %rsi      # 0x5068
leaq 0x294a(%rip), %rdx      # 0x5071
callq 0x2fac
leaq -0x120(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
leaq -0x22(%rbp), %rcx
leaq -0x21(%rbp), %r8
movl $0x3, %edx
callq 0x2eb4
movq $-0x78, %rbx
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x2769
movq (%r12), %rsi
incq %rsi
callq 0x21a0
addq $-0x28, %r12
addq $0x28, %rbx
jne 0x2753
movl $0x30, %edi
callq 0x2190
movq %rax, %rbx
leaq -0x120(%rbp), %rdx
movq %rax, %rdi
movl $0x64, %esi
callq 0x3e96
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x37c2
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x5812(%rip), %r14      # 0x7fd0
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq %rax, %r15
leaq 0x289a(%rip), %rsi      # 0x5072
movl $0x38, %edx
movq %rax, %rdi
callq 0x21c0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq -0x40(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x386a
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x5796(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x27e7(%rip), %rsi      # 0x5038
movl $0x1b, %edx
movq %rax, %rdi
callq 0x21c0
movq -0x38(%rbp), %rsi
subq -0x40(%rbp), %rsi
sarq $0x3, %rsi
movq %r14, %rdi
callq 0x20d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x37c2
callq 0x2e30
leaq -0x120(%rbp), %rdi
callq 0x3046
movq -0xe0(%rbp), %rax
testq %rax, %rax
je 0x28d6
leaq -0xf0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0x40(%rbp), %rdi
callq 0x30d6
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a35
jmp 0x2a35
jmp 0x2a35
jmp 0x2a35
movq %rax, %r14
movl $0x30, %esi
movq %rbx, %rdi
callq 0x21a0
jmp 0x29fb
movq %rax, %r14
leaq -0x48(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2270
movb $0x1, %al
jmp 0x2942
jmp 0x2933
movq %rax, %r14
xorl %eax, %eax
jmp 0x2942
movq %rax, %r14
xorl %eax, %eax
movq %rbx, %r15
cmpq %r15, %rbx
sete %cl
orb %al, %cl
jne 0x2a07
addq $-0x10, %r15
leaq -0xc0(%rbp), %rbx
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x296f
movq (%r15), %rsi
incq %rsi
callq 0x21a0
leaq -0x28(%r15), %rax
addq $-0x18, %r15
cmpq %rbx, %r15
movq %rax, %r15
jne 0x295b
jmp 0x2a07
movq %rax, %r14
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x2a07
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2a07
jmp 0x2a35
movq %rax, %r14
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x2a07
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2a07
jmp 0x2a35
movq %rax, %r14
movq -0xb0(%rbp), %rax
testq %rax, %rax
je 0x2a24
leaq -0xc0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2a24
jmp 0x2a35
movq %rax, %r14
jmp 0x2a07
movq %rax, %r14
leaq -0x120(%rbp), %rdi
callq 0x3046
movq -0xe0(%rbp), %rax
testq %rax, %rax
je 0x2a24
leaq -0xf0(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0x40(%rbp), %rdi
callq 0x30d6
movq %r14, %rdi
callq 0x2230
movq %rax, %rdi
callq 0x2f9d