// File: /workspace/github_cpp_makefile_star2_O1/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), %xmm1
mulsd 0x2e73(%rip), %xmm1     # 0x7038
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jbe 0x42a5
leaq 0x2a0(%rbx), %r14
leaq 0x2e8(%rbx), %r15
xorl %r12d, %r12d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x5160
movl %eax, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
movq 0x2a8(%rbx), %rsi
cmpq 0x2b0(%rbx), %rsi
je 0x421f
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2a8(%rbx)
jmp 0x422b
movq %r14, %rdi
leaq -0x60(%rbp), %rdx
callq 0x6696
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x5264
movsd 0x168(%rbx), %xmm0
divsd 0x160(%rbx), %xmm0
callq 0x2140
movsd %xmm0, -0x60(%rbp)
movq 0x2f0(%rbx), %rsi
cmpq 0x2f8(%rbx), %rsi
je 0x4274
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2f0(%rbx)
jmp 0x4280
movq %r15, %rdi
leaq -0x60(%rbp), %rdx
callq 0x6696
incl %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd 0x1d0(%rbx), %xmm1
mulsd 0x2d9d(%rip), %xmm1     # 0x7038
ucomisd %xmm0, %xmm1
ja 0x41e4
movq 0x2a0(%rbx), %rax
cmpq %rax, 0x2a8(%rbx)
je 0x42bc
movq %rax, 0x2a8(%rbx)
movq 0x1f8(%rbx), %rax
cmpq %rax, 0x200(%rbx)
je 0x42d3
movq %rax, 0x200(%rbx)
leaq 0x1f8(%rbx), %rax
movq %rax, -0x68(%rbp)
movabsq $0x3f50624de0000000, %rax # imm = 0x3F50624DE0000000
movq %rax, 0x68(%rbx)
cvttpd2dq %xmm1, %xmm0
cvtdq2pd %xmm0, %xmm2
movsd 0x1d0(%rbx), %xmm0
cvtsi2sdl 0x1d8(%rbx), %xmm3
movsd 0x2d2c(%rip), %xmm4     # 0x7038
mulsd %xmm0, %xmm4
addsd %xmm3, %xmm4
ucomisd %xmm2, %xmm4
jbe 0x44bd
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 0x5160
movl %eax, %r13d
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x60(%rbp)
movq 0x2a8(%rbx), %rsi
cmpq 0x2b0(%rbx), %rsi
je 0x4393
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2a8(%rbx)
jmp 0x43a0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x6696
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x5264
movq (%rbx), %rdi
callq 0x2a70
movsd 0x168(%rbx), %xmm0
divsd 0x160(%rbx), %xmm0
callq 0x2140
movsd %xmm0, -0x60(%rbp)
movq 0x2f0(%rbx), %rsi
cmpq 0x2f8(%rbx), %rsi
je 0x43f1
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x2f0(%rbx)
jmp 0x4401
movq -0x128(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x6696
movq %r14, %r13
movq %r14, %rdi
movq -0x70(%rbp), %rsi
callq 0x3846
movq %r15, %rdi
movq -0x68(%rbp), %rsi
callq 0x3846
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movl %r12d, %ecx
callq 0x5416
movq -0x238(%rbp), %rdi
testq %rdi, %rdi
movsd %xmm0, -0x78(%rbp)
je 0x4448
callq 0x21a0
movsd -0x78(%rbp), %xmm0
movq -0x250(%rbp), %rdi
testq %rdi, %rdi
je 0x445e
callq 0x21a0
movsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x60(%rbp)
movq 0x40(%rbx), %rsi
cmpq 0x48(%rbx), %rsi
je 0x447b
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x40(%rbx)
jmp 0x448b
movq -0x120(%rbp), %rdi
leaq -0x60(%rbp), %rdx
callq 0x67d2
incl %r12d
cvtsi2sd %r12d, %xmm1
movsd 0x1d0(%rbx), %xmm0
cvtsi2sdl 0x1d8(%rbx), %xmm2
movapd %xmm0, %xmm3
mulsd 0x2b89(%rip), %xmm3     # 0x7038
addsd %xmm2, %xmm3
ucomisd %xmm1, %xmm3
ja 0x4355
movq 0x5afc(%rip), %rsi      # 0x9fc0
leaq 0x2cab(%rip), %rcx      # 0x7176
leaq -0x98(%rbp), %rdi
movl $0x148, %edx            # imm = 0x148
movb $0x1, %al
callq 0x5ca1
leaq -0x210(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2c41(%rip), %rsi      # 0x7131
leaq 0x2c46(%rip), %rdx      # 0x713d
leaq -0x220(%rbp), %rdi
callq 0x5dec
leaq 0x2c34(%rip), %rsi      # 0x713e
leaq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rdx
callq 0x55fa
leaq -0x200(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x118(%rbp), %rcx
movl $0x1, %edx
callq 0x568c
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x4541
callq 0x21a0
leaq -0x50(%rbp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x4554
callq 0x21a0
leaq -0x60(%rbp), %rdi
leaq -0x220(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x56cd
leaq 0x2bd3(%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 0x45a8
movq %rdx, -0x118(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x108(%rbp)
jmp 0x45b0
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 0x45d8
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 0x5d52
leaq 0x2b44(%rip), %rsi      # 0x714b
leaq -0x188(%rbp), %rdi
callq 0x22b0
leaq -0x1e8(%rbp), %rdi
leaq -0x200(%rbp), %rsi
callq 0x599a
leaq -0x188(%rbp), %rsi
leaq -0x1e8(%rbp), %rdx
movq %rbx, %rdi
callq 0x572c
leaq -0x1e8(%rbp), %rdi
callq 0x5a36
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
je 0x4659
callq 0x21a0
leaq 0x2e8(%rbx), %rdx
leaq 0x2ad7(%rip), %rsi      # 0x713e
leaq -0x60(%rbp), %rdi
callq 0x55fa
leaq -0x1d0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xb8(%rbp), %rcx
movl $0x1, %edx
callq 0x568c
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x469a
callq 0x21a0
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x46a8
callq 0x21a0
leaq -0xe8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0x2a9d(%rip), %rsi      # 0x7157
leaq 0x2aa4(%rip), %rdx      # 0x7165
leaq -0xf8(%rbp), %rdi
callq 0x5dec
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 0x4707
movq %rdx, -0x60(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x50(%rbp)
jmp 0x4711
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 0x2a0b(%rip), %rsi      # 0x7145
leaq 0x2a09(%rip), %rdx      # 0x714a
leaq -0xd8(%rbp), %rdi
callq 0x5dec
movq -0x60(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0xd0(%rbp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r12, %rcx
je 0x476e
movq -0x50(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x478d
movl $0xf, %esi
cmpq %r14, -0xd8(%rbp)
je 0x4788
movq -0xc8(%rbp), %rsi
cmpq %rsi, %rax
jbe 0x479f
movq -0xd8(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x2070
jmp 0x47af
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 0x47d9
movq %rsi, -0xb8(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa8(%rbp)
jmp 0x47e1
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 0x4811
callq 0x21a0
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x481f
callq 0x21a0
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x4830
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 0x5d52
leaq 0x2907(%rip), %rsi      # 0x7166
leaq -0x168(%rbp), %rdi
callq 0x22b0
leaq -0x1b8(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
callq 0x599a
leaq -0x168(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
movq %rbx, %rdi
callq 0x572c
leaq -0x1b8(%rbp), %rdi
callq 0x5a36
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x48b1
callq 0x21a0
leaq 0x38(%rbx), %rdx
leaq 0x2882(%rip), %rsi      # 0x713e
leaq -0x60(%rbp), %rdi
callq 0x55fa
leaq -0xf8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0xd8(%rbp), %rcx
movl $0x1, %edx
callq 0x568c
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x48ef
callq 0x21a0
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x48fd
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 0x5d52
leaq 0x2841(%rip), %rsi      # 0x716d
leaq -0x148(%rbp), %rdi
callq 0x22b0
leaq -0x1a0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x599a
leaq -0x148(%rbp), %rsi
leaq -0x1a0(%rbp), %rdx
movq %rbx, %rdi
callq 0x572c
leaq -0x1a0(%rbp), %rdi
callq 0x5a36
movq -0x148(%rbp), %rdi
cmpq %r14, %rdi
je 0x497e
callq 0x21a0
leaq -0xf8(%rbp), %rdi
callq 0x5a36
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x499f
callq 0x21a0
leaq -0x1d0(%rbp), %rdi
callq 0x5a36
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x49c3
callq 0x21a0
leaq -0x200(%rbp), %rdi
callq 0x5a36
movq -0x220(%rbp), %rdi
cmpq %r15, %rdi
je 0x49e0
callq 0x21a0
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x49f5
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 0x5a36
jmp 0x4a1d
jmp 0x4a1a
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r14, %rdi
je 0x4a33
callq 0x21a0
jmp 0x4a33
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x5a36
jmp 0x4a7d
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x565a
jmp 0x4a7d
jmp 0x4a7a
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
callq 0x5a36
jmp 0x4a67
jmp 0x4a64
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r14, %rdi
je 0x4a7d
callq 0x21a0
jmp 0x4a7d
movq %rax, %rbx
leaq -0xa8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4ac7
jmp 0x4acc
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0x4aa8
callq 0x21a0
jmp 0x4aa8
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4abb
callq 0x21a0
jmp 0x4abb
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r13, %rdi
je 0x4acc
callq 0x21a0
leaq -0x1d0(%rbp), %rdi
callq 0x5a36
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x4af0
callq 0x21a0
leaq -0x200(%rbp), %rdi
callq 0x5a36
movq -0x220(%rbp), %rdi
cmpq %r15, %rdi
je 0x4b0d
callq 0x21a0
leaq -0x88(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4bd6
jmp 0x4bdb
movq %rax, %rbx
jmp 0x4acc
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x565a
jmp 0x4ad8
jmp 0x4b6b
movq %rax, %rbx
leaq -0x1e8(%rbp), %rdi
callq 0x5a36
jmp 0x4b51
jmp 0x4b4e
movq %rax, %rbx
movq -0x188(%rbp), %rdi
cmpq %r14, %rdi
je 0x4ad8
callq 0x21a0
jmp 0x4ad8
movq %rax, %rbx
jmp 0x4ad8
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
jne 0x4aeb
jmp 0x4af0
movq %rax, %rbx
jmp 0x4af0
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x565a
jmp 0x4afc
movq %rax, %rbx
jmp 0x4afc
movq %rax, %rbx
jmp 0x4b0d
movq %rax, %rbx
jmp 0x4bca
movq %rax, %rbx
movq -0x238(%rbp), %rdi
testq %rdi, %rdi
je 0x4bca
callq 0x21a0
movq -0x250(%rbp), %rdi
testq %rdi, %rdi
je 0x4bdb
callq 0x21a0
movq %rbx, %rdi
callq 0x2290
nop