// File: /workspace/github_cpp_makefile_star2_O3/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 0x4b13
movq 0x6529(%rip), %rbx      # 0xaff0
leaq 0x2917(%rip), %rsi      # 0x73e5
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
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 0x2160
leaq 0x20(%rsp), %rdi
movq %rax, (%rdi)
callq 0x2120
movq %rax, %r12
addq $0x10, %rbx
leaq 0x2878(%rip), %rsi      # 0x73b3
movl $0xd, %edx
movq %rbx, %rdi
callq 0x21d0
movl $0x76c, %esi            # imm = 0x76C
addl 0x14(%r12), %esi
movq %rbx, 0x10(%rsp)
movq %rbx, %rdi
callq 0x22d0
movb $0x2d, %bl
leaq 0x28(%rsp), %r15
movb %bl, (%r15)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
movl 0x10(%r12), %esi
incl %esi
movq %rax, %rdi
callq 0x22d0
movb %bl, (%r15)
leaq 0x28(%rsp), %rsi
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movl 0xc(%r12), %esi
movq %rax, %rdi
callq 0x22d0
leaq 0x24f8(%rip), %rsi      # 0x70a9
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movl $0x1, %ebx
leaq 0x68(%rsp), %r12
leaq 0xa8(%rsp), %r13
movq %r14, %rdi
xorl %esi, %esi
callq 0x3a6a
movl %ebx, 0xc(%rsp)
cvtsi2sd %ebx, %xmm0
divsd 0x243e(%rip), %xmm0     # 0x7028
cvtsd2ss %xmm0, %xmm0
movq %r14, %rdi
callq 0x3772
movq 0x10(%r14), %rax
movq %rax, 0x18(%rsp)
movq 0x28(%r14), %rbp
movq %r15, %rdi
movq %r14, %rsi
callq 0x3b4e
movq %r14, %rdi
movq %r15, %rsi
callq 0x2552
testb %al, %al
je 0x4c21
xorl %ebx, %ebx
jmp 0x4c68
movq %r12, %rdi
movq %r14, %rsi
callq 0x3b4e
movq %r13, %rdi
movq %r12, %rsi
callq 0x3b4e
movq %r14, %rdi
movq %r13, %rsi
callq 0x2552
movl %eax, %ebx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x4c56
callq 0x2210
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4c65
callq 0x2210
xorb $0x1, %bl
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x4c77
callq 0x2210
testb %bl, %bl
je 0x4ca9
movq %r15, %rdi
movq %r14, %rsi
callq 0x3b4e
movq %r14, %rdi
movq %r15, %rsi
callq 0x3970
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x4c03
callq 0x2210
jmp 0x4c03
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x20f0
movq %rax, %rbx
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2529(%rip), %rsi      # 0x71f1
callq 0x21d0
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x20f0
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0x24de(%rip), %rsi      # 0x71c8
callq 0x21d0
imulq $0x64, 0x18(%rsp), %rax
imulq %rbp, %rbp
xorl %edx, %edx
divq %rbp
movq %rbx, %rdi
movq %rax, %rsi
callq 0x20f0
movq %rax, %rbx
movl $0x5, %edx
movq %rax, %rdi
leaq 0x26a6(%rip), %rsi      # 0x73c1
callq 0x21d0
imulq $0x64, 0x10(%r14), %rax
xorl %edx, %edx
divq %rbp
movq %rbx, %rdi
movq %rax, %rsi
callq 0x20f0
movq %rax, %rbx
movl $0x3, %edx
movq %rax, %rdi
leaq 0x2680(%rip), %rsi      # 0x73c7
callq 0x21d0
movl $0xd, %edx
movq %rbx, %rdi
leaq 0x2670(%rip), %rsi      # 0x73cb
callq 0x21d0
movq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x20f0
movq %rax, %rbx
movl $0xb, %edx
movq %rax, %rdi
leaq 0x265b(%rip), %rsi      # 0x73d9
callq 0x21d0
movq 0x30(%r14), %rsi
movq %rbx, %rdi
callq 0x20f0
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl 0xc(%rsp), %ebx
incl %ebx
cmpl $0x64, %ebx
jne 0x4bd0
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4df4
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x4df4
callq 0x2210
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4e0c
callq 0x2210
jmp 0x4e0c
jmp 0x4e09
jmp 0x4e09
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x4e1b
callq 0x2210
movq %rbx, %rdi
callq 0x22e0
nop