#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*/ readaheadext();
int /*<<< orphan*/ readaheadint();
int /*<<< orphan*/ scanf(char *, int *);
void readaheadmenu() {
  for (;;) {
    printf("What do you want to change?\n\n");
    printf(" [1] Internal SDCard cache size\n");
    printf(" [2] External SDCard cache size\n");
    printf(" [0] Noting\n");
    printf("\nChoice: ");
    int readaheadchoice;
    scanf("%d", &readaheadchoice);
    if (readaheadchoice == 1)
      readaheadint();
    if (readaheadchoice == 2)
      readaheadext();
    if (readaheadchoice == 0)
      break;
  }
}


x86 assembly (clang, -O0):
<readaheadmenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    11a5 <readaheadmenu+0x65>
mov    $0x0,%al
call   1060 <readaheadint@plt>
cmpl   $0x2,-0x4(%rbp)
jne    11b6 <readaheadmenu+0x76>
mov    $0x0,%al
call   1040 <readaheadext@plt>
cmpl   $0x0,-0x4(%rbp)
jne    11c5 <readaheadmenu+0x85>
jmp    11ca <readaheadmenu+0x8a>
jmp    1148 <readaheadmenu+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readaheadmenu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xec8(%rip),%r15
lea    0xee1(%rip),%r12
lea    0xefa(%rip),%r13
lea    0xe89(%rip),%rbx
lea    0xe8c(%rip),%rbp
lea    0x4(%rsp),%r14
jmp    1194 <readaheadmenu+0x44>
cs nopw 0x0(%rax,%rax,1)
nop
test   %eax,%eax
je     11fd <readaheadmenu+0xad>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x1,%eax
je     11e0 <readaheadmenu+0x90>
cmp    $0x2,%eax
jne    1190 <readaheadmenu+0x40>
jmp    11f0 <readaheadmenu+0xa0>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <readaheadint@plt>
mov    0x4(%rsp),%eax
cmp    $0x2,%eax
jne    1190 <readaheadmenu+0x40>
xor    %eax,%eax
call   1050 <readaheadext@plt>
mov    0x4(%rsp),%eax
jmp    1190 <readaheadmenu+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"What do you want to change?\0A\0A\00"
@.str.1 = [33 x i8] c" [1] Internal SDCard cache size\0A\00"
@.str.2 = [33 x i8] c" [2] External SDCard cache size\0A\00"
@.str.3 = [13 x i8] c" [0] Noting\0A\00"
@.str.4 = [10 x i8] c"\0AChoice: \00"
@.str.5 = [3 x i8] c"%d\00"
define void @readaheadmenu() {
%1 = alloca i32
br label %2
2: ; preds = %22, %0
%3 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (...) @readaheadint()
br label %13
13: ; preds = %11, %2
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @readaheadext()
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
br label %23
22: ; preds = %18
br label %2
23: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str.4 = [10 x i8] c"\0AChoice: \00"
@.str.5 = [3 x i8] c"%d\00"
@str = [29 x i8] c"What do you want to change?\0A\00"
@str.6 = [32 x i8] c" [1] Internal SDCard cache size\00"
@str.7 = [32 x i8] c" [2] External SDCard cache size\00"
@str.8 = [12 x i8] c" [0] Noting\00"
define void @readaheadmenu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %21, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.6, i64 0, i64 0))
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.7, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.8, i64 0, i64 0))
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = call i32 (...) @readaheadint()
%14 = load i32, i32* %1
br label %15
15: ; preds = %12, %3
%16 = phi i32 [ %14, %12 ], [ %10, %3 ]
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = call i32 (...) @readaheadext()
%20 = load i32, i32* %1
br label %21
21: ; preds = %18, %15
%22 = phi i32 [ %20, %18 ], [ %16, %15 ]
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %3
24: ; preds = %21
ret void
}