// File: /workspace/github_cpp_makefile_star2_O1/drarwood[P]gags/GA.cpp
// Function: InitializeSolutions(int, 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::vector<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::allocator<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>>, int, 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, int>>>&)
void InitializeSolutions(int n, vector<string>& s, vector<vector<string> >& p, map<string,int>& e) {
    // solutions will be a hash containing arrays of subject IDs. 
    // We will score these later by referencing ID to phenotype value
    // Note that N in each solution will be the total N across the groups in which to find specific distributions for. 
    // We will break each solution up into the relevant subsets for scoring and returning. 
    map<string, int> idsSelected;
    int randomIndex;
    for (int i = 0; i < p.size(); ++i) {
        for (int j = 0; j < n; ++j) {
            do {
                randomIndex = rand() % s.size(); // 0 to vector-size -1
            } while (!((idsSelected.find(s[randomIndex]) == idsSelected.end()) && (e.find(s[randomIndex]) == e.end())));
            p[i].push_back(s[randomIndex]);
            idsSelected[s[randomIndex]] = 0;
        }        
        idsSelected.clear();
    }     
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edi, 0x4(%rsp)
leaq 0x30(%rsp), %rbp
movl $0x0, (%rbp)
xorl %eax, %eax
movq %rax, 0x8(%rbp)
movq %rbp, 0x10(%rbp)
movq %rbp, 0x18(%rbp)
movq %rax, 0x20(%rbp)
movq 0x8(%rdx), %rax
movq %rdx, 0x18(%rsp)
cmpq (%rdx), %rax
je 0x781d
movq %rcx, %rbx
movq %rsi, %r15
leaq 0x8(%rcx), %r14
movq $0x0, 0x8(%rsp)
leaq 0x28(%rsp), %r12
cmpl $0x0, 0x4(%rsp)
jle 0x77e1
xorl %ecx, %ecx
movq 0x8(%rsp), %rax
leaq (%rax,%rax,2), %rax
shlq $0x3, %rax
movq %rax, 0x20(%rsp)
movl %ecx, 0x14(%rsp)
callq 0x30a0
cltq
movq (%r15), %rsi
movq 0x8(%r15), %rcx
subq %rsi, %rcx
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
movslq %edx, %r13
shlq $0x5, %r13
addq %r13, %rsi
movq %r12, %rdi
callq 0x8c74
cmpq %rbp, %rax
jne 0x7765
movq (%r15), %rsi
addq %r13, %rsi
movq %rbx, %rdi
callq 0x8c74
cmpq %r14, %rax
jne 0x7765
movq 0x18(%rsp), %rax
movq (%rax), %rdi
addq 0x20(%rsp), %rdi
movq (%r15), %rsi
addq %r13, %rsi
callq 0x8b28
addq (%r15), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x57be
movl $0x0, (%rax)
movl 0x14(%rsp), %ecx
incl %ecx
cmpl 0x4(%rsp), %ecx
jne 0x7761
movq %r12, %rdi
callq 0x8ee2
movq 0x18(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
movq 0x8(%rsp), %rdx
incq %rdx
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rdx, 0x8(%rsp)
cmpq %rdx, %rax
ja 0x7742
leaq 0x28(%rsp), %rdi
callq 0x5adc
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x783a
jmp 0x783a
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5adc
movq %rbx, %rdi
callq 0x3450