// File: /workspace/github_cpp_makefile_star2_O1/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 0x70(%rsp), %rdi
leaq 0x130(%rsp), %rcx
movq %r15, %rdx
callq 0x2022c
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 0x4cb59(%rip), %rdi     # 0x6afa0
leaq 0x2c975(%rip), %rsi     # 0x4adc3
movl $0xb, %edx
callq 0xb600
movl 0x18(%rbx), %esi
movq 0x4cb3e(%rip), %rdi     # 0x6afa0
callq 0xb380
movq %rax, %r12
leaq 0x2c95e(%rip), %rsi     # 0x4adcf
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 0x1e51b
xorl %ebp, %ebp
leaq 0x111f(%rip), %r14      # 0x1f5d4
leaq 0x1146(%rip), %r15      # 0x1f602
leaq 0x1c0(%rsp), %r12
leaq 0x40(%rsp), %r13
movl 0x2c(%rbx), %esi
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movq %rbx, 0x40(%rsp)
leaq 0x70(%rsp), %rax
movq %rax, 0x48(%rsp)
movq %r14, 0x58(%rsp)
movq %r15, 0x50(%rsp)
movq %r12, %rdi
movq %r13, %rdx
callq 0x1ff2c
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x1e514
movq %r13, %rdi
movq %r13, %rsi
movl $0x3, %edx
callq *%rax
incl %ebp
cmpl 0x18(%rbx), %ebp
jb 0x1e4c9
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movq %rbx, (%rsi)
leaq 0x10f3(%rip), %rax      # 0x1f62a
movq %rax, 0x18(%rsi)
leaq 0x134e(%rip), %rax      # 0x1f890
movq %rax, 0x10(%rsi)
leaq 0x10(%rsp), %rdx
movq $0x1f4, (%rdx)          # imm = 0x1F4
leaq 0x130(%rsp), %rdi
callq 0x1ffa6
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x1e57e
leaq 0xa0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movq %rbx, (%rsi)
leaq 0x131f(%rip), %rax      # 0x1f8b6
movq %rax, 0x18(%rsi)
leaq 0x1328(%rip), %rax      # 0x1f8ca
movq %rax, 0x10(%rsi)
leaq 0x88(%rsp), %r15
movq $0x1, (%r15)
leaq 0xa0(%rsp), %rdi
movq %r15, %rdx
callq 0x1ffa6
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1e5de
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x4c9bb(%rip), %r12     # 0x6afa0
leaq 0x2c7ee(%rip), %rsi     # 0x4adda
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 0x4c988(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
movq %r15, 0x90(%rsp)
movq %r15, 0x88(%rsp)
xorl %eax, %eax
movq %rax, 0x98(%rsp)
movq %rax, 0x8(%rsp)
movl $0x18, %edi
callq 0xb4e0
leaq 0x4b463(%rip), %rcx     # 0x69ab8
movq %rcx, (%rax)
movq %rbx, 0x8(%rax)
leaq 0x1c0(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0xb4a0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1e68c
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x4c90d(%rip), %r14     # 0x6afa0
leaq 0x2c75b(%rip), %rsi     # 0x4adf5
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 0x4c8db(%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 0x8(%rsp), %rdi
callq 0xb9a0
movq 0x4c8aa(%rip), %r14     # 0x6afa0
leaq 0x2c710(%rip), %rsi     # 0x4ae0d
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 0x4c878(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
leaq 0x100(%rsp), %rdi
callq 0xb9a0
leaq 0x48(%rbx), %rdi
callq 0xd6b4
xorl %eax, %eax
leaq 0x160(%rsp), %rdi
xchgb %al, -0x30(%rdi)
callq 0xb280
leaq 0x190(%rsp), %rdi
callq 0xb9a0
cmpl $0x0, 0x1c(%rbx)
je 0x1e862
leaq 0x68(%rsp), %r14
xorl %r15d, %r15d
movq 0x70(%rsp), %rax
cmpl $0x0, (%rax,%r15,4)
setne 0x60(%rsp)
movq $0x0, 0x68(%rsp)
je 0x1e7ae
movq %r14, %rdi
xorl %esi, %esi
callq 0x127b6
incq %r15
cmpl 0x1c(%rbx), %r15d
jb 0x1e77c
jmp 0x1e862
movq %rsp, %rdi
callq 0x295e4
leaq 0x2c699(%rip), %rdx     # 0x4ae56
leaq 0x2c69f(%rip), %rcx     # 0x4ae63
leaq 0x2c69e(%rip), %r8      # 0x4ae69
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x2ab9b
movq 0x10(%rsp), %r8
leaq 0x2c64f(%rip), %rdx     # 0x4ae35
leaq 0x38(%rsp), %rdi
movl $0x2, %esi
movl $0xa9, %ecx
callq 0x27652
leaq 0x38(%rsp), %rdi
movq %rsp, %rsi
callq 0x276f0
leaq 0x38(%rsp), %rdi
callq 0x276be
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e82c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0xb510
cmpq $0x0, (%rsp)
je 0x1e858
movl $0x1, %edi
callq 0x2764e
testb %al, %al
je 0x1e850
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x1e850
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, (%rsp)
movq %r14, %rdi
xorl %esi, %esi
callq 0x127b6
cmpq $0x0, 0x8(%rsp)
jne 0x1e9e2
leaq 0x88(%rsp), %rdi
callq 0x1538e
leaq 0xa0(%rsp), %rdi
callq 0x200a0
leaq 0x130(%rsp), %rdi
callq 0x200a0
leaq 0x1c0(%rsp), %rdi
callq 0x2287c
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1e8bc
movq 0x80(%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 0x1ea34
jmp 0x1ea34
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x276be
jmp 0x1e8ea
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1e90a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0xb510
jmp 0x1e90a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x120ca
jmp 0x1e917
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x120dc
jmp 0x1e9b1
jmp 0x1ea34
jmp 0x1ea34
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1e943
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x10(%rsp)
jmp 0x1e9b9
movq %rax, %rbx
jmp 0x1e9b9
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1e9d3
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e9d3
jmp 0x1ea34
movq %rax, %rbx
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x1ea05
leaq 0xa0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1ea05
jmp 0x1ea34
movq %rax, %rbx
jmp 0x1e9c6
movq %rax, %rbx
jmp 0x1ea05
jmp 0x1ea34
movq %rax, %rbx
cmpq $0x0, 0x8(%rsp)
jne 0x1e9e2
leaq 0x88(%rsp), %rdi
callq 0x1538e
leaq 0xa0(%rsp), %rdi
callq 0x200a0
leaq 0x130(%rsp), %rdi
callq 0x200a0
jmp 0x1ea05
callq 0xb130
jmp 0x1ea34
movq %rax, %rbx
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x1ea05
leaq 0x40(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x1c0(%rsp), %rdi
callq 0x2287c
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x1ea2c
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0xb510
movq %rbx, %rdi
callq 0xba10
movq %rax, %rdi
callq 0xd81f