#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) {
  if (arg == NULL) {
    *baudrate = B115200;
    return 0;
  }
  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)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <_parse_baudrate+0x36>
mov    0x2e96(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1230 <_parse_baudrate+0x120>
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     11b9 <_parse_baudrate+0xa9>
jmp    116d <_parse_baudrate+0x5d>
mov    -0x1c(%rbp),%eax
sub    $0x4b00,%eax
je     11cd <_parse_baudrate+0xbd>
jmp    1180 <_parse_baudrate+0x70>
mov    -0x1c(%rbp),%eax
sub    $0x9600,%eax
je     11e1 <_parse_baudrate+0xd1>
jmp    1193 <_parse_baudrate+0x83>
mov    -0x1c(%rbp),%eax
sub    $0xe100,%eax
je     11f5 <_parse_baudrate+0xe5>
jmp    11a6 <_parse_baudrate+0x96>
mov    -0x1c(%rbp),%eax
sub    $0x1c200,%eax
je     1209 <_parse_baudrate+0xf9>
jmp    121d <_parse_baudrate+0x10d>
mov    0x2e20(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1229 <_parse_baudrate+0x119>
mov    0x2e1c(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1229 <_parse_baudrate+0x119>
mov    0x2dd0(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1229 <_parse_baudrate+0x119>
mov    0x2ddc(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1229 <_parse_baudrate+0x119>
mov    0x2db8(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1229 <_parse_baudrate+0x119>
movl   $0xffffffff,-0x4(%rbp)
jmp    1230 <_parse_baudrate+0x120>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_baudrate>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    0x2eaa(%rip),%rbx
test   %rdi,%rdi
je     118a <_parse_baudrate+0x7a>
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x95ff,%ecx
jle    1158 <_parse_baudrate+0x48>
cmp    $0x9600,%ecx
je     1171 <_parse_baudrate+0x61>
cmp    $0xe100,%ecx
je     117a <_parse_baudrate+0x6a>
cmp    $0x1c200,%ecx
je     118a <_parse_baudrate+0x7a>
jmp    1191 <_parse_baudrate+0x81>
cmp    $0x2580,%ecx
je     1183 <_parse_baudrate+0x73>
cmp    $0x4b00,%ecx
jne    1191 <_parse_baudrate+0x81>
mov    0x2e81(%rip),%rbx
jmp    118a <_parse_baudrate+0x7a>
mov    0x2e40(%rip),%rbx
jmp    118a <_parse_baudrate+0x7a>
mov    0x2e57(%rip),%rbx
jmp    118a <_parse_baudrate+0x7a>
mov    0x2e56(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@B115200 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = 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 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @B115200
%10 = load i32*, i32** %5
store i32 %9, i32* %10
store i32 0, i32* %3
br label %31
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @strtol(i8* %12, i8** null, i32 10)
switch i32 %13, label %29 [
i32 9600, label %14
i32 19200, label %17
i32 38400, label %20
i32 57600, label %23
i32 115200, label %26
]
14: ; preds = %11
%15 = load i32, i32* @B9600
%16 = load i32*, i32** %5
store i32 %15, i32* %16
br label %30
17: ; preds = %11
%18 = load i32, i32* @B19200
%19 = load i32*, i32** %5
store i32 %18, i32* %19
br label %30
20: ; preds = %11
%21 = load i32, i32* @B38400
%22 = load i32*, i32** %5
store i32 %21, i32* %22
br label %30
23: ; preds = %11
%24 = load i32, i32* @B57600
%25 = load i32*, i32** %5
store i32 %24, i32* %25
br label %30
26: ; preds = %11
%27 = load i32, i32* @B115200
%28 = load i32*, i32** %5
store i32 %27, i32* %28
br label %30
29: ; preds = %11
store i32 -1, i32* %3
br label %31
30: ; preds = %26, %23, %20, %17, %14
store i32 0, i32* %3
br label %31
31: ; preds = %30, %29, %8
%32 = load i32, i32* %3
ret i32 %32
}

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