// File: /workspace/github_cpp_makefile_star2_O1/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, 0x88(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leal -0x1(%rdx), %eax
movl $0x0, 0x58(%rsp)
movl %eax, 0x5c(%rsp)
movq 0x8(%rdi), %rax
movq %rdi, 0x28(%rsp)
subq (%rdi), %rax
sarq $0x5, %rax
movq %rsi, 0x80(%rsp)
cmpq %rsi, %rax
jae 0x3fc8
movq %r8, %r14
movq %rdx, %r12
movabsq $-0x8000000000000000, %r13 # imm = 0x8000000000000000
leaq 0x58(%rsp), %r15
leaq 0x3f(%r13), %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movb $0x0, 0x60(%rsp)
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
leaq 0x60(%rsp), %rdx
leaq 0xf(%rsp), %rcx
callq 0x4078
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
sarq $0x2, %rax
cmpq %r12, %rax
jae 0x3ee1
movq %r15, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4242
movl %eax, 0x60(%rsp)
movslq %eax, %rcx
leaq 0x3f(%rcx), %rdx
testq %rcx, %rcx
cmovnsq %rcx, %rdx
sarq $0x6, %rdx
shlq $0x3, %rdx
addq 0x30(%rsp), %rdx
movq %rcx, %rsi
andq %rbx, %rsi
xorl %edi, %edi
cmpq %r13, %rsi
setbe %dil
movq -0x8(%rdx,%rdi,8), %rdx
btq %rcx, %rdx
jb 0x3e1d
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3e94
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3ea3
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x43ca
movslq 0x60(%rsp), %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x30(%rsp), %rax
movq %rcx, %rdx
andq %rbx, %rdx
xorl %esi, %esi
cmpq %r13, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
orq %rdx, -0x8(%rax,%rsi,8)
jmp 0x3e1d
leaq 0x90(%rsp), %rbp
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2e46
leaq 0x60(%rsp), %rdi
movq %rbp, %rsi
callq 0x35b0
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x3f20
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x88(%rsp), %rdi
leaq 0x60(%rsp), %rbp
movq %rbp, %rsi
callq 0x3738
movq %rbp, %rdi
movl %eax, %esi
callq 0x3616
movq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x40e0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x3f63
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3f93
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3faa
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x28(%rsp), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
sarq $0x5, %rax
cmpq 0x80(%rsp), %rax
jb 0x3df0
movq 0x28(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x401c
movq %rax, %r14
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x401f
movq 0xa0(%rsp), %rsi
jmp 0x4012
movq %rax, %r14
jmp 0x404f
movq %rax, %r14
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x401f
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
jmp 0x401f
movq %rax, %r14
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x404f
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movl %eax, 0x48(%rsp)
movq %rax, 0x50(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x4066
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x28(%rsp), %rdi
callq 0x4126
movq %r14, %rdi
callq 0x2280