// File: /workspace/github_cpp_makefile_star2_O2/massykezzoul[P]jeu-de-la-vie/population/population.cpp
// Function: simulation(Population&, std::basic_fstream<char, std::char_traits<char>>&)
void simulation(Population &popu,fstream& stat) {
	if (stat) {
		time_t t = time(0);   // get time now
    	tm* now = localtime(&t);
    	stat << "Simulation : " << (now->tm_year + 1900) << '-' 
         		<< (now->tm_mon + 1) << '-'
         		<<  now->tm_mday
         		<< "\n";

		for (int i = 1; i < 100; ++i) {
			popu.init();
			popu.set_probability((float)((float)i/100.0));
			size_t vivant_debut = popu.get_vivante();
			size_t dimension = popu.get_dimension();
			while ( (popu != popu.next()) && (popu != popu.next().next()) )  {
				popu = popu.next();
			}
			stat << dimension << "x" << dimension << " : "
					<< (vivant_debut*100) / (dimension*dimension) << "%\t-> "
					<< popu.get_vivante()*100 / (dimension*dimension) << "%\t,"
					<< "generation = " << popu.get_generation() 
					<< "\t,graine = " << popu.get_graine() << endl;
		}
	} else 
		cerr << "Erreur d'ouverture du fichier " << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq (%rsi), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rsi,%rax)
je 0x4032
movq 0x5fe3(%rip), %rdi      # 0x9ff0
leaq 0x23d1(%rip), %rsi      # 0x63e5
callq 0x21d0
movq %rax, %rdi
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2100
movq %rsi, %rbx
movq %rdi, %r14
xorl %edi, %edi
callq 0x21b0
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
callq 0x2150
movq %rax, %r15
addq $0x10, %rbx
leaq 0x2359(%rip), %rsi      # 0x63b3
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
callq 0x21d0
movl $0x76c, %esi            # imm = 0x76C
addl 0x14(%r15), %esi
movq %rax, %rdi
callq 0x22b0
pushq $0x2d
popq %rbx
movq %rax, %rdi
movl %ebx, %esi
callq 0x21f0
movl 0x10(%r15), %esi
incl %esi
movq %rax, %rdi
callq 0x22b0
movq %rax, %rdi
movl %ebx, %esi
callq 0x21f0
movl 0xc(%r15), %esi
movq %rax, %rdi
callq 0x22b0
leaq 0x1ff9(%rip), %rsi      # 0x60a9
movq %rax, %rdi
callq 0x21d0
pushq $0x1
popq %rbx
leaq 0x28(%rsp), %r15
leaq 0x68(%rsp), %r12
leaq 0xa8(%rsp), %r13
cmpl $0x64, %ebx
je 0x4256
movq %r14, %rdi
xorl %esi, %esi
callq 0x34b2
movl %ebx, 0xc(%rsp)
cvtsi2sd %ebx, %xmm0
divsd 0x1f38(%rip), %xmm0     # 0x6028
cvtsd2ss %xmm0, %xmm0
movq %r14, %rdi
callq 0x3224
movq 0x10(%r14), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%r14), %rbp
movq %r15, %rdi
movq %r14, %rsi
callq 0x3592
movq %r14, %rdi
movq %r15, %rsi
callq 0x2609
testb %al, %al
je 0x4182
movq %r12, %rdi
movq %r14, %rsi
callq 0x3592
movq %r13, %rdi
movq %r12, %rsi
callq 0x3592
movq %r14, %rdi
movq %r13, %rsi
callq 0x2609
movl %eax, %ebx
movq %r13, %rdi
callq 0x33aa
movq %r12, %rdi
callq 0x33aa
movq %r15, %rdi
callq 0x33aa
testb %bl, %bl
je 0x418a
movq %r15, %rdi
movq %r14, %rsi
callq 0x3592
movq %r14, %rdi
movq %r15, %rsi
callq 0x33b8
movq %r15, %rdi
callq 0x33aa
jmp 0x4109
movq %r15, %rdi
callq 0x33aa
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x2050(%rip), %rsi      # 0x61f1
callq 0x21d0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x200d(%rip), %rsi      # 0x61c8
callq 0x21d0
movq %rax, %rdi
imulq $0x64, 0x18(%rsp), %rax
imulq %rbp, %rbp
xorl %edx, %edx
divq %rbp
movq %rax, %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x21dd(%rip), %rsi      # 0x63c1
callq 0x21d0
movq %rax, %rdi
imulq $0x64, 0x10(%r14), %rax
xorl %edx, %edx
divq %rbp
movq %rax, %rsi
callq 0x2130
movq %rax, %rdi
leaq 0x21bf(%rip), %rsi      # 0x63c7
callq 0x21d0
movq %rax, %rdi
leaq 0x21b4(%rip), %rsi      # 0x63cb
callq 0x21d0
movq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
leaq 0x21a7(%rip), %rsi      # 0x63d9
callq 0x21d0
movq 0x30(%r14), %rsi
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x2100
movl 0xc(%rsp), %ebx
incl %ebx
jmp 0x40cd
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x428d
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x33aa
jmp 0x4281
jmp 0x428d
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x33aa
jmp 0x4290
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x33aa
movq %rbx, %rdi
callq 0x22c0