#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 main(void) {
  int apples = 5;
  printf("How many apples do I've got ?\n");
  if (apples == 0) {
    printf("Sorry for you!\n");
  } else if (apples == 1) {
    printf("Enjoy !\n");
  } else if (apples == 2) {
    printf("Can you give me your second apple ?\n");
  } else if (apples == 3) {
    printf("It's pretty nice !\n");
  } else {
    printf("I don't have anything to say...\n");
  }
  switch (apples) {
  case 0:
    printf("Sorry for you!\n");
    break;
  case 1:
    printf("Enjoy !\n");
    break;
  case 2:
    printf("Can you give me your second apple ?\n");
    break;
  case 3:
    printf("It's pretty nice !\n");
    break;
  default:
    printf("I don't have anything to say...\n");
    break;
  }
  apples = 1;
  switch (apples) {
  case 1:
  case 2:
    printf("How can you get 1 and 2 apples ?\n");
    break;
  case 3:
    printf("Oh! You have 3 apples !\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    114d <main+0x3d>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
jmp    11b9 <main+0xa9>
cmpl   $0x1,-0x8(%rbp)
jne    1168 <main+0x58>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
jmp    11b4 <main+0xa4>
cmpl   $0x2,-0x8(%rbp)
jne    1183 <main+0x73>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
jmp    11af <main+0x9f>
cmpl   $0x3,-0x8(%rbp)
jne    119e <main+0x8e>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
jmp    11aa <main+0x9a>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
jmp    11af <main+0x9f>
jmp    11b4 <main+0xa4>
jmp    11b9 <main+0xa9>
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     1222 <main+0x112>
mov    -0x10(%rbp),%rax
lea    0xe2b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0x11e>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0x11e>
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0x11e>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <main+0x11e>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     125d <main+0x14d>
jmp    124c <main+0x13c>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     126e <main+0x15e>
jmp    127a <main+0x16a>
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
jmp    127a <main+0x16a>
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefa(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"How many apples do I've got ?\0A\00"
@.str.1 = [16 x i8] c"Sorry for you!\0A\00"
@.str.2 = [9 x i8] c"Enjoy !\0A\00"
@.str.3 = [37 x i8] c"Can you give me your second apple ?\0A\00"
@.str.4 = [20 x i8] c"It's pretty nice !\0A\00"
@.str.5 = [33 x i8] c"I don't have anything to say...\0A\00"
@.str.6 = [34 x i8] c"How can you get 1 and 2 apples ?\0A\00"
@.str.7 = [25 x i8] c"Oh! You have 3 apples !\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %28
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %27
13: ; preds = %8
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
br label %26
18: ; preds = %13
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %25
23: ; preds = %18
%24 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
br label %26
26: ; preds = %25, %16
br label %27
27: ; preds = %26, %11
br label %28
28: ; preds = %27, %6
%29 = load i32, i32* %2
switch i32 %29, label %38 [
i32 0, label %30
i32 1, label %32
i32 2, label %34
i32 3, label %36
]
30: ; preds = %28
%31 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %40
32: ; preds = %28
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %40
34: ; preds = %28
%35 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
br label %40
36: ; preds = %28
%37 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %40
38: ; preds = %28
%39 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %40
40: ; preds = %38, %36, %34, %32, %30
store i32 1, i32* %2
%41 = load i32, i32* %2
switch i32 %41, label %46 [
i32 1, label %42
i32 2, label %42
i32 3, label %44
]
42: ; preds = %40, %40
%43 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %46
44: ; preds = %40
%45 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %46
46: ; preds = %40, %44, %42
ret i32 0
}

LLVM IR (-O2):
@str = [30 x i8] c"How many apples do I've got ?\00"
@str.9 = [32 x i8] c"I don't have anything to say...\00"
@str.10 = [33 x i8] c"How can you get 1 and 2 apples ?\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}