#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*/ carmen_serial_setparms(int, char *, char *, char *,
                                          int /*<<< orphan*/,
                                          int /*<<< orphan*/);
void carmen_serial_configure(int dev_fd, int baudrate, char *parity) {
  switch (baudrate) {
  case 9600:
    carmen_serial_setparms(dev_fd, "9600", parity, "8", 0, 0);
    break;
  case 19200:
    carmen_serial_setparms(dev_fd, "19200", parity, "8", 0, 0);
    break;
  case 38400:
    carmen_serial_setparms(dev_fd, "38400", parity, "8", 0, 0);
    break;
  case 57600:
  case 55555:
    carmen_serial_setparms(dev_fd, "57600", parity, "8", 0, 0);
    break;
  case 115200:
    carmen_serial_setparms(dev_fd, "115200", parity, "8", 0, 0);
  case 500000:
    carmen_serial_setparms(dev_fd, "500000", parity, "8", 0, 0);
    break;
  }
}


x86 assembly (clang, -O0):
<carmen_serial_configure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x2580,%eax
je     11aa <carmen_serial_configure+0x9a>
jmp    1138 <carmen_serial_configure+0x28>
mov    -0x14(%rbp),%eax
sub    $0x4b00,%eax
je     11cf <carmen_serial_configure+0xbf>
jmp    114b <carmen_serial_configure+0x3b>
mov    -0x14(%rbp),%eax
sub    $0x9600,%eax
je     11f4 <carmen_serial_configure+0xe4>
jmp    115e <carmen_serial_configure+0x4e>
mov    -0x14(%rbp),%eax
sub    $0xd903,%eax
je     1219 <carmen_serial_configure+0x109>
jmp    1171 <carmen_serial_configure+0x61>
mov    -0x14(%rbp),%eax
sub    $0xe100,%eax
je     1219 <carmen_serial_configure+0x109>
jmp    1184 <carmen_serial_configure+0x74>
mov    -0x14(%rbp),%eax
sub    $0x1c200,%eax
je     123e <carmen_serial_configure+0x12e>
jmp    1197 <carmen_serial_configure+0x87>
mov    -0x14(%rbp),%eax
sub    $0x7a120,%eax
je     125e <carmen_serial_configure+0x14e>
jmp    127e <carmen_serial_configure+0x16e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe48(%rip),%rsi
lea    0xe46(%rip),%rcx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <carmen_serial_setparms@plt>
jmp    127e <carmen_serial_configure+0x16e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe2a(%rip),%rsi
lea    0xe21(%rip),%rcx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <carmen_serial_setparms@plt>
jmp    127e <carmen_serial_configure+0x16e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe0b(%rip),%rsi
lea    0xdfc(%rip),%rcx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <carmen_serial_setparms@plt>
jmp    127e <carmen_serial_configure+0x16e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xdec(%rip),%rsi
lea    0xdd7(%rip),%rcx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <carmen_serial_setparms@plt>
jmp    127e <carmen_serial_configure+0x16e>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xdcd(%rip),%rsi
lea    0xdb2(%rip),%rcx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <carmen_serial_setparms@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xdb4(%rip),%rsi
lea    0xd92(%rip),%rcx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <carmen_serial_setparms@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carmen_serial_configure>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %edi,%ebp
cmp    $0xd902,%esi
jle    1141 <carmen_serial_configure+0x31>
cmp    $0x1c1ff,%esi
jg     1162 <carmen_serial_configure+0x52>
cmp    $0xd903,%esi
je     1138 <carmen_serial_configure+0x28>
cmp    $0xe100,%esi
jne    1172 <carmen_serial_configure+0x62>
lea    0xed4(%rip),%rsi
jmp    11b0 <carmen_serial_configure+0xa0>
cmp    $0x2580,%esi
je     1179 <carmen_serial_configure+0x69>
cmp    $0x4b00,%esi
je     11a9 <carmen_serial_configure+0x99>
cmp    $0x9600,%esi
jne    1172 <carmen_serial_configure+0x62>
lea    0xead(%rip),%rsi
jmp    11b0 <carmen_serial_configure+0xa0>
cmp    $0x1c200,%esi
je     1182 <carmen_serial_configure+0x72>
cmp    $0x7a120,%esi
je     11a0 <carmen_serial_configure+0x90>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe80(%rip),%rsi
jmp    11b0 <carmen_serial_configure+0xa0>
lea    0xe90(%rip),%rsi
lea    0xe75(%rip),%rcx
mov    %ebp,%edi
mov    %rbx,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <carmen_serial_setparms@plt>
lea    0xe79(%rip),%rsi
jmp    11b0 <carmen_serial_configure+0xa0>
lea    0xe57(%rip),%rsi
lea    0xe4e(%rip),%rcx
mov    %ebp,%edi
mov    %rbx,%rdx
xor    %r8d,%r8d
xor    %r9d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <carmen_serial_setparms@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"9600\00"
@.str.1 = [2 x i8] c"8\00"
@.str.2 = [6 x i8] c"19200\00"
@.str.3 = [6 x i8] c"38400\00"
@.str.4 = [6 x i8] c"57600\00"
@.str.5 = [7 x i8] c"115200\00"
@.str.6 = [7 x i8] c"500000\00"
define void @carmen_serial_configure(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
switch i32 %7, label %32 [
i32 9600, label %8
i32 19200, label %12
i32 38400, label %16
i32 57600, label %20
i32 55555, label %20
i32 115200, label %24
i32 500000, label %28
]
8: ; preds = %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %6
%11 = call i32 @carmen_serial_setparms(i32 %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %32
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i8*, i8** %6
%15 = call i32 @carmen_serial_setparms(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %32
16: ; preds = %3
%17 = load i32, i32* %4
%18 = load i8*, i8** %6
%19 = call i32 @carmen_serial_setparms(i32 %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %32
20: ; preds = %3, %3
%21 = load i32, i32* %4
%22 = load i8*, i8** %6
%23 = call i32 @carmen_serial_setparms(i32 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %32
24: ; preds = %3
%25 = load i32, i32* %4
%26 = load i8*, i8** %6
%27 = call i32 @carmen_serial_setparms(i32 %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %28
28: ; preds = %3, %24
%29 = load i32, i32* %4
%30 = load i8*, i8** %6
%31 = call i32 @carmen_serial_setparms(i32 %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %32
32: ; preds = %3, %28, %20, %16, %12, %8
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"9600\00"
@.str.1 = [2 x i8] c"8\00"
@.str.2 = [6 x i8] c"19200\00"
@.str.3 = [6 x i8] c"38400\00"
@.str.4 = [6 x i8] c"57600\00"
@.str.5 = [7 x i8] c"115200\00"
@.str.6 = [7 x i8] c"500000\00"
define void @carmen_serial_configure(i32 %0, i32 %1, i8* %2) {
switch i32 %1, label %13 [
i32 9600, label %10
i32 19200, label %4
i32 38400, label %5
i32 57600, label %6
i32 55555, label %6
i32 115200, label %7
i32 500000, label %9
]
4: ; preds = %3
br label %10
5: ; preds = %3
br label %10
6: ; preds = %3, %3
br label %10
7: ; preds = %3
%8 = tail call i32 @carmen_serial_setparms(i32 %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %9
9: ; preds = %3, %7
br label %10
10: ; preds = %3, %4, %5, %6, %9
%11 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %3 ]
%12 = tail call i32 @carmen_serial_setparms(i32 %0, i8* %11, i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0)
br label %13
13: ; preds = %10, %3
ret void
}