// File: /workspace/github_cpp_makefile_star2_O1/massykezzoul[P]jeu-de-la-vie/population/population.cpp
// Function: simulation(Population&)
void simulation(Population &popu) {
	size_t vivant_debut = popu.get_vivante();
	size_t dimension = popu.get_dimension();
	int temps_pose = popu.get_speed();
	while ( (popu != popu.next()) && (popu != popu.next().next()) )  {
		cout << "Voici La population de Départ : " << endl << endl;
		popu.affiche_matrice();

		cout << "Pourcentage de vie : " << popu.get_vivante()*100 / (dimension*dimension) <<"%" << endl
			<< "Generation : " << popu.get_generation() << endl
			<< "Matrice de taille : " << dimension << "x" << dimension << endl;
		
		if (popu.get_generation() == 1) {
			cout << "Qliquer sur Entrée pour commencer la Simulation ..." << endl;
			getchar();
		}
		

		popu = popu.next();

		usleep(temps_pose);
	}

	cout << "########################## END OF SIMULATION ##########################" << endl << endl;

	popu.next().affiche_matrice();

	cout << "Fin de la simuation après : " << popu.get_generation() << " Generations."<<endl;
	if (popu.get_vivante() == 0) 
		cout << "Les cellules sont toutes Morte à la fin de cette simulation." << endl;
	else 
		cout << popu.get_vivante() << " Cellule vivantes à la fin." << endl;
	cout << "Soit un Taux d'environ " << (popu.get_vivante()*100) / (dimension*dimension) << "% de vie." << endl;
	cout << endl << "Au Debut de la simulation : " << endl;
 	cout << "La Graine étais : " << popu.get_graine() <<"."<< endl;
	cout << "Matrice de "<<dimension<<"x"<<dimension<<" cases, Soit un total de "<< dimension*dimension<<" Cellules" << endl;
	cout << "Avec "<< vivant_debut <<" Cellule vivante au debut, Contre " << (dimension*dimension) - vivant_debut << " Cellule Morte." << endl;
	cout << "Soit un Taux d'environ " << (vivant_debut*100) / (dimension*dimension) << "% de vie." << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %r12
movq 0x10(%rdi), %rax
movq %rax, 0x20(%rsp)
movq 0x28(%rdi), %rcx
movl 0x38(%rdi), %eax
movl %eax, 0xc(%rsp)
movq %rcx, 0x10(%rsp)
movq %rcx, %rax
imulq %rcx, %rax
movq %rax, 0x18(%rsp)
leaq 0x28(%rsp), %rbx
movq 0x6c7f(%rip), %r13      # 0xafd0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b18
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2552
movl %eax, %ebp
testb %al, %al
je 0x4372
xorl %r14d, %r14d
jmp 0x43a7
leaq 0x68(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x3b18
leaq 0xa8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x3b18
movq %r12, %rdi
movq %r15, %rsi
callq 0x2552
movl %eax, %r14d
xorb $0x1, %r14b
testb %bpl, %bpl
jne 0x43cd
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x43be
callq 0x2210
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x43cd
callq 0x2210
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x43dc
callq 0x2210
testb %r14b, %r14b
je 0x45fa
movl $0x21, %edx
movq %r13, %rdi
leaq 0x2da0(%rip), %rsi      # 0x7194
callq 0x21d0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq %r12, %rdi
callq 0x3e1a
movl $0x15, %edx
movq %r13, %rdi
leaq 0x2d54(%rip), %rsi      # 0x71b6
callq 0x21d0
imulq $0x64, 0x10(%r12), %rax
xorl %edx, %edx
divq 0x18(%rsp)
movq %r13, %rdi
movq %rax, %rsi
callq 0x20f0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2d3b(%rip), %rsi      # 0x71cc
callq 0x21d0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq %rax, %r14
movl $0xd, %edx
movq %rax, %rdi
leaq 0x2cff(%rip), %rsi      # 0x71ce
callq 0x21d0
movq 0x8(%r12), %rsi
movq %r14, %rdi
callq 0x20f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq %rax, %r14
movl $0x14, %edx
movq %rax, %rdi
leaq 0x2cbf(%rip), %rsi      # 0x71dc
callq 0x21d0
movq %r14, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
callq 0x20f0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2cad(%rip), %rsi      # 0x71f1
callq 0x21d0
movq %r14, %rdi
movq %r15, %rsi
callq 0x20f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
cmpq $0x1, 0x8(%r12)
jne 0x45c7
movl $0x34, %edx
movq %r13, %rdi
leaq 0x2c5e(%rip), %rsi      # 0x71f3
callq 0x21d0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
callq 0x2230
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b18
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3938
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x45ec
callq 0x2210
movl 0xc(%rsp), %edi
callq 0x2240
jmp 0x4351
leaq 0x2c27(%rip), %rsi      # 0x7228
movl $0x47, %edx
movq %r13, %rdi
callq 0x21d0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
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
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3b18
movq %rbx, %rdi
callq 0x3e1a
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x4687
callq 0x2210
movq 0x6942(%rip), %r13      # 0xafd0
leaq 0x2bdb(%rip), %rsi      # 0x7270
movl $0x1d, %edx
movq %r13, %rdi
callq 0x21d0
movq 0x8(%r12), %rsi
movq %r13, %rdi
callq 0x20f0
movq %rax, %rbx
leaq 0x2bd5(%rip), %rsi      # 0x728e
movl $0xd, %edx
movq %rax, %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
callq 0x2100
movq 0x10(%r12), %rsi
testq %rsi, %rsi
je 0x471c
movq 0x68d2(%rip), %rdi      # 0xafd0
callq 0x20f0
movq %rax, %rbx
leaq 0x2bcd(%rip), %rsi      # 0x72da
movl $0x1c, %edx
movq %rax, %rdi
callq 0x21d0
jmp 0x4733
leaq 0x2b79(%rip), %rsi      # 0x729c
movl $0x3d, %edx
movq %r13, %rdi
callq 0x21d0
movq %r13, %rbx
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
callq 0x2100
leaq 0x2b96(%rip), %rsi      # 0x72f7
movl $0x17, %edx
movq %r13, %rdi
callq 0x21d0
imulq $0x64, 0x10(%r12), %rax
xorl %edx, %edx
movq 0x18(%rsp), %rbx
divq %rbx
movq %r13, %rdi
movq %rax, %rsi
callq 0x20f0
movq %rax, %rbp
leaq 0x2b7c(%rip), %r14      # 0x730f
movl $0x9, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x21d0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movq %rax, %rbp
leaq 0x2b1c(%rip), %rsi      # 0x7319
movl $0x1c, %edx
movq %rax, %rdi
callq 0x21d0
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbp, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq 0x2afd(%rip), %rsi      # 0x7336
movl $0x13, %edx
movq %r13, %rdi
callq 0x21d0
movq 0x30(%r12), %rsi
movq %r13, %rdi
callq 0x20f0
movq %rax, %r12
leaq 0x29c9(%rip), %rsi      # 0x7226
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq 0x2ab1(%rip), %rsi      # 0x734a
movl $0xb, %edx
movq %r13, %rdi
callq 0x21d0
movq %r13, %rdi
movq 0x10(%rsp), %r15
movq %r15, %rsi
callq 0x20f0
movq %rax, %r12
leaq 0x2931(%rip), %rsi      # 0x71f1
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq %r12, %rdi
movq %r15, %rsi
callq 0x20f0
movq %rax, %r15
leaq 0x2a74(%rip), %rsi      # 0x7356
movl $0x19, %edx
movq %rax, %rdi
callq 0x21d0
movq %r15, %rdi
movq %rbx, %rsi
callq 0x20f0
movq %rax, %r15
leaq 0x2a6c(%rip), %rsi      # 0x7370
movl $0x9, %edx
movq %rax, %rdi
callq 0x21d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
leaq 0x2a3b(%rip), %rsi      # 0x737a
movl $0x5, %edx
movq %r13, %rdi
callq 0x21d0
movq %r13, %rdi
movq 0x20(%rsp), %r12
movq %r12, %rsi
callq 0x20f0
movq %rax, %r15
leaq 0x2a1a(%rip), %rsi      # 0x7380
movl $0x22, %edx
movq %rax, %rdi
callq 0x21d0
movq %rbx, %rsi
subq %r12, %rsi
movq %r15, %rdi
callq 0x20f0
movq %rax, %r15
leaq 0x2a18(%rip), %rsi      # 0x73a3
movl $0xf, %edx
movq %rax, %rdi
callq 0x21d0
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %r15, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2100
movl $0x17, %edx
movq %r13, %rdi
leaq 0x2929(%rip), %rsi      # 0x72f7
callq 0x21d0
imulq $0x64, %r12, %rax
xorl %edx, %edx
divq %rbx
movq %r13, %rdi
movq %rax, %rsi
callq 0x20f0
movq %rax, %rbx
movl $0x9, %edx
movq %rax, %rdi
movq %r14, %rsi
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
callq 0x2100
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4a64
movq %rax, %rbx
jmp 0x4a51
jmp 0x4a64
movq %rax, %rbx
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x4a51
callq 0x2210
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x4a67
callq 0x2210
jmp 0x4a67
jmp 0x4a64
movq %rax, %rbx
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x4a76
callq 0x2210
movq %rbx, %rdi
callq 0x22e0