#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*/ assert(int);
int /*<<< orphan*/ eatFruit(int);
int /*<<< orphan*/ printf(char *, ...);
void personEat(int aPerson, int aFruit) {
  char *sPerson;
  assert(aPerson > 1 && aPerson < 4);
  switch (aPerson) {
  case 2:
    sPerson = "Hi, c'est Bob !\n";
    break;
  case 3:
    sPerson = "Hallihallo, Anne parle:\n";
    break;
  default:
    sPerson = "une personne inconnue parle:\n";
    break;
  }
  printf("%s", sPerson);
  eatFruit(aFruit);
  printf("\n");
}


x86 assembly (clang, -O0):
<personEat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x11(%rbp)
jle    1157 <personEat+0x27>
cmpl   $0x4,-0x4(%rbp)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
movzbl %al,%edi
and    $0x1,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x2,%eax
je     118a <personEat+0x5a>
jmp    1179 <personEat+0x49>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
je     119a <personEat+0x6a>
jmp    11aa <personEat+0x7a>
lea    0xe6f(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11b5 <personEat+0x85>
lea    0xe70(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11b5 <personEat+0x85>
lea    0xe79(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <eatFruit@plt>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<personEat>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edi,%eax
and    $0xfffffffe,%eax
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
cmp    $0x3,%ebp
lea    0xead(%rip),%rax
lea    0xebf(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x2,%ebp
lea    0xe87(%rip),%rsi
cmovne %rcx,%rsi
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%edi
call   1060 <eatFruit@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Hi, c'est Bob !\0A\00"
@.str.1 = [25 x i8] c"Hallihallo, Anne parle:\0A\00"
@.str.2 = [30 x i8] c"une personne inconnue parle:\0A\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @personEat(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 4
br label %11
11: ; preds = %8, %2
%12 = phi i1 [ false, %2 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %3
switch i32 %15, label %18 [
i32 2, label %16
i32 3, label %17
]
16: ; preds = %11
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %5
br label %19
17: ; preds = %11
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %19
18: ; preds = %11
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %19
19: ; preds = %18, %17, %16
%20 = load i8*, i8** %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%22 = load i32, i32* %4
%23 = call i32 @eatFruit(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"Hi, c'est Bob !\0A\00"
@.str.1 = [25 x i8] c"Hallihallo, Anne parle:\0A\00"
@.str.2 = [30 x i8] c"une personne inconnue parle:\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define void @personEat(i32 %0, i32 %1) {
%3 = and i32 %0, -2
%4 = icmp eq i32 %3, 2
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp eq i32 %0, 3
%8 = select i1 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0)
%9 = icmp eq i32 %0, 2
%10 = select i1 %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %8
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = tail call i32 @eatFruit(i32 %1)
%13 = tail call i32 @putchar(i32 10)
ret void
}