// File: /workspace/github_cpp_makefile_star2_O3/godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::Train()
void Train()
    {

        //Pre-processing
        alpha = 0.0f;
        for(int t=0;t<4.0f * ro;t++)
        {
            int v = GetSignalValue(t);
            signalVector.push_back(v);
            OscillateFeedForward(v,t);

            f_vector1.push_back(log(V/U));
        }

        signalVector.clear();
        resultVector.clear();

        //Training
        alpha = 0.001f;
        for(int t = 4.0f * ro;t<(4.0f*ro+TOTAL_TIME);t++)
        {
            int v = GetSignalValue(t);
            signalVector.push_back(v);
            OscillateFeedForward(v,t);
            getNetwork()->UpdateWeights();

            f_vector1.push_back(log(V/U));


            double correlation = GetCorrelationTrace(signalVector,resultVector,t);
       //     cout<<correlation<<endl;
         //   cout<<resultVector.size()<<endl;
            corVector1.push_back(correlation);
        }  

        string ro_string = to_string(ro);
        string prefix_o = "Output: ro= ";
        
        std::vector<std::pair<std::string,
        std::vector<double>>> vals = {{"Values", resultVector}};
        string stt = prefix_o+ro_string+" .csv";
        write_csv(ro_string + " values.csv", vals);

        std::vector<std::pair<std::string,
        std::vector<double>>> f_vals = {{"Values", f_vector1}};
        string spp = (string)"F values: ro= "+ro_string+(string)" .csv";
        write_csv(ro_string + " F.csv", f_vals);

        std::vector<std::pair<std::string,
        std::vector<double>>> c_vals = {{"Values", corVector1}};
        write_csv(ro_string + " Cor.csv", c_vals);

/*
        std::vector<std::pair<std::string,
        std::vector<double>>> vals2 = {{"j", getNetwork()->GetWeights()}};
        write_csv("weight_vector.csv", vals2);
*/


    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdi, %rbx
movq $0x0, 0x68(%rdi)
movsd 0x1d0(%rdi), %xmm0
movsd 0x2ef5(%rip), %xmm1     # 0x7038
mulsd %xmm0, %xmm1
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm1
jbe 0x422b
leaq 0x2a0(%rbx), %r14
leaq 0x2e8(%rbx), %r15
xorl %r12d, %r12d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x50e8
movl %eax, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
movq 0x2a8(%rbx), %rsi
cmpq 0x2b0(%rbx), %rsi
je 0x41a1
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2a8(%rbx)
jmp 0x41ad
movq %r14, %rdi
leaq -0x60(%rbp), %rdx
callq 0x65f6
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x51ec
movsd 0x168(%rbx), %xmm0
divsd 0x160(%rbx), %xmm0
callq 0x2140
movsd %xmm0, -0x60(%rbp)
movq 0x2f0(%rbx), %rsi
cmpq 0x2f8(%rbx), %rsi
je 0x41f6
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2f0(%rbx)
jmp 0x4202
movq %r15, %rdi
leaq -0x60(%rbp), %rdx
callq 0x65f6
incl %r12d
xorps %xmm2, %xmm2
cvtsi2sd %r12d, %xmm2
movsd 0x1d0(%rbx), %xmm0
movapd %xmm0, %xmm1
mulsd 0x2e17(%rip), %xmm1     # 0x7038
ucomisd %xmm2, %xmm1
ja 0x4166
movq 0x2a0(%rbx), %rax
cmpq %rax, 0x2a8(%rbx)
je 0x4242
movq %rax, 0x2a8(%rbx)
movq 0x1f8(%rbx), %rax
cmpq %rax, 0x200(%rbx)
je 0x4259
movq %rax, 0x200(%rbx)
leaq 0x1f8(%rbx), %rax
movq %rax, -0x68(%rbp)
movabsq $0x3f50624de0000000, %rax # imm = 0x3F50624DE0000000
cvttpd2dq %xmm1, %xmm2
cvtdq2pd %xmm2, %xmm2
movq %rax, 0x68(%rbx)
cvtsi2sdl 0x1d8(%rbx), %xmm3
movsd 0x2dae(%rip), %xmm4     # 0x7038
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
ucomisd %xmm2, %xmm4
jbe 0x443b
leaq 0x2a0(%rbx), %rax
movq %rax, -0x70(%rbp)
cvttsd2si %xmm1, %r12d
leaq 0x2e8(%rbx), %rax
movq %rax, -0x128(%rbp)
leaq 0x38(%rbx), %rax
movq %rax, -0x120(%rbp)
leaq -0x250(%rbp), %r13
leaq -0x238(%rbp), %r15
movq %r13, %r14
movq %rbx, %rdi
movl %r12d, %esi
callq 0x50e8
movl %eax, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
movq 0x2a8(%rbx), %rsi
cmpq 0x2b0(%rbx), %rsi
je 0x4311
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2a8(%rbx)
jmp 0x431e
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x65f6
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x51ec
movq (%rbx), %rdi
callq 0x2a2e
movsd 0x168(%rbx), %xmm0
divsd 0x160(%rbx), %xmm0
callq 0x2140
movsd %xmm0, -0x60(%rbp)
movq 0x2f0(%rbx), %rsi
cmpq 0x2f8(%rbx), %rsi
je 0x436f
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2f0(%rbx)
jmp 0x437f
movq -0x128(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x65f6
movq %r14, %r13
movq %r14, %rdi
movq -0x70(%rbp), %rsi
callq 0x381e
movq %r15, %rdi
movq -0x68(%rbp), %rsi
callq 0x381e
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x539e
movq -0x238(%rbp), %rdi
testq %rdi, %rdi
movsd %xmm0, -0x78(%rbp)
je 0x43c6
callq 0x21a0
movsd -0x78(%rbp), %xmm0
movq -0x250(%rbp), %rdi
testq %rdi, %rdi
je 0x43dc
callq 0x21a0
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x43f9
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x40(%rbx)
jmp 0x4409
movq -0x120(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x6732
incl %r12d
cvtsi2sd %r12d, %xmm1
movsd 0x1d0(%rbx), %xmm0
cvtsi2sdl 0x1d8(%rbx), %xmm2
movapd %xmm0, %xmm3
mulsd 0x2c0b(%rip), %xmm3     # 0x7038
addsd %xmm2, %xmm3
ucomisd %xmm1, %xmm3
ja 0x42d3
movq 0x5b7e(%rip), %rsi      # 0x9fc0
leaq 0x2d2d(%rip), %rcx      # 0x7176
leaq -0x98(%rbp), %rdi
movl $0x148, %edx            # imm = 0x148
movb $0x1, %al
callq 0x5bf9
leaq -0x210(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2cc3(%rip), %rsi      # 0x7131
leaq 0x2cc8(%rip), %rdx      # 0x713d
leaq -0x220(%rbp), %rdi
callq 0x5d48
leaq 0x2cb6(%rip), %rsi      # 0x713e
leaq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rdx
callq 0x5572
leaq -0x200(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x118(%rbp), %rcx
movl $0x1, %edx
callq 0x5604
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x44bf
callq 0x21a0
leaq -0x50(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x44d2
callq 0x21a0
leaq -0x60(%rbp), %rdi
leaq -0x220(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x5645
leaq 0x2c55(%rip), %rsi      # 0x7145
leaq -0x60(%rbp), %rdi
callq 0x22b0
leaq -0x108(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4526
movq %rdx, -0x118(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x108(%rbp)
jmp 0x452e
movupd (%rcx), %xmm0
movupd %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x110(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4556
callq 0x21a0
leaq -0x178(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %rdi
callq 0x5caa
leaq 0x2bc6(%rip), %rsi      # 0x714b
leaq -0x188(%rbp), %rdi
callq 0x22b0
leaq -0x1e8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x5902
leaq -0x188(%rbp), %rsi
leaq -0x1e8(%rbp), %rdx
movq %rbx, %rdi
callq 0x56a4
leaq -0x1e8(%rbp), %rdi
callq 0x599e
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
je 0x45d7
callq 0x21a0
leaq 0x2e8(%rbx), %rdx
leaq 0x2b59(%rip), %rsi      # 0x713e
leaq -0x60(%rbp), %rdi
callq 0x5572
leaq -0x1d0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xb8(%rbp), %rcx
movl $0x1, %edx
callq 0x5604
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4618
callq 0x21a0
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4626
callq 0x21a0
leaq -0xe8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x2b1f(%rip), %rsi      # 0x7157
leaq 0x2b26(%rip), %rdx      # 0x7165
leaq -0xf8(%rbp), %rdi
callq 0x5d48
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0xf8(%rbp), %rdi
callq 0x2070
movq %r12, -0x60(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x4685
movq %rdx, -0x60(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x50(%rbp)
jmp 0x468f
movupd (%rcx), %xmm0
movupd %xmm0, (%r12)
movq 0x8(%rax), %rdx
movq %rdx, -0x58(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xc8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x2a8d(%rip), %rsi      # 0x7145
leaq 0x2a8b(%rip), %rdx      # 0x714a
leaq -0xd8(%rbp), %rdi
callq 0x5d48
movq -0x60(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0xd0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %r12, %rcx
je 0x46ec
movq -0x50(%rbp), %rdi
movq -0xd8(%rbp), %rsi
cmpq %rdi, %rax
jbe 0x470e
movl $0xf, %edi
cmpq %r14, %rsi
je 0x4709
movq -0xc8(%rbp), %rdi
cmpq %rdi, %rax
jbe 0x4719
leaq -0x60(%rbp), %rdi
callq 0x2070
jmp 0x4729
leaq -0xd8(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x21e0
leaq -0xa8(%rbp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x4753
movq %rsi, -0xb8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa8(%rbp)
jmp 0x475b
movupd (%rcx), %xmm0
movupd %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, -0xb0(%rbp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0x478b
callq 0x21a0
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4799
callq 0x21a0
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x47aa
callq 0x21a0
leaq -0x158(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x168(%rbp), %rdi
callq 0x5caa
leaq 0x298d(%rip), %rsi      # 0x7166
leaq -0x168(%rbp), %rdi
callq 0x22b0
leaq -0x1b8(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x5902
leaq -0x168(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
movq %rbx, %rdi
callq 0x56a4
leaq -0x1b8(%rbp), %rdi
callq 0x599e
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x482b
callq 0x21a0
leaq 0x38(%rbx), %rdx
leaq 0x2908(%rip), %rsi      # 0x713e
leaq -0x60(%rbp), %rdi
callq 0x5572
leaq -0xf8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xd8(%rbp), %rcx
movl $0x1, %edx
callq 0x5604
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4869
callq 0x21a0
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4877
callq 0x21a0
leaq -0x138(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x5caa
leaq 0x28c7(%rip), %rsi      # 0x716d
leaq -0x148(%rbp), %rdi
callq 0x22b0
leaq -0x1a0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x5902
leaq -0x148(%rbp), %rsi
leaq -0x1a0(%rbp), %rdx
movq %rbx, %rdi
callq 0x56a4
leaq -0x1a0(%rbp), %rdi
callq 0x599e
movq -0x148(%rbp), %rdi
cmpq %r14, %rdi
je 0x48f8
callq 0x21a0
leaq -0xf8(%rbp), %rdi
callq 0x599e
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4919
callq 0x21a0
leaq -0x1d0(%rbp), %rdi
callq 0x599e
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x493d
callq 0x21a0
leaq -0x200(%rbp), %rdi
callq 0x599e
movq -0x220(%rbp), %rdi
cmpq %r15, %rdi
je 0x495a
callq 0x21a0
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x496f
callq 0x21a0
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x1a0(%rbp), %rdi
callq 0x599e
jmp 0x4997
jmp 0x4994
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r14, %rdi
je 0x49ad
callq 0x21a0
jmp 0x49ad
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x599e
jmp 0x49f7
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x55d2
jmp 0x49f7
jmp 0x49f4
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x599e
jmp 0x49e1
jmp 0x49de
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x49f7
callq 0x21a0
jmp 0x49f7
movq %rax, %rbx
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4a41
jmp 0x4a46
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0x4a22
callq 0x21a0
jmp 0x4a22
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4a35
callq 0x21a0
jmp 0x4a35
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x4a46
callq 0x21a0
leaq -0x1d0(%rbp), %rdi
callq 0x599e
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x4a6a
callq 0x21a0
leaq -0x200(%rbp), %rdi
callq 0x599e
movq -0x220(%rbp), %rdi
cmpq %r15, %rdi
je 0x4a87
callq 0x21a0
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4b50
jmp 0x4b55
movq %rax, %rbx
jmp 0x4a46
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x55d2
jmp 0x4a52
jmp 0x4ae5
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x599e
jmp 0x4acb
jmp 0x4ac8
movq %rax, %rbx
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
je 0x4a52
callq 0x21a0
jmp 0x4a52
movq %rax, %rbx
jmp 0x4a52
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
jne 0x4a65
jmp 0x4a6a
movq %rax, %rbx
jmp 0x4a6a
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x55d2
jmp 0x4a76
movq %rax, %rbx
jmp 0x4a76
movq %rax, %rbx
jmp 0x4a87
movq %rax, %rbx
jmp 0x4b44
movq %rax, %rbx
movq -0x238(%rbp), %rdi
testq %rdi, %rdi
je 0x4b44
callq 0x21a0
movq -0x250(%rbp), %rdi
testq %rdi, %rdi
je 0x4b55
callq 0x21a0
movq %rbx, %rdi
callq 0x2290
nop