// File: Barath-Kannan[P]SignalsAndSlots/test/SignalTest.cpp
// Function: SignalTest_AsynchronousSignal_Test::TestBody()
TEST_F(SignalTest, AsynchronousSignal) {
    cout << "Instantiating signal object" << endl;

    Signal<int, int> testSignal;

    BasicTimer bt;
    BasicTimer bt2;
    cout << "Connecting signal" << endl;
    bt.start();
    int id = testSignal.connectSlot(ExecutorScheme::ASYNCHRONOUS, staticSumFunction);
    bt.stop();
    cout << "Time to connect: " << bt.getElapsedMilliseconds() << "ms" << endl;

    cout << "Emitting signal" << endl;

    bt.start();
    bt2.start();
    testSignal.emitSignal(1, 2);
    bt.stop();

    while (bt2.getElapsedSeconds() < 0.1) {
        if (globalStaticIntX == 3) {
            bt2.stop();
            break;
        }
    }
    ASSERT_LT(bt2.getElapsedSeconds(), 0.1);
    ASSERT_EQ(globalStaticIntX, 3);

    cout << "Time to emit: " << bt.getElapsedMilliseconds() << "ms" << endl;
    cout << "Time to emit and process: " << bt2.getElapsedMilliseconds() << "ms" << endl;
    cout << "Net time to process: " << bt2.getElapsedMilliseconds() - bt.getElapsedMilliseconds() << "ms" << endl;

    ASSERT_EQ(0, id);

    testSignal.disconnectSlot(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x300, %rsp            # imm = 0x300
movq %rdi, -0x8(%rbp)
movq 0xe24a2(%rip), %rdi     # 0xfafb8
leaq 0x8cba2(%rip), %rsi     # 0xa56bf
callq 0xd640
movq %rax, %rdi
movq 0xe2464(%rip), %rsi     # 0xfaf90
callq 0xd6e0
leaq -0x120(%rbp), %rdi
callq 0x1c140
leaq -0x138(%rbp), %rdi
callq 0xfc20
jmp 0x18b4b
leaq -0x160(%rbp), %rdi
callq 0xfc20
jmp 0x18b59
movq 0xe2458(%rip), %rdi     # 0xfafb8
leaq 0x8cba0(%rip), %rsi     # 0xa5707
callq 0xd640
movq %rax, -0x220(%rbp)
jmp 0x18b75
movq -0x220(%rbp), %rdi
movq 0xe240d(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x18b8a
leaq -0x138(%rbp), %rdi
callq 0xfde0
jmp 0x18b98
leaq -0xe2f(%rip), %rsi      # 0x17d70
leaq -0x188(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x1c3d0
movq -0x230(%rbp), %rdx
leaq -0x120(%rbp), %rdi
movl $0x2, %esi
callq 0x1c350
movl %eax, -0x224(%rbp)
jmp 0x18bd2
leaq -0x188(%rbp), %rdi
callq 0x1c460
movl -0x224(%rbp), %eax
movl %eax, -0x164(%rbp)
leaq -0x138(%rbp), %rdi
callq 0xfe30
jmp 0x18bf8
movq 0xe23b9(%rip), %rdi     # 0xfafb8
leaq 0x8cb13(%rip), %rsi     # 0xa5719
callq 0xd640
movq %rax, -0x238(%rbp)
jmp 0x18c14
leaq -0x138(%rbp), %rdi
callq 0xfd00
movsd %xmm0, -0x240(%rbp)
jmp 0x18c2a
movsd -0x240(%rbp), %xmm0
movq -0x238(%rbp), %rdi
callq 0xddc0
movq %rax, -0x248(%rbp)
jmp 0x18c47
movq -0x248(%rbp), %rdi
leaq 0x8e546(%rip), %rsi     # 0xa719b
callq 0xd640
movq %rax, -0x250(%rbp)
jmp 0x18c63
movq -0x250(%rbp), %rdi
movq 0xe231f(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x18c78
movq 0xe2339(%rip), %rdi     # 0xfafb8
leaq 0x8caa5(%rip), %rsi     # 0xa572b
callq 0xd640
movq %rax, -0x258(%rbp)
jmp 0x18c94
movq -0x258(%rbp), %rdi
movq 0xe22ee(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x18ca9
leaq -0x138(%rbp), %rdi
callq 0xfde0
jmp 0x18cb7
leaq -0x160(%rbp), %rdi
callq 0xfde0
jmp 0x18cc5
movl $0x1, -0x18c(%rbp)
movl $0x2, -0x190(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x18c(%rbp), %rsi
leaq -0x190(%rbp), %rdx
callq 0x1c710
jmp 0x18cf5
leaq -0x138(%rbp), %rdi
callq 0xfe30
jmp 0x18d03
jmp 0x18d05
leaq -0x160(%rbp), %rdi
callq 0xfc60
movsd %xmm0, -0x260(%rbp)
jmp 0x18d1b
movsd -0x260(%rbp), %xmm1
movsd 0x8c45d(%rip), %xmm0    # 0xa5188
ucomisd %xmm1, %xmm0
jbe 0x18d91
leaq 0x134b3c(%rip), %rdi    # 0x14d874
callq 0x1c740
cmpl $0x3, %eax
jne 0x18d8c
leaq -0x160(%rbp), %rdi
callq 0xfe30
jmp 0x18d50
jmp 0x18d91
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x193c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x1c460
jmp 0x193c9
jmp 0x18d05
leaq -0x160(%rbp), %rdi
callq 0xfc60
movsd %xmm0, -0x268(%rbp)
jmp 0x18da7
movsd -0x268(%rbp), %xmm0
movsd %xmm0, -0x1a8(%rbp)
movabsq $0x3fb999999999999a, %rax # imm = 0x3FB999999999999A
movq %rax, -0x1b0(%rbp)
leaq 0x8c9bb(%rip), %rsi     # 0xa578a
leaq 0x8c9cc(%rip), %rdx     # 0xa57a2
leaq -0x1a0(%rbp), %rdi
leaq -0x1a8(%rbp), %rcx
leaq -0x1b0(%rbp), %r8
callq 0x1c7c0
jmp 0x18df2
leaq -0x1a0(%rbp), %rdi
callq 0x1c500
movb %al, -0x269(%rbp)
jmp 0x18e06
movb -0x269(%rbp), %al
testb $0x1, %al
jne 0x18e12
jmp 0x18e2e
jmp 0x18ef0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x18f6f
leaq -0x1b8(%rbp), %rdi
callq 0x6f130
jmp 0x18e3c
leaq -0x1a0(%rbp), %rdi
callq 0x1c520
movq %rax, -0x278(%rbp)
jmp 0x18e51
movq -0x278(%rbp), %r8
leaq 0x8c84c(%rip), %rdx     # 0xa56ab
leaq -0x1c0(%rbp), %rdi
movl $0x2, %esi
movl $0x8a, %ecx
callq 0x6c7e0
jmp 0x18e77
leaq -0x1c0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x6c8a0
jmp 0x18e8c
leaq -0x1c0(%rbp), %rdi
callq 0x6c860
leaq -0x1b8(%rbp), %rdi
callq 0x1c540
movl $0x1, -0x1c4(%rbp)
jmp 0x18efa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x18ee2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x6c860
leaq -0x1b8(%rbp), %rdi
callq 0x1c540
jmp 0x18f6f
movl $0x0, -0x1c4(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x1c560
movl -0x1c4(%rbp), %eax
testl %eax, %eax
jne 0x193a8
jmp 0x18f16
movl $0x3, -0x1dc(%rbp)
leaq 0x8c823(%rip), %rsi     # 0xa574a
leaq 0x8c82d(%rip), %rdx     # 0xa575b
leaq 0x13493f(%rip), %rcx    # 0x14d874
leaq -0x1d8(%rbp), %rdi
leaq -0x1dc(%rbp), %r8
callq 0x1c4b0
jmp 0x18f4a
leaq -0x1d8(%rbp), %rdi
callq 0x1c500
movb %al, -0x279(%rbp)
jmp 0x18f5e
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0x18f6a
jmp 0x18f97
jmp 0x1905c
leaq -0x1a0(%rbp), %rdi
callq 0x1c560
jmp 0x193c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x19282
leaq -0x1e8(%rbp), %rdi
callq 0x6f130
jmp 0x18fa5
leaq -0x1d8(%rbp), %rdi
callq 0x1c520
movq %rax, -0x288(%rbp)
jmp 0x18fba
movq -0x288(%rbp), %r8
leaq 0x8c6e3(%rip), %rdx     # 0xa56ab
leaq -0x1f0(%rbp), %rdi
movl $0x2, %esi
movl $0x8b, %ecx
callq 0x6c7e0
jmp 0x18fe0
leaq -0x1f0(%rbp), %rdi
leaq -0x1e8(%rbp), %rsi
callq 0x6c8a0
jmp 0x18ff5
leaq -0x1f0(%rbp), %rdi
callq 0x6c860
leaq -0x1e8(%rbp), %rdi
callq 0x1c540
movl $0x1, -0x1c4(%rbp)
jmp 0x19066
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x1904b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x1f0(%rbp), %rdi
callq 0x6c860
leaq -0x1e8(%rbp), %rdi
callq 0x1c540
jmp 0x19282
movl $0x0, -0x1c4(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x1c560
movl -0x1c4(%rbp), %eax
testl %eax, %eax
jne 0x193a8
jmp 0x19082
movq 0xe1f2f(%rip), %rdi     # 0xfafb8
leaq 0x8c6ab(%rip), %rsi     # 0xa573b
callq 0xd640
movq %rax, -0x290(%rbp)
jmp 0x1909e
leaq -0x138(%rbp), %rdi
callq 0xfd00
movsd %xmm0, -0x298(%rbp)
jmp 0x190b4
movsd -0x298(%rbp), %xmm0
movq -0x290(%rbp), %rdi
callq 0xddc0
movq %rax, -0x2a0(%rbp)
jmp 0x190d1
movq -0x2a0(%rbp), %rdi
leaq 0x8e0bc(%rip), %rsi     # 0xa719b
callq 0xd640
movq %rax, -0x2a8(%rbp)
jmp 0x190ed
movq -0x2a8(%rbp), %rdi
movq 0xe1e95(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x19102
movq 0xe1eaf(%rip), %rdi     # 0xfafb8
leaq 0x8c696(%rip), %rsi     # 0xa57a6
callq 0xd640
movq %rax, -0x2b0(%rbp)
jmp 0x1911e
leaq -0x160(%rbp), %rdi
callq 0xfd00
movsd %xmm0, -0x2b8(%rbp)
jmp 0x19134
movsd -0x2b8(%rbp), %xmm0
movq -0x2b0(%rbp), %rdi
callq 0xddc0
movq %rax, -0x2c0(%rbp)
jmp 0x19151
movq -0x2c0(%rbp), %rdi
leaq 0x8e03c(%rip), %rsi     # 0xa719b
callq 0xd640
movq %rax, -0x2c8(%rbp)
jmp 0x1916d
movq -0x2c8(%rbp), %rdi
movq 0xe1e15(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x19182
movq 0xe1e2f(%rip), %rdi     # 0xfafb8
leaq 0x8c631(%rip), %rsi     # 0xa57c1
callq 0xd640
movq %rax, -0x2d0(%rbp)
jmp 0x1919e
leaq -0x160(%rbp), %rdi
callq 0xfd00
movsd %xmm0, -0x2d8(%rbp)
jmp 0x191b4
leaq -0x138(%rbp), %rdi
callq 0xfd00
movsd %xmm0, -0x2e0(%rbp)
jmp 0x191ca
movq -0x2d0(%rbp), %rdi
movsd -0x2e0(%rbp), %xmm1
movsd -0x2d8(%rbp), %xmm0
subsd %xmm1, %xmm0
callq 0xddc0
movq %rax, -0x2e8(%rbp)
jmp 0x191f3
movq -0x2e8(%rbp), %rdi
leaq 0x8df9a(%rip), %rsi     # 0xa719b
callq 0xd640
movq %rax, -0x2f0(%rbp)
jmp 0x1920f
movq -0x2f0(%rbp), %rdi
movq 0xe1d73(%rip), %rsi     # 0xfaf90
callq 0xd6e0
jmp 0x19224
movl $0x0, -0x204(%rbp)
leaq 0x9251a(%rip), %rsi     # 0xab74f
leaq 0x918bd(%rip), %rdx     # 0xaaaf9
xorl %eax, %eax
movl %eax, %r9d
leaq -0x200(%rbp), %rdi
leaq -0x204(%rbp), %rcx
leaq -0x164(%rbp), %r8
callq 0x1c580
jmp 0x1925d
leaq -0x200(%rbp), %rdi
callq 0x1c500
movb %al, -0x2f1(%rbp)
jmp 0x19271
movb -0x2f1(%rbp), %al
testb $0x1, %al
jne 0x1927d
jmp 0x192aa
jmp 0x1936c
leaq -0x1d8(%rbp), %rdi
callq 0x1c560
jmp 0x193c9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x193bd
leaq -0x210(%rbp), %rdi
callq 0x6f130
jmp 0x192b8
leaq -0x200(%rbp), %rdi
callq 0x1c520
movq %rax, -0x300(%rbp)
jmp 0x192cd
movq -0x300(%rbp), %r8
leaq 0x8c3d0(%rip), %rdx     # 0xa56ab
leaq -0x218(%rbp), %rdi
movl $0x2, %esi
movl $0x91, %ecx
callq 0x6c7e0
jmp 0x192f3
leaq -0x218(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x6c8a0
jmp 0x19308
leaq -0x218(%rbp), %rdi
callq 0x6c860
leaq -0x210(%rbp), %rdi
callq 0x1c540
movl $0x1, -0x1c4(%rbp)
jmp 0x19376
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x1935e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x6c860
leaq -0x210(%rbp), %rdi
callq 0x1c540
jmp 0x193bd
movl $0x0, -0x1c4(%rbp)
leaq -0x200(%rbp), %rdi
callq 0x1c560
movl -0x1c4(%rbp), %eax
testl %eax, %eax
jne 0x193a8
jmp 0x1938e
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
callq 0x1c5d0
jmp 0x1939e
movl $0x0, -0x1c4(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x1c2f0
addq $0x300, %rsp            # imm = 0x300
popq %rbp
retq
leaq -0x200(%rbp), %rdi
callq 0x1c560
leaq -0x120(%rbp), %rdi
callq 0x1c2f0
movq -0x140(%rbp), %rdi
callq 0xdcb0
nopw %cs:(%rax,%rax)