// File: /workspace/github_cpp_makefile_star2_O3/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 0x3410
movq %rbx, 0x10(%rsp)
cmpl $0x1, (%rbx)
movq (%r13), %rsi
jne 0x70cf
leaq 0x18(%rsp), %rdi
movl $0x10, %edx
callq 0x3050
leaq 0x88(%rsp), %rdi
callq 0x3080
testb %al, %al
je 0x723a
leaq 0x537b(%rip), %rsi      # 0xc33d
leaq 0x18(%rsp), %rdi
movl $0x13, %edx
callq 0x32c0
movq (%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
cmpq %rax, %rcx
je 0x71ec
xorl %ebx, %ebx
leaq 0x5363(%rip), %rbp      # 0xc351
cmpl $0x0, (%rax,%rbx,4)
jle 0x70b4
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x10(%rsp), %rax
movl (%rax), %esi
leaq 0x18(%rsp), %rdi
callq 0x3420
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x32c0
movq (%r12), %rax
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
movq %r13, %rdi
callq 0x32c0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x32c0
movq (%r12), %rsi
addq %r15, %rsi
movq 0x8(%rsp), %rdi
callq 0x72f6
movsd (%rax), %xmm0
movq %r13, %rdi
callq 0x33e0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31b0
incq %r14
movq (%rsp), %rax
movq (%rax), %rax
movslq (%rax,%rbx,4), %rcx
addq $0x20, %r15
cmpq %rcx, %r14
jl 0x6ffe
movq (%rsp), %rcx
movq 0x8(%rcx), %rcx
incq %rbx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
ja 0x6fee
jmp 0x71ec
leaq 0x18(%rsp), %rdi
movl $0x1, %edx
callq 0x3050
leaq 0x88(%rsp), %rdi
callq 0x3080
testb %al, %al
je 0x7287
movq (%rsp), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rcx
cmpq %rax, %rcx
je 0x71ec
xorl %ebx, %ebx
leaq 0x5241(%rip), %rbp      # 0xc351
cmpl $0x0, (%rax,%rbx,4)
jle 0x71d6
xorl %r15d, %r15d
xorl %r14d, %r14d
movq 0x10(%rsp), %rax
movl (%rax), %esi
leaq 0x18(%rsp), %rdi
callq 0x3420
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x32c0
movq (%r12), %rax
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
movq %r13, %rdi
callq 0x32c0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x32c0
movq (%r12), %rsi
addq %r15, %rsi
movq 0x8(%rsp), %rdi
callq 0x72f6
movsd (%rax), %xmm0
movq %r13, %rdi
callq 0x33e0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x3260
movsbl %al, %esi
movq %r13, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x31b0
incq %r14
movq (%rsp), %rax
movq (%rax), %rax
movslq (%rax,%rbx,4), %rcx
addq $0x20, %r15
cmpq %rcx, %r14
jl 0x7120
movq (%rsp), %rcx
movq 0x8(%rcx), %rcx
incq %rbx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbx, %rdx
ja 0x7110
leaq 0x18(%rsp), %rdi
callq 0x3340
movq 0x9dc3(%rip), %rax      # 0x10fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x20(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x18(%rsp,%rcx)
callq 0x3230
leaq 0x110(%rsp), %rdi
callq 0x30d0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x9d97(%rip), %rdi      # 0x10fd8
leaq 0x510b(%rip), %rsi      # 0xc353
movl $0xd, %edx
callq 0x32c0
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq 0x9d77(%rip), %rdi      # 0x10fd8
callq 0x32c0
movq %rax, %rbx
leaq 0x50f1(%rip), %rsi      # 0xc361
movl $0xc, %edx
movq %rax, %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3120
jmp 0x72d2
movq 0x9d4a(%rip), %rdi      # 0x10fd8
leaq 0x50be(%rip), %rsi      # 0xc353
movl $0xd, %edx
callq 0x32c0
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq 0x9d2a(%rip), %rdi      # 0x10fd8
callq 0x32c0
movq %rax, %rbx
leaq 0x50b1(%rip), %rsi      # 0xc36e
movl $0xe, %edx
movq %rax, %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3120
movl $0x1, %edi
callq 0x32e0
jmp 0x72e0
jmp 0x72e0
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3370
movq %rbx, %rdi
callq 0x3450
nop