#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*/ add_rule();
int /*<<< orphan*/ del_rule();
int /*<<< orphan*/ disable_rule();
int /*<<< orphan*/ enable_rule();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void menu_action(int opt) {
  switch (opt) {
  case 0:
    printf("Bye!\n");
    break;
  case 1:
    disable_rule();
    break;
  case 2:
    enable_rule();
    break;
  case 8:
    add_rule();
    break;
  case 9:
    del_rule();
    break;
  default:
    printf("None selected.");
  }
  system("pause");
}


x86 assembly (clang, -O0):
<menu_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x9,%rax
ja     11d1 <menu_action+0x71>
mov    -0x10(%rbp),%rax
lea    0xe79(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
jmp    11dd <menu_action+0x7d>
mov    $0x0,%al
call   1050 <disable_rule@plt>
jmp    11dd <menu_action+0x7d>
mov    $0x0,%al
call   1070 <enable_rule@plt>
jmp    11dd <menu_action+0x7d>
mov    $0x0,%al
call   1060 <add_rule@plt>
jmp    11dd <menu_action+0x7d>
mov    $0x0,%al
call   1080 <del_rule@plt>
jmp    11dd <menu_action+0x7d>
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
lea    0xe59(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menu_action>:
push   %rax
cmp    $0x9,%edi
ja     11a8 <menu_action+0x38>
mov    %edi,%eax
lea    0xe81(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
jmp    11c6 <menu_action+0x56>
xor    %eax,%eax
call   1060 <disable_rule@plt>
jmp    11c6 <menu_action+0x56>
xor    %eax,%eax
call   1080 <enable_rule@plt>
jmp    11c6 <menu_action+0x56>
lea    0xe79(%rip),%rdi
call   1050 <printf@plt>
jmp    11c6 <menu_action+0x56>
xor    %eax,%eax
call   1070 <add_rule@plt>
jmp    11c6 <menu_action+0x56>
xor    %eax,%eax
call   1090 <del_rule@plt>
lea    0xe6a(%rip),%rdi
pop    %rax
jmp    1040 <system@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Bye!\0A\00"
@.str.1 = [15 x i8] c"None selected.\00"
@.str.2 = [6 x i8] c"pause\00"
define void @menu_action(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %14 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 8, label %10
i32 9, label %12
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %16
6: ; preds = %1
%7 = call i32 (...) @disable_rule()
br label %16
8: ; preds = %1
%9 = call i32 (...) @enable_rule()
br label %16
10: ; preds = %1
%11 = call i32 (...) @add_rule()
br label %16
12: ; preds = %1
%13 = call i32 (...) @del_rule()
br label %16
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %10, %8, %6, %4
%17 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"None selected.\00"
@.str.2 = [6 x i8] c"pause\00"
@str = [5 x i8] c"Bye!\00"
define void @menu_action(i32 %0) {
switch i32 %0, label %12 [
i32 0, label %2
i32 1, label %4
i32 2, label %6
i32 8, label %8
i32 9, label %10
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %14
4: ; preds = %1
%5 = tail call i32 (...) @disable_rule()
br label %14
6: ; preds = %1
%7 = tail call i32 (...) @enable_rule()
br label %14
8: ; preds = %1
%9 = tail call i32 (...) @add_rule()
br label %14
10: ; preds = %1
%11 = tail call i32 (...) @del_rule()
br label %14
12: ; preds = %1
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %10, %8, %6, %4, %2
%15 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}