#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 InitialisationAvecService(char *, char *);
int /*<<< orphan*/ Terminaison();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ menu_enregistrement();
int /*<<< orphan*/ menu_reservation();
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int /*<<< orphan*/ vider_buffer();
int main() {
  int choix;
  int fini = 1;
  if (InitialisationAvecService("127.0.0.1", "12321") != 1) {
    printf("Erreur d'initialisation\n");
    exit(0);
  }
  while (fini) {
    printf("\n\n\n\n\t\t**** MENU ****");
    printf("\n\t------------------------------");
    printf("\n\t1. Reserver une chambre \n\t2. S'enregistrer en tant "
           "qu'hotel\n\t3. Quitter\n");
    printf("\n\n Entrez votre choix: ");
    while (scanf("%1d", &choix) != 1) {
      printf("\n\n Entrez votre choix: ");
      vider_buffer();
    }
    vider_buffer();
    switch (choix) {
    case 1:
      menu_reservation();
      break;
    case 2:
      menu_enregistrement();
      break;
    case 3:
      fini = 0;
      break;
    default:
      printf("\nSelection invalide ... veuillez reesayer.\n");
    }
    choix = 99;
  }
  Terminaison();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe66(%rip),%rsi
call   1050 <InitialisationAvecService@plt>
cmp    $0x1,%eax
je     11c5 <main+0x45>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>
jmp    11ca <main+0x4a>
cmpl   $0x0,-0xc(%rbp)
je     12ae <main+0x12e>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
je     1235 <main+0xb5>
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   10a0 <vider_buffer@plt>
jmp    1204 <main+0x84>
xor    %eax,%eax
call   10a0 <vider_buffer@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1272 <main+0xf2>
jmp    1250 <main+0xd0>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     127e <main+0xfe>
jmp    1261 <main+0xe1>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     128a <main+0x10a>
jmp    1296 <main+0x116>
mov    $0x0,%al
call   1090 <menu_reservation@plt>
jmp    12a2 <main+0x122>
mov    $0x0,%al
call   1070 <menu_enregistrement@plt>
jmp    12a2 <main+0x122>
movl   $0x0,-0xc(%rbp)
jmp    12a2 <main+0x122>
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
movl   $0x63,-0x8(%rbp)
jmp    11ca <main+0x4a>
mov    $0x0,%al
call   1030 <Terminaison@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe5e(%rip),%rdi
lea    0xe61(%rip),%rsi
call   1060 <InitialisationAvecService@plt>
cmp    $0x1,%eax
jne    12c4 <main+0x134>
lea    0xe52(%rip),%r14
lea    0xe60(%rip),%r15
lea    0xe96(%rip),%r12
lea    0xe73(%rip),%r13
lea    0xe84(%rip),%rbx
lea    0x4(%rsp),%rbp
jmp    11ff <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1080 <menu_enregistrement@plt>
movl   $0x63,0x4(%rsp)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1050 <printf@plt>
nop
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
je     1250 <main+0xc0>
mov    %r13,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   10b0 <vider_buffer@plt>
jmp    1220 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <vider_buffer@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     1290 <main+0x100>
cmp    $0x2,%eax
je     11f0 <main+0x60>
cmp    $0x3,%eax
je     12a4 <main+0x114>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
movl   $0x63,0x4(%rsp)
jmp    11ff <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   10a0 <menu_reservation@plt>
movl   $0x63,0x4(%rsp)
jmp    11ff <main+0x6f>
movl   $0x63,0x4(%rsp)
xor    %eax,%eax
call   1040 <Terminaison@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe0c(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [6 x i8] c"12321\00"
@.str.2 = [25 x i8] c"Erreur d'initialisation\0A\00"
@.str.3 = [21 x i8] c"\0A\0A\0A\0A\09\09**** MENU ****\00"
@.str.4 = [33 x i8] c"\0A\09------------------------------\00"
@.str.5 = [75 x i8] c"\0A\091. Reserver une chambre \0A\092. S'enregistrer en tant qu'hotel\0A\093. Quitter\0A\00"
@.str.6 = [24 x i8] c"\0A\0A Entrez votre choix: \00"
@.str.7 = [4 x i8] c"%1d\00"
@.str.8 = [44 x i8] c"\0ASelection invalide ... veuillez reesayer.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
%4 = call i32 @InitialisationAvecService(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %0
br label %10
10: ; preds = %34, %9
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %18
18: ; preds = %21, %13
%19 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32* %2)
%20 = icmp ne i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 (...) @vider_buffer()
br label %18
24: ; preds = %18
%25 = call i32 (...) @vider_buffer()
%26 = load i32, i32* %2
switch i32 %26, label %32 [
i32 1, label %27
i32 2, label %29
i32 3, label %31
]
27: ; preds = %24
%28 = call i32 (...) @menu_reservation()
br label %34
29: ; preds = %24
%30 = call i32 (...) @menu_enregistrement()
br label %34
31: ; preds = %24
store i32 0, i32* %3
br label %34
32: ; preds = %24
%33 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
br label %34
34: ; preds = %32, %31, %29, %27
store i32 99, i32* %2
br label %10
35: ; preds = %10
%36 = call i32 (...) @Terminaison()
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [6 x i8] c"12321\00"
@.str.3 = [21 x i8] c"\0A\0A\0A\0A\09\09**** MENU ****\00"
@.str.4 = [33 x i8] c"\0A\09------------------------------\00"
@.str.6 = [24 x i8] c"\0A\0A Entrez votre choix: \00"
@.str.7 = [4 x i8] c"%1d\00"
@str = [74 x i8] c"\0A\091. Reserver une chambre \0A\092. S'enregistrer en tant qu'hotel\0A\093. Quitter\00"
@str.9 = [43 x i8] c"\0ASelection invalide ... veuillez reesayer.\00"
@str.10 = [24 x i8] c"Erreur d'initialisation\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @InitialisationAvecService(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32 %3, 1
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %0, %29
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str, i64 0, i64 0))
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%14 = icmp eq i32 %13, 1
br i1 %14, label %20, label %15
15: ; preds = %8, %15
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 (...) @vider_buffer()
%18 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %15
20: ; preds = %15, %8
%21 = call i32 (...) @vider_buffer()
%22 = load i32, i32* %1
switch i32 %22, label %27 [
i32 1, label %23
i32 2, label %25
i32 3, label %30
]
23: ; preds = %20
%24 = call i32 (...) @menu_reservation()
br label %29
25: ; preds = %20
%26 = call i32 (...) @menu_enregistrement()
br label %29
27: ; preds = %20
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.9, i64 0, i64 0))
br label %29
29: ; preds = %27, %25, %23
store i32 99, i32* %1
br label %8
30: ; preds = %20
store i32 99, i32* %1
%31 = call i32 (...) @Terminaison()
ret i32 0
}