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


x86 assembly (clang, -O0):
<_parse_baudrate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1138 <_parse_baudrate+0x28>
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <_parse_baudrate+0xfc>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x2580,%eax
je     11ab <_parse_baudrate+0x9b>
jmp    115f <_parse_baudrate+0x4f>
mov    -0x14(%rbp),%eax
sub    $0x4b00,%eax
je     11bc <_parse_baudrate+0xac>
jmp    1172 <_parse_baudrate+0x62>
mov    -0x14(%rbp),%eax
sub    $0x9600,%eax
je     11cd <_parse_baudrate+0xbd>
jmp    1185 <_parse_baudrate+0x75>
mov    -0x14(%rbp),%eax
sub    $0xe100,%eax
je     11de <_parse_baudrate+0xce>
jmp    1198 <_parse_baudrate+0x88>
mov    -0x14(%rbp),%eax
sub    $0x1c200,%eax
je     11ef <_parse_baudrate+0xdf>
jmp    1200 <_parse_baudrate+0xf0>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <_parse_baudrate+0xfc>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <_parse_baudrate+0xfc>
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <_parse_baudrate+0xfc>
mov    0x2df3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <_parse_baudrate+0xfc>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <_parse_baudrate+0xfc>
jmp    1205 <_parse_baudrate+0xf5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_baudrate>:
push   %rbx
test   %rdi,%rdi
je     1140 <_parse_baudrate+0x30>
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
cmp    $0x95ff,%eax
jle    114d <_parse_baudrate+0x3d>
cmp    $0x9600,%eax
je     1164 <_parse_baudrate+0x54>
cmp    $0xe100,%eax
je     116d <_parse_baudrate+0x5d>
cmp    $0x1c200,%eax
jne    1149 <_parse_baudrate+0x39>
mov    0x2e81(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
ret
cmp    $0x2580,%eax
je     1176 <_parse_baudrate+0x66>
cmp    $0x4b00,%eax
jne    1149 <_parse_baudrate+0x39>
mov    0x2e8e(%rip),%rax
jmp    1147 <_parse_baudrate+0x37>
mov    0x2e4d(%rip),%rax
jmp    1147 <_parse_baudrate+0x37>
mov    0x2e64(%rip),%rax
jmp    1147 <_parse_baudrate+0x37>
mov    0x2e63(%rip),%rax
jmp    1147 <_parse_baudrate+0x37>

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

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) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i32, i32* @B115200
br label %17
5: ; preds = %1
%6 = tail call i32 @strtol(i8* nocapture %0, i32* null, i32 10)
switch i32 %6, label %17 [
i32 9600, label %7
i32 19200, label %9
i32 38400, label %11
i32 57600, label %13
i32 115200, label %15
]
7: ; preds = %5
%8 = load i32, i32* @B9600
br label %17
9: ; preds = %5
%10 = load i32, i32* @B19200
br label %17
11: ; preds = %5
%12 = load i32, i32* @B38400
br label %17
13: ; preds = %5
%14 = load i32, i32* @B57600
br label %17
15: ; preds = %5
%16 = load i32, i32* @B115200
br label %17
17: ; preds = %5, %15, %13, %11, %9, %7, %3
%18 = phi i32 [ %4, %3 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ 0, %5 ]
ret i32 %18
}