// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rsi, 0x8(%rsp)
movq %rdi, %r12
leaq 0x18(%rsp), %rdi
callq 0x3410
movq %rbx, 0x10(%rsp)
cmpl $0x1, (%rbx)
movq (%r13), %rsi
movq %r14, (%rsp)
jne 0x70f4
leaq 0x18(%rsp), %rdi
movl $0x10, %edx
callq 0x3050
leaq 0x88(%rsp), %rdi
callq 0x3080
testb %al, %al
je 0x7258
leaq 0x634f(%rip), %rsi      # 0xd33d
leaq 0x18(%rsp), %rdi
movl $0x13, %edx
callq 0x32c0
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x720a
xorl %ebx, %ebx
leaq 0x633e(%rip), %rbp      # 0xd351
movq (%r14), %rax
cmpl $0x0, (%rax,%rbx,4)
jle 0x70d4
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 0x7314
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), %rax
addq $0x20, %r15
cmpq %rax, %r14
jl 0x7026
incq %rbx
movq (%rsp), %r14
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
ja 0x7013
jmp 0x720a
leaq 0x18(%rsp), %rdi
movl $0x1, %edx
callq 0x3050
leaq 0x88(%rsp), %rdi
callq 0x3080
testb %al, %al
je 0x72a5
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x720a
xorl %ebx, %ebx
leaq 0x6223(%rip), %rbp      # 0xd351
movq (%r14), %rax
cmpl $0x0, (%rax,%rbx,4)
jle 0x71ef
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 0x7314
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), %rax
addq $0x20, %r15
cmpq %rax, %r14
jl 0x7141
incq %rbx
movq (%rsp), %r14
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x2, %rax
cmpq %rbx, %rax
ja 0x712e
leaq 0x18(%rsp), %rdi
callq 0x3340
movq 0xada5(%rip), %rax      # 0x11fc0
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 0xad79(%rip), %rdi      # 0x11fd8
leaq 0x60ed(%rip), %rsi      # 0xd353
movl $0xd, %edx
callq 0x32c0
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq 0xad59(%rip), %rdi      # 0x11fd8
callq 0x32c0
movq %rax, %rbx
leaq 0x60d3(%rip), %rsi      # 0xd361
movl $0xc, %edx
movq %rax, %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3120
jmp 0x72f0
movq 0xad2c(%rip), %rdi      # 0x11fd8
leaq 0x60a0(%rip), %rsi      # 0xd353
movl $0xd, %edx
callq 0x32c0
movq (%r13), %rsi
movq 0x8(%r13), %rdx
movq 0xad0c(%rip), %rdi      # 0x11fd8
callq 0x32c0
movq %rax, %rbx
leaq 0x6093(%rip), %rsi      # 0xd36e
movl $0xe, %edx
movq %rax, %rdi
callq 0x32c0
movq %rbx, %rdi
callq 0x3120
movl $0x1, %edi
callq 0x32e0
jmp 0x72fe
jmp 0x72fe
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3370
movq %rbx, %rdi
callq 0x3450
nop