// File: /workspace/github_cpp_makefile_star2_O1/jandoerntlein[P]wire/src/main.cpp
// Function: main
int main( int argc, char** argv )
{
    std::cout << "--- Wire Test ---" << std::endl;

    Button B;
    Light  L1;
    Light  L2;

    B.toggle.connect( &Light::Toggle, &L1 );
    B.toggle.connect( &Light::Toggle, &L2 );
    B.changeColor.connect( &Light::setColor, &L1 );
    B.changeColor.connect( &Light::setColor, &L2 );
    B.range.connect( &Light::setRange, &L1 );
    B.toggle(); // toggles all connected lights
    B.changeColor( 17 );
    B.toggle();
    B.range( 17.f, 19.f );

    std::cout << "--- Disconnect Test ---" << std::endl;

    B.toggle.disconnect();
    B.toggle.connect( &Light::Toggle, &L2 );
    B.toggle();    

    std::cout << "--- DirectWire Test ---" << std::endl;

    Light  L3;
    Light  L4;
    enum { PORT0, PORT1 };

    B.direct_toggle.connect( PORT0, &Light::Toggle, &L3 );
    B.direct_toggle.connect( PORT1, &Light::Toggle, &L4 );
    B.direct_ChangeColor.connect( PORT0, &Light::setColor, &L3 );
    B.direct_ChangeColor.connect( PORT1, &Light::setColor, &L4 );
    B.direct_toggle( PORT0 ); // toggles only light connected to PORT0
    B.direct_toggle( PORT1 );
    B.direct_ChangeColor( PORT0, 1337 );
    B.direct_ChangeColor( PORT1, 42 );
    B.direct_toggle( PORT0 );
    B.direct_toggle( PORT1 );

    std::cout << "--- End Test ---" << std::endl;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq 0x5cc4(%rip), %rbx      # 0x7fd8
leaq 0x2d19(%rip), %rsi      # 0x5034
movl $0x11, %edx
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
leaq 0xe8(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0x48(%rax)
movaps %xmm0, -0x58(%rax)
movaps %xmm0, -0x68(%rax)
movaps %xmm0, -0x78(%rax)
movq $0x0, -0x38(%rax)
movq %rax, -0x30(%rax)
movl $0x1, %ecx
movq %rcx, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl $0x3f800000, %edx       # imm = 0x3F800000
movl %edx, -0x10(%rax)
movaps %xmm0, -0x8(%rax)
leaq 0x120(%rsp), %rax
movq %rax, -0x30(%rax)
movq %rcx, -0x28(%rax)
movaps %xmm0, -0x20(%rax)
movl %edx, -0x10(%rax)
movups %xmm0, -0x8(%rax)
xorl %eax, %eax
movl %eax, 0x68(%rsp)
movb %al, 0x6c(%rsp)
movl 0x5d2e(%rip), %ecx      # 0x80e8
leal 0x1(%rcx), %edx
movl %edx, 0x5d25(%rip)      # 0x80e8
movl %ecx, 0x64(%rsp)
movl %eax, 0x5c(%rsp)
movb %al, 0x60(%rsp)
addl $0x2, %ecx
movl %ecx, 0x5d10(%rip)      # 0x80e8
movl %edx, 0x58(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0xa71(%rip), %rcx       # 0x2e68
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x64(%rsp), %r15
movq %r15, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xf76(%rip), %rax       # 0x3390
movq %rax, 0x18(%rsi)
leaq 0xf87(%rip), %rbx       # 0x33ac
movq %rbx, 0x10(%rsi)
leaq 0x70(%rsp), %rdi
callq 0x335a
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x244c
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x9fe(%rip), %rcx       # 0x2e68
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x58(%rsp), %r14
movq %r14, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xf03(%rip), %rax       # 0x3390
movq %rax, 0x18(%rsi)
movq %rbx, 0x10(%rsi)
leaq 0x70(%rsp), %rdi
callq 0x335a
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x24b8
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x88(%rsp), %rdi
leaq 0xa5a(%rip), %rcx       # 0x2f38
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movq %r15, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x11d2(%rip), %rax      # 0x36ce
movq %rax, 0x18(%rsi)
leaq 0x11e5(%rip), %rax      # 0x36ec
movq %rax, 0x10(%rsi)
callq 0x3698
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2529
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x9f1(%rip), %rcx       # 0x2f38
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movq %r14, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x1169(%rip), %rax      # 0x36ce
movq %rax, 0x18(%rsi)
leaq 0x117c(%rip), %rax      # 0x36ec
movq %rax, 0x10(%rsi)
leaq 0x88(%rsp), %rdi
callq 0x3698
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x259a
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0xa0(%rsp), %rdi
leaq 0x9fa(%rip), %rcx       # 0x2fba
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movq %r15, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x1430(%rip), %rax      # 0x3a0e
movq %rax, 0x18(%rsi)
leaq 0x1449(%rip), %rax      # 0x3a32
movq %rax, 0x10(%rsi)
callq 0x39d8
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x260b
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %r12
cmpq %r12, %r15
je 0x2632
cmpq $0x0, 0x10(%r15)
je 0x2c85
movq %r15, %rdi
callq *0x18(%r15)
addq $0x20, %r15
jmp 0x2615
movq 0x88(%rsp), %r15
movq 0x90(%rsp), %r13
cmpq %r13, %r15
je 0x2672
leaq 0x10(%rsp), %r12
movl $0x11, 0x10(%rsp)
cmpq $0x0, 0x10(%r15)
je 0x2c85
movq %r15, %rdi
movq %r12, %rsi
callq *0x18(%r15)
addq $0x20, %r15
cmpq %r13, %r15
jne 0x264c
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %r12
cmpq %r12, %r15
je 0x2699
cmpq $0x0, 0x10(%r15)
je 0x2c85
movq %r15, %rdi
callq *0x18(%r15)
addq $0x20, %r15
jmp 0x267c
movq 0xa0(%rsp), %r15
movq 0xa8(%rsp), %rbp
cmpq %rbp, %r15
je 0x26e9
leaq 0x10(%rsp), %r12
leaq 0x40(%rsp), %r13
movl $0x41880000, 0x10(%rsp) # imm = 0x41880000
movl $0x41980000, 0x40(%rsp) # imm = 0x41980000
cmpq $0x0, 0x10(%r15)
je 0x2c85
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq *0x18(%r15)
addq $0x20, %r15
cmpq %rbp, %r15
jne 0x26b8
movq 0x58e8(%rip), %r15      # 0x7fd8
leaq 0x294f(%rip), %rsi      # 0x5046
movl $0x17, %edx
movq %r15, %rdi
callq 0x2100
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq 0x58b6(%rip), %rdi      # 0x7fd8
callq 0x2030
movq %rax, %rdi
callq 0x20a0
leaq 0x70(%rsp), %rdi
movq (%rdi), %rsi
callq 0x3d1e
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x70e(%rip), %rcx       # 0x2e68
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movq %r14, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0xc18(%rip), %rax       # 0x3390
movq %rax, 0x18(%rsi)
movq %rbx, 0x10(%rsi)
leaq 0x70(%rsp), %rdi
callq 0x335a
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x27a3
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x70(%rsp), %r15
movq 0x78(%rsp), %r14
cmpq %r14, %r15
je 0x27ca
cmpq $0x0, 0x10(%r15)
je 0x2c85
movq %r15, %rdi
callq *0x18(%r15)
addq $0x20, %r15
jmp 0x27ad
movq 0x5807(%rip), %r15      # 0x7fd8
leaq 0x2886(%rip), %rsi      # 0x505e
movl $0x17, %edx
movq %r15, %rdi
callq 0x2100
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq 0x57d5(%rip), %rdi      # 0x7fd8
callq 0x2030
movq %rax, %rdi
callq 0x20a0
leaq 0xb8(%rsp), %r15
xorl %eax, %eax
movl %eax, 0x44(%rsp)
movb %al, 0x48(%rsp)
movl 0x58c0(%rip), %ecx      # 0x80e8
leal 0x1(%rcx), %edx
movl %edx, 0x58b7(%rip)      # 0x80e8
movl %ecx, 0x40(%rsp)
movl %eax, 0x50(%rsp)
movb %al, 0x54(%rsp)
addl $0x2, %ecx
movl %ecx, 0x58a2(%rip)      # 0x80e8
movl %edx, 0x4c(%rsp)
leaq 0x3c(%rsp), %rsi
movl %eax, (%rsi)
movq %r15, %rdi
callq 0x3d4e
testq %rax, %rax
jne 0x28d5
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x5e4(%rip), %rcx       # 0x2e68
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
leaq 0xae9(%rip), %rax       # 0x3390
movq %rax, 0x18(%rdx)
movq %rbx, 0x10(%rdx)
leaq 0xc(%rsp), %rsi
movq %r15, %rdi
callq 0x3dc8
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x28d5
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x3c(%rsp), %rsi
movl $0x1, (%rsi)
movq %r15, %rdi
callq 0x3d4e
testq %rax, %rax
jne 0x2964
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x555(%rip), %rcx       # 0x2e68
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x4c(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
leaq 0xa5a(%rip), %rax       # 0x3390
movq %rax, 0x18(%rdx)
movq %rbx, 0x10(%rdx)
leaq 0xc(%rsp), %rsi
movq %r15, %rdi
callq 0x3dc8
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2964
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0xf0(%rsp), %r12
leaq 0x3c(%rsp), %rsi
movl $0x0, (%rsi)
movq %r12, %rdi
callq 0x40f6
testq %rax, %rax
jne 0x2a02
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x58e(%rip), %rcx       # 0x2f38
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
leaq 0xd01(%rip), %rax       # 0x36ce
movq %rax, 0x18(%rdx)
leaq 0xd14(%rip), %rax       # 0x36ec
movq %rax, 0x10(%rdx)
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x4170
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2a02
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x3c(%rsp), %rsi
movl $0x1, (%rsi)
movq %r12, %rdi
callq 0x40f6
testq %rax, %rax
jne 0x2a98
movl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x18, %edi
callq 0x20e0
leaq 0x4f8(%rip), %rcx       # 0x2f38
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
leaq 0x4c(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
leaq 0xc6b(%rip), %rax       # 0x36ce
movq %rax, 0x18(%rdx)
leaq 0xc7e(%rip), %rax       # 0x36ec
movq %rax, 0x10(%rdx)
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x4170
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2a98
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x10(%rsp), %rsi
movl $0x0, (%rsi)
movq %r15, %rdi
callq 0x3d4e
testq %rax, %rax
je 0x2ace
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x4482
cmpq $0x0, 0x10(%rax)
je 0x2c8a
movq %rax, %rdi
callq *0x18(%rax)
leaq 0x10(%rsp), %rsi
movl $0x1, (%rsi)
movq %r15, %rdi
callq 0x3d4e
testq %rax, %rax
je 0x2b04
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x4482
cmpq $0x0, 0x10(%rax)
je 0x2c8a
movq %rax, %rdi
callq *0x18(%rax)
leaq 0xc(%rsp), %rsi
movl $0x0, (%rsi)
movq %r12, %rdi
callq 0x40f6
testq %rax, %rax
je 0x2b47
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x44c4
movl $0x539, 0x10(%rsp)      # imm = 0x539
cmpq $0x0, 0x10(%rax)
je 0x2c8a
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq *0x18(%rax)
leaq 0xc(%rsp), %rsi
movl $0x1, (%rsi)
movq %r12, %rdi
callq 0x40f6
testq %rax, %rax
je 0x2b8a
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x44c4
movl $0x2a, 0x10(%rsp)
cmpq $0x0, 0x10(%rax)
je 0x2c8a
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq *0x18(%rax)
leaq 0x10(%rsp), %rsi
movl $0x0, (%rsi)
movq %r15, %rdi
callq 0x3d4e
testq %rax, %rax
je 0x2bc0
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x4482
cmpq $0x0, 0x10(%rax)
je 0x2c8a
movq %rax, %rdi
callq *0x18(%rax)
leaq 0x10(%rsp), %rsi
movl $0x1, (%rsi)
movq %r15, %rdi
callq 0x3d4e
testq %rax, %rax
je 0x2bf6
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x4482
cmpq $0x0, 0x10(%rax)
je 0x2c8a
movq %rax, %rdi
callq *0x18(%rax)
movq 0x53db(%rip), %r13      # 0x7fd8
leaq 0x2472(%rip), %rsi      # 0x5076
movl $0x10, %edx
movq %r13, %rdi
callq 0x2100
movq (%r13), %rax
addq -0x18(%rax), %r13
movq %r13, %rdi
movl $0xa, %esi
callq 0x20d0
movsbl %al, %esi
movq 0x53a8(%rip), %rdi      # 0x7fd8
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq %r12, %rdi
callq 0x30ba
movq %r15, %rdi
callq 0x316a
leaq 0xa0(%rsp), %rdi
callq 0x3210
leaq 0x88(%rsp), %rdi
callq 0x327e
leaq 0x70(%rsp), %rdi
callq 0x32ec
xorl %eax, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2060
callq 0x2060
jmp 0x2e3f
jmp 0x2e3f
jmp 0x2e3f
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
jmp 0x2e3f
jmp 0x2e3f
jmp 0x2e3f
jmp 0x2e3f
jmp 0x2e3f
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
jmp 0x2e3f
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x2e56
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x2e56
movq %rax, %rdi
callq 0x312d
jmp 0x2e53
jmp 0x2e53
jmp 0x2e53
jmp 0x2e53
jmp 0x2e53
jmp 0x2e53
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3086
movq %rbx, %rdi
callq 0x2180