#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 */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fd_nrf8001_decode_bond_status_event(int *,
                                                       int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_command_response_event(int *,
                                                            int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_connected_event(int *, int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_data_ack_event(int *, int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_data_credit_event(int *,
                                                       int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_data_received_event(int *,
                                                         int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_device_started_event(int *,
                                                          int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_disconnected_event(int *,
                                                        int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_display_key_event(int *,
                                                       int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_echo_event(int *, int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_hardware_error_event(int *,
                                                          int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_key_request_event(int *,
                                                       int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_pipe_error_event(int *,
                                                      int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_pipe_status_event(int *,
                                                       int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_decode_timing_event(int *, int /*<<< orphan*/);
int /*<<< orphan*/ fd_nrf8001_error();
void fd_nrf8001_dispatch(uint8_t *buffer, uint32_t length) {
  uint8_t op = buffer[0];
  switch (op) {
  case 0x81:
    fd_nrf8001_decode_device_started_event(buffer, length);
    break;
  case 0x82:
    fd_nrf8001_decode_echo_event(buffer, length);
    break;
  case 0x83:
    fd_nrf8001_decode_hardware_error_event(buffer, length);
    break;
  case 0x84:
    fd_nrf8001_decode_command_response_event(buffer, length);
    break;
  case 0x85:
    fd_nrf8001_decode_connected_event(buffer, length);
    break;
  case 0x86:
    fd_nrf8001_decode_disconnected_event(buffer, length);
    break;
  case 0x87:
    fd_nrf8001_decode_bond_status_event(buffer, length);
    break;
  case 0x88:
    fd_nrf8001_decode_pipe_status_event(buffer, length);
    break;
  case 0x89:
    fd_nrf8001_decode_timing_event(buffer, length);
    break;
  case 0x8e:
    fd_nrf8001_decode_display_key_event(buffer, length);
    break;
  case 0x8f:
    fd_nrf8001_decode_key_request_event(buffer, length);
    break;
  case 0x8a:
    fd_nrf8001_decode_data_credit_event(buffer, length);
    break;
  case 0x8d:
    fd_nrf8001_decode_pipe_error_event(buffer, length);
    break;
  case 0x8c:
    fd_nrf8001_decode_data_received_event(buffer, length);
    break;
  case 0x8b:
    fd_nrf8001_decode_data_ack_event(buffer, length);
    break;
  default:
    fd_nrf8001_error();
    return;
    break;
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffff7f,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xe,%eax
ja     1342 <fd_nrf8001_dispatch+0x142>
mov    -0x18(%rbp),%rax
lea    0xdc6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10d0 <fd_nrf8001_decode_device_started_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10b0 <fd_nrf8001_decode_echo_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1100 <fd_nrf8001_decode_hardware_error_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1080 <fd_nrf8001_decode_command_response_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <fd_nrf8001_decode_connected_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1090 <fd_nrf8001_decode_disconnected_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10f0 <fd_nrf8001_decode_bond_status_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10a0 <fd_nrf8001_decode_pipe_status_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10c0 <fd_nrf8001_decode_timing_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   10e0 <fd_nrf8001_decode_display_key_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <fd_nrf8001_decode_key_request_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1070 <fd_nrf8001_decode_data_credit_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1120 <fd_nrf8001_decode_pipe_error_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1110 <fd_nrf8001_decode_data_received_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <fd_nrf8001_decode_data_ack_event@plt>
jmp    1349 <fd_nrf8001_dispatch+0x149>
mov    $0x0,%al
call   1030 <fd_nrf8001_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0xffffff7f,%eax
add    (%rdi),%eax
cmp    $0xe,%eax
ja     1221 <fd_nrf8001_dispatch+0x21>
lea    0xded(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    10d0 <fd_nrf8001_decode_device_started_event@plt>
xor    %eax,%eax
jmp    1030 <fd_nrf8001_error@plt>
jmp    10b0 <fd_nrf8001_decode_echo_event@plt>
jmp    1100 <fd_nrf8001_decode_hardware_error_event@plt>
jmp    1080 <fd_nrf8001_decode_command_response_event@plt>
jmp    1060 <fd_nrf8001_decode_connected_event@plt>
jmp    1090 <fd_nrf8001_decode_disconnected_event@plt>
jmp    10f0 <fd_nrf8001_decode_bond_status_event@plt>
jmp    10a0 <fd_nrf8001_decode_pipe_status_event@plt>
jmp    10c0 <fd_nrf8001_decode_timing_event@plt>
jmp    1070 <fd_nrf8001_decode_data_credit_event@plt>
jmp    1040 <fd_nrf8001_decode_data_ack_event@plt>
jmp    1110 <fd_nrf8001_decode_data_received_event@plt>
jmp    1120 <fd_nrf8001_decode_pipe_error_event@plt>
jmp    10e0 <fd_nrf8001_decode_display_key_event@plt>
jmp    1050 <fd_nrf8001_decode_key_request_event@plt>

LLVM IR (-O0):
define void @fd_nrf8001_dispatch(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
switch i32 %9, label %70 [
i32 129, label %10
i32 130, label %14
i32 131, label %18
i32 132, label %22
i32 133, label %26
i32 134, label %30
i32 135, label %34
i32 136, label %38
i32 137, label %42
i32 142, label %46
i32 143, label %50
i32 138, label %54
i32 141, label %58
i32 140, label %62
i32 139, label %66
]
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = call i32 @fd_nrf8001_decode_device_started_event(i32* %11, i32 %12)
br label %72
14: ; preds = %2
%15 = load i32*, i32** %3
%16 = load i32, i32* %4
%17 = call i32 @fd_nrf8001_decode_echo_event(i32* %15, i32 %16)
br label %72
18: ; preds = %2
%19 = load i32*, i32** %3
%20 = load i32, i32* %4
%21 = call i32 @fd_nrf8001_decode_hardware_error_event(i32* %19, i32 %20)
br label %72
22: ; preds = %2
%23 = load i32*, i32** %3
%24 = load i32, i32* %4
%25 = call i32 @fd_nrf8001_decode_command_response_event(i32* %23, i32 %24)
br label %72
26: ; preds = %2
%27 = load i32*, i32** %3
%28 = load i32, i32* %4
%29 = call i32 @fd_nrf8001_decode_connected_event(i32* %27, i32 %28)
br label %72
30: ; preds = %2
%31 = load i32*, i32** %3
%32 = load i32, i32* %4
%33 = call i32 @fd_nrf8001_decode_disconnected_event(i32* %31, i32 %32)
br label %72
34: ; preds = %2
%35 = load i32*, i32** %3
%36 = load i32, i32* %4
%37 = call i32 @fd_nrf8001_decode_bond_status_event(i32* %35, i32 %36)
br label %72
38: ; preds = %2
%39 = load i32*, i32** %3
%40 = load i32, i32* %4
%41 = call i32 @fd_nrf8001_decode_pipe_status_event(i32* %39, i32 %40)
br label %72
42: ; preds = %2
%43 = load i32*, i32** %3
%44 = load i32, i32* %4
%45 = call i32 @fd_nrf8001_decode_timing_event(i32* %43, i32 %44)
br label %72
46: ; preds = %2
%47 = load i32*, i32** %3
%48 = load i32, i32* %4
%49 = call i32 @fd_nrf8001_decode_display_key_event(i32* %47, i32 %48)
br label %72
50: ; preds = %2
%51 = load i32*, i32** %3
%52 = load i32, i32* %4
%53 = call i32 @fd_nrf8001_decode_key_request_event(i32* %51, i32 %52)
br label %72
54: ; preds = %2
%55 = load i32*, i32** %3
%56 = load i32, i32* %4
%57 = call i32 @fd_nrf8001_decode_data_credit_event(i32* %55, i32 %56)
br label %72
58: ; preds = %2
%59 = load i32*, i32** %3
%60 = load i32, i32* %4
%61 = call i32 @fd_nrf8001_decode_pipe_error_event(i32* %59, i32 %60)
br label %72
62: ; preds = %2
%63 = load i32*, i32** %3
%64 = load i32, i32* %4
%65 = call i32 @fd_nrf8001_decode_data_received_event(i32* %63, i32 %64)
br label %72
66: ; preds = %2
%67 = load i32*, i32** %3
%68 = load i32, i32* %4
%69 = call i32 @fd_nrf8001_decode_data_ack_event(i32* %67, i32 %68)
br label %72
70: ; preds = %2
%71 = call i32 (...) @fd_nrf8001_error()
br label %72
72: ; preds = %70, %66, %62, %58, %54, %50, %46, %42, %38, %34, %30, %26, %22, %18, %14, %10
ret void
}

LLVM IR (-O2):
define void @fd_nrf8001_dispatch(i32* %0, i32 %1) {
%3 = load i32, i32* %0
switch i32 %3, label %34 [
i32 129, label %4
i32 130, label %6
i32 131, label %8
i32 132, label %10
i32 133, label %12
i32 134, label %14
i32 135, label %16
i32 136, label %18
i32 137, label %20
i32 142, label %22
i32 143, label %24
i32 138, label %26
i32 141, label %28
i32 140, label %30
i32 139, label %32
]
4: ; preds = %2
%5 = tail call i32 @fd_nrf8001_decode_device_started_event(i32* %0, i32 %1)
br label %36
6: ; preds = %2
%7 = tail call i32 @fd_nrf8001_decode_echo_event(i32* %0, i32 %1)
br label %36
8: ; preds = %2
%9 = tail call i32 @fd_nrf8001_decode_hardware_error_event(i32* %0, i32 %1)
br label %36
10: ; preds = %2
%11 = tail call i32 @fd_nrf8001_decode_command_response_event(i32* %0, i32 %1)
br label %36
12: ; preds = %2
%13 = tail call i32 @fd_nrf8001_decode_connected_event(i32* %0, i32 %1)
br label %36
14: ; preds = %2
%15 = tail call i32 @fd_nrf8001_decode_disconnected_event(i32* %0, i32 %1)
br label %36
16: ; preds = %2
%17 = tail call i32 @fd_nrf8001_decode_bond_status_event(i32* %0, i32 %1)
br label %36
18: ; preds = %2
%19 = tail call i32 @fd_nrf8001_decode_pipe_status_event(i32* %0, i32 %1)
br label %36
20: ; preds = %2
%21 = tail call i32 @fd_nrf8001_decode_timing_event(i32* %0, i32 %1)
br label %36
22: ; preds = %2
%23 = tail call i32 @fd_nrf8001_decode_display_key_event(i32* %0, i32 %1)
br label %36
24: ; preds = %2
%25 = tail call i32 @fd_nrf8001_decode_key_request_event(i32* %0, i32 %1)
br label %36
26: ; preds = %2
%27 = tail call i32 @fd_nrf8001_decode_data_credit_event(i32* %0, i32 %1)
br label %36
28: ; preds = %2
%29 = tail call i32 @fd_nrf8001_decode_pipe_error_event(i32* %0, i32 %1)
br label %36
30: ; preds = %2
%31 = tail call i32 @fd_nrf8001_decode_data_received_event(i32* %0, i32 %1)
br label %36
32: ; preds = %2
%33 = tail call i32 @fd_nrf8001_decode_data_ack_event(i32* %0, i32 %1)
br label %36
34: ; preds = %2
%35 = tail call i32 (...) @fd_nrf8001_error()
br label %36
36: ; preds = %4, %6, %8, %10, %12, %14, %16, %18, %20, %22, %24, %26, %28, %30, %32, %34
ret void
}