#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int ans;
  do {
    printf("0-Exit\n");
    printf("1-Hello\n");
    printf("2-Area\n");
    printf("please choose 0,1,2 ");
    scanf("%d", &ans);
    switch (ans) {
    case 0:
      exit(0);
    case 1:
      printf("hello");
      break;
    case 2:
      printf("area");
      break;
    default:
      break;
    }
  } while (1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     11b4 <main+0x84>
jmp    1192 <main+0x62>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     11bb <main+0x8b>
jmp    11a3 <main+0x73>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11cc <main+0x9c>
jmp    11dd <main+0xad>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    11e2 <main+0xb2>
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    11e2 <main+0xb2>
jmp    11e2 <main+0xb2>
jmp    11e7 <main+0xb7>
mov    $0x1,%al
test   $0x1,%al
jne    113f <main+0xf>
jmp    11f6 <main+0xc6>
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    0xed8(%rip),%r15
lea    0xed9(%rip),%r12
lea    0xea0(%rip),%r13
lea    0xeae(%rip),%rbx
lea    0x4(%rsp),%rbp
lea    0xea5(%rip),%r14
jmp    118c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %r14,%rdi
cmp    $0x1,%eax
je     1187 <main+0x47>
cmp    $0x2,%eax
je     1180 <main+0x40>
test   %eax,%eax
jne    118c <main+0x4c>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"0-Exit\0A\00"
@.str.1 = [9 x i8] c"1-Hello\0A\00"
@.str.2 = [8 x i8] c"2-Area\0A\00"
@.str.3 = [21 x i8] c"please choose 0,1,2 \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"hello\00"
@.str.6 = [5 x i8] c"area\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %18, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
switch i32 %9, label %16 [
i32 0, label %10
i32 1, label %12
i32 2, label %14
]
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %17
14: ; preds = %3
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %17
16: ; preds = %3
br label %17
17: ; preds = %16, %14, %12
br label %18
18: ; preds = %17
br i1 true, label %3, label %19
19: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [21 x i8] c"please choose 0,1,2 \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [6 x i8] c"hello\00"
@.str.6 = [5 x i8] c"area\00"
@str = [7 x i8] c"0-Exit\00"
@str.7 = [8 x i8] c"1-Hello\00"
@str.8 = [7 x i8] c"2-Area\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %16, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.7, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.8, i64 0, i64 0))
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
switch i32 %9, label %16 [
i32 0, label %10
i32 1, label %13
i32 2, label %12
]
10: ; preds = %3
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %3
br label %13
13: ; preds = %3, %12
%14 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), %12 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), %3 ]
%15 = call i32 @printf(i8* dereferenceable(1) %14)
br label %16
16: ; preds = %13, %3
br label %3
}