#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int montant = 0;
  int choix;
  printf("1-Tempura de crevettes 6.00$\n");
  printf("2-Soupe Miso           3.00$\n");
  printf("Choisissez une entrée>");
  scanf("%d", &choix);
  if (choix == 1)
    montant += 6;
  else if (choix == 2)
    montant += 3;
  printf("1-Sashimis         24.00$\n");
  printf("2-Poulet au beurre 19.00$\n");
  printf("Choisissez un plat principal>");
  scanf("%d", &choix);
  if (choix == 1)
    montant += 24;
  else if (choix == 2)
    montant += 19;
  printf("1-Crème glacée napolitaine 1.00$\n");
  printf("2-Sorbet au durion         9.00$\n");
  printf("Choisissez un dessert>");
  scanf("%d", &choix);
  if (choix == 1)
    montant += 1;
  else if (choix == 2)
    montant += 9;
  printf("Montant total de la facture : %d.00$\n", montant);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x18(%rbp)
jne    118f <main+0x6f>
mov    -0x14(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x14(%rbp)
jmp    11a7 <main+0x87>
cmpl   $0x2,-0x18(%rbp)
jne    11a2 <main+0x82>
mov    -0x14(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x14(%rbp)
jmp    11a7 <main+0x87>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7c(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x18(%rbp)
jne    11f9 <main+0xd9>
mov    -0x14(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x14(%rbp)
jmp    1211 <main+0xf1>
cmpl   $0x2,-0x18(%rbp)
jne    120c <main+0xec>
mov    -0x14(%rbp),%eax
add    $0x13,%eax
mov    %eax,-0x14(%rbp)
jmp    1211 <main+0xf1>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe12(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x18(%rbp)
jne    1263 <main+0x143>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    127b <main+0x15b>
cmpl   $0x2,-0x18(%rbp)
jne    1276 <main+0x156>
mov    -0x14(%rbp),%eax
add    $0x9,%eax
mov    %eax,-0x14(%rbp)
jmp    127b <main+0x15b>
mov    -0x14(%rbp),%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf36(%rip),%rdi
call   1030 <puts@plt>
lea    0xf47(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
xor    %ecx,%ecx
cmp    $0x2,%eax
sete   %cl
lea    (%rcx,%rcx,2),%ecx
cmp    $0x1,%eax
mov    $0x6,%ebx
cmovne %ecx,%ebx
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
lea    0xf27(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
je     11d4 <main+0xa4>
cmp    $0x1,%eax
jne    11d7 <main+0xa7>
or     $0x18,%ebx
jmp    11d7 <main+0xa7>
add    $0x13,%ebx
lea    0xf06(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe14(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x2,%eax
je     1221 <main+0xf1>
cmp    $0x1,%eax
jne    1224 <main+0xf4>
add    $0x1,%ebx
jmp    1224 <main+0xf4>
add    $0x9,%ebx
lea    0xe25(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"1-Tempura de crevettes 6.00$\0A\00"
@.str.1 = [30 x i8] c"2-Soupe Miso 3.00$\0A\00"
@.str.2 = [24 x i8] c"Choisissez une entr\C3\A9e>\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [27 x i8] c"1-Sashimis 24.00$\0A\00"
@.str.5 = [27 x i8] c"2-Poulet au beurre 19.00$\0A\00"
@.str.6 = [30 x i8] c"Choisissez un plat principal>\00"
@.str.7 = [36 x i8] c"1-Cr\C3\A8me glac\C3\A9e napolitaine 1.00$\0A\00"
@.str.8 = [34 x i8] c"2-Sorbet au durion 9.00$\0A\00"
@.str.9 = [23 x i8] c"Choisissez un dessert>\00"
@.str.10 = [38 x i8] c"Montant total de la facture : %d.00$\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i32, i32* %6
%16 = add nsw i32 %15, 6
store i32 %16, i32* %6
br label %24
17: ; preds = %2
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 3
store i32 %22, i32* %6
br label %23
23: ; preds = %20, %17
br label %24
24: ; preds = %23, %14
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 24
store i32 %33, i32* %6
br label %41
34: ; preds = %24
%35 = load i32, i32* %7
%36 = icmp eq i32 %35, 2
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 19
store i32 %39, i32* %6
br label %40
40: ; preds = %37, %34
br label %41
41: ; preds = %40, %31
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%45 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %7)
%46 = load i32, i32* %7
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %51
48: ; preds = %41
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %58
51: ; preds = %41
%52 = load i32, i32* %7
%53 = icmp eq i32 %52, 2
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 9
store i32 %56, i32* %6
br label %57
57: ; preds = %54, %51
br label %58
58: ; preds = %57, %48
%59 = load i32, i32* %6
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %59)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [24 x i8] c"Choisissez une entr\C3\A9e>\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.6 = [30 x i8] c"Choisissez un plat principal>\00"
@.str.9 = [23 x i8] c"Choisissez un dessert>\00"
@.str.10 = [38 x i8] c"Montant total de la facture : %d.00$\0A\00"
@str = [29 x i8] c"1-Tempura de crevettes 6.00$\00"
@str.11 = [29 x i8] c"2-Soupe Miso 3.00$\00"
@str.12 = [26 x i8] c"1-Sashimis 24.00$\00"
@str.13 = [26 x i8] c"2-Poulet au beurre 19.00$\00"
@str.14 = [35 x i8] c"1-Cr\C3\A8me glac\C3\A9e napolitaine 1.00$\00"
@str.15 = [33 x i8] c"2-Sorbet au durion 9.00$\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 2
%11 = select i1 %10, i32 3, i32 0
%12 = icmp eq i32 %9, 1
%13 = select i1 %12, i32 6, i32 %11
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.12, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.13, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
switch i32 %18, label %23 [
i32 1, label %19
i32 2, label %21
]
19: ; preds = %2
%20 = or i32 %13, 24
br label %23
21: ; preds = %2
%22 = add nuw nsw i32 %13, 19
br label %23
23: ; preds = %2, %21, %19
%24 = phi i32 [ %20, %19 ], [ %22, %21 ], [ %13, %2 ]
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.14, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.15, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%29 = load i32, i32* %3
switch i32 %29, label %34 [
i32 1, label %30
i32 2, label %32
]
30: ; preds = %23
%31 = add nsw i32 %24, 1
br label %34
32: ; preds = %23
%33 = add nsw i32 %24, 9
br label %34
34: ; preds = %23, %32, %30
%35 = phi i32 [ %31, %30 ], [ %33, %32 ], [ %24, %23 ]
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %35)
ret i32 0
}