#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*/ option_one();
int /*<<< orphan*/ option_two();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quit();
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int choice;
  while (1) {
    printf("\nCache memory allocation and mapping:\n");
    printf("-------------------------------------\n");
    printf("1) Enter parameters\n");
    printf("2) Access cache for reading/writing and transfer data\n");
    printf("3) Quit\n\n");
    printf("Enter selection: ");
    scanf("%d", &choice);
    switch (choice) {
    case 1:
      option_one();
      break;
    case 2:
      option_two();
      break;
    case 3:
      quit();
      break;
    default:
      printf("");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11ed <main+0x9d>
jmp    11cb <main+0x7b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11f9 <main+0xa9>
jmp    11dc <main+0x8c>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     1205 <main+0xb5>
jmp    1211 <main+0xc1>
mov    $0x0,%al
call   1070 <option_one@plt>
jmp    121d <main+0xcd>
mov    $0x0,%al
call   1050 <option_two@plt>
jmp    121d <main+0xcd>
mov    $0x0,%al
call   1040 <quit@plt>
jmp    121d <main+0xcd>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeef(%rip),%r12
lea    0xefc(%rip),%r13
lea    0xf2b(%rip),%rbx
lea    0xe79(%rip),%rbp
lea    0xe84(%rip),%r14
lea    0x4(%rsp),%r15
jmp    11a7 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <option_two@plt>
lea    0xe67(%rip),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x3,%eax
je     1210 <main+0xb0>
cmp    $0x2,%eax
je     11a0 <main+0x40>
cmp    $0x1,%eax
jne    11a7 <main+0x47>
xor    %eax,%eax
call   1080 <option_one@plt>
jmp    11a7 <main+0x47>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <quit@plt>
jmp    11a7 <main+0x47>

LLVM IR (-O0):
@.str = [39 x i8] c"\0ACache memory allocation and mapping:\0A\00"
@.str.1 = [39 x i8] c"-------------------------------------\0A\00"
@.str.2 = [21 x i8] c"1) Enter parameters\0A\00"
@.str.3 = [55 x i8] c"2) Access cache for reading/writing and transfer data\0A\00"
@.str.4 = [10 x i8] c"3) Quit\0A\0A\00"
@.str.5 = [18 x i8] c"Enter selection: \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %20
%4 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
switch i32 %11, label %18 [
i32 1, label %12
i32 2, label %14
i32 3, label %16
]
12: ; preds = %3
%13 = call i32 (...) @option_one()
br label %20
14: ; preds = %3
%15 = call i32 (...) @option_two()
br label %20
16: ; preds = %3
%17 = call i32 (...) @quit()
br label %20
18: ; preds = %3
%19 = call i32 @printf(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0))
br label %20
20: ; preds = %18, %16, %14, %12
br label %3
}

LLVM IR (-O2):
@.str.5 = [18 x i8] c"Enter selection: \00"
@.str.6 = [3 x i8] c"%d\00"
@str = [38 x i8] c"\0ACache memory allocation and mapping:\00"
@str.8 = [38 x i8] c"-------------------------------------\00"
@str.9 = [20 x i8] c"1) Enter parameters\00"
@str.10 = [54 x i8] c"2) Access cache for reading/writing and transfer data\00"
@str.11 = [9 x i8] c"3) Quit\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %12, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.8, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.9, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.10, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.11, i64 0, i64 0))
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
switch i32 %11, label %12 [
i32 1, label %13
i32 2, label %15
i32 3, label %17
]
12: ; preds = %3, %17, %15, %13
br label %3
13: ; preds = %3
%14 = call i32 (...) @option_one()
br label %12
15: ; preds = %3
%16 = call i32 (...) @option_two()
br label %12
17: ; preds = %3
%18 = call i32 (...) @quit()
br label %12
}