#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ affiche(int **, int, int);
int /*<<< orphan*/ affiche_fichier(int **, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ duplication(int **, int **, int, int);
int /*<<< orphan*/ generation_suivante_M(int **, int **, int, int, int *,
                                         int *);
int /*<<< orphan*/ printf(char *, int);
void jeu_conway(int **tab1, int n, int m, int ng) {
  int i;
  int **tab2 = NULL;
  int tableau_naissance_conway[9] = {0, 0, 0, 1, 0, 0, 0, 0, 0};
  int tableau_survie_conway[9] = {0, 0, 1, 1, 0, 0, 0, 0, 0};
  FILE *fichier = NULL;
  for (i = 0; i < ng; i++) {
    duplication(tab1, tab2, n, m);
    generation_suivante_M(tab1, tab2, n, m, tableau_naissance_conway,
                          tableau_survie_conway);
    printf("\n\nAffichage pour la generation %d\n", i + 1);
    affiche(tab2, n, m);
    affiche_fichier(tab2, n, m, fichier);
  }
}


x86 assembly (clang, -O0):
<jeu_conway>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
movl   $0x1,-0x44(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
movl   $0x1,-0x78(%rbp)
movl   $0x1,-0x74(%rbp)
movq   $0x0,-0x88(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1246 <jeu_conway+0xe6>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1070 <duplication@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    -0x50(%rbp),%r8
lea    -0x80(%rbp),%r9
call   1080 <generation_suivante_M@plt>
mov    -0x18(%rbp),%esi
add    $0x1,%esi
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <affiche@plt>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x88(%rbp),%rcx
call   1050 <affiche_fichier@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c7 <jeu_conway+0x67>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jeu_conway>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movl   $0x0,0x50(%rsp)
movl   $0x1,0x3c(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x8(%rsp)
test   %ecx,%ecx
jle    121d <jeu_conway+0xcd>
mov    %ecx,%r14d
mov    %edx,%r12d
mov    %esi,%ebx
mov    %rdi,%r15
neg    %r14d
mov    $0x1,%ebp
lea    0xe47(%rip),%r13
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
call   1060 <duplication@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
lea    0x30(%rsp),%r8
mov    %rsp,%r9
call   1070 <generation_suivante_M@plt>
mov    %r13,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    %r12d,%edx
call   1050 <affiche@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    %r12d,%edx
xor    %ecx,%ecx
call   1040 <affiche_fichier@plt>
lea    (%r14,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    11c0 <jeu_conway+0x70>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"\0A\0AAffichage pour la generation %d\0A\00"
define void @jeu_conway(i32** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32**
%11 = alloca [9 x i32]
%12 = alloca [9 x i32]
%13 = alloca i32*
store i32** %0, i32*** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32** null, i32*** %10
%14 = bitcast [9 x i32]* %11 to i8*
%15 = bitcast i8* %14 to [9 x i32]*
%16 = getelementptr inbounds [9 x i32], [9 x i32]* %15, i32 0, i32 3
store i32 1, i32* %16
%17 = bitcast [9 x i32]* %12 to i8*
%18 = bitcast i8* %17 to [9 x i32]*
%19 = getelementptr inbounds [9 x i32], [9 x i32]* %18, i32 0, i32 2
store i32 1, i32* %19
%20 = getelementptr inbounds [9 x i32], [9 x i32]* %18, i32 0, i32 3
store i32 1, i32* %20
store i32* null, i32** %13
store i32 0, i32* %9
br label %21
21: ; preds = %50, %4
%22 = load i32, i32* %9
%23 = load i32, i32* %8
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %53
25: ; preds = %21
%26 = load i32**, i32*** %5
%27 = load i32**, i32*** %10
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = call i32 @duplication(i32** %26, i32** %27, i32 %28, i32 %29)
%31 = load i32**, i32*** %5
%32 = load i32**, i32*** %10
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = getelementptr inbounds [9 x i32], [9 x i32]* %11, i64 0, i64 0
%36 = getelementptr inbounds [9 x i32], [9 x i32]* %12, i64 0, i64 0
%37 = call i32 @generation_suivante_M(i32** %31, i32** %32, i32 %33, i32 %34, i32* %35, i32* %36)
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
%40 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = load i32**, i32*** %10
%42 = load i32, i32* %6
%43 = load i32, i32* %7
%44 = call i32 @affiche(i32** %41, i32 %42, i32 %43)
%45 = load i32**, i32*** %10
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = load i32*, i32** %13
%49 = call i32 @affiche_fichier(i32** %45, i32 %46, i32 %47, i32* %48)
br label %50
50: ; preds = %25
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
br label %21
53: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"\0A\0AAffichage pour la generation %d\0A\00"
define void @jeu_conway(i32** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [9 x i32]
%6 = alloca [9 x i32]
%7 = bitcast [9 x i32]* %5 to i8*
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 3
store i32 1, i32* %8
%9 = bitcast [9 x i32]* %6 to i8*
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 2
store i32 1, i32* %10
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 3
store i32 1, i32* %11
%12 = icmp sgt i32 %3, 0
br i1 %12, label %13, label %25
13: ; preds = %4
%14 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 0
%15 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 0
br label %16
16: ; preds = %13, %16
%17 = phi i32 [ 0, %13 ], [ %20, %16 ]
%18 = call i32 @duplication(i32** %0, i32** null, i32 %1, i32 %2)
%19 = call i32 @generation_suivante_M(i32** %0, i32** null, i32 %1, i32 %2, i32* %14, i32* %15)
%20 = add nuw nsw i32 %17, 1
%21 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = call i32 @affiche(i32** null, i32 %1, i32 %2)
%23 = call i32 @affiche_fichier(i32** null, i32 %1, i32 %2, i32* null)
%24 = icmp eq i32 %20, %3
br i1 %24, label %25, label %16
25: ; preds = %16, %4
ret void
}