#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 int B115200;
unsigned int B19200;
unsigned int B38400;
unsigned int B57600;
unsigned int B9600;
int strtol(char const *, char **, int);
int _parse_baudrate(const char *arg, unsigned *baudrate) {
  switch (strtol(arg, (char **)NULL, 10)) {
  case 9600:
    *baudrate = B9600;
    break;
  case 19200:
    *baudrate = B19200;
    break;
  case 38400:
    *baudrate = B38400;
    break;
  case 57600:
    *baudrate = B57600;
    break;
  case 115200:
    *baudrate = B115200;
    break;
  default:
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_parse_baudrate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
sub    $0x2580,%eax
je     1193 <_parse_baudrate+0x83>
jmp    1147 <_parse_baudrate+0x37>
mov    -0x1c(%rbp),%eax
sub    $0x4b00,%eax
je     11a7 <_parse_baudrate+0x97>
jmp    115a <_parse_baudrate+0x4a>
mov    -0x1c(%rbp),%eax
sub    $0x9600,%eax
je     11bb <_parse_baudrate+0xab>
jmp    116d <_parse_baudrate+0x5d>
mov    -0x1c(%rbp),%eax
sub    $0xe100,%eax
je     11cf <_parse_baudrate+0xbf>
jmp    1180 <_parse_baudrate+0x70>
mov    -0x1c(%rbp),%eax
sub    $0x1c200,%eax
je     11e3 <_parse_baudrate+0xd3>
jmp    11f7 <_parse_baudrate+0xe7>
mov    0x2e46(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1203 <_parse_baudrate+0xf3>
mov    0x2e42(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1203 <_parse_baudrate+0xf3>
mov    0x2df6(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1203 <_parse_baudrate+0xf3>
mov    0x2e02(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1203 <_parse_baudrate+0xf3>
mov    0x2dde(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1203 <_parse_baudrate+0xf3>
movl   $0xffffffff,-0x4(%rbp)
jmp    120a <_parse_baudrate+0xfa>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_baudrate>:
push   %rbx
mov    %rsi,%rbx
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x95ff,%ecx
jle    1150 <_parse_baudrate+0x40>
cmp    $0x9600,%ecx
je     1169 <_parse_baudrate+0x59>
cmp    $0xe100,%ecx
je     1172 <_parse_baudrate+0x62>
cmp    $0x1c200,%ecx
jne    1188 <_parse_baudrate+0x78>
mov    0x2e7a(%rip),%rax
jmp    1182 <_parse_baudrate+0x72>
cmp    $0x2580,%ecx
je     117b <_parse_baudrate+0x6b>
cmp    $0x4b00,%ecx
jne    1188 <_parse_baudrate+0x78>
mov    0x2e89(%rip),%rax
jmp    1182 <_parse_baudrate+0x72>
mov    0x2e48(%rip),%rax
jmp    1182 <_parse_baudrate+0x72>
mov    0x2e5f(%rip),%rax
jmp    1182 <_parse_baudrate+0x72>
mov    0x2e5e(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
define i32 @_parse_baudrate(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
%6 = load i8*, i8** %4
%7 = call i32 @strtol(i8* %6, i8** null, i32 10)
switch i32 %7, label %23 [
i32 9600, label %8
i32 19200, label %11
i32 38400, label %14
i32 57600, label %17
i32 115200, label %20
]
8: ; preds = %2
%9 = load i32, i32* @B9600
%10 = load i32*, i32** %5
store i32 %9, i32* %10
br label %24
11: ; preds = %2
%12 = load i32, i32* @B19200
%13 = load i32*, i32** %5
store i32 %12, i32* %13
br label %24
14: ; preds = %2
%15 = load i32, i32* @B38400
%16 = load i32*, i32** %5
store i32 %15, i32* %16
br label %24
17: ; preds = %2
%18 = load i32, i32* @B57600
%19 = load i32*, i32** %5
store i32 %18, i32* %19
br label %24
20: ; preds = %2
%21 = load i32, i32* @B115200
%22 = load i32*, i32** %5
store i32 %21, i32* %22
br label %24
23: ; preds = %2
store i32 -1, i32* %3
br label %25
24: ; preds = %20, %17, %14, %11, %8
store i32 0, i32* %3
br label %25
25: ; preds = %24, %23
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
define i32 @_parse_baudrate(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @strtol(i8* nocapture %0, i8** null, i32 10)
switch i32 %3, label %11 [
i32 9600, label %8
i32 19200, label %4
i32 38400, label %5
i32 57600, label %6
i32 115200, label %7
]
4: ; preds = %2
br label %8
5: ; preds = %2
br label %8
6: ; preds = %2
br label %8
7: ; preds = %2
br label %8
8: ; preds = %2, %7, %6, %5, %4
%9 = phi i32* [ @B19200, %4 ], [ @B38400, %5 ], [ @B57600, %6 ], [ @B115200, %7 ], [ @B9600, %2 ]
%10 = load i32, i32* %9
store i32 %10, i32* %1
br label %11
11: ; preds = %8, %2
%12 = phi i32 [ -1, %2 ], [ 0, %8 ]
ret i32 %12
}