// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/UnitTest.cpp
// Function: UnitTest::TestCNNToCNN()
void UnitTest::TestCNNToCNN()
{
    // 1) Data interface, this is a tool class, for data prepare
    DataInterface *data_interface = new DataInterface("unit_test_data/data_signal.dat", "unit_test_data/data_cosmic.dat", LayerDimension::_2D);

    // 3) input layer   ID=0
    LayerParameterList p_list0(LayerType::input, LayerDimension::_2D, data_interface, 0, 0, 
            std::pair<size_t, size_t>(0, 0), 0, false, 0, 0, Regularization::Undefined, 0, ActuationFuncType::Undefined, TrainingType::NewTraining, false);
    Layer* layer_input = new ConstructLayer(p_list0);
    layer_input->Init();

    // 4) middle layer 1 : cnn layer ID=1
    LayerParameterList p_list1(LayerType::cnn, LayerDimension::_2D, data_interface, 0, 2, 
            std::pair<size_t, size_t>(2, 2), 0.1, false, 0, 0.5, Regularization::L2, 0.1, ActuationFuncType::Relu, TrainingType::NewTraining, false);
    Layer *l1 = new ConstructLayer(p_list1);
    l1->SetPrevLayer(layer_input);
    l1->Init();

    // 4) middle layer 1 : fc layer ID=6
    LayerParameterList p_list6(LayerType::cnn, LayerDimension::_2D, data_interface, 0, 2, 
            std::pair<size_t, size_t>(2, 2), 0.1, false, 0, 0.5, Regularization::L2, 0.1, ActuationFuncType::Relu, TrainingType::NewTraining, false);
    Layer *l6 = new ConstructLayer(p_list6);
    l6->SetPrevLayer(l1);
    l6->Init();

    // 5) output layer ID = 7
    LayerParameterList p_list_output(LayerType::output, LayerDimension::_1D, data_interface, 2, 0, 
            std::pair<size_t, size_t>(0, 0), 0.1, false, 0, 0., Regularization::L2, 0.1, ActuationFuncType::SoftMax, TrainingType::NewTraining, false);
    Layer* layer_output = new ConstructLayer(p_list_output);
    layer_output -> SetPrevLayer(l6);
    layer_output -> Init();

    // 6) connect all layers; SetNextLayer must be after all layers have finished initialization
    //                        input layer not needed to set, input layer has no update on w & b
    //                        input layer is just for data transfer (prepare)
    l1->SetNextLayer(l6);
    //l2->SetNextLayer(l3);
    l6->SetNextLayer(layer_output); // This line is ugly, to be improved


    // step 2: forward propagate
    data_interface -> Reset();
    layer_input->EpochInit();
    l1->EpochInit();
    l6->EpochInit();
    layer_output->EpochInit();

    //layer_input->BatchInit();
    l1->BatchInit();
    l6->BatchInit();
    layer_output->BatchInit();


    data_interface->GetNewBatchData();
    data_interface->GetNewBatchLabel();
    layer_input -> FillBatchDataToInputLayerA();


    // helper functions
    auto print_a_images = [&](Layer *l)
    {
        // print a images
        cout<<"XXXXXX::'A' images from layer: "<<l->GetID()<<endl;
        auto & images = l->GetImagesFullA();
        int sample_IIID = 0;
        for(auto &i: images)
        {
            cout<<"---------------------- sample id: "<<sample_IIID<<endl;
            int kernel_id = 0;
            for(auto &j: i.OutputImageFromKernel)
            {
                cout<<"----kernel id: "<<kernel_id<<endl;
                cout<<j<<endl;
                kernel_id++;
            }
            sample_IIID++;
        }
    };
    auto print_z_images = [&](Layer *l)
    {
        // print a images
        cout<<"XXXXXX::'Z' images from layer: "<<l->GetID()<<endl;
        auto & images = l->GetImagesFullZ();
        int sample_IIID = 0;
        for(auto &i: images)
        {
            cout<<"---------------------- sample id: "<<sample_IIID<<endl;
            int kernel_id = 0;
            for(auto &j: i.OutputImageFromKernel)
            {
                cout<<"----kernel id: "<<kernel_id<<endl;
                cout<<j<<endl;
                kernel_id++;
            }
            sample_IIID++;
        }
    };


    auto print_W_B_images = [&](Layer *l)
    {
        // print a images
        cout<<"XXXXXX::W&B matrix from layer: "<<l->GetID()<<endl;
        auto w_images = l->GetWeightMatrixOriginal();
        auto b_images = l->GetBiasVectorOriginal();
        assert((*w_images).size() == (*b_images).size());

        for(size_t kernel = 0;kernel<(*w_images).size();kernel++)
        {
            cout<<"----kernel id: "<<kernel<<endl;
            cout<<"w"<<kernel<<":"<<endl;
            cout<<(*w_images)[kernel]<<endl;
            cout<<"b"<<kernel<<":"<<endl;
            cout<<(*b_images)[kernel]<<endl;
        }
    };

    // forward propagation
    int sample_size = data_interface->GetBatchSize();
    for(int i=0;i<sample_size;i++)
    {
        l1->ForwardPropagate_Z_ForSample(i);
        l1->ForwardPropagate_SigmaPrimeAndA_ForSample(i);

        l6->ForwardPropagate_Z_ForSample(i);
        l6->ForwardPropagate_SigmaPrimeAndA_ForSample(i);

        layer_output->ForwardPropagate_Z_ForSample(i);
        layer_output->ForwardPropagate_SigmaPrimeAndA_ForSample(i);
    }

    cout<<"ooooooooo000000000oooooooooo000000000ooooooooooo00000000oooooooooo0000000000000ooooooooooooo"<<endl;
    print_a_images(l1);
    print_z_images(l1);
    //print_a_images(l6);
    //print_z_images(l6);


    // backward propagation
    for(int i=0;i<sample_size;i++)
    {
        // must inverse order
        layer_output->BackwardPropagateForSample(i);
        l6->BackwardPropagateForSample(i);
        l1->BackwardPropagateForSample(i);
    }

    auto print_delta_images = [&](Layer *l)
    {
        // print a images
        cout<<"XXXXXX::'Delta' images from layer: "<<l->GetID()<<endl;
        auto & images = l->GetImagesFullDelta();
        int sample_IIID = 0;
        for(auto &i: images)
        {
            cout<<"---------------------- sample id: "<<sample_IIID<<endl;
            int kernel_id = 0;
            for(auto &j: i.OutputImageFromKernel)
            {
                cout<<"----kernel id: "<<kernel_id<<endl;
                cout<<j<<endl;
                kernel_id++;
            }
            sample_IIID++;
        }
    };

    auto print_sigmaPrime_images = [&](Layer *l)
    {
        // print a images
        cout<<"XXXXXX::'SigmaPrime' images from layer: "<<l->GetID()<<endl;
        auto & images = l->GetImagesFullSigmaPrime();
        int sample_IIID = 0;
        for(auto &i: images)
        {
            cout<<"---------------------- sample id: "<<sample_IIID<<endl;
            int kernel_id = 0;
            for(auto &j: i.OutputImageFromKernel)
            {
                cout<<"----kernel id: "<<kernel_id<<endl;
                cout<<j<<endl;
                kernel_id++;
            }
            sample_IIID++;
        }
    };

    cout<<"ooooooooo000000000oooooooooo000000000ooooooooooo00000000oooooooooo0000000000000ooooooooooooo"<<endl;
    print_delta_images(l6);
    cout<<"ooooooooo000000000oooooooooo000000000ooooooooooo00000000oooooooooo0000000000000ooooooooooooo"<<endl;
    print_W_B_images(l6); 
    cout<<"ooooooooo000000000oooooooooo000000000ooooooooooo00000000oooooooooo0000000000000ooooooooooooo"<<endl;
    //print_a_images(l6);
    cout<<"ooooooooo000000000oooooooooo000000000ooooooooooo00000000oooooooooo0000000000000ooooooooooooo"<<endl;
    //print_delta_images(l6);
    cout<<"ooooooooo000000000oooooooooo000000000ooooooooooo00000000oooooooooo0000000000000ooooooooooooo"<<endl;
    print_sigmaPrime_images(l1);
    cout<<"ooooooooo000000000oooooooooo000000000ooooooooooo00000000oooooooooo0000000000000ooooooooooooo"<<endl;
    print_delta_images(l1);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movl $0xc8, %edi
callq 0x4270
movq %rax, %r14
leaq 0x5ed2(%rip), %rsi      # 0x2b5bf
leaq 0x5eea(%rip), %rdx      # 0x2b5de
movq %rax, %rdi
movl $0x1, %ecx
callq 0x19144
movl $0x490, %edi            # imm = 0x490
callq 0x4270
movq %rax, %r13
movabsq $0x100000003, %rax      # imm = 0x100000003
leaq 0x1e0(%rsp), %rsi
movq %rax, (%rsi)
movq %r14, 0x8(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsi)
movups %xmm0, 0x20(%rsi)
movups %xmm0, 0x29(%rsi)
movl $0x0, 0x3c(%rsi)
xorl %ebp, %ebp
movq %rbp, 0x40(%rsi)
movl $0x2, 0x48(%rsi)
movq %rbp, 0x50(%rsi)
movq $0x4, 0x58(%rsi)
movb $0x0, 0x60(%rsi)
movl $0xd, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r13, %rdi
callq 0x4a54
movq (%r13), %rax
movq %r13, %rdi
callq *0x10(%rax)
movl $0x490, %edi            # imm = 0x490
callq 0x4270
movabsq $0x100000001, %rcx      # imm = 0x100000001
leaq 0x178(%rsp), %rsi
movq %rcx, (%rsi)
movq %r14, 0x8(%rsi)
movq $0x0, 0x10(%rsi)
movl $0x2, %r12d
movq %r12, 0x18(%rsi)
movq %r12, 0x20(%rsi)
movq %r12, 0x28(%rsi)
movabsq $0x3fb999999999999a, %rbx # imm = 0x3FB999999999999A
movq %rbx, 0x30(%rsi)
movb %bpl, 0x38(%rsi)
movl %ebp, 0x3c(%rsi)
movabsq $0x3fe0000000000000, %r15 # imm = 0x3FE0000000000000
movq %r15, 0x40(%rsi)
movl %ebp, 0x48(%rsi)
movq %rbx, 0x50(%rsi)
movq $0x3, 0x58(%rsi)
movb %bpl, 0x60(%rsi)
movq %rax, %rbp
movl $0xd, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq 0x4a54
movq (%rbp), %rax
movq %rbp, %rdi
movq %r13, %rsi
callq *0x1e8(%rax)
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x10(%rax)
movl $0x490, %edi            # imm = 0x490
callq 0x4270
leaq 0x110(%rsp), %rsi
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, (%rsi)
movq %r14, 0x8(%rsi)
movq $0x0, 0x10(%rsi)
movq %r12, 0x18(%rsi)
movq %r12, 0x20(%rsi)
movq %r12, 0x28(%rsi)
movq %rbx, 0x30(%rsi)
xorl %ecx, %ecx
movb %cl, 0x38(%rsi)
movl %ecx, 0x3c(%rsi)
movq %r15, 0x40(%rsi)
movq %rax, %r15
movl %ecx, 0x48(%rsi)
movq %rbx, 0x50(%rsi)
movq $0x3, 0x58(%rsi)
movb %cl, 0x60(%rsi)
movl $0xd, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq 0x4a54
movq (%r15), %rax
movq %r15, %rdi
movq %rbp, %rsi
callq *0x1e8(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
movl $0x490, %edi            # imm = 0x490
callq 0x4270
movq %rax, %r12
leaq 0xa8(%rsp), %rsi
movq $0x4, (%rsi)
movq %r14, 0x8(%rsi)
movq $0x2, 0x10(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsi)
movq $0x0, 0x28(%rsi)
movq %rbx, 0x30(%rsi)
xorl %eax, %eax
movb %al, 0x38(%rsi)
movups %xmm0, 0x3c(%rsi)
movq %rbx, 0x50(%rsi)
movq $0x1, 0x58(%rsi)
movb %al, 0x60(%rsi)
movl $0xd, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r12, %rdi
callq 0x4a54
movq (%r12), %rax
movq %r12, %rdi
movq %r15, %rsi
callq *0x1e8(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *0x10(%rax)
movq (%rbp), %rax
movq %rbp, %rdi
movq %r15, %rsi
callq *0x1f0(%rax)
movq (%r15), %rax
movq %r15, %rdi
movq %r12, %rsi
callq *0x1f0(%rax)
movq %r14, %rdi
callq 0x19d98
movq (%r13), %rax
movq %r13, %rdi
callq *0x18(%rax)
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x18(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *0x18(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x88(%rax)
movq (%r15), %rax
movq %r15, %rdi
callq *0x88(%rax)
movq (%r12), %rax
movq %r12, %rdi
callq *0x88(%rax)
movq %r14, %rdi
callq 0x198a4
movq %r14, %rdi
callq 0x19bd4
movq (%r13), %rax
movq %r13, %rdi
callq *0x180(%rax)
movl (%r14), %r14d
testl %r14d, %r14d
jle 0x25a09
xorl %ebx, %ebx
movq (%rbp), %rax
movq %rbp, %rdi
movl %ebx, %esi
callq *0x28(%rax)
movq (%rbp), %rax
movq %rbp, %rdi
movl %ebx, %esi
callq *0x30(%rax)
movq (%r15), %rax
movq %r15, %rdi
movl %ebx, %esi
callq *0x28(%rax)
movq (%r15), %rax
movq %r15, %rdi
movl %ebx, %esi
callq *0x30(%rax)
movq (%r12), %rax
movq %r12, %rdi
movl %ebx, %esi
callq *0x28(%rax)
movq (%r12), %rax
movq %r12, %rdi
movl %ebx, %esi
callq *0x30(%rax)
incl %ebx
cmpl %ebx, %r14d
jne 0x259bc
movl %r14d, 0x94(%rsp)
movq %r12, 0x98(%rsp)
movq %r15, 0xa0(%rsp)
movq 0x115b0(%rip), %rbx     # 0x36fd8
leaq 0x5d45(%rip), %rsi      # 0x2b774
movl $0x5c, %edx
movq %rbx, %rdi
callq 0x4280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
leaq 0x602f(%rip), %rsi      # 0x2ba99
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x4280
movq (%rbp), %rax
movq %rbp, %rdi
callq *0x298(%rax)
movq %rbx, %rdi
movl %eax, %esi
callq 0x43c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%rbp), %rax
movq %rbp, 0x88(%rsp)
movq %rbp, %rdi
callq *0xd0(%rax)
movq (%rax), %r15
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
cmpq %rax, %r15
je 0x25c00
xorl %ebx, %ebx
movq 0x114ea(%rip), %r14     # 0x36fd8
leaq 0x5f4d(%rip), %r13      # 0x2ba42
movl $0x22, %edx
movq %r14, %rdi
leaq 0x5f72(%rip), %rsi      # 0x2ba76
callq 0x4280
movq %r14, %rdi
movl %ebx, 0x74(%rsp)
movl %ebx, %esi
callq 0x43c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%r15), %rbx
movq %r15, 0x78(%rsp)
movq 0x8(%r15), %rbp
cmpq %rbp, %rbx
je 0x25be3
xorl %r15d, %r15d
movl $0xf, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x4280
movq %r14, %rdi
movl %r15d, %esi
callq 0x43c0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r12, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1ba81
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r12, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
incl %r15d
addq $0x18, %rbx
cmpq %rbp, %rbx
jne 0x25b59
movl 0x74(%rsp), %ebx
incl %ebx
movq 0x78(%rsp), %r15
addq $0x18, %r15
cmpq 0x80(%rsp), %r15
jne 0x25af5
movq 0x113d1(%rip), %rbx     # 0x36fd8
leaq 0x5e48(%rip), %rsi      # 0x2ba56
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x4280
movq 0x88(%rsp), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x298(%rax)
movq %rbx, %rdi
movl %eax, %esi
callq 0x43c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%r14), %rax
movq %r14, %rdi
callq *0xe0(%rax)
movq (%rax), %r15
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
cmpq %rax, %r15
je 0x25da2
xorl %ebx, %ebx
movq 0x11348(%rip), %r14     # 0x36fd8
leaq 0x5dab(%rip), %r13      # 0x2ba42
movl $0x22, %edx
movq %r14, %rdi
leaq 0x5dd0(%rip), %rsi      # 0x2ba76
callq 0x4280
movq %r14, %rdi
movl %ebx, 0x74(%rsp)
movl %ebx, %esi
callq 0x43c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%r15), %rbx
movq %r15, 0x78(%rsp)
movq 0x8(%r15), %rbp
cmpq %rbp, %rbx
je 0x25d85
xorl %r15d, %r15d
movl $0xf, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x4280
movq %r14, %rdi
movl %r15d, %esi
callq 0x43c0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r12, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1ba81
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r12, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
incl %r15d
addq $0x18, %rbx
cmpq %rbp, %rbx
jne 0x25cfb
movl 0x74(%rsp), %ebx
incl %ebx
movq 0x78(%rsp), %r15
addq $0x18, %r15
cmpq 0x80(%rsp), %r15
jne 0x25c97
movl 0x94(%rsp), %ebp
testl %ebp, %ebp
movq 0x88(%rsp), %r14
movq 0xa0(%rsp), %r15
movq 0x98(%rsp), %r12
jle 0x25def
xorl %ebx, %ebx
movq (%r12), %rax
movq %r12, %rdi
movl %ebx, %esi
callq *0x38(%rax)
movq (%r15), %rax
movq %r15, %rdi
movl %ebx, %esi
callq *0x38(%rax)
movq (%r14), %rax
movq %r14, %rdi
movl %ebx, %esi
callq *0x38(%rax)
incl %ebx
cmpl %ebx, %ebp
jne 0x25dc7
leaq 0x597e(%rip), %rbx      # 0x2b774
movl $0x5c, %edx
movq 0x111d6(%rip), %r14     # 0x36fd8
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq %r15, %rdi
callq 0x263c2
movl $0x5c, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4280
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r14, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
leaq 0x5b27(%rip), %rsi      # 0x2b9a1
movl $0x1f, %edx
movq %r14, %rdi
callq 0x4280
movq (%r15), %rax
movq %r15, %rdi
callq *0x298(%rax)
movq %r14, %rdi
movl %eax, %esi
callq 0x43c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%r15), %rax
movq %r15, %rdi
callq *0x230(%rax)
movq %rax, %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x238(%rax)
movq %rax, %r12
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
movq 0x8(%r12), %rsi
subq (%r12), %rsi
cmpq %rsi, %rdx
jne 0x2636f
cmpq %rax, %rcx
je 0x260c4
xorl %ebp, %ebp
movq 0x110c2(%rip), %r13     # 0x36fd8
xorl %r14d, %r14d
movq %rbx, 0x78(%rsp)
movl $0xf, %edx
movq %r13, %rdi
leaq 0x5b15(%rip), %rsi      # 0x2ba42
callq 0x4280
movq %r13, %rdi
movq %r14, %rsi
callq 0x4180
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movl $0x1, %edx
movq %r13, %rdi
leaq 0x5adc(%rip), %rsi      # 0x2ba52
callq 0x4280
movq %r13, %rdi
movq %r14, %rsi
callq 0x4180
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x401c(%rip), %r15      # 0x29fb4
movq %r15, %rsi
callq 0x4280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq 0x78(%rsp), %rax
movq (%rax), %rsi
addq %rbp, %rsi
movq %r13, %rdi
callq 0x1ba81
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movl $0x1, %edx
movq %r13, %rdi
leaq 0x5a41(%rip), %rsi      # 0x2ba54
callq 0x4280
movq %r13, %rdi
movq %r14, %rsi
callq 0x4180
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%r12), %rsi
addq %rbp, %rsi
movq %r13, %rdi
callq 0x1ba81
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
movq 0x78(%rsp), %rbx
callq 0x4030
movq %rax, %rdi
callq 0x4190
incq %r14
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
addq $0x18, %rbp
cmpq %rax, %r14
jb 0x25f1e
leaq 0x56a9(%rip), %rbx      # 0x2b774
movl $0x5c, %edx
movq 0x10f01(%rip), %r15     # 0x36fd8
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4280
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movl $0x5c, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4280
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movl $0x5c, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4280
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
leaq 0x593b(%rip), %rsi      # 0x2bab9
movl $0x28, %edx
movq %r15, %rdi
callq 0x4280
movq 0x88(%rsp), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x298(%rax)
movq %r15, %rdi
movl %eax, %esi
callq 0x43c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%r14), %rax
movq %r14, %rdi
callq *0xf0(%rax)
movq (%rax), %r15
movq 0x8(%rax), %rax
movq %rax, 0x80(%rsp)
cmpq %rax, %r15
je 0x26312
xorl %ebx, %ebx
movq 0x10dd8(%rip), %r14     # 0x36fd8
leaq 0x583b(%rip), %r12      # 0x2ba42
movl $0x22, %edx
movq %r14, %rdi
leaq 0x5860(%rip), %rsi      # 0x2ba76
callq 0x4280
movq %r14, %rdi
movl %ebx, 0x74(%rsp)
movl %ebx, %esi
callq 0x43c0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq (%r15), %rbx
movq %r15, 0x78(%rsp)
movq 0x8(%r15), %rbp
cmpq %rbp, %rbx
je 0x262f5
xorl %r13d, %r13d
movl $0xf, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x4280
movq %r14, %rdi
movl %r13d, %esi
callq 0x43c0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1ba81
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %r15, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
incl %r13d
addq $0x18, %rbx
cmpq %rbp, %rbx
jne 0x2626b
movl 0x74(%rsp), %ebx
incl %ebx
movq 0x78(%rsp), %r15
addq $0x18, %r15
cmpq 0x80(%rsp), %r15
jne 0x26207
leaq 0x545b(%rip), %rsi      # 0x2b774
movl $0x5c, %edx
movq 0x10cb3(%rip), %rbx     # 0x36fd8
movq %rbx, %rdi
callq 0x4280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq 0x88(%rsp), %rdi
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x263c2
leaq 0x564b(%rip), %rdi      # 0x2b9c1
leaq 0x566d(%rip), %rsi      # 0x2b9ea
leaq 0x57cc(%rip), %rcx      # 0x2bb50
movl $0x3ad, %edx            # imm = 0x3AD
callq 0x4160
movq %rax, %rbx
movq %r12, %r14
jmp 0x263b1
movq %rax, %rbx
movq %r15, %r14
jmp 0x263b1
movq %rax, %rbx
movq %rbp, %r14
jmp 0x263b1
movq %rax, %rbx
movq %r13, %r14
jmp 0x263b1
movq %rax, %rbx
movq %r14, %rdi
callq 0x4230
movq %rbx, %rdi
callq 0x43e0
nop