// File: 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:
subq $0xd8, %rsp
movl %edi, 0xd4(%rsp)
movq %rsi, 0xc8(%rsp)
movq %rdx, 0xc0(%rsp)
movq %rcx, 0xb8(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x5700
movl $0x0, 0x80(%rsp)
movslq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x12020
movq %rax, %rcx
movq 0x40(%rsp), %rax
cmpq %rcx, %rax
jae 0xfe41
movl $0x0, 0x7c(%rsp)
movl 0x7c(%rsp), %eax
cmpl 0xd4(%rsp), %eax
jge 0xfe1e
jmp 0xfc74
callq 0x30d0
cltq
movq %rax, 0x38(%rsp)
movq 0xc8(%rsp), %rdi
callq 0xd220
movq %rax, %rcx
movq 0x38(%rsp), %rax
xorl %edx, %edx
divq %rcx
movl %edx, %eax
movl %eax, 0x84(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xeca0
movq %rax, %rsi
leaq 0x88(%rsp), %rdi
callq 0x12040
movq %rax, 0x30(%rsp)
jmp 0xfccf
movq 0x30(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x88(%rsp), %rdi
callq 0xbf10
movq %rax, 0x58(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xbef0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x2f(%rsp)
jne 0xfd09
jmp 0xfd6e
movq 0xb8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xeca0
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x12040
movq %rax, 0x20(%rsp)
jmp 0xfd3f
movq 0x20(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0xb8(%rsp), %rdi
callq 0xbf10
movq %rax, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0xbef0
movb %al, 0x2f(%rsp)
movb 0x2f(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xfc74
movq 0xc0(%rsp), %rdi
movslq 0x80(%rsp), %rsi
callq 0x5f00
movq %rax, 0x10(%rsp)
movq 0xc8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xeca0
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x12070
jmp 0xfdba
movq 0xc8(%rsp), %rdi
movslq 0x84(%rsp), %rsi
callq 0xeca0
movq %rax, %rsi
leaq 0x88(%rsp), %rdi
callq 0x5fc0
movq %rax, 0x8(%rsp)
jmp 0xfde6
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
movl 0x7c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x7c(%rsp)
jmp 0xfc61
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x6560
jmp 0xfe56
leaq 0x88(%rsp), %rdi
callq 0x120e0
movl 0x80(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x80(%rsp)
jmp 0xfc2e
leaq 0x88(%rsp), %rdi
callq 0x6560
addq $0xd8, %rsp
retq
movq 0x68(%rsp), %rdi
callq 0x3510