#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 uint32_t;

/* Variables and functions */
#define B1000000 148
#define B115200 147
#define B1152000 146
#define B1200 145
#define B1500000 144
#define B19200 143
#define B2000000 142
#define B230400 141
#define B2400 140
#define B2500000 139
#define B3000000 138
#define B3500000 137
#define B38400 136
#define B4000000 135
#define B460800 134
#define B4800 133
#define B500000 132
#define B57600 131
#define B576000 130
#define B921600 129
#define B9600 128
uint32_t librpip_uart_config_convert_b2l(uint32_t baud) {
  switch (baud) {
  case B1200:
    return 1200;
    break;
  case B2400:
    return 2400;
    break;
  case B4800:
    return 4800;
    break;
  case B9600:
    return 9600;
    break;
  case B19200:
    return 19200;
    break;
  case B38400:
    return 38400;
    break;
  case B57600:
    return 57600;
    break;
  case B115200:
    return 115200;
    break;
  case B230400:
    return 230400;
    break;
  case B460800:
    return 460800;
    break;
  case B500000:
    return 500000;
    break;
  case B576000:
    return 576000;
    break;
  case B921600:
    return 921600;
    break;
  case B1000000:
    return 1000000;
    break;
  case B1152000:
    return 1152000;
    break;
  case B1500000:
    return 1500000;
    break;
  case B2000000:
    return 2000000;
    break;
  case B2500000:
    return 2500000;
    break;
  case B3000000:
    return 3000000;
    break;
  case B3500000:
    return 3500000;
    break;
  case B4000000:
    return 4000000;
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<librpip_uart_config_convert_b2l>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x14,%eax
ja     122c <librpip_uart_config_convert_b2l+0x12c>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x4b0,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x960,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x12c0,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x2580,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x4b00,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x9600,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0xe100,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x1c200,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x38400,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x70800,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x7a120,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x8ca00,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0xe1000,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0xf4240,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x119400,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x16e360,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x1e8480,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x2625a0,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x2dc6c0,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x3567e0,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x3d0900,-0x4(%rbp)
jmp    1233 <librpip_uart_config_convert_b2l+0x133>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<librpip_uart_config_convert_b2l>:
add    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0x14,%edi
ja     1117 <librpip_uart_config_convert_b2l+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @librpip_uart_config_convert_b2l(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %26 [
i32 145, label %5
i32 140, label %6
i32 133, label %7
i32 128, label %8
i32 143, label %9
i32 136, label %10
i32 131, label %11
i32 147, label %12
i32 141, label %13
i32 134, label %14
i32 132, label %15
i32 130, label %16
i32 129, label %17
i32 148, label %18
i32 146, label %19
i32 144, label %20
i32 142, label %21
i32 139, label %22
i32 138, label %23
i32 137, label %24
i32 135, label %25
]
5: ; preds = %1
store i32 1200, i32* %2
br label %27
6: ; preds = %1
store i32 2400, i32* %2
br label %27
7: ; preds = %1
store i32 4800, i32* %2
br label %27
8: ; preds = %1
store i32 9600, i32* %2
br label %27
9: ; preds = %1
store i32 19200, i32* %2
br label %27
10: ; preds = %1
store i32 38400, i32* %2
br label %27
11: ; preds = %1
store i32 57600, i32* %2
br label %27
12: ; preds = %1
store i32 115200, i32* %2
br label %27
13: ; preds = %1
store i32 230400, i32* %2
br label %27
14: ; preds = %1
store i32 460800, i32* %2
br label %27
15: ; preds = %1
store i32 500000, i32* %2
br label %27
16: ; preds = %1
store i32 576000, i32* %2
br label %27
17: ; preds = %1
store i32 921600, i32* %2
br label %27
18: ; preds = %1
store i32 1000000, i32* %2
br label %27
19: ; preds = %1
store i32 1152000, i32* %2
br label %27
20: ; preds = %1
store i32 1500000, i32* %2
br label %27
21: ; preds = %1
store i32 2000000, i32* %2
br label %27
22: ; preds = %1
store i32 2500000, i32* %2
br label %27
23: ; preds = %1
store i32 3000000, i32* %2
br label %27
24: ; preds = %1
store i32 3500000, i32* %2
br label %27
25: ; preds = %1
store i32 4000000, i32* %2
br label %27
26: ; preds = %1
store i32 0, i32* %2
br label %27
27: ; preds = %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@switch.table.librpip_uart_config_convert_b2l = [21 x i32] [i32 9600, i32 921600, i32 576000, i32 57600, i32 500000, i32 4800, i32 460800, i32 4000000, i32 38400, i32 3500000, i32 3000000, i32 2500000, i32 2400, i32 230400, i32 2000000, i32 19200, i32 1500000, i32 1200, i32 1152000, i32 115200, i32 1000000]
define i32 @librpip_uart_config_convert_b2l(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 21
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [21 x i32], [21 x i32]* @switch.table.librpip_uart_config_convert_b2l, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}