// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq 0x51a3b(%rip), %rdi     # 0x5ffb0
leaq 0x2bc0c(%rip), %rsi     # 0x3a188
callq 0xb4f0
movq %rax, %rdi
callq 0xb270
leaq 0x80(%rsp), %rdi
callq 0x10606
leaq 0x28(%rsp), %rdi
callq 0xcb2c
leaq 0x40(%rsp), %rdi
callq 0xcb2c
movq 0x519ff(%rip), %rdi     # 0x5ffb0
leaq 0x2bc18(%rip), %rsi     # 0x3a1d0
callq 0xb4f0
movq %rax, %rdi
callq 0xb270
leaq 0x28(%rsp), %rdi
callq 0xcb9a
leaq 0x60(%rsp), %rdx
andq $0x0, 0x8(%rdx)
leaq -0x7cb(%rip), %rax      # 0xde15
movq %rax, (%rdx)
leaq 0x6b5a(%rip), %rax      # 0x15144
movq %rax, 0x18(%rdx)
leaq 0x6b59(%rip), %rax      # 0x1514e
movq %rax, 0x10(%rdx)
leaq 0x80(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x10164
movl %eax, %ebx
leaq 0x60(%rsp), %rdi
callq 0xd31c
movl %ebx, 0x24(%rsp)
leaq 0x28(%rsp), %rdi
callq 0xcbc2
movq 0x51986(%rip), %rdi     # 0x5ffb0
leaq 0x2bbb1(%rip), %rsi     # 0x3a1e2
callq 0xb4f0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xcb66
movq %rbx, %rdi
callq 0xb960
leaq 0x2d6b1(%rip), %rsi     # 0x3bd03
movq %rax, %rdi
callq 0xb4f0
movq %rax, %rdi
callq 0xb270
movq 0x51947(%rip), %rdi     # 0x5ffb0
leaq 0x2bb84(%rip), %rsi     # 0x3a1f4
callq 0xb4f0
movq %rax, %rdi
callq 0xb270
leaq 0x28(%rsp), %rdi
callq 0xcb9a
leaq 0x40(%rsp), %rdi
callq 0xcb9a
leaq 0x10(%rsp), %rsi
movl $0x1, (%rsi)
movq %rsp, %rdx
movl $0x2, (%rdx)
leaq 0x80(%rsp), %rdi
callq 0x15170
leaq 0x28(%rsp), %rdi
callq 0xcbc2
leaq 0x40(%rsp), %rbx
leaq 0xa4044(%rip), %r14     # 0xb270c
movq %rbx, %rdi
callq 0xcb38
movsd 0x2b9a8(%rip), %xmm1    # 0x3a080
ucomisd %xmm0, %xmm1
jbe 0xe6f0
movl (%r14), %eax
cmpl $0x3, %eax
jne 0xe6c8
leaq 0x40(%rsp), %rdi
callq 0xcbc2
leaq 0x40(%rsp), %rdi
callq 0xcb38
movq %rsp, %rcx
movsd %xmm0, (%rcx)
movabsq $0x3fb999999999999a, %rax # imm = 0x3FB999999999999A
leaq 0x8(%rsp), %r8
movq %rax, (%r8)
leaq 0x2bb39(%rip), %rsi     # 0x3a253
leaq 0x2bb4a(%rip), %rdx     # 0x3a26b
leaq 0x10(%rsp), %rdi
callq 0x101df
cmpb $0x0, 0x10(%rsp)
je 0xe8a1
leaq 0x18(%rsp), %rdi
callq 0x10766
movq %rsp, %r8
movl $0x3, (%r8)
leaq 0x2bac2(%rip), %rsi     # 0x3a213
leaq 0x2bacc(%rip), %rdx     # 0x3a224
leaq 0xa3fad(%rip), %rcx     # 0xb270c
leaq 0x10(%rsp), %rdi
callq 0x15402
cmpb $0x0, 0x10(%rsp)
je 0xe8b8
leaq 0x18(%rsp), %rdi
callq 0x10766
movq 0x5182b(%rip), %rdi     # 0x5ffb0
leaq 0x2ba78(%rip), %rsi     # 0x3a204
callq 0xb4f0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xcb66
movq %rbx, %rdi
callq 0xb960
leaq 0x2d556(%rip), %rsi     # 0x3bd03
movq %rax, %rdi
callq 0xb4f0
movq %rax, %rdi
callq 0xb270
movq 0x517ec(%rip), %rdi     # 0x5ffb0
leaq 0x2baa4(%rip), %rsi     # 0x3a26f
callq 0xb4f0
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xcb66
movq %rbx, %rdi
callq 0xb960
leaq 0x2d517(%rip), %rsi     # 0x3bd03
movq %rax, %rdi
callq 0xb4f0
movq %rax, %rdi
callq 0xb270
movq 0x517ad(%rip), %rdi     # 0x5ffb0
leaq 0x2ba80(%rip), %rsi     # 0x3a28a
callq 0xb4f0
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0xcb66
movsd %xmm0, 0x58(%rsp)
leaq 0x28(%rsp), %rdi
callq 0xcb66
movsd 0x58(%rsp), %xmm1
subsd %xmm0, %xmm1
movq %rbx, %rdi
movapd %xmm1, %xmm0
callq 0xb960
leaq 0x2d4ba(%rip), %rsi     # 0x3bd03
movq %rax, %rdi
callq 0xb4f0
movq %rax, %rdi
callq 0xb270
movq %rsp, %rcx
andl $0x0, (%rcx)
leaq 0x317dc(%rip), %rsi     # 0x40042
leaq 0x30b0e(%rip), %rdx     # 0x3f37b
leaq 0x10(%rsp), %rdi
leaq 0x24(%rsp), %r8
callq 0x1558a
cmpb $0x0, 0x10(%rsp)
je 0xe8fe
leaq 0x18(%rsp), %rdi
callq 0x10766
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
callq 0x15640
jmp 0xe990
movq %rsp, %rdi
callq 0x23d1e
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xe8cf
movq (%rax), %r8
jmp 0xe8d6
movq %rsp, %rdi
callq 0x23d1e
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xe915
movq (%rax), %r8
jmp 0xe91c
leaq 0x3016e(%rip), %r8      # 0x3ea44
leaq 0x2b897(%rip), %rdx     # 0x3a174
leaq 0x8(%rsp), %rdi
pushq $0x2
popq %rsi
movl $0x8a, %ecx
callq 0x22794
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x22812
jmp 0xe971
movq %rsp, %rdi
callq 0x23d1e
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xe944
movq (%rax), %r8
jmp 0xe94b
leaq 0x30128(%rip), %r8      # 0x3ea44
leaq 0x2b851(%rip), %rdx     # 0x3a174
leaq 0x8(%rsp), %rdi
pushq $0x2
popq %rsi
movl $0x8b, %ecx
callq 0x22794
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x22812
jmp 0xe971
leaq 0x300f9(%rip), %r8      # 0x3ea44
leaq 0x2b822(%rip), %rdx     # 0x3a174
leaq 0x8(%rsp), %rdi
pushq $0x2
popq %rsi
movl $0x91, %ecx
callq 0x22794
leaq 0x8(%rsp), %rdi
movq %rsp, %rsi
callq 0x22812
leaq 0x18(%rsp), %rbx
leaq 0x8(%rsp), %rdi
callq 0x227f4
movq %rsp, %rdi
callq 0x10720
movq %rbx, %rdi
callq 0x10766
leaq 0x80(%rsp), %rdi
callq 0x1352c
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r14
retq
jmp 0xe9b6
jmp 0xe9c5
jmp 0xe9d2
jmp 0xe9fe
jmp 0xe9b6
jmp 0xe9c5
jmp 0xe9d2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x227f4
jmp 0xe9c8
movq %rax, %rbx
movq %rsp, %rdi
callq 0x10720
jmp 0xe9d5
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x10766
jmp 0xea01
jmp 0xe9fe
jmp 0xe9fe
jmp 0xe9fe
jmp 0xe9fe
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xd31c
jmp 0xea01
jmp 0xe9fe
jmp 0xe9fe
jmp 0xe9fe
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x1352c
movq %rbx, %rdi
callq 0xba30