// File: /workspace/github_cpp_makefile_star2_O3/cssartori[P]ga-qap/src/populationcreator.cpp
// Function: PopulationCreator::random(unsigned long, unsigned long, ObjectiveFunction const&, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&)
std::vector<Solution> PopulationCreator::random(const size_t max_pop_size, const size_t n, const ObjectiveFunction& of, std::default_random_engine& generator){
	std::vector<Solution> population;
	std::uniform_int_distribution<int> randn(0, n-1);
	
	/*While population is smaller than the parameter 'population size'*/
	while(population.size() < max_pop_size){
		std::vector<int> individual;
		std::vector<bool> used(n, false);
		
		/*While individual doesn't have n locations in it*/
		while(individual.size() < n){
			int r = randn(generator);
			if(not used[r]){
				individual.push_back(r);
				used[r] = true;
			}
		}

		Solution si(individual);
		si.set_fitness(of.eval(si));
		population.push_back(si);
	}
	
	return population;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rcx, 0x60(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, 0x28(%rsp)
movq $0x0, 0x10(%rdi)
leal -0x1(%rdx), %eax
movl $0x0, 0x30(%rsp)
movl %eax, 0x34(%rsp)
movq %rsi, 0x58(%rsp)
testq %rsi, %rsi
je 0x43b9
movq %r8, %r14
movq %rdx, %r12
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
leaq 0x30(%rsp), %r15
leaq 0x3f(%r13), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x38(%rsp)
leaq 0x68(%rsp), %rdi
movq %r12, %rsi
leaq 0x38(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x4468
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x2, %rax
cmpq %r12, %rax
jae 0x42ee
movq %r15, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4638
movl %eax, 0x38(%rsp)
movslq %eax, %rcx
movq 0x68(%rsp), %rdx
leal 0x3f(%rcx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
sarl $0x6, %esi
movslq %esi, %rsi
movq %rcx, %rdi
andq %rbx, %rdi
xorl %r8d, %r8d
cmpq %r13, %rdi
setbe %r8b
leaq (%rdx,%rsi,8), %rsi
movq -0x8(%rsi,%r8,8), %rsi
btq %rcx, %rsi
movq 0x18(%rsp), %rsi
jb 0x42dc
cmpq 0x20(%rsp), %rsi
je 0x428f
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x42a8
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x47c0
movq 0x68(%rsp), %rdx
movq 0x18(%rsp), %rsi
movslq 0x38(%rsp), %rcx
leal 0x3f(%rcx), %eax
testq %rcx, %rcx
cmovnsl %ecx, %eax
sarl $0x6, %eax
cltq
movq %rcx, %rdi
andq %rbx, %rdi
xorl %r8d, %r8d
cmpq %r13, %rdi
setbe %r8b
movl $0x1, %edi
shlq %cl, %rdi
leaq (%rdx,%rax,8), %rax
orq %rdi, -0x8(%rax,%r8,8)
subq 0x10(%rsp), %rsi
sarq $0x2, %rsi
cmpq %r12, %rsi
jb 0x422f
leaq 0x90(%rsp), %rbp
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2f74
leaq 0x38(%rsp), %rdi
movq %rbp, %rsi
callq 0x36e4
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x432d
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x60(%rsp), %rdi
leaq 0x38(%rsp), %rbp
movq %rbp, %rsi
callq 0x3b34
movq %rbp, %rdi
movl %eax, %esi
callq 0x374a
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x44d0
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x436d
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4387
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x439e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x28(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq 0x58(%rsp), %rax
jb 0x41eb
movq 0x28(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x440d
movq %rax, %r14
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x4410
movq 0xa0(%rsp), %rsi
jmp 0x4403
movq %rax, %r14
jmp 0x443e
movq %rax, %r14
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x4410
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x4410
movq %rax, %r14
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x443e
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
xorl %eax, %eax
movq %rax, 0x68(%rsp)
movl $0x0, 0x70(%rsp)
movq %rax, 0x78(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4455
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x28(%rsp), %rdi
callq 0x4516
movq %r14, %rdi
callq 0x2280
nop