#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 */
unsigned long crb_close(long);
unsigned long crb_get_env(long, char *, long);
unsigned long crb_getc(long);
unsigned long crb_ioctl(long);
unsigned long crb_open(char const *, long);
unsigned long crb_process_keycode(long, long, long);
unsigned long crb_pswitch(long, long);
unsigned long crb_puts(long, char const *, long);
unsigned long crb_read(long, long, char *, long);
unsigned long crb_reset_env(long, char *, long);
unsigned long crb_reset_term(long);
unsigned long crb_save_env();
unsigned long crb_set_env(long, char const *, long);
unsigned long crb_set_term_ctl(long, long);
unsigned long crb_set_term_int(long, long);
unsigned long crb_write(long, long, char const *, long);
unsigned long __attribute__((used))
int_crb_dispatch(long select, long a1, long a2, long a3, long a4) {
  switch (select) {
  case 0x01:
    return crb_getc(a1);
  case 0x02:
    return crb_puts(a1, (const char *)a2, a3);
  case 0x03:
    return crb_reset_term(a1);
  case 0x04:
    return crb_set_term_int(a1, a2);
  case 0x05:
    return crb_set_term_ctl(a1, a2);
  case 0x06:
    return crb_process_keycode(a1, a2, a3);
  case 0x10:
    return crb_open((const char *)a1, a2);
  case 0x11:
    return crb_close(a1);
  case 0x12:
    return crb_ioctl(a1);
  case 0x13:
    return crb_read(a1, a2, (char *)a3, a4);
  case 0x14:
    return crb_write(a1, a2, (const char *)a3, a4);
  case 0x20:
    return crb_set_env(a1, (const char *)a2, a3);
  case 0x21:
    return crb_reset_env(a1, (char *)a2, a3);
  case 0x22:
    return crb_get_env(a1, (char *)a2, a3);
  case 0x23:
    return crb_save_env();
  case 0x30:
    return crb_pswitch(a1, a2);
  }
  return 0x8000000000000000ul;
}


x86 assembly (clang, -O0):
<int_crb_dispatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x38(%rbp)
sub    $0x2f,%rax
ja     13b4 <int_crb_dispatch+0x1b4>
mov    -0x38(%rbp),%rax
lea    0xdc3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rdi
call   10a0 <crb_getc@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1090 <crb_puts@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
call   1070 <crb_reset_term@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1100 <crb_set_term_int@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10f0 <crb_set_term_ctl@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <crb_process_keycode@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <crb_open@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
call   10d0 <crb_close@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
call   10b0 <crb_ioctl@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1110 <crb_read@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1060 <crb_write@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10c0 <crb_set_env@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1080 <crb_reset_env@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   10e0 <crb_get_env@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    $0x0,%al
call   1050 <crb_save_env@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1120 <crb_pswitch@plt>
mov    %rax,-0x8(%rbp)
jmp    13c2 <int_crb_dispatch+0x1c2>
movabs $0x8000000000000000,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_crb_dispatch>:
add    $0xffffffffffffffff,%rdi
cmp    $0x2f,%rdi
ja     12d9 <int_crb_dispatch+0xd9>
lea    0xdeb(%rip),%rax
movslq (%rax,%rdi,4),%rdi
add    %rax,%rdi
jmp    *%rdi
mov    %rsi,%rdi
jmp    10a0 <crb_getc@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1090 <crb_puts@plt>
mov    %rsi,%rdi
jmp    1070 <crb_reset_term@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1100 <crb_set_term_int@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    10f0 <crb_set_term_ctl@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1040 <crb_process_keycode@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <crb_open@plt>
mov    %rsi,%rdi
jmp    10d0 <crb_close@plt>
mov    %rsi,%rdi
jmp    10b0 <crb_ioctl@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%rcx
jmp    1110 <crb_read@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%rcx
jmp    1060 <crb_write@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    10c0 <crb_set_env@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1080 <crb_reset_env@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    10e0 <crb_get_env@plt>
xor    %eax,%eax
jmp    1050 <crb_save_env@plt>
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1120 <crb_pswitch@plt>
movabs $0x8000000000000000,%rax
ret

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i64 (i64, i64, i64, i64, i64)* @int_crb_dispatch to i8*)], section "llvm.metadata"
define i64 @int_crb_dispatch(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
%12 = load i64, i64* %7
switch i64 %12, label %87 [
i64 1, label %13
i64 2, label %16
i64 3, label %22
i64 4, label %25
i64 5, label %29
i64 6, label %33
i64 16, label %38
i64 17, label %43
i64 18, label %46
i64 19, label %49
i64 20, label %56
i64 32, label %63
i64 33, label %69
i64 34, label %75
i64 35, label %81
i64 48, label %83
]
13: ; preds = %5
%14 = load i64, i64* %8
%15 = call i64 @crb_getc(i64 %14)
store i64 %15, i64* %6
br label %88
16: ; preds = %5
%17 = load i64, i64* %8
%18 = load i64, i64* %9
%19 = inttoptr i64 %18 to i8*
%20 = load i64, i64* %10
%21 = call i64 @crb_puts(i64 %17, i8* %19, i64 %20)
store i64 %21, i64* %6
br label %88
22: ; preds = %5
%23 = load i64, i64* %8
%24 = call i64 @crb_reset_term(i64 %23)
store i64 %24, i64* %6
br label %88
25: ; preds = %5
%26 = load i64, i64* %8
%27 = load i64, i64* %9
%28 = call i64 @crb_set_term_int(i64 %26, i64 %27)
store i64 %28, i64* %6
br label %88
29: ; preds = %5
%30 = load i64, i64* %8
%31 = load i64, i64* %9
%32 = call i64 @crb_set_term_ctl(i64 %30, i64 %31)
store i64 %32, i64* %6
br label %88
33: ; preds = %5
%34 = load i64, i64* %8
%35 = load i64, i64* %9
%36 = load i64, i64* %10
%37 = call i64 @crb_process_keycode(i64 %34, i64 %35, i64 %36)
store i64 %37, i64* %6
br label %88
38: ; preds = %5
%39 = load i64, i64* %8
%40 = inttoptr i64 %39 to i8*
%41 = load i64, i64* %9
%42 = call i64 @crb_open(i8* %40, i64 %41)
store i64 %42, i64* %6
br label %88
43: ; preds = %5
%44 = load i64, i64* %8
%45 = call i64 @crb_close(i64 %44)
store i64 %45, i64* %6
br label %88
46: ; preds = %5
%47 = load i64, i64* %8
%48 = call i64 @crb_ioctl(i64 %47)
store i64 %48, i64* %6
br label %88
49: ; preds = %5
%50 = load i64, i64* %8
%51 = load i64, i64* %9
%52 = load i64, i64* %10
%53 = inttoptr i64 %52 to i8*
%54 = load i64, i64* %11
%55 = call i64 @crb_read(i64 %50, i64 %51, i8* %53, i64 %54)
store i64 %55, i64* %6
br label %88
56: ; preds = %5
%57 = load i64, i64* %8
%58 = load i64, i64* %9
%59 = load i64, i64* %10
%60 = inttoptr i64 %59 to i8*
%61 = load i64, i64* %11
%62 = call i64 @crb_write(i64 %57, i64 %58, i8* %60, i64 %61)
store i64 %62, i64* %6
br label %88
63: ; preds = %5
%64 = load i64, i64* %8
%65 = load i64, i64* %9
%66 = inttoptr i64 %65 to i8*
%67 = load i64, i64* %10
%68 = call i64 @crb_set_env(i64 %64, i8* %66, i64 %67)
store i64 %68, i64* %6
br label %88
69: ; preds = %5
%70 = load i64, i64* %8
%71 = load i64, i64* %9
%72 = inttoptr i64 %71 to i8*
%73 = load i64, i64* %10
%74 = call i64 @crb_reset_env(i64 %70, i8* %72, i64 %73)
store i64 %74, i64* %6
br label %88
75: ; preds = %5
%76 = load i64, i64* %8
%77 = load i64, i64* %9
%78 = inttoptr i64 %77 to i8*
%79 = load i64, i64* %10
%80 = call i64 @crb_get_env(i64 %76, i8* %78, i64 %79)
store i64 %80, i64* %6
br label %88
81: ; preds = %5
%82 = call i64 (...) @crb_save_env()
store i64 %82, i64* %6
br label %88
83: ; preds = %5
%84 = load i64, i64* %8
%85 = load i64, i64* %9
%86 = call i64 @crb_pswitch(i64 %84, i64 %85)
store i64 %86, i64* %6
br label %88
87: ; preds = %5
store i64 -9223372036854775808, i64* %6
br label %88
88: ; preds = %87, %83, %81, %75, %69, %63, %56, %49, %46, %43, %38, %33, %29, %25, %22, %16, %13
%89 = load i64, i64* %6
ret i64 %89
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i64 (i64, i64, i64, i64, i64)* @int_crb_dispatch to i8*)], section "llvm.metadata"
define i64 @int_crb_dispatch(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
switch i64 %0, label %45 [
i64 1, label %6
i64 2, label %8
i64 3, label %11
i64 4, label %13
i64 5, label %15
i64 6, label %17
i64 16, label %19
i64 17, label %22
i64 18, label %24
i64 19, label %26
i64 20, label %29
i64 32, label %32
i64 33, label %35
i64 34, label %38
i64 35, label %41
i64 48, label %43
]
6: ; preds = %5
%7 = tail call i64 @crb_getc(i64 %1)
br label %45
8: ; preds = %5
%9 = inttoptr i64 %2 to i8*
%10 = tail call i64 @crb_puts(i64 %1, i8* %9, i64 %3)
br label %45
11: ; preds = %5
%12 = tail call i64 @crb_reset_term(i64 %1)
br label %45
13: ; preds = %5
%14 = tail call i64 @crb_set_term_int(i64 %1, i64 %2)
br label %45
15: ; preds = %5
%16 = tail call i64 @crb_set_term_ctl(i64 %1, i64 %2)
br label %45
17: ; preds = %5
%18 = tail call i64 @crb_process_keycode(i64 %1, i64 %2, i64 %3)
br label %45
19: ; preds = %5
%20 = inttoptr i64 %1 to i8*
%21 = tail call i64 @crb_open(i8* %20, i64 %2)
br label %45
22: ; preds = %5
%23 = tail call i64 @crb_close(i64 %1)
br label %45
24: ; preds = %5
%25 = tail call i64 @crb_ioctl(i64 %1)
br label %45
26: ; preds = %5
%27 = inttoptr i64 %3 to i8*
%28 = tail call i64 @crb_read(i64 %1, i64 %2, i8* %27, i64 %4)
br label %45
29: ; preds = %5
%30 = inttoptr i64 %3 to i8*
%31 = tail call i64 @crb_write(i64 %1, i64 %2, i8* %30, i64 %4)
br label %45
32: ; preds = %5
%33 = inttoptr i64 %2 to i8*
%34 = tail call i64 @crb_set_env(i64 %1, i8* %33, i64 %3)
br label %45
35: ; preds = %5
%36 = inttoptr i64 %2 to i8*
%37 = tail call i64 @crb_reset_env(i64 %1, i8* %36, i64 %3)
br label %45
38: ; preds = %5
%39 = inttoptr i64 %2 to i8*
%40 = tail call i64 @crb_get_env(i64 %1, i8* %39, i64 %3)
br label %45
41: ; preds = %5
%42 = tail call i64 (...) @crb_save_env()
br label %45
43: ; preds = %5
%44 = tail call i64 @crb_pswitch(i64 %1, i64 %2)
br label %45
45: ; preds = %5, %43, %41, %38, %35, %32, %29, %26, %24, %22, %19, %17, %15, %13, %11, %8, %6
%46 = phi i64 [ %44, %43 ], [ %42, %41 ], [ %40, %38 ], [ %37, %35 ], [ %34, %32 ], [ %31, %29 ], [ %28, %26 ], [ %25, %24 ], [ %23, %22 ], [ %21, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %8 ], [ %7, %6 ], [ -9223372036854775808, %5 ]
ret i64 %46
}