#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*/ O_RDWR;
int /*<<< orphan*/ TIOCMBIC;
int /*<<< orphan*/ TIOCMBIS;
int /*<<< orphan*/ TIOCMGET;
int TIOCM_CTS;
int TIOCM_RTS;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ strncat(char *, char *, int);
int main(int argc, char *argv[]) {
  int rtscts = TIOCM_RTS;
  int f;
  char devname[30] = "/dev/";
  if (argc < 3 || argv[2][0] != '-' ||
      !(argv[2][1] == 'e' || argv[2][1] == 'd' || argv[2][1] == 't' ||
        argv[2][1] == 's')) {
    printf("Usage: %s <ttyBFx> <-e|-d|-t|-s>\n\t-e Enable RTS\n\t-d Disable "
           "RTS\n\t-t Test RTS\n\t-s Status of RTS/CTS\n",
           argv[0]);
    return 0;
  }
  strncat(devname, argv[1], 25);
  f = open(devname, O_RDWR);
  if (f < 0) {
    printf("Fail to open %s\n", devname);
    return 0;
  }
  switch (argv[2][1]) {
  case 'e':
    ioctl(f, TIOCMBIS, &rtscts);
    printf("RTS on %s is enabled.\n", devname);
    break;
  case 'd':
    ioctl(f, TIOCMBIC, &rtscts);
    printf("RTS on %s is disabled.\n", devname);
    break;
  case 't':
    printf("Disable RTS on %s for 5 seconds. \nIf you hit any keys, you won't "
           "see them.\n",
           devname);
    ioctl(f, TIOCMBIC, &rtscts);
    sleep(5);
    ioctl(f, TIOCMBIS, &rtscts);
    printf("\nRTS is enabled again. \nYou should see the keys you hit just "
           "now.\n");
    break;
  case 's':
    ioctl(f, TIOCMGET, &rtscts);
    if (rtscts & TIOCM_RTS)
      printf("RTS on %s is enabled.\n", devname);
    else
      printf("RTS on %s is disabled.\n", devname);
    if (rtscts & TIOCM_CTS)
      printf("CTS on %s is enabled.\n", devname);
    else
      printf("CTS on %s is disabled.\n", devname);
    break;
  }
  close(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x28(%rbp)
mov    0xeb9(%rip),%ax
mov    %ax,-0x24(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1229 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1229 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x65,%eax
je     124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x64,%eax
je     124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x74,%eax
je     124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x73,%eax
je     124a <main+0xea>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1425 <main+0x2c5>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x19,%edx
call   1050 <strncat@plt>
lea    -0x40(%rbp),%rdi
mov    0x2d7d(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    129d <main+0x13d>
lea    -0x40(%rbp),%rsi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1425 <main+0x2c5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl 0x1(%rax),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x10,%eax
ja     1416 <main+0x2b6>
mov    -0x48(%rbp),%rax
lea    0xd3a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%edi
mov    0x2cef(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdx
call   1040 <ioctl@plt>
lea    -0x40(%rbp),%rsi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1416 <main+0x2b6>
mov    -0x18(%rbp),%edi
mov    0x2cbb(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdx
call   1040 <ioctl@plt>
lea    -0x40(%rbp),%rsi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1416 <main+0x2b6>
lea    -0x40(%rbp),%rsi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
mov    0x2c7d(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdx
call   1040 <ioctl@plt>
mov    $0x5,%edi
call   1080 <sleep@plt>
mov    -0x18(%rbp),%edi
mov    0x2c66(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdx
call   1040 <ioctl@plt>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1416 <main+0x2b6>
mov    -0x18(%rbp),%edi
mov    0x2c4e(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdx
call   1040 <ioctl@plt>
mov    -0x14(%rbp),%eax
mov    0x2c41(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13c1 <main+0x261>
lea    -0x40(%rbp),%rsi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13d3 <main+0x273>
lea    -0x40(%rbp),%rsi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    0x2bdb(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13ff <main+0x29f>
lea    -0x40(%rbp),%rsi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1411 <main+0x2b1>
lea    -0x40(%rbp),%rsi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1416 <main+0x2b6>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
mov    0x2e5e(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0xc(%rsp)
movups 0xece(%rip),%xmm0
movups %xmm0,0x1e(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
cmp    $0x3,%edi
jl     1246 <main+0xd6>
mov    0x10(%rbx),%rax
cmpb   $0x2d,(%rax)
jne    1246 <main+0xd6>
mov    0x1(%rax),%al
add    $0x9c,%al
cmp    $0x10,%al
ja     1246 <main+0xd6>
movzbl %al,%eax
mov    $0x18003,%ecx
bt     %rax,%rcx
jae    1246 <main+0xd6>
mov    0x8(%rbx),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x19,%edx
call   1060 <strncat@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1080 <open@plt>
test   %eax,%eax
js     1262 <main+0xf2>
mov    %eax,%r14d
mov    0x10(%rbx),%rax
movsbl 0x1(%rax),%eax
add    $0xffffff9c,%eax
cmp    $0x10,%eax
ja     1350 <main+0x1e0>
lea    0xde5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdx
mov    %r14d,%edi
call   1050 <ioctl@plt>
lea    0xeb9(%rip),%rdi
jmp    1344 <main+0x1d4>
mov    (%rbx),%rsi
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe69(%rip),%rdi
lea    0x10(%rsp),%rsi
jmp    1250 <main+0xe0>
mov    0x2d51(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdx
mov    %r14d,%edi
call   1050 <ioctl@plt>
lea    0xe56(%rip),%rdi
jmp    1344 <main+0x1d4>
mov    0x2d3f(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rdx
mov    %r14d,%edi
call   1050 <ioctl@plt>
mov    0x0(%rbp),%eax
and    0xc(%rsp),%eax
lea    0xe44(%rip),%rax
lea    0xe26(%rip),%rdi
cmove  %rax,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2ce4(%rip),%rax
mov    (%rax),%eax
test   %eax,0xc(%rsp)
je     133d <main+0x1cd>
lea    0xe7b(%rip),%rdi
jmp    1344 <main+0x1d4>
lea    0xe26(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%esi
lea    0xc(%rsp),%rbx
mov    %r14d,%edi
mov    %rbx,%rdx
call   1050 <ioctl@plt>
mov    $0x5,%edi
call   1090 <sleep@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
mov    %rbx,%rdx
call   1050 <ioctl@plt>
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
jmp    1350 <main+0x1e0>
lea    0xe31(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14d,%edi
call   1070 <close@plt>
jmp    1257 <main+0xe7>

LLVM IR (-O0):
@TIOCM_RTS = global i32 0
@__const.main.devname = [30 x i8] c"/dev/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [100 x i8] c"Usage: %s <ttyBFx> <-e|-d|-t|-s>\0A\09-e Enable RTS\0A\09-d Disable RTS\0A\09-t Test RTS\0A\09-s Status of RTS/CTS\0A\00"
@O_RDWR = global i32 0
@.str.1 = [17 x i8] c"Fail to open %s\0A\00"
@TIOCMBIS = global i32 0
@.str.2 = [23 x i8] c"RTS on %s is enabled.\0A\00"
@TIOCMBIC = global i32 0
@.str.3 = [24 x i8] c"RTS on %s is disabled.\0A\00"
@.str.4 = [76 x i8] c"Disable RTS on %s for 5 seconds. \0AIf you hit any keys, you won't see them.\0A\00"
@.str.5 = [67 x i8] c"\0ARTS is enabled again. \0AYou should see the keys you hit just now.\0A\00"
@TIOCMGET = global i32 0
@TIOCM_CTS = global i32 0
@.str.6 = [23 x i8] c"CTS on %s is enabled.\0A\00"
@.str.7 = [24 x i8] c"CTS on %s is disabled.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [30 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @TIOCM_RTS
store i32 %9, i32* %6
%10 = bitcast [30 x i8]* %8 to i8*
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 3
br i1 %12, label %53, label %13
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 45
br i1 %20, label %53, label %21
21: ; preds = %13
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 101
br i1 %28, label %58, label %29
29: ; preds = %21
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 100
br i1 %36, label %58, label %37
37: ; preds = %29
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 2
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 116
br i1 %44, label %58, label %45
45: ; preds = %37
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 2
%48 = load i8*, i8** %47
%49 = getelementptr inbounds i8, i8* %48, i64 1
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 115
br i1 %52, label %58, label %53
53: ; preds = %45, %13, %2
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 0
%56 = load i8*, i8** %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %56)
store i32 0, i32* %3
br label %131
58: ; preds = %45, %37, %29, %21
%59 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 1
%62 = load i8*, i8** %61
%63 = call i32 @strncat(i8* %59, i8* %62, i32 25)
%64 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%65 = load i32, i32* @O_RDWR
%66 = call i32 @open(i8* %64, i32 %65)
store i32 %66, i32* %7
%67 = load i32, i32* %7
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %58
%70 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %70)
store i32 0, i32* %3
br label %131
72: ; preds = %58
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 2
%75 = load i8*, i8** %74
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
switch i32 %78, label %128 [
i32 101, label %79
i32 100, label %85
i32 116, label %91
i32 115, label %102
]
79: ; preds = %72
%80 = load i32, i32* %7
%81 = load i32, i32* @TIOCMBIS
%82 = call i32 @ioctl(i32 %80, i32 %81, i32* %6)
%83 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %83)
br label %128
85: ; preds = %72
%86 = load i32, i32* %7
%87 = load i32, i32* @TIOCMBIC
%88 = call i32 @ioctl(i32 %86, i32 %87, i32* %6)
%89 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %89)
br label %128
91: ; preds = %72
%92 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.4, i64 0, i64 0), i8* %92)
%94 = load i32, i32* %7
%95 = load i32, i32* @TIOCMBIC
%96 = call i32 @ioctl(i32 %94, i32 %95, i32* %6)
%97 = call i32 @sleep(i32 5)
%98 = load i32, i32* %7
%99 = load i32, i32* @TIOCMBIS
%100 = call i32 @ioctl(i32 %98, i32 %99, i32* %6)
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.5, i64 0, i64 0))
br label %128
102: ; preds = %72
%103 = load i32, i32* %7
%104 = load i32, i32* @TIOCMGET
%105 = call i32 @ioctl(i32 %103, i32 %104, i32* %6)
%106 = load i32, i32* %6
%107 = load i32, i32* @TIOCM_RTS
%108 = and i32 %106, %107
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %102
%111 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %111)
br label %116
113: ; preds = %102
%114 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %114)
br label %116
116: ; preds = %113, %110
%117 = load i32, i32* %6
%118 = load i32, i32* @TIOCM_CTS
%119 = and i32 %117, %118
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %124
121: ; preds = %116
%122 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %122)
br label %127
124: ; preds = %116
%125 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* %125)
br label %127
127: ; preds = %124, %121
br label %128
128: ; preds = %72, %127, %91, %85, %79
%129 = load i32, i32* %7
%130 = call i32 @close(i32 %129)
store i32 0, i32* %3
br label %131
131: ; preds = %128, %69, %53
%132 = load i32, i32* %3
ret i32 %132
}

LLVM IR (-O2):
@TIOCM_RTS = global i32 0
@__const.main.devname = [30 x i8] c"/dev/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [100 x i8] c"Usage: %s <ttyBFx> <-e|-d|-t|-s>\0A\09-e Enable RTS\0A\09-d Disable RTS\0A\09-t Test RTS\0A\09-s Status of RTS/CTS\0A\00"
@O_RDWR = global i32 0
@.str.1 = [17 x i8] c"Fail to open %s\0A\00"
@TIOCMBIS = global i32 0
@.str.2 = [23 x i8] c"RTS on %s is enabled.\0A\00"
@TIOCMBIC = global i32 0
@.str.3 = [24 x i8] c"RTS on %s is disabled.\0A\00"
@.str.4 = [76 x i8] c"Disable RTS on %s for 5 seconds. \0AIf you hit any keys, you won't see them.\0A\00"
@TIOCMGET = global i32 0
@TIOCM_CTS = global i32 0
@.str.6 = [23 x i8] c"CTS on %s is enabled.\0A\00"
@.str.7 = [24 x i8] c"CTS on %s is disabled.\0A\00"
@str = [66 x i8] c"\0ARTS is enabled again. \0AYou should see the keys you hit just now.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [30 x i8]
%5 = bitcast i32* %3 to i8*
%6 = load i32, i32* @TIOCM_RTS
store i32 %6, i32* %3
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%8 = icmp slt i32 %0, 3
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 45
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = load i8, i8* %15
switch i8 %16, label %17 [
i8 101, label %20
i8 100, label %20
i8 116, label %20
i8 115, label %20
]
17: ; preds = %14, %9, %2
%18 = load i8*, i8** %1
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %18)
br label %69
20: ; preds = %14, %14, %14, %14
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @strncat(i8* %7, i8* %22, i32 25)
%24 = load i32, i32* @O_RDWR
%25 = call i32 @open(i8* %7, i32 %24)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %69
29: ; preds = %20
%30 = load i8*, i8** %10
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
switch i32 %33, label %67 [
i32 101, label %34
i32 100, label %38
i32 116, label %42
i32 115, label %50
]
34: ; preds = %29
%35 = load i32, i32* @TIOCMBIS
%36 = call i32 @ioctl(i32 %25, i32 %35, i32* %3)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %7)
br label %67
38: ; preds = %29
%39 = load i32, i32* @TIOCMBIC
%40 = call i32 @ioctl(i32 %25, i32 %39, i32* %3)
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %7)
br label %67
42: ; preds = %29
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%44 = load i32, i32* @TIOCMBIC
%45 = call i32 @ioctl(i32 %25, i32 %44, i32* %3)
%46 = call i32 @sleep(i32 5)
%47 = load i32, i32* @TIOCMBIS
%48 = call i32 @ioctl(i32 %25, i32 %47, i32* %3)
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
br label %67
50: ; preds = %29
%51 = load i32, i32* @TIOCMGET
%52 = call i32 @ioctl(i32 %25, i32 %51, i32* %3)
%53 = load i32, i32* %3
%54 = load i32, i32* @TIOCM_RTS
%55 = and i32 %54, %53
%56 = icmp eq i32 %55, 0
%57 = select i1 %56, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0)
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %57, i8* %7)
%59 = load i32, i32* %3
%60 = load i32, i32* @TIOCM_CTS
%61 = and i32 %60, %59
%62 = icmp eq i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %50
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %7)
br label %67
65: ; preds = %50
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i8* %7)
br label %67
67: ; preds = %63, %65, %29, %42, %38, %34
%68 = call i32 @close(i32 %25)
br label %69
69: ; preds = %67, %27, %17
ret i32 0
}