#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*/ mpb_add();
int /*<<< orphan*/ mpb_clear_screen();
int /*<<< orphan*/ mpb_del();
int /*<<< orphan*/ mpb_edit();
int mpb_get_choice();
int /*<<< orphan*/ mpb_preference();
int /*<<< orphan*/ mpb_print_all_data();
int /*<<< orphan*/ mpb_search();
int /*<<< orphan*/ printf(char *, ...);
int mpb_menu_choose(void) {
  int i = 0;
  int choice = -1;
  char *menu[] = {
      "\033[37m"
      "A/a"
      "\033[0m"
      "dd",
      "\033[37m"
      "D/d"
      "\033[0m"
      "el",
      "\033[37m"
      "E/e"
      "\033[0m"
      "dit",
      "\033[37m"
      "S/s"
      "\033[0m"
      "earch",
      "\033[37m"
      "P/p"
      "\033[0m"
      "reference",
      "\033[31m"
      "Q/q"
      "\033[0m"
      "uit",
      NULL,
  };
  do {
    mpb_print_all_data();
    i = 0;
    do {
      printf("%-24s", menu[i++]);
    } while (NULL != menu[i]);
    printf("\n>>");
    choice = mpb_get_choice();
    mpb_clear_screen();
    switch (choice) {
    case 'A':
    case 'a':
      mpb_add();
      break;
    case 'D':
    case 'd':
      mpb_del();
      break;
    case 'E':
    case 'e':
      mpb_edit();
      break;
    case 'S':
    case 's':
      mpb_search();
      break;
    case 'P':
    case 'p':
      mpb_preference();
      break;
    case 'Q':
      choice = 'q';
    case 'q':
      break;
    default:
      printf("Have not the choose "
             "\033[31m"
             "%c"
             "\033[0m"
             "\n",
             choice);
      break;
    }
  } while ('q' != choice);
  return 0;
}


x86 assembly (clang, -O0):
<mpb_menu_choose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1060 <memset@plt>
lea    0xeff(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xf03(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xf07(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xf0c(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xf13(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xf1e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <mpb_print_all_data@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
cltq
mov    -0x40(%rbp,%rax,8),%rsi
lea    0xf03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x4(%rbp),%rcx
xor    %eax,%eax
cmp    -0x40(%rbp,%rcx,8),%rax
jne    1216 <mpb_menu_choose+0x76>
lea    0xeea(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x49(%rbp)
call   1030 <printf@plt>
mov    -0x49(%rbp),%al
call   1080 <mpb_get_choice@plt>
mov    %eax,%ecx
mov    -0x49(%rbp),%al
mov    %ecx,-0x8(%rbp)
call   10a0 <mpb_clear_screen@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x32,%eax
ja     12de <mpb_menu_choose+0x13e>
mov    -0x48(%rbp),%rax
lea    0xd73(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10b0 <mpb_add@plt>
jmp    12ef <mpb_menu_choose+0x14f>
mov    $0x0,%al
call   10c0 <mpb_del@plt>
jmp    12ef <mpb_menu_choose+0x14f>
mov    $0x0,%al
call   1070 <mpb_edit@plt>
jmp    12ef <mpb_menu_choose+0x14f>
mov    $0x0,%al
call   1090 <mpb_search@plt>
jmp    12ef <mpb_menu_choose+0x14f>
mov    $0x0,%al
call   1050 <mpb_preference@plt>
jmp    12ef <mpb_menu_choose+0x14f>
movl   $0x71,-0x8(%rbp)
jmp    12ef <mpb_menu_choose+0x14f>
mov    -0x8(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12f4 <mpb_menu_choose+0x154>
mov    $0x71,%eax
cmp    -0x8(%rbp),%eax
jne    1208 <mpb_menu_choose+0x68>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpb_menu_choose>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movq   $0x0,0x30(%rsp)
lea    0xf1e(%rip),%r13
mov    %r13,(%rsp)
lea    0xf22(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xf25(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xf29(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xf2f(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xf39(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xf3d(%rip),%rbx
lea    0xf3c(%rip),%r14
lea    0xdfd(%rip),%r15
jmp    121a <mpb_menu_choose+0x8a>
xor    %eax,%eax
call   1050 <mpb_preference@plt>
nopl   0x0(%rax)
cmp    $0x71,%r12d
je     12b2 <mpb_menu_choose+0x122>
xor    %eax,%eax
call   1040 <mpb_print_all_data@plt>
lea    0x8(%rsp),%rbp
mov    %r13,%rsi
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x0(%rbp),%rsi
add    $0x8,%rbp
test   %rsi,%rsi
jne    1230 <mpb_menu_choose+0xa0>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <mpb_get_choice@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1090 <mpb_clear_screen@plt>
lea    -0x41(%r12),%eax
cmp    $0x32,%eax
ja     129c <mpb_menu_choose+0x10c>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <mpb_add@plt>
jmp    1210 <mpb_menu_choose+0x80>
xor    %eax,%eax
call   10b0 <mpb_del@plt>
jmp    1210 <mpb_menu_choose+0x80>
xor    %eax,%eax
call   1060 <mpb_edit@plt>
jmp    1210 <mpb_menu_choose+0x80>
xor    %eax,%eax
call   1080 <mpb_search@plt>
jmp    1210 <mpb_menu_choose+0x80>
lea    0xe99(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1210 <mpb_menu_choose+0x80>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\1B[37mA/a\1B[0mdd\00"
@.str.1 = [15 x i8] c"\1B[37mD/d\1B[0mel\00"
@.str.2 = [16 x i8] c"\1B[37mE/e\1B[0mdit\00"
@.str.3 = [18 x i8] c"\1B[37mS/s\1B[0mearch\00"
@.str.4 = [22 x i8] c"\1B[37mP/p\1B[0mreference\00"
@.str.5 = [16 x i8] c"\1B[31mQ/q\1B[0muit\00"
@.str.6 = [6 x i8] c"%-24s\00"
@.str.7 = [4 x i8] c"\0A>>\00"
@.str.8 = [33 x i8] c"Have not the choose \1B[31m%c\1B[0m\0A\00"
define i32 @mpb_menu_choose() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [7 x i8*]
store i32 0, i32* %1
store i32 -1, i32* %2
%4 = bitcast [7 x i8*]* %3 to i8*
%5 = bitcast i8* %4 to [7 x i8*]*
%6 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i32 0, i32 0
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i32 0, i32 0), i8** %6
%7 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i32 0, i32 1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i32 0, i32 2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i32 0, i32 3
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i32 0, i32 4
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i32 0, i32 5
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i32 0, i32 0), i8** %11
br label %12
12: ; preds = %48, %0
%13 = call i32 (...) @mpb_print_all_data()
store i32 0, i32* %1
br label %14
14: ; preds = %21, %12
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = icmp ne i8* null, %25
br i1 %26, label %14, label %27
27: ; preds = %21
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%29 = call i32 (...) @mpb_get_choice()
store i32 %29, i32* %2
%30 = call i32 (...) @mpb_clear_screen()
%31 = load i32, i32* %2
switch i32 %31, label %44 [
i32 65, label %32
i32 97, label %32
i32 68, label %34
i32 100, label %34
i32 69, label %36
i32 101, label %36
i32 83, label %38
i32 115, label %38
i32 80, label %40
i32 112, label %40
i32 81, label %42
i32 113, label %43
]
32: ; preds = %27, %27
%33 = call i32 (...) @mpb_add()
br label %47
34: ; preds = %27, %27
%35 = call i32 (...) @mpb_del()
br label %47
36: ; preds = %27, %27
%37 = call i32 (...) @mpb_edit()
br label %47
38: ; preds = %27, %27
%39 = call i32 (...) @mpb_search()
br label %47
40: ; preds = %27, %27
%41 = call i32 (...) @mpb_preference()
br label %47
42: ; preds = %27
store i32 113, i32* %2
br label %43
43: ; preds = %27, %42
br label %47
44: ; preds = %27
%45 = load i32, i32* %2
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %44, %43, %40, %38, %36, %34, %32
br label %48
48: ; preds = %47
%49 = load i32, i32* %2
%50 = icmp ne i32 113, %49
br i1 %50, label %12, label %51
51: ; preds = %48
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"\1B[37mA/a\1B[0mdd\00"
@.str.1 = [15 x i8] c"\1B[37mD/d\1B[0mel\00"
@.str.2 = [16 x i8] c"\1B[37mE/e\1B[0mdit\00"
@.str.3 = [18 x i8] c"\1B[37mS/s\1B[0mearch\00"
@.str.4 = [22 x i8] c"\1B[37mP/p\1B[0mreference\00"
@.str.5 = [16 x i8] c"\1B[31mQ/q\1B[0muit\00"
@.str.6 = [6 x i8] c"%-24s\00"
@.str.7 = [4 x i8] c"\0A>>\00"
@.str.8 = [33 x i8] c"Have not the choose \1B[31m%c\1B[0m\0A\00"
define i32 @mpb_menu_choose() {
%1 = alloca [7 x i8*]
%2 = bitcast [7 x i8*]* %1 to i8*
%3 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 6
%4 = bitcast i8** %3 to i64*
store i64 0, i64* %4
%5 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 5
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8** %10
br label %11
11: ; preds = %37, %0
%12 = tail call i32 (...) @mpb_print_all_data()
br label %13
13: ; preds = %13, %11
%14 = phi i8* [ %19, %13 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %11 ]
%15 = phi i64 [ %16, %13 ], [ 0, %11 ]
%16 = add nuw i64 %15, 1
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %14)
%18 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 %16
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %13
21: ; preds = %13
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%23 = tail call i32 (...) @mpb_get_choice()
%24 = tail call i32 (...) @mpb_clear_screen()
switch i32 %23, label %35 [
i32 65, label %25
i32 97, label %25
i32 68, label %27
i32 100, label %27
i32 69, label %29
i32 101, label %29
i32 83, label %31
i32 115, label %31
i32 80, label %33
i32 112, label %33
i32 81, label %39
i32 113, label %39
]
25: ; preds = %21, %21
%26 = tail call i32 (...) @mpb_add()
br label %37
27: ; preds = %21, %21
%28 = tail call i32 (...) @mpb_del()
br label %37
29: ; preds = %21, %21
%30 = tail call i32 (...) @mpb_edit()
br label %37
31: ; preds = %21, %21
%32 = tail call i32 (...) @mpb_search()
br label %37
33: ; preds = %21, %21
%34 = tail call i32 (...) @mpb_preference()
br label %37
35: ; preds = %21
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i32 %23)
br label %37
37: ; preds = %25, %27, %29, %31, %33, %35
%38 = icmp eq i32 %23, 113
br i1 %38, label %39, label %11
39: ; preds = %21, %21, %37
ret i32 0
}