#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*/ csr_close_3wire();
int /*<<< orphan*/ csr_close_bcsp();
int /*<<< orphan*/ csr_close_h4();
int /*<<< orphan*/ csr_close_hci();
int /*<<< orphan*/ csr_close_usb();
void transport_close(int transport) {
  switch (transport) {
  case 1:
    csr_close_hci();
    break;
  case 2:
    csr_close_usb();
    break;
  case 3:
    csr_close_bcsp();
    break;
  case 4:
    csr_close_h4();
    break;
  case 5:
    csr_close_3wire();
    break;
  }
}


x86 assembly (clang, -O0):
<transport_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x4,%eax
ja     11bb <transport_close+0x6b>
mov    -0x10(%rbp),%rax
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <csr_close_hci@plt>
jmp    11bb <transport_close+0x6b>
mov    $0x0,%al
call   1050 <csr_close_usb@plt>
jmp    11bb <transport_close+0x6b>
mov    $0x0,%al
call   1060 <csr_close_bcsp@plt>
jmp    11bb <transport_close+0x6b>
mov    $0x0,%al
call   1070 <csr_close_h4@plt>
jmp    11bb <transport_close+0x6b>
mov    $0x0,%al
call   1030 <csr_close_3wire@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transport_close>:
add    $0xffffffff,%edi
cmp    $0x4,%edi
ja     116f <transport_close+0x1f>
lea    0xea1(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
jmp    1040 <csr_close_hci@plt>
ret
xor    %eax,%eax
jmp    1050 <csr_close_usb@plt>
xor    %eax,%eax
jmp    1060 <csr_close_bcsp@plt>
xor    %eax,%eax
jmp    1070 <csr_close_h4@plt>
xor    %eax,%eax
jmp    1030 <csr_close_3wire@plt>

LLVM IR (-O0):
define void @transport_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %14 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
]
4: ; preds = %1
%5 = call i32 (...) @csr_close_hci()
br label %14
6: ; preds = %1
%7 = call i32 (...) @csr_close_usb()
br label %14
8: ; preds = %1
%9 = call i32 (...) @csr_close_bcsp()
br label %14
10: ; preds = %1
%11 = call i32 (...) @csr_close_h4()
br label %14
12: ; preds = %1
%13 = call i32 (...) @csr_close_3wire()
br label %14
14: ; preds = %1, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
define void @transport_close(i32 %0) {
switch i32 %0, label %12 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
i32 4, label %8
i32 5, label %10
]
2: ; preds = %1
%3 = tail call i32 (...) @csr_close_hci()
br label %12
4: ; preds = %1
%5 = tail call i32 (...) @csr_close_usb()
br label %12
6: ; preds = %1
%7 = tail call i32 (...) @csr_close_bcsp()
br label %12
8: ; preds = %1
%9 = tail call i32 (...) @csr_close_h4()
br label %12
10: ; preds = %1
%11 = tail call i32 (...) @csr_close_3wire()
br label %12
12: ; preds = %1, %10, %8, %6, %4, %2
ret void
}