// File: /workspace/github_cpp_makefile_star2_O2/drarwood[P]gags/FileWriter.cpp
// Function: OutputIndependentSolution(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, double, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, double>>>&, std::vector<int, std::allocator<int>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int&)
void OutputIndependentSolution(vector<string>& s, map<string,double>& m, vector<int>& n, string& o, int& g) {
    
    ofstream outFile;
    
    if (g == 1) {
        outFile.open(o.c_str(), ios_base::out);
        if (outFile.is_open()) {
            outFile << "Group\tID\tPhenotype\n";   
            for (int i = 0; i < n.size(); ++i) {
                for (int j = 0; j < n[i]; ++j) {
                    outFile << g << "\t" << s[j] << "\t" << m[s[j]] << endl;
                }
            }
            outFile.close();
        }
        else {
            cout << "Can not open " << o << " for writing" << endl;
            exit(EXIT_FAILURE);
        }
    }
    else {
        outFile.open(o.c_str(), ios_base::app);
        if (outFile.is_open()) {
            for (int i = 0; i < n.size(); ++i) {
                for (int j = 0; j < n[i]; ++j) {
                    outFile << g << "\t" << s[j] << "\t" << m[s[j]] << endl;
                }
            }
            outFile.close();
        }
        else {
            cout << "Can not open " << o << " for appending" << endl;
            exit(EXIT_FAILURE);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %r8, %rbx
movq %rcx, %r13
movq %rdx, (%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
leaq 0x18(%rsp), %rdi
callq 0x33e0
movq %rbx, 0x10(%rsp)
cmpl $0x1, (%rbx)
movq (%r13), %rsi
jne 0x658b
leaq 0x18(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x3040
leaq 0x88(%rsp), %rdi
callq 0x3080
testb %al, %al
je 0x6680
leaq 0x3e39(%rip), %rsi      # 0xa30d
leaq 0x18(%rsp), %rdi
callq 0x3250
movq (%rsp), %rax
movq (%rax), %rax
xorl %ebx, %ebx
leaq 0x3e33(%rip), %rbp      # 0xa321
movq (%rsp), %rcx
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0x665a
xorl %r15d, %r15d
xorl %r14d, %r14d
movslq (%rax,%rbx,4), %rcx
cmpq %rcx, %r14
jge 0x6583
movq 0x10(%rsp), %rax
movl (%rax), %esi
leaq 0x18(%rsp), %rdi
callq 0x33f0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3250
movq (%r12), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3250
movq %rax, %r13
movq (%r12), %rsi
addq %r15, %rsi
movq 0x8(%rsp), %rdi
callq 0x670e
movsd (%rax), %xmm0
movq %r13, %rdi
callq 0x33b0
movq %rax, %rdi
callq 0x3140
incq %r14
movq (%rsp), %rax
movq (%rax), %rax
addq $0x20, %r15
jmp 0x650c
incq %rbx
jmp 0x64ee
leaq 0x18(%rsp), %rdi
pushq $0x1
popq %rdx
callq 0x3040
leaq 0x88(%rsp), %rdi
callq 0x3080
testb %al, %al
je 0x66b7
movq (%rsp), %rax
movq (%rax), %rax
xorl %ebx, %ebx
leaq 0x3d64(%rip), %rbp      # 0xa321
movq (%rsp), %rcx
movq 0x8(%rcx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rbx, %rcx
jbe 0x665a
xorl %r15d, %r15d
xorl %r14d, %r14d
movslq (%rax,%rbx,4), %rcx
cmpq %rcx, %r14
jge 0x6652
movq 0x10(%rsp), %rax
movl (%rax), %esi
leaq 0x18(%rsp), %rdi
callq 0x33f0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3250
movq (%r12), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0x3230
movq %rax, %rdi
movq %rbp, %rsi
callq 0x3250
movq %rax, %r13
movq (%r12), %rsi
addq %r15, %rsi
movq 0x8(%rsp), %rdi
callq 0x670e
movsd (%rax), %xmm0
movq %r13, %rdi
callq 0x33b0
movq %rax, %rdi
callq 0x3140
incq %r14
movq (%rsp), %rax
movq (%rax), %rax
addq $0x20, %r15
jmp 0x65db
incq %rbx
jmp 0x65bd
leaq 0x18(%rsp), %rdi
callq 0x3330
leaq 0x18(%rsp), %rdi
callq 0x3350
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8951(%rip), %rdi      # 0xefd8
leaq 0x3c95(%rip), %rsi      # 0xa323
callq 0x3250
movq %rax, %rdi
movq %r13, %rsi
callq 0x3230
leaq 0x3c8c(%rip), %rsi      # 0xa331
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
callq 0x3140
jmp 0x66ec
movq 0x891a(%rip), %rdi      # 0xefd8
leaq 0x3c5e(%rip), %rsi      # 0xa323
callq 0x3250
movq %rax, %rdi
movq %r13, %rsi
callq 0x3230
leaq 0x3c62(%rip), %rsi      # 0xa33e
movq %rax, %rdi
callq 0x3250
movq %rax, %rdi
callq 0x3140
pushq $0x1
popq %rdi
callq 0x32c0
jmp 0x66f8
jmp 0x66f8
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3350
movq %rbx, %rdi
callq 0x3410
nop