// File: /workspace/github_cpp_makefile_star2_O3/godofecht[P]Slow-Feature-Analysis/./sfa.h
// Function: SFA::write_csv(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<double, std::allocator<double>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<double, std::allocator<double>>>>>)
void write_csv(std::string filename, std::vector<std::pair<std::string, std::vector<double>>> dataset)
    {
    // Make a CSV file with one or more columns of integer values
    // Each column of data is represented by the pair <column name, column data>
    //   as std::pair<std::string, std::vector<int>>
    // The dataset is represented as a vector of these columns
    // Note that all columns should be the same size
    
    // Create an output filestream object
    std::ofstream myFile(filename);
    
    // Send column names to the stream
    for(int j = 0; j < dataset.size(); ++j)
    {
        myFile << dataset.at(j).first;
        if(j != dataset.size() - 1) myFile << ","; // No comma at end of line
    }
    myFile << "\n";
    
    // Send data to the stream
    for(int i = 0; i < dataset.at(0).second.size(); ++i)
    {
        for(int j = 0; j < dataset.size(); ++j)
        {
            myFile << dataset.at(j).second.at(i);
            if(j != dataset.size() - 1) myFile << ","; // No comma at end of line
        }
        myFile << "\n";
    }
    
    // Close the file
    myFile.close();
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rdx, %rbx
leaq -0x228(%rbp), %rdi
movl $0x10, %edx
callq 0x22c0
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x575e
movl $0x8, %r15d
xorl %r13d, %r13d
leaq -0x228(%rbp), %r14
leaq 0x1ae4(%rip), %r12      # 0x71d4
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %r14, %rdi
callq 0x21f0
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
leaq -0x1(%rcx), %rdx
cmpq %rdx, %r13
je 0x5752
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x21f0
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
incq %r13
addq $0x38, %r15
cmpq %r13, %rcx
ja 0x56f0
leaq 0x1a71(%rip), %rsi      # 0x71d6
leaq -0x228(%rbp), %rdi
movl $0x1, %edx
callq 0x21f0
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rax, %rcx
je 0x586a
xorl %r14d, %r14d
leaq -0x228(%rbp), %r12
movq 0x28(%rax), %rdx
subq 0x20(%rax), %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
jbe 0x587c
cmpq %rax, %rcx
je 0x5843
movl $0x28, %r13d
xorl %r15d, %r15d
movq -0x8(%rax,%r13), %rcx
movq (%rax,%r13), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
jbe 0x58d0
movsd (%rcx,%r14,8), %xmm0
movq %r12, %rdi
callq 0x2250
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
leaq -0x1(%rcx), %rdx
cmpq %rdx, %r15
je 0x5833
movl $0x1, %edx
movq %r12, %rdi
leaq 0x19c2(%rip), %rsi      # 0x71d4
callq 0x21f0
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
incq %r15
addq $0x38, %r13
cmpq %r15, %rcx
ja 0x57b7
movl $0x1, %edx
movq %r12, %rdi
leaq 0x1984(%rip), %rsi      # 0x71d6
callq 0x21f0
incq %r14
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rax, %rcx
jne 0x5790
leaq 0x1967(%rip), %rdi      # 0x71d8
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2230
leaq -0x228(%rbp), %rdi
callq 0x2200
movq 0x4741(%rip), %rax      # 0x9fd0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x220(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x228(%rbp,%rcx)
callq 0x2160
leaq -0x130(%rbp), %rdi
callq 0x2080
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1901(%rip), %rdi      # 0x71d8
movq %r14, %rsi
xorl %eax, %eax
callq 0x2230
jmp 0x58eb
jmp 0x58eb
jmp 0x58eb
jmp 0x58eb
jmp 0x58eb
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2290