#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 */

/* Variables and functions */
int /*<<< orphan*/ actionSauvegarde(char **, int);
int /*<<< orphan*/ afficherMenuSauvegarde(char **);
int choisirMenu(int);
int /*<<< orphan*/ menuPrincipal();
int /*<<< orphan*/ quitter();
int /*<<< orphan*/ titre(char *, int);
void sauvegarde(void) {
  int choixJoueur;
  char baseNomSauvegarde[3][200];
  titre("Sauvegarde", 32);
  afficherMenuSauvegarde(baseNomSauvegarde);
  choixJoueur = choisirMenu(3);
  if (choixJoueur == -1)
    menuPrincipal();
  else if (choixJoueur == 0)
    quitter();
  else
    actionSauvegarde(baseNomSauvegarde, choixJoueur - 1);
}


x86 assembly (clang, -O0):
<sauvegarde>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
lea    0xe8e(%rip),%rdi
mov    $0x20,%esi
call   1070 <titre@plt>
lea    -0x260(%rbp),%rdi
call   1060 <afficherMenuSauvegarde@plt>
mov    $0x3,%edi
call   1080 <choisirMenu@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    11ab <sauvegarde+0x4b>
mov    $0x0,%al
call   1040 <menuPrincipal@plt>
jmp    11d8 <sauvegarde+0x78>
cmpl   $0x0,-0x4(%rbp)
jne    11c1 <sauvegarde+0x61>
mov    $0x0,%al
call   1030 <quitter@plt>
jmp    11d3 <sauvegarde+0x73>
lea    -0x260(%rbp),%rdi
mov    -0x4(%rbp),%esi
sub    $0x1,%esi
call   1050 <actionSauvegarde@plt>
jmp    11d8 <sauvegarde+0x78>
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sauvegarde>:
sub    $0x258,%rsp
lea    0xe92(%rip),%rdi
mov    $0x20,%esi
call   1070 <titre@plt>
mov    %rsp,%rdi
call   1060 <afficherMenuSauvegarde@plt>
mov    $0x3,%edi
call   1080 <choisirMenu@plt>
test   %eax,%eax
je     11a2 <sauvegarde+0x42>
cmp    $0xffffffff,%eax
jne    11b1 <sauvegarde+0x51>
xor    %eax,%eax
call   1040 <menuPrincipal@plt>
add    $0x258,%rsp
ret
xor    %eax,%eax
call   1030 <quitter@plt>
add    $0x258,%rsp
ret
add    $0xffffffff,%eax
mov    %rsp,%rdi
mov    %eax,%esi
call   1050 <actionSauvegarde@plt>
add    $0x258,%rsp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Sauvegarde\00"
define void @sauvegarde() {
%1 = alloca i32
%2 = alloca [3 x [200 x i8]]
%3 = call i32 @titre(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 32)
%4 = getelementptr inbounds [3 x [200 x i8]], [3 x [200 x i8]]* %2, i64 0, i64 0
%5 = bitcast [200 x i8]* %4 to i8**
%6 = call i32 @afficherMenuSauvegarde(i8** %5)
%7 = call i32 @choisirMenu(i32 3)
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (...) @menuPrincipal()
br label %24
12: ; preds = %0
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 (...) @quitter()
br label %23
17: ; preds = %12
%18 = getelementptr inbounds [3 x [200 x i8]], [3 x [200 x i8]]* %2, i64 0, i64 0
%19 = bitcast [200 x i8]* %18 to i8**
%20 = load i32, i32* %1
%21 = sub nsw i32 %20, 1
%22 = call i32 @actionSauvegarde(i8** %19, i32 %21)
br label %23
23: ; preds = %17, %15
br label %24
24: ; preds = %23, %10
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Sauvegarde\00"
define void @sauvegarde() {
%1 = alloca [3 x [200 x i8]]
%2 = getelementptr inbounds [3 x [200 x i8]], [3 x [200 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 @titre(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 32)
%4 = bitcast [3 x [200 x i8]]* %1 to i8**
%5 = call i32 @afficherMenuSauvegarde(i8** %4)
%6 = call i32 @choisirMenu(i32 3)
switch i32 %6, label %11 [
i32 -1, label %7
i32 0, label %9
]
7: ; preds = %0
%8 = call i32 (...) @menuPrincipal()
br label %14
9: ; preds = %0
%10 = call i32 (...) @quitter()
br label %14
11: ; preds = %0
%12 = add nsw i32 %6, -1
%13 = call i32 @actionSauvegarde(i8** %4, i32 %12)
br label %14
14: ; preds = %9, %11, %7
ret void
}