// File: /workspace/github_cpp_makefile_star2_O3/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
xorl %eax, %eax
movq %rax, -0x30(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
leaq -0xb8(%rbp), %rsi
movq %rax, 0x8(%rsi)
leaq 0x4cd(%rip), %rax       # 0x2a16
movq %rax, (%rsi)
leaq 0xecb(%rip), %r14       # 0x341e
movq %r14, 0x18(%rsi)
leaq 0xece(%rip), %r15       # 0x342c
movq %r15, 0x10(%rsi)
leaq -0xe8(%rbp), %rdi
callq 0x2f12
leaq 0x5bdb(%rip), %rax      # 0x8150
movl (%rax), %ecx
incl %ecx
movl %ecx, (%rax)
movl %ecx, -0xc0(%rbp)
movq -0xa8(%rbp), %rax
testq %rax, %rax
je 0x259e
leaq -0xb8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0xb8(%rbp), %rsi
movq $0x0, 0x8(%rsi)
leaq 0x4b0(%rip), %rax       # 0x2a64
movq %rax, (%rsi)
movq %r14, 0x18(%rsi)
movq %r15, 0x10(%rsi)
leaq -0x40(%rbp), %rdi
callq 0x37b6
movq -0xa8(%rbp), %rax
testq %rax, %rax
je 0x25e5
leaq -0xb8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0xb8(%rbp), %rbx
movq $0x0, 0x8(%rbx)
leaq 0x6db(%rip), %rax       # 0x2cd6
movq %rax, (%rbx)
movq %r14, 0x18(%rbx)
movq %r15, 0x10(%rbx)
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x37b6
movq -0xa8(%rbp), %rax
testq %rax, %rax
je 0x262f
leaq -0xb8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0x40(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x36a2
movq 0x598a(%rip), %rdi      # 0x7fd0
leaq 0x29eb(%rip), %rsi      # 0x5038
movl $0x1b, %edx
callq 0x21c0
movq -0x38(%rbp), %rsi
subq -0x40(%rbp), %rsi
sarq $0x3, %rsi
movq 0x5966(%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 -0xb0(%rbp), %rdi
movl $0x1, -0x8(%rdi)
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2998(%rip), %rsi      # 0x5054
leaq 0x299a(%rip), %rdx      # 0x505d
callq 0x2f86
leaq -0x90(%rbp), %r15
movl $0x2, (%r15)
leaq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x2972(%rip), %rsi      # 0x505e
leaq 0x2974(%rip), %rdx      # 0x5067
callq 0x2f86
leaq -0x68(%rbp), %r15
movl $0x3, (%r15)
leaq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x2951(%rip), %rsi      # 0x5068
leaq 0x2953(%rip), %rdx      # 0x5071
callq 0x2f86
leaq -0x118(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
leaq -0x22(%rbp), %rcx
leaq -0x21(%rbp), %r8
movl $0x3, %edx
callq 0x2e8e
movq $-0x78, %rbx
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x2760
movq (%r12), %rsi
incq %rsi
callq 0x21a0
addq $-0x28, %r12
addq $0x28, %rbx
jne 0x274a
movl $0x30, %edi
callq 0x2190
movq %rax, %rbx
leaq -0x118(%rbp), %rdx
movq %rax, %rdi
movl $0x64, %esi
callq 0x3e66
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x3794
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x581b(%rip), %r14      # 0x7fd0
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq %rax, %r15
leaq 0x28a3(%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 -0xe8(%rbp), %rsi
callq 0x383c
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq 0x579f(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x27f0(%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 0x3794
callq 0x2e09
leaq -0x118(%rbp), %rdi
callq 0x3024
movq -0xd8(%rbp), %rax
testq %rax, %rax
je 0x28cd
leaq -0xe8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0x40(%rbp), %rdi
callq 0x30b4
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2a0e
jmp 0x2a0e
jmp 0x2a0e
jmp 0x2a0e
movq %rax, %r14
movl $0x30, %esi
movq %rbx, %rdi
callq 0x21a0
jmp 0x29d4
movq %rax, %r14
leaq -0x40(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x2270
jmp 0x29e0
jmp 0x292b
movq %rax, %r14
addq $-0x10, %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x2946
movq (%r15), %rsi
incq %rsi
callq 0x21a0
leaq -0x28(%r15), %rax
addq $-0x18, %r15
cmpq %rbx, %r15
movq %rax, %r15
jne 0x2932
jmp 0x29e0
jmp 0x29cc
movq %rax, %r14
movq -0xa8(%rbp), %rax
testq %rax, %rax
je 0x29e0
leaq -0xb8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x29e0
jmp 0x2a0e
movq %rax, %r14
movq -0xa8(%rbp), %rax
testq %rax, %rax
je 0x29e0
leaq -0xb8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x29e0
jmp 0x2a0e
movq %rax, %r14
movq -0xa8(%rbp), %rax
testq %rax, %rax
je 0x29fd
leaq -0xb8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x29fd
jmp 0x2a0e
movq %rax, %r14
jmp 0x29e0
movq %rax, %r14
leaq -0x118(%rbp), %rdi
callq 0x3024
movq -0xd8(%rbp), %rax
testq %rax, %rax
je 0x29fd
leaq -0xe8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq -0x40(%rbp), %rdi
callq 0x30b4
movq %r14, %rdi
callq 0x2230
movq %rax, %rdi
callq 0x2f77