// File: /workspace/github_cpp_makefile_star2_O1/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 0x57e2
movl $0x8, %r15d
xorl %r13d, %r13d
leaq -0x228(%rbp), %r14
leaq 0x1a5c(%rip), %r12      # 0x71d4
movq -0x8(%rax,%r15), %rsi
movq (%rax,%r15), %rdx
movq %r14, %rdi
callq 0x21f0
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
decq %rax
cmpq %rax, %r13
je 0x57ba
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x21f0
incq %r13
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
addq $0x38, %r15
cmpq %r13, %rcx
ja 0x5778
leaq 0x19ed(%rip), %rsi      # 0x71d6
leaq -0x228(%rbp), %rdi
movl $0x1, %edx
callq 0x21f0
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
cmpq %rax, %rdx
je 0x58ee
xorl %r14d, %r14d
leaq -0x228(%rbp), %r12
movq 0x28(%rax), %rcx
subq 0x20(%rax), %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0x5913
movq (%rbx), %rax
cmpq %rax, 0x8(%rbx)
je 0x58c7
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 0x5967
movsd (%rcx,%r14,8), %xmm0
movq %r12, %rdi
callq 0x2250
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
movabsq $0x6db6db6db6db6db7, %rcx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rax
decq %rax
cmpq %rax, %r15
je 0x589b
movl $0x1, %edx
movq %r12, %rdi
leaq 0x193e(%rip), %rsi      # 0x71d4
callq 0x21f0
incq %r15
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rdx # imm = 0x6DB6DB6DB6DB6DB7
imulq %rdx, %rcx
addq $0x38, %r13
cmpq %r15, %rcx
ja 0x583f
movl $0x1, %edx
movq %r12, %rdi
leaq 0x1900(%rip), %rsi      # 0x71d6
callq 0x21f0
incq %r14
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
cmpq %rax, %rdx
jne 0x5814
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $0x6db6db6db6db6db7, %rax # imm = 0x6DB6DB6DB6DB6DB7
imulq %rax, %rdx
leaq 0x18ce(%rip), %rdi      # 0x71d8
xorl %esi, %esi
xorl %eax, %eax
callq 0x2230
leaq -0x228(%rbp), %rdi
callq 0x2200
movq 0x46aa(%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 0x186a(%rip), %rdi      # 0x71d8
movq %r14, %rsi
xorl %eax, %eax
callq 0x2230
jmp 0x5982
jmp 0x5982
jmp 0x5982
jmp 0x5982
jmp 0x5982
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2290
nop