// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::SetupDropOutFilterPool()
void ConstructLayer::SetupDropOutFilterPool()
{
    //std::cout<<"INFO: setting up drop-out filter pools."<<std::endl;
    if(__activeFlag.size() <= 0)
    {
        std::cout<<__func__<<" Error: Filters must be initialized before setting up filter pool."
            <<std::endl;
        exit(0);
    }
    assert(__activeFlag[0].Dimension().first > 0);
    assert(__dropOutBranches >= 1);
    assert(__dropOut > 0.); // one cannot drop all neurons/matrix_elements

    // 1) generate drop-out pool for each filter
    std::vector<std::vector<Filter2D>> _p;
    for(auto &i: __activeFlag)
    {
        std::vector<Filter2D> tmp = i.GenerateCompleteDropOutSet(__dropOutBranches, __dropOut);
        _p.push_back(tmp);
    }

    // 2) fill accordingly to the drop-out pool
    for(int drop_id=0;drop_id<__dropOutBranches;drop_id++)
    {
        std::vector<Filter2D> tmp;
        for(auto &i: _p)
        {
            tmp.push_back(i[drop_id]);
        }
        __activeFlagPool.push_back(tmp);
    }
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
movq %rdi, (%rsp)
addq $0x108, %rdi            # imm = 0x108
callq 0x1ffd0
cmpq $0x0, %rax
ja 0x13df5
movq 0x57214(%rip), %rdi     # 0x6afd8
leaq 0x3f0f6(%rip), %rsi     # 0x52ec1
callq 0x4230
movq %rax, %rdi
leaq 0x3f0fe(%rip), %rsi     # 0x52ed8
callq 0x4230
movq %rax, %rdi
movq 0x571c7(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq (%rsp), %rdi
addq $0x108, %rdi            # imm = 0x108
xorl %eax, %eax
movl %eax, %esi
callq 0x1ff80
movq %rax, %rdi
callq 0x200b0
movq %rax, 0xa0(%rsp)
movq %rdx, 0xa8(%rsp)
cmpq $0x0, 0xa0(%rsp)
jbe 0x13e2e
jmp 0x13e4d
leaq 0x3f0e6(%rip), %rdi     # 0x52f1b
leaq 0x3e396(%rip), %rsi     # 0x521d2
movl $0xa82, %edx            # imm = 0xA82
leaq 0x3f0f9(%rip), %rcx     # 0x52f41
callq 0x4170
movq (%rsp), %rax
cmpl $0x1, 0x3cc(%rax)
jl 0x13e5c
jmp 0x13e7b
leaq 0x3f114(%rip), %rdi     # 0x52f77
leaq 0x3e368(%rip), %rsi     # 0x521d2
movl $0xa83, %edx            # imm = 0xA83
leaq 0x3f0cb(%rip), %rcx     # 0x52f41
callq 0x4170
movq (%rsp), %rax
movsd 0x3d8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x13e92
jmp 0x13eb1
leaq 0x3f0f5(%rip), %rdi     # 0x52f8e
leaq 0x3e332(%rip), %rsi     # 0x521d2
movl $0xa84, %edx            # imm = 0xA84
leaq 0x3f095(%rip), %rcx     # 0x52f41
callq 0x4170
leaq 0x88(%rsp), %rdi
callq 0x1f080
movq (%rsp), %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rdi
callq 0x20140
movq %rax, 0x78(%rsp)
movq 0x80(%rsp), %rdi
callq 0x20170
movq %rax, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x201a0
testb $0x1, %al
jne 0x13f0c
jmp 0x13f9c
leaq 0x78(%rsp), %rdi
callq 0x201e0
movq %rax, %rcx
movq (%rsp), %rax
movq %rcx, 0x68(%rsp)
movq 0x68(%rsp), %rsi
movslq 0x3cc(%rax), %rdx
movsd 0x3d8(%rax), %xmm0
leaq 0x50(%rsp), %rdi
callq 0x201f0
jmp 0x13f42
leaq 0x88(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x20af0
jmp 0x13f56
leaq 0x50(%rsp), %rdi
callq 0x1f250
leaq 0x78(%rsp), %rdi
callq 0x20b60
jmp 0x13ef4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
jmp 0x1409d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x1f250
jmp 0x1409d
movl $0x0, 0x40(%rsp)
movq (%rsp), %rcx
movl 0x40(%rsp), %eax
cmpl 0x3cc(%rcx), %eax
jge 0x14088
leaq 0x28(%rsp), %rdi
callq 0x1f070
leaq 0x88(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0x20b80
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
callq 0x20bb0
movq %rax, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x20be0
testb $0x1, %al
jne 0x14002
jmp 0x14057
leaq 0x18(%rsp), %rdi
callq 0x20c20
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rdi
movslq 0x40(%rsp), %rsi
callq 0x1ff80
movq %rax, %rsi
leaq 0x28(%rsp), %rdi
callq 0x1f940
jmp 0x1402f
jmp 0x14031
leaq 0x18(%rsp), %rdi
callq 0x20c30
jmp 0x13fed
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x1f250
jmp 0x1409d
movq (%rsp), %rdi
addq $0x120, %rdi            # imm = 0x120
leaq 0x28(%rsp), %rsi
callq 0x20af0
jmp 0x1406e
leaq 0x28(%rsp), %rdi
callq 0x1f250
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x13fa4
leaq 0x88(%rsp), %rdi
callq 0x1f1f0
addq $0xb8, %rsp
retq
leaq 0x88(%rsp), %rdi
callq 0x1f1f0
movq 0x48(%rsp), %rdi
callq 0x43f0
nopw %cs:(%rax,%rax)