#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 */
#define KEY_DOWN 130
#define KEY_RIGHT 129
#define KEY_UP 128
int /*<<< orphan*/ hist_older();
int /*<<< orphan*/ hist_to_clean_shell();
int /*<<< orphan*/ hist_to_shell();
int /*<<< orphan*/ hist_younger();
void input_hist(int key) {
  switch (key) {
  case KEY_UP:
    hist_older();
    break;
  case KEY_DOWN:
    hist_younger();
    break;
  case KEY_RIGHT:
    hist_to_clean_shell();
    break;
  case 10:
    hist_to_shell();
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<input_hist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0xa,%eax
je     11bc <input_hist+0x7c>
jmp    115f <input_hist+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
je     1198 <input_hist+0x58>
jmp    1172 <input_hist+0x32>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
je     11b0 <input_hist+0x70>
jmp    1185 <input_hist+0x45>
mov    -0x8(%rbp),%eax
sub    $0x82,%eax
je     11a4 <input_hist+0x64>
jmp    11c8 <input_hist+0x88>
mov    $0x0,%al
call   1060 <hist_older@plt>
jmp    11cd <input_hist+0x8d>
mov    $0x0,%al
call   1030 <hist_younger@plt>
jmp    11cd <input_hist+0x8d>
mov    $0x0,%al
call   1050 <hist_to_clean_shell@plt>
jmp    11cd <input_hist+0x8d>
mov    $0x0,%al
call   1040 <hist_to_shell@plt>
jmp    11cd <input_hist+0x8d>
jmp    11cd <input_hist+0x8d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_hist>:
cmp    $0x80,%edi
jg     115c <input_hist+0x1c>
cmp    $0xa,%edi
je     1174 <input_hist+0x34>
cmp    $0x80,%edi
jne    1173 <input_hist+0x33>
xor    %eax,%eax
jmp    1060 <hist_older@plt>
cmp    $0x81,%edi
je     117b <input_hist+0x3b>
cmp    $0x82,%edi
jne    1173 <input_hist+0x33>
xor    %eax,%eax
jmp    1030 <hist_younger@plt>
ret
xor    %eax,%eax
jmp    1040 <hist_to_shell@plt>
xor    %eax,%eax
jmp    1050 <hist_to_clean_shell@plt>

LLVM IR (-O0):
define void @input_hist(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 128, label %4
i32 130, label %6
i32 129, label %8
i32 10, label %10
]
4: ; preds = %1
%5 = call i32 (...) @hist_older()
br label %13
6: ; preds = %1
%7 = call i32 (...) @hist_younger()
br label %13
8: ; preds = %1
%9 = call i32 (...) @hist_to_clean_shell()
br label %13
10: ; preds = %1
%11 = call i32 (...) @hist_to_shell()
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
define void @input_hist(i32 %0) {
switch i32 %0, label %10 [
i32 128, label %2
i32 130, label %4
i32 129, label %6
i32 10, label %8
]
2: ; preds = %1
%3 = tail call i32 (...) @hist_older()
br label %10
4: ; preds = %1
%5 = tail call i32 (...) @hist_younger()
br label %10
6: ; preds = %1
%7 = tail call i32 (...) @hist_to_clean_shell()
br label %10
8: ; preds = %1
%9 = tail call i32 (...) @hist_to_shell()
br label %10
10: ; preds = %1, %8, %6, %4, %2
ret void
}