#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*/ action_referentiel(int);
int /*<<< orphan*/ banniere(char *);
int choix();
int /*<<< orphan*/ liste_referentiels();
int /*<<< orphan*/ menu();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  banniere(argv[1]);
  int c = 1;
  char *message[200];
  while (c != 4) {
    menu();
    switch (c = choix()) {
    case 1:
      liste_referentiels();
      break;
    case 2:
      action_referentiel(c);
      break;
    case 3:
      action_referentiel(c);
      break;
    case 4:
      printf("byebye\n");
      return 0;
      break;
    default:
      printf("je n'ai pas compris votre choix\n");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x670,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <banniere@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
je     122d <main+0xcd>
xor    %eax,%eax
mov    %al,-0x669(%rbp)
call   1040 <menu@plt>
mov    -0x669(%rbp),%al
call   1030 <choix@plt>
mov    %eax,-0x14(%rbp)
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x668(%rbp)
sub    $0x3,%eax
ja     121c <main+0xbc>
mov    -0x668(%rbp),%rax
lea    0xe2b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1070 <liste_referentiels@plt>
jmp    1228 <main+0xc8>
mov    -0x14(%rbp),%edi
call   1080 <action_referentiel@plt>
jmp    1228 <main+0xc8>
mov    -0x14(%rbp),%edi
call   1080 <action_referentiel@plt>
jmp    1228 <main+0xc8>
lea    0xe05(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1234 <main+0xd4>
lea    0xdf5(%rip),%rdi
call   1050 <printf@plt>
jmp    118d <main+0x2d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x670,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
call   1060 <banniere@plt>
lea    0xea3(%rip),%r14
lea    0xe85(%rip),%rbx
jmp    118a <main+0x2a>
nopl   (%rax)
mov    $0x3,%edi
call   1080 <action_referentiel@plt>
xor    %eax,%eax
call   1050 <menu@plt>
xor    %eax,%eax
call   1040 <choix@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11c0 <main+0x60>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <liste_referentiels@plt>
jmp    118a <main+0x2a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    118a <main+0x2a>
nopw   0x0(%rax,%rax,1)
mov    $0x2,%edi
call   1080 <action_referentiel@plt>
jmp    118a <main+0x2a>
lea    0xe2d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"byebye\0A\00"
@.str.1 = [33 x i8] c"je n'ai pas compris votre choix\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [200 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @banniere(i8* %10)
store i32 1, i32* %6
br label %12
12: ; preds = %30, %2
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 4
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = call i32 (...) @menu()
%17 = call i32 (...) @choix()
store i32 %17, i32* %6
switch i32 %17, label %28 [
i32 1, label %18
i32 2, label %20
i32 3, label %23
i32 4, label %26
]
18: ; preds = %15
%19 = call i32 (...) @liste_referentiels()
br label %30
20: ; preds = %15
%21 = load i32, i32* %6
%22 = call i32 @action_referentiel(i32 %21)
br label %30
23: ; preds = %15
%24 = load i32, i32* %6
%25 = call i32 @action_referentiel(i32 %24)
br label %30
26: ; preds = %15
%27 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %32
28: ; preds = %15
%29 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %23, %20, %18
br label %12
31: ; preds = %12
store i32 0, i32* %3
br label %32
32: ; preds = %31, %26
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@str = [7 x i8] c"byebye\00"
@str.2 = [32 x i8] c"je n'ai pas compris votre choix\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @banniere(i8* %4)
br label %6
6: ; preds = %17, %2
%7 = tail call i32 (...) @menu()
%8 = tail call i32 (...) @choix()
switch i32 %8, label %15 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %18
]
9: ; preds = %6
%10 = tail call i32 (...) @liste_referentiels()
br label %17
11: ; preds = %6
%12 = tail call i32 @action_referentiel(i32 2)
br label %17
13: ; preds = %6
%14 = tail call i32 @action_referentiel(i32 3)
br label %17
15: ; preds = %6
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %13, %11, %9
br label %6
18: ; preds = %6
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}