// File: /workspace/github_cpp_makefile_star2_O3/Barath-Kannan[P]SignalsAndSlots/test/SignalTest_Parametrized.cpp
// Function: SignalTestParametrized_Correctness_Test::TestBody()
TEST_P(SignalTestParametrized, Correctness) {
    std::vector<uint32_t> doneFlags(params.nEmissions, 0);
    auto func = ([this, &doneFlags](sigType x) {
        volatile sigType v = x;
        for (uint32_t i = 0; i < params.nOperations; i++) {
            v+=x;
        }
        doneFlags[x] = 1;
        completedFunctions++;
    });

    Signal<sigType> signal(params.threadSafe);
    cout << "Connecting " << params.nConnections << " functions" << endl;
    for (uint32_t i = 0; i < params.nConnections; i++) {
        signal.connectSlot(params.scheme, func);
    }

    FunctionTimeRegular<> printer([this]() {
        cout << "Total elements emitted: " << counter << " / " << params.nEmissions << fixed << endl;
        cout << "Emission rate: " << (double) counter / bt.getElapsedMilliseconds() << fixed << "m/ms" << endl;
        cout << "Total elements processed: " << completedFunctions << " / " << params.nEmissions * params.nConnections << fixed << endl;
        cout << "Operation rate: " << (double) completedFunctions * params.nOperations / bt2.getElapsedNanoseconds() << "m/ns" << endl;
        return (bt2.getElapsedSeconds() < 6000);
    }, std::chrono::milliseconds(500));

    FunctionTimeRegular<> checkFinished([this]() {
        return (completedFunctions != params.nEmissions * params.nConnections);
    }, std::chrono::milliseconds(1));

    cout << "Starting emission thread: " << endl;
    
    std::list<thread> emitters;
    thread emitter([this, &signal]() {
        bt2.start();
        bt.start();
        for (counter=0; counter<params.nEmissions; ++counter) {
            signal.emitSignal(counter);
        }
        bt.stop();
    });
    cout << "Emission thread spawned" << endl;
    cout.precision(std::numeric_limits<double>::max_digits10);
    emitter.join();
    cout << "Emission completed" << endl;
    checkFinished.join();
    bt2.stop();
    printer.stopAndJoin();
    for (uint32_t i=0; i<params.nEmissions; i++) ASSERT_TRUE(doneFlags[i]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, %rbx
movl 0x1c(%rdi), %esi
xorl %r14d, %r14d
leaq 0x1c0(%rsp), %r15
movl %r14d, (%r15)
leaq 0x50(%rsp), %rdi
leaq 0x130(%rsp), %rcx
movq %r15, %rdx
callq 0x1fcb4
movb 0x28(%rbx), %al
movl %r14d, (%r15)
movb %al, 0x4(%r15)
leaq 0x200(%rsp), %r12
xorps %xmm0, %xmm0
movups %xmm0, -0x38(%r12)
movups %xmm0, -0x28(%r12)
movups %xmm0, -0x18(%r12)
movq %r14, -0x8(%r12)
movq %r12, %rdi
callq 0xb7c0
movb %r14b, 0x40(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r12)
leaq 0x250(%rsp), %rax
movl %r14d, (%rax)
movq %r14, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
leaq 0x2b0(%rsp), %rax
movl %r14d, (%rax)
movq %r14, 0x8(%rax)
movups %xmm0, -0x40(%rax)
movups %xmm0, -0x30(%rax)
movups %xmm0, -0x20(%rax)
movb %r14b, -0x10(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %r14, 0x20(%rax)
movq 0x4d0a7(%rip), %rdi     # 0x6afa0
leaq 0x2cef3(%rip), %rsi     # 0x4adf3
movl $0xb, %edx
callq 0xb600
movl 0x18(%rbx), %esi
movq 0x4d08c(%rip), %rdi     # 0x6afa0
callq 0xb380
movq %rax, %r12
leaq 0x2cedc(%rip), %rsi     # 0x4adff
movl $0xa, %edx
movq %rax, %rdi
callq 0xb600
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq %r12, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb390
cmpl $0x0, 0x18(%rbx)
je 0x1dfd2
xorl %ebp, %ebp
leaq 0x10f7(%rip), %r14      # 0x1f05e
leaq 0x111e(%rip), %r15      # 0x1f08c
leaq 0x1c0(%rsp), %r12
leaq 0x80(%rsp), %r13
movl 0x2c(%rbx), %esi
movq %rbx, 0x80(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, 0x88(%rsp)
movq %r14, 0x98(%rsp)
movq %r15, 0x90(%rsp)
movq %r12, %rdi
movq %r13, %rdx
callq 0x1f9b4
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x1dfcb
movq %r13, %rdi
movq %r13, %rsi
movl $0x3, %edx
callq *%rax
incl %ebp
cmpl 0x18(%rbx), %ebp
jb 0x1df7e
leaq 0xa0(%rsp), %rsi
movq $0x0, 0x8(%rsi)
movq %rbx, (%rsi)
leaq 0x10c8(%rip), %rax      # 0x1f0b4
movq %rax, 0x18(%rsi)
leaq 0x1323(%rip), %rax      # 0x1f31a
movq %rax, 0x10(%rsi)
leaq 0x20(%rsp), %rdx
movq $0x1f4, (%rdx)          # imm = 0x1F4
leaq 0x130(%rsp), %rdi
callq 0x1fa2e
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x1e033
leaq 0xa0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x20(%rsp), %rsi
movq $0x0, 0x8(%rsi)
movq %rbx, (%rsi)
leaq 0x12f6(%rip), %rax      # 0x1f340
movq %rax, 0x18(%rsi)
leaq 0x12ff(%rip), %rax      # 0x1f354
movq %rax, 0x10(%rsi)
leaq 0x68(%rsp), %r15
movq $0x1, (%r15)
leaq 0xa0(%rsp), %rdi
movq %r15, %rdx
callq 0x1fa2e
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x1e08e
leaq 0x20(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x4cf0b(%rip), %r12     # 0x6afa0
leaq 0x2cd6e(%rip), %rsi     # 0x4ae0a
movl $0x1a, %edx
movq %r12, %rdi
callq 0xb600
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq 0x4ced8(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
movq %r15, 0x70(%rsp)
movq %r15, 0x68(%rsp)
xorl %eax, %eax
movq %rax, 0x78(%rsp)
movq %rax, 0x10(%rsp)
movl $0x18, %edi
callq 0xb4e0
leaq 0x4b9d4(%rip), %rcx     # 0x69ad0
movq %rcx, (%rax)
movq %rbx, 0x8(%rax)
leaq 0x1c0(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0xb4a0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1e133
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x4ce66(%rip), %r14     # 0x6afa0
leaq 0x2cce4(%rip), %rsi     # 0x4ae25
movl $0x17, %edx
movq %r14, %rdi
callq 0xb600
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq 0x4ce34(%rip), %r14     # 0x6afa0
movq %r14, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb390
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x11, 0x8(%r14,%rax)
leaq 0x10(%rsp), %rdi
callq 0xb9a0
movq 0x4ce03(%rip), %r14     # 0x6afa0
leaq 0x2cc99(%rip), %rsi     # 0x4ae3d
movl $0x12, %edx
movq %r14, %rdi
callq 0xb600
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq 0x4cdd1(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
leaq 0x100(%rsp), %rdi
callq 0xb9a0
leaq 0x48(%rbx), %rdi
callq 0xd664
xorl %eax, %eax
leaq 0x160(%rsp), %rdi
xchgb %al, -0x30(%rdi)
callq 0xb280
leaq 0x190(%rsp), %rdi
callq 0xb9a0
cmpl $0x0, 0x1c(%rbx)
je 0x1e309
leaq 0x48(%rsp), %r14
xorl %r15d, %r15d
movq 0x50(%rsp), %rax
cmpl $0x0, (%rax,%r15,4)
setne 0x40(%rsp)
movq $0x0, 0x48(%rsp)
je 0x1e257
movq %r14, %rdi
xorl %esi, %esi
callq 0x125fc
incq %r15
movl 0x1c(%rbx), %eax
cmpq %rax, %r15
jb 0x1e223
jmp 0x1e309
leaq 0x8(%rsp), %rdi
callq 0x28fb6
leaq 0x2cc1e(%rip), %rdx     # 0x4ae86
leaq 0x2cc24(%rip), %rcx     # 0x4ae93
leaq 0x2cc23(%rip), %r8      # 0x4ae99
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x2a57e
movq 0x20(%rsp), %r8
leaq 0x2cbd4(%rip), %rdx     # 0x4ae65
leaq 0x18(%rsp), %rdi
movl $0x2, %esi
movl $0xa9, %ecx
callq 0x2703e
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x270da
leaq 0x18(%rsp), %rdi
callq 0x270aa
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e2d9
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xb510
cmpq $0x0, 0x8(%rsp)
je 0x1e2ff
movl $0x1, %edi
callq 0x2703b
testb %al, %al
je 0x1e2ff
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1e2ff
movq (%rdi), %rax
callq *0x8(%rax)
movq %r14, %rdi
xorl %esi, %esi
callq 0x125fc
cmpq $0x0, 0x10(%rsp)
jne 0x1e47d
leaq 0x68(%rsp), %rdi
callq 0x1510e
leaq 0xa0(%rsp), %rdi
callq 0x1fb28
leaq 0x130(%rsp), %rdi
callq 0x1fb28
leaq 0x1c0(%rsp), %rdi
callq 0x223c6
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1e35d
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0xb510
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e4d2
jmp 0x1e4d2
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x270aa
jmp 0x1e38b
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e3ab
movq 0x30(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x1e3ab
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x11f0a
jmp 0x1e3ba
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x11f1c
jmp 0x1e44f
jmp 0x1e4d2
jmp 0x1e4d2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1e457
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x1e457
movq %rax, %rbx
jmp 0x1e457
movq %rax, %rbx
movq 0x30(%rsp), %rax
testq %rax, %rax
je 0x1e46e
leaq 0x20(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e46e
jmp 0x1e4d2
movq %rax, %rbx
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x1e4a6
leaq 0xa0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e4a6
jmp 0x1e4d2
movq %rax, %rbx
jmp 0x1e461
movq %rax, %rbx
jmp 0x1e4a6
jmp 0x1e4d2
movq %rax, %rbx
cmpq $0x0, 0x10(%rsp)
jne 0x1e47d
leaq 0x68(%rsp), %rdi
callq 0x1510e
leaq 0xa0(%rsp), %rdi
callq 0x1fb28
leaq 0x130(%rsp), %rdi
callq 0x1fb28
jmp 0x1e4a6
callq 0xb130
jmp 0x1e4d2
movq %rax, %rbx
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x1e4a6
leaq 0x80(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x1c0(%rsp), %rdi
callq 0x223c6
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1e4ca
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xba10
movq %rax, %rdi
callq 0xd7cf