// File: Barath-Kannan[P]SignalsAndSlots/inc/BSignals/details/SignalImpl.hpp
// Function: BSignals::details::SignalImpl<unsigned int>::connectSlotFunction(unsigned int, BSignals::ExecutorScheme, std::function<void (unsigned int)>)
int connectSlotFunction(uint32_t id, BSignals::ExecutorScheme scheme, std::function<void(Args...)> slot){
        std::unique_ptr<Slot<Args...>> slotInstance{nullptr};
        switch(scheme){
            case(BSignals::ExecutorScheme::STRAND):
                slotInstance = std::make_unique<StrandSlot<Args...>>(slot);
                break;
            case(BSignals::ExecutorScheme::THREAD_POOLED):
                if (enableEmissionGuard) slotInstance = std::make_unique<ThreadPooledSlot<Args...>>(slot, [this, id](){return getIsStillConnectedFromExecutor(id);});
                else slotInstance = std::make_unique<ThreadPooledSlot<Args...>>(slot);
                break;
            case(BSignals::ExecutorScheme::ASYNCHRONOUS):
                if (enableEmissionGuard) slotInstance = std::make_unique<AsynchronousSlot<Args...>>(slot, [this, id](){return getIsStillConnectedFromExecutor(id);});
                else slotInstance = std::make_unique<AsynchronousSlot<Args...>>(slot);
                break;
            case(BSignals::ExecutorScheme::DEFERRED_SYNCHRONOUS):
                initializeDeferredQueue();
                slotInstance = std::make_unique<DeferredSlot<Args...>>(slot, deferredQueue, id);
                break;
            case(BSignals::ExecutorScheme::SYNCHRONOUS):
                slotInstance = std::make_unique<SynchronousSlot<Args...>>(slot);
                break;
        }
        slotLock.lock();
        slots.emplace_hint(slots.end(), std::piecewise_construct, std::make_tuple(id),
                    std::make_tuple(std::move(slotInstance)));
        slotLock.unlock();
        return (int)id;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rcx, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xc0(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x20(%rbp), %rdi
callq 0x203b0
movl -0x10(%rbp), %eax
movq %rax, -0xb8(%rbp)
subq $0x4, %rax
ja 0x1f648
movq -0xb8(%rbp), %rax
leaq 0x85d32(%rip), %rcx     # 0xa51cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0xc8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x203f0
jmp 0x1f4b5
leaq -0x20(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x204b0
leaq -0x28(%rbp), %rdi
callq 0x20510
jmp 0x1f648
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x1f748
movq -0xc0(%rbp), %rax
testb $0x1, 0x4(%rax)
je 0x1f52d
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rdx
callq 0x20570
jmp 0x1f515
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x20660
leaq -0x40(%rbp), %rdi
callq 0x206c0
jmp 0x1f555
movq -0xc8(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x20720
jmp 0x1f53f
leaq -0x20(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x20660
leaq -0x58(%rbp), %rdi
callq 0x206c0
jmp 0x1f648
movq -0xc0(%rbp), %rax
testb $0x1, 0x4(%rax)
je 0x1f5a6
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x20810
jmp 0x1f58e
leaq -0x20(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x20900
leaq -0x60(%rbp), %rdi
callq 0x20960
jmp 0x1f5ce
movq -0xc8(%rbp), %rsi
leaq -0x78(%rbp), %rdi
callq 0x209c0
jmp 0x1f5b8
leaq -0x20(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x20900
leaq -0x78(%rbp), %rdi
callq 0x20960
jmp 0x1f648
movq -0xc0(%rbp), %rdi
callq 0x20ab0
jmp 0x1f5de
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
addq $0x8, %rdx
leaq -0x80(%rbp), %rdi
leaq -0xc(%rbp), %rcx
callq 0x20b40
jmp 0x1f5ff
leaq -0x20(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x20c40
leaq -0x80(%rbp), %rdi
callq 0x20ca0
jmp 0x1f648
movq -0xc8(%rbp), %rsi
leaq -0x88(%rbp), %rdi
callq 0x20d00
jmp 0x1f62c
leaq -0x20(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x20dc0
leaq -0x88(%rbp), %rdi
callq 0x20e20
movq -0xc0(%rbp), %rdi
addq $0x18, %rdi
callq 0x10920
jmp 0x1f65a
movq -0xc0(%rbp), %rdi
addq $0x88, %rdi
movq %rdi, -0xd0(%rbp)
callq 0x20ed0
movq %rax, -0x98(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x20f00
leaq -0x9c(%rbp), %rdi
leaq -0xc(%rbp), %rsi
callq 0x20f20
jmp 0x1f6a0
leaq -0xa8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x20f50
jmp 0x1f6b2
movq -0xd0(%rbp), %rdi
movq -0x90(%rbp), %rsi
leaq 0x85f6c(%rip), %rdx     # 0xa5633
leaq -0x9c(%rbp), %rcx
leaq -0xa8(%rbp), %r8
callq 0x20e80
movq %rax, -0xd8(%rbp)
jmp 0x1f6e3
movq -0xd8(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x20f80
movq -0xc0(%rbp), %rdi
addq $0x18, %rdi
callq 0x10a60
jmp 0x1f70f
movl -0xc(%rbp), %eax
movl %eax, -0xdc(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x20fa0
movl -0xdc(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x20f80
leaq -0x20(%rbp), %rdi
callq 0x20fa0
movq -0x30(%rbp), %rdi
callq 0xdcb0
nopw (%rax,%rax)