// File: /workspace/github_cpp_makefile_star2_O2/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), %r14
pushq $0x10
popq %rdx
movq %r14, %rdi
callq 0x22b0
xorl %r15d, %r15d
pushq $0x38
popq %r12
leaq 0x1693(%rip), %r13      # 0x61d4
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cqto
idivq %r12
cmpq %r15, %rax
jbe 0x4b8c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x532a
movq %r14, %rdi
movq %rax, %rsi
callq 0x2150
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cqto
idivq %r12
decq %rax
cmpq %rax, %r15
je 0x4b87
movq %r14, %rdi
movq %r13, %rsi
callq 0x21a0
incq %r15
jmp 0x4b41
leaq 0x1643(%rip), %rsi      # 0x61d6
leaq -0x228(%rbp), %rdi
callq 0x21a0
xorl %r14d, %r14d
leaq -0x228(%rbp), %r15
movq %rbx, %rdi
xorl %esi, %esi
callq 0x532a
movq 0x28(%rax), %rcx
subq 0x20(%rax), %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0x4c3d
xorl %r13d, %r13d
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cqto
idivq %r12
cmpq %r13, %rax
jbe 0x4c26
movq %rbx, %rdi
movq %r13, %rsi
callq 0x532a
addq $0x20, %rax
movq %rax, %rdi
movq %r14, %rsi
callq 0x5348
movsd (%rax), %xmm0
movq %r15, %rdi
callq 0x2240
movq 0x8(%rbx), %rax
subq (%rbx), %rax
cqto
idivq %r12
decq %rax
cmpq %rax, %r13
je 0x4c21
movq %r15, %rdi
leaq 0x15b8(%rip), %rsi      # 0x61d4
callq 0x21a0
incq %r13
jmp 0x4bc7
movq %r15, %rdi
leaq 0x15a6(%rip), %rsi      # 0x61d6
callq 0x21a0
incq %r14
jmp 0x4ba9
leaq -0x228(%rbp), %rdi
callq 0x21e0
leaq -0x228(%rbp), %rdi
callq 0x2200
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4c6d
jmp 0x4c6d
jmp 0x4c6d
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x2200
movq %rbx, %rdi
callq 0x2280