#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 */
struct termios {
  int c_iflag;
  int *c_cc;
  unsigned short c_cflag;
  scalar_t__ c_line;
  scalar_t__ c_lflag;
  scalar_t__ c_oflag;
};

/* Variables and functions */
unsigned short B1200;
unsigned short B2400;
unsigned short B4800;
unsigned short B9600;
unsigned short CLOCAL;
unsigned short CREAD;
unsigned short HUPCL;
int IGNBRK;
int IGNPAR;
int /*<<< orphan*/ TCSAFLUSH;
size_t VMIN;
size_t VTIME;
int errno;
scalar_t__ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ usleep(int);
int write(int, char *, int);
int _setspeed(int fd, int old, int new, int needtowrite, unsigned short flags) {
  struct termios tty;
  char *c;
  int err = 0;
  flags |= CREAD | CLOCAL | HUPCL;
  if (tcgetattr(fd, &tty))
    return errno;
  tty.c_iflag = IGNBRK | IGNPAR;
  tty.c_oflag = 0;
  tty.c_lflag = 0;
  tty.c_line = 0;
  tty.c_cc[VTIME] = 0;
  tty.c_cc[VMIN] = 1;
  switch (old) {
  case 9600:
    tty.c_cflag = flags | B9600;
    break;
  case 4800:
    tty.c_cflag = flags | B4800;
    break;
  case 2400:
    tty.c_cflag = flags | B2400;
    break;
  case 1200:
  default:
    tty.c_cflag = flags | B1200;
    break;
  }
  if (tcsetattr(fd, TCSAFLUSH, &tty))
    return errno;
  switch (new) {
  case 9600:
    c = "*q";
    tty.c_cflag = flags | B9600;
    break;
  case 4800:
    c = "*p";
    tty.c_cflag = flags | B4800;
    break;
  case 2400:
    c = "*o";
    tty.c_cflag = flags | B2400;
    break;
  case 1200:
  default:
    c = "*n";
    tty.c_cflag = flags | B1200;
    break;
  }
  if (needtowrite) {
    err = 2 - write(fd, c, 2);
  }
  usleep(100000);
  if (tcsetattr(fd, TCSAFLUSH, &tty))
    return errno;
  return err;
}


x86 assembly (clang, -O0):
<_setspeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %r8w,%ax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %ax,-0x16(%rbp)
movl   $0x0,-0x54(%rbp)
mov    0x2e66(%rip),%rax
movzwl (%rax),%ecx
mov    0x2e04(%rip),%rax
movzwl (%rax),%eax
or     %eax,%ecx
mov    0x2e10(%rip),%rax
movzwl (%rax),%eax
or     %eax,%ecx
movzwl -0x16(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x16(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x48(%rbp),%rsi
call   1040 <tcgetattr@plt>
cmp    $0x0,%rax
je     11b6 <_setspeed+0x76>
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1438 <_setspeed+0x2f8>
mov    0x2de3(%rip),%rax
mov    (%rax),%eax
mov    0x2dc2(%rip),%rcx
mov    (%rcx),%ecx
or     %ecx,%eax
mov    %eax,-0x48(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x40(%rbp),%rax
mov    0x2da8(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x40(%rbp),%rax
mov    0x2dc3(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
mov    %eax,-0x58(%rbp)
sub    $0x4b0,%eax
je     12a9 <_setspeed+0x169>
jmp    1225 <_setspeed+0xe5>
mov    -0x58(%rbp),%eax
sub    $0x960,%eax
je     1290 <_setspeed+0x150>
jmp    1238 <_setspeed+0xf8>
mov    -0x58(%rbp),%eax
sub    $0x12c0,%eax
je     1277 <_setspeed+0x137>
jmp    124b <_setspeed+0x10b>
mov    -0x58(%rbp),%eax
sub    $0x2580,%eax
jne    12ae <_setspeed+0x16e>
jmp    125e <_setspeed+0x11e>
movzwl -0x16(%rbp),%eax
mov    0x2d6f(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
jmp    12c2 <_setspeed+0x182>
movzwl -0x16(%rbp),%eax
mov    0x2d5e(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
jmp    12c2 <_setspeed+0x182>
movzwl -0x16(%rbp),%eax
mov    0x2d1d(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
jmp    12c2 <_setspeed+0x182>
jmp    12ae <_setspeed+0x16e>
movzwl -0x16(%rbp),%eax
mov    0x2cef(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
lea    -0x48(%rbp),%rdx
call   1050 <tcsetattr@plt>
cmp    $0x0,%rax
je     12f2 <_setspeed+0x1b2>
mov    0x2cc8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1438 <_setspeed+0x2f8>
mov    -0x10(%rbp),%eax
mov    %eax,-0x5c(%rbp)
sub    $0x4b0,%eax
je     13ad <_setspeed+0x26d>
jmp    1308 <_setspeed+0x1c8>
mov    -0x5c(%rbp),%eax
sub    $0x960,%eax
je     1389 <_setspeed+0x249>
jmp    131b <_setspeed+0x1db>
mov    -0x5c(%rbp),%eax
sub    $0x12c0,%eax
je     1365 <_setspeed+0x225>
jmp    132e <_setspeed+0x1ee>
mov    -0x5c(%rbp),%eax
sub    $0x2580,%eax
jne    13b2 <_setspeed+0x272>
jmp    1341 <_setspeed+0x201>
lea    0xcb8(%rip),%rax
mov    %rax,-0x50(%rbp)
movzwl -0x16(%rbp),%eax
mov    0x2c81(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
jmp    13d1 <_setspeed+0x291>
lea    0xc97(%rip),%rax
mov    %rax,-0x50(%rbp)
movzwl -0x16(%rbp),%eax
mov    0x2c65(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
jmp    13d1 <_setspeed+0x291>
lea    0xc76(%rip),%rax
mov    %rax,-0x50(%rbp)
movzwl -0x16(%rbp),%eax
mov    0x2c19(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
jmp    13d1 <_setspeed+0x291>
jmp    13b2 <_setspeed+0x272>
lea    0xc50(%rip),%rax
mov    %rax,-0x50(%rbp)
movzwl -0x16(%rbp),%eax
mov    0x2be0(%rip),%rcx
movzwl (%rcx),%ecx
or     %ecx,%eax
mov    %ax,-0x38(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     13f8 <_setspeed+0x2b8>
mov    -0x8(%rbp),%edi
mov    -0x50(%rbp),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
mov    %eax,%ecx
mov    $0x2,%eax
sub    %ecx,%eax
mov    %eax,-0x54(%rbp)
mov    $0x186a0,%edi
call   1060 <usleep@plt>
mov    -0x8(%rbp),%edi
mov    0x2bdc(%rip),%rax
mov    (%rax),%esi
lea    -0x48(%rbp),%rdx
call   1050 <tcsetattr@plt>
cmp    $0x0,%rax
je     1432 <_setspeed+0x2f2>
mov    0x2b88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1438 <_setspeed+0x2f8>
mov    -0x54(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_setspeed>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8d,%ebp
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%r12d
mov    0x2e6d(%rip),%rax
mov    0x2e0e(%rip),%rcx
mov    0x2e1f(%rip),%rdx
or     (%rax),%bp
or     (%rcx),%bp
or     (%rdx),%bp
lea    0x8(%rsp),%rsi
call   1040 <tcgetattr@plt>
test   %rax,%rax
jne    12df <_setspeed+0x19f>
mov    0x2e0c(%rip),%rax
mov    0x2ded(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x8(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
movq   $0x0,0x30(%rsp)
mov    0x10(%rsp),%rax
mov    0x2dd8(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2df7(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
cmp    $0x960,%ebx
je     11fc <_setspeed+0xbc>
cmp    $0x2580,%ebx
je     1205 <_setspeed+0xc5>
cmp    $0x12c0,%ebx
jne    120e <_setspeed+0xce>
mov    0x2de6(%rip),%rax
jmp    1215 <_setspeed+0xd5>
mov    0x2db5(%rip),%rax
jmp    1215 <_setspeed+0xd5>
mov    0x2dcc(%rip),%rax
jmp    1215 <_setspeed+0xd5>
mov    0x2d93(%rip),%rax
movzwl (%rax),%eax
or     %bp,%ax
mov    %ax,0x18(%rsp)
mov    0x2dc1(%rip),%r13
mov    0x0(%r13),%esi
lea    0x8(%rsp),%rdx
mov    %r12d,%edi
call   1050 <tcsetattr@plt>
test   %rax,%rax
jne    12df <_setspeed+0x19f>
cmp    $0x960,%r15d
je     126c <_setspeed+0x12c>
cmp    $0x2580,%r15d
je     127c <_setspeed+0x13c>
cmp    $0x12c0,%r15d
jne    128c <_setspeed+0x14c>
lea    0xda0(%rip),%rsi
mov    0x2d76(%rip),%rax
jmp    129a <_setspeed+0x15a>
lea    0xd93(%rip),%rsi
mov    0x2d3e(%rip),%rax
jmp    129a <_setspeed+0x15a>
lea    0xd7d(%rip),%rsi
mov    0x2d4e(%rip),%rax
jmp    129a <_setspeed+0x15a>
lea    0xd76(%rip),%rsi
mov    0x2d0e(%rip),%rax
or     (%rax),%bp
mov    %bp,0x18(%rsp)
test   %r14d,%r14d
je     12bd <_setspeed+0x17d>
mov    $0x2,%ebx
mov    %r12d,%edi
mov    $0x2,%edx
call   1030 <write@plt>
sub    %eax,%ebx
jmp    12bf <_setspeed+0x17f>
xor    %ebx,%ebx
mov    $0x186a0,%edi
call   1060 <usleep@plt>
mov    0x0(%r13),%esi
lea    0x8(%rsp),%rdx
mov    %r12d,%edi
call   1050 <tcsetattr@plt>
test   %rax,%rax
je     12e8 <_setspeed+0x1a8>
mov    0x2cca(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32*, i16, i64, i64, i64 }
@CREAD = global i16 0
@CLOCAL = global i16 0
@HUPCL = global i16 0
@errno = global i32 0
@IGNBRK = global i32 0
@IGNPAR = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@B9600 = global i16 0
@B4800 = global i16 0
@B2400 = global i16 0
@B1200 = global i16 0
@TCSAFLUSH = global i32 0
@.str = [3 x i8] c"*q\00"
@.str.1 = [3 x i8] c"*p\00"
@.str.2 = [3 x i8] c"*o\00"
@.str.3 = [3 x i8] c"*n\00"
define i32 @_setspeed(i32 %0, i32 %1, i32 %2, i32 %3, i16 zeroext %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i16
%12 = alloca %struct.termios
%13 = alloca i8*
%14 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i16 %4, i16* %11
store i32 0, i32* %14
%15 = load i16, i16* @CREAD
%16 = zext i16 %15 to i32
%17 = load i16, i16* @CLOCAL
%18 = zext i16 %17 to i32
%19 = or i32 %16, %18
%20 = load i16, i16* @HUPCL
%21 = zext i16 %20 to i32
%22 = or i32 %19, %21
%23 = load i16, i16* %11
%24 = zext i16 %23 to i32
%25 = or i32 %24, %22
%26 = trunc i32 %25 to i16
store i16 %26, i16* %11
%27 = load i32, i32* %7
%28 = call i64 @tcgetattr(i32 %27, %struct.termios* %12)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %5
%31 = load i32, i32* @errno
store i32 %31, i32* %6
br label %142
32: ; preds = %5
%33 = load i32, i32* @IGNBRK
%34 = load i32, i32* @IGNPAR
%35 = or i32 %33, %34
%36 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 0
store i32 %35, i32* %36
%37 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 5
store i64 0, i64* %37
%38 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 4
store i64 0, i64* %38
%39 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 3
store i64 0, i64* %39
%40 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 1
%41 = load i32*, i32** %40
%42 = load i64, i64* @VTIME
%43 = getelementptr inbounds i32, i32* %41, i64 %42
store i32 0, i32* %43
%44 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 1
%45 = load i32*, i32** %44
%46 = load i64, i64* @VMIN
%47 = getelementptr inbounds i32, i32* %45, i64 %46
store i32 1, i32* %47
%48 = load i32, i32* %8
switch i32 %48, label %74 [
i32 9600, label %49
i32 4800, label %57
i32 2400, label %65
i32 1200, label %73
]
49: ; preds = %32
%50 = load i16, i16* %11
%51 = zext i16 %50 to i32
%52 = load i16, i16* @B9600
%53 = zext i16 %52 to i32
%54 = or i32 %51, %53
%55 = trunc i32 %54 to i16
%56 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %55, i16* %56
br label %82
57: ; preds = %32
%58 = load i16, i16* %11
%59 = zext i16 %58 to i32
%60 = load i16, i16* @B4800
%61 = zext i16 %60 to i32
%62 = or i32 %59, %61
%63 = trunc i32 %62 to i16
%64 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %63, i16* %64
br label %82
65: ; preds = %32
%66 = load i16, i16* %11
%67 = zext i16 %66 to i32
%68 = load i16, i16* @B2400
%69 = zext i16 %68 to i32
%70 = or i32 %67, %69
%71 = trunc i32 %70 to i16
%72 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %71, i16* %72
br label %82
73: ; preds = %32
br label %74
74: ; preds = %32, %73
%75 = load i16, i16* %11
%76 = zext i16 %75 to i32
%77 = load i16, i16* @B1200
%78 = zext i16 %77 to i32
%79 = or i32 %76, %78
%80 = trunc i32 %79 to i16
%81 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %80, i16* %81
br label %82
82: ; preds = %74, %65, %57, %49
%83 = load i32, i32* %7
%84 = load i32, i32* @TCSAFLUSH
%85 = call i64 @tcsetattr(i32 %83, i32 %84, %struct.termios* %12)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %89
87: ; preds = %82
%88 = load i32, i32* @errno
store i32 %88, i32* %6
br label %142
89: ; preds = %82
%90 = load i32, i32* %9
switch i32 %90, label %116 [
i32 9600, label %91
i32 4800, label %99
i32 2400, label %107
i32 1200, label %115
]
91: ; preds = %89
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %13
%92 = load i16, i16* %11
%93 = zext i16 %92 to i32
%94 = load i16, i16* @B9600
%95 = zext i16 %94 to i32
%96 = or i32 %93, %95
%97 = trunc i32 %96 to i16
%98 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %97, i16* %98
br label %124
99: ; preds = %89
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %13
%100 = load i16, i16* %11
%101 = zext i16 %100 to i32
%102 = load i16, i16* @B4800
%103 = zext i16 %102 to i32
%104 = or i32 %101, %103
%105 = trunc i32 %104 to i16
%106 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %105, i16* %106
br label %124
107: ; preds = %89
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %13
%108 = load i16, i16* %11
%109 = zext i16 %108 to i32
%110 = load i16, i16* @B2400
%111 = zext i16 %110 to i32
%112 = or i32 %109, %111
%113 = trunc i32 %112 to i16
%114 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %113, i16* %114
br label %124
115: ; preds = %89
br label %116
116: ; preds = %89, %115
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %13
%117 = load i16, i16* %11
%118 = zext i16 %117 to i32
%119 = load i16, i16* @B1200
%120 = zext i16 %119 to i32
%121 = or i32 %118, %120
%122 = trunc i32 %121 to i16
%123 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 2
store i16 %122, i16* %123
br label %124
124: ; preds = %116, %107, %99, %91
%125 = load i32, i32* %10
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %132
127: ; preds = %124
%128 = load i32, i32* %7
%129 = load i8*, i8** %13
%130 = call i32 @write(i32 %128, i8* %129, i32 2)
%131 = sub nsw i32 2, %130
store i32 %131, i32* %14
br label %132
132: ; preds = %127, %124
%133 = call i32 @usleep(i32 100000)
%134 = load i32, i32* %7
%135 = load i32, i32* @TCSAFLUSH
%136 = call i64 @tcsetattr(i32 %134, i32 %135, %struct.termios* %12)
%137 = icmp ne i64 %136, 0
br i1 %137, label %138, label %140
138: ; preds = %132
%139 = load i32, i32* @errno
store i32 %139, i32* %6
br label %142
140: ; preds = %132
%141 = load i32, i32* %14
store i32 %141, i32* %6
br label %142
142: ; preds = %140, %138, %87, %30
%143 = load i32, i32* %6
ret i32 %143
}

LLVM IR (-O2):
%struct.termios = type { i32, i32*, i16, i64, i64, i64 }
@CREAD = global i16 0
@CLOCAL = global i16 0
@HUPCL = global i16 0
@errno = global i32 0
@IGNBRK = global i32 0
@IGNPAR = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@B9600 = global i16 0
@B4800 = global i16 0
@B2400 = global i16 0
@B1200 = global i16 0
@TCSAFLUSH = global i32 0
@.str = [3 x i8] c"*q\00"
@.str.1 = [3 x i8] c"*p\00"
@.str.2 = [3 x i8] c"*o\00"
@.str.3 = [3 x i8] c"*n\00"
define i32 @_setspeed(i32 %0, i32 %1, i32 %2, i32 %3, i16 zeroext %4) {
%6 = alloca %struct.termios
%7 = bitcast %struct.termios* %6 to i8*
%8 = load i16, i16* @CREAD
%9 = load i16, i16* @CLOCAL
%10 = load i16, i16* @HUPCL
%11 = or i16 %8, %4
%12 = or i16 %11, %9
%13 = or i16 %12, %10
%14 = call i64 @tcgetattr(i32 %0, %struct.termios* %6)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %5
%17 = load i32, i32* @errno
br label %66
18: ; preds = %5
%19 = load i32, i32* @IGNBRK
%20 = load i32, i32* @IGNPAR
%21 = or i32 %20, %19
%22 = getelementptr inbounds %struct.termios, %struct.termios* %6, i64 0, i32 0
store i32 %21, i32* %22
%23 = getelementptr inbounds %struct.termios, %struct.termios* %6, i64 0, i32 3
%24 = getelementptr inbounds %struct.termios, %struct.termios* %6, i64 0, i32 1
%25 = bitcast i64* %23 to i8*
%26 = load i32*, i32** %24
%27 = load i64, i64* @VTIME
%28 = getelementptr inbounds i32, i32* %26, i64 %27
store i32 0, i32* %28
%29 = load i64, i64* @VMIN
%30 = getelementptr inbounds i32, i32* %26, i64 %29
store i32 1, i32* %30
switch i32 %1, label %33 [
i32 9600, label %34
i32 4800, label %31
i32 2400, label %32
]
31: ; preds = %18
br label %34
32: ; preds = %18
br label %34
33: ; preds = %18
br label %34
34: ; preds = %18, %33, %32, %31
%35 = phi i16* [ @B1200, %33 ], [ @B2400, %32 ], [ @B4800, %31 ], [ @B9600, %18 ]
%36 = load i16, i16* %35
%37 = or i16 %36, %13
%38 = getelementptr inbounds %struct.termios, %struct.termios* %6, i64 0, i32 2
store i16 %37, i16* %38
%39 = load i32, i32* @TCSAFLUSH
%40 = call i64 @tcsetattr(i32 %0, i32 %39, %struct.termios* %6)
%41 = icmp eq i64 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %34
%43 = load i32, i32* @errno
br label %66
44: ; preds = %34
switch i32 %2, label %47 [
i32 9600, label %48
i32 4800, label %45
i32 2400, label %46
]
45: ; preds = %44
br label %48
46: ; preds = %44
br label %48
47: ; preds = %44
br label %48
48: ; preds = %44, %47, %46, %45
%49 = phi i16* [ @B1200, %47 ], [ @B2400, %46 ], [ @B4800, %45 ], [ @B9600, %44 ]
%50 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %47 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %46 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %45 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %44 ]
%51 = load i16, i16* %49
%52 = or i16 %51, %13
%53 = getelementptr inbounds %struct.termios, %struct.termios* %6, i64 0, i32 2
store i16 %52, i16* %53
%54 = icmp eq i32 %3, 0
br i1 %54, label %58, label %55
55: ; preds = %48
%56 = call i32 @write(i32 %0, i8* %50, i32 2)
%57 = sub nsw i32 2, %56
br label %58
58: ; preds = %55, %48
%59 = phi i32 [ %57, %55 ], [ 0, %48 ]
%60 = call i32 @usleep(i32 100000)
%61 = load i32, i32* @TCSAFLUSH
%62 = call i64 @tcsetattr(i32 %0, i32 %61, %struct.termios* %6)
%63 = icmp eq i64 %62, 0
%64 = load i32, i32* @errno
%65 = select i1 %63, i32 %59, i32 %64
br label %66
66: ; preds = %58, %42, %16
%67 = phi i32 [ %17, %16 ], [ %43, %42 ], [ %65, %58 ]
ret i32 %67
}