#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_cc;
  scalar_t__ c_lflag;
  scalar_t__ c_oflag;
  int /*<<< orphan*/ c_iflag;
  int /*<<< orphan*/ c_cflag;
};
typedef int /*<<< orphan*/ io;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ B115200;
int /*<<< orphan*/ CLOCAL;
int /*<<< orphan*/ CREAD;
int /*<<< orphan*/ CS8;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ IGNPAR;
int O_NDELAY;
int O_NONBLOCK;
int O_RDWR;
int /*<<< orphan*/ TCIFLUSH;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ memset(struct termios *, int /*<<< orphan*/, int);
int open(char *, int);
char *optarg;
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ printf(char *, ...);
int strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int write(int, unsigned char *, int);
int main(int argc, char *argv[]) {
  int fd;
  int ret;
  unsigned char buf[4] = {0xf1, 0x0, 0x0, 0xf2};
  struct termios io;
  char *fd_buf;
  int opt;
  unsigned int commandline_option = 0;
  if (argc <= 1) {
    print_help();
    exit(EXIT_FAILURE);
  }
  while ((opt = getopt(argc, argv, "hi:f:")) != -1) {
    switch (opt) {
    case 'i':
      commandline_option |= 0b0000001;
      buf[1] = (unsigned char)((strtol(optarg, NULL, 16) & 0xff00) >> 8);
      buf[2] = (unsigned char)strtol(optarg, NULL, 16) & 0x00ff;
      printf("Set %x%x%x%x\n", buf[0], buf[1], buf[2], buf[3]);
      break;
    case 'f':
      commandline_option |= 0b0000010;
      fd_buf = optarg;
      printf("tty: %s\n", fd_buf);
      break;
    default:
      print_help();
      exit(EXIT_FAILURE);
    }
  }
  if (commandline_option & 0b0000010) {
    fd = open(fd_buf, O_RDWR | O_NONBLOCK | O_NDELAY);
  } else {
    fd = open("/dev/ttyPIFctrl", O_RDWR | O_NONBLOCK | O_NDELAY);
  }
  memset(&io, 0, sizeof(io));
  io.c_cflag = B115200;
  io.c_cflag |= CS8;
  io.c_cflag |= CLOCAL;
  io.c_cflag |= CREAD;
  io.c_iflag = IGNPAR;
  io.c_oflag = 0;
  io.c_lflag = 0;
  io.c_cc[VTIME] = 0;
  io.c_cc[VMIN] = 1;
  tcflush(fd, TCIFLUSH);
  tcsetattr(fd, TCSANOW, &io);
  ret = write(fd, buf, sizeof(buf));
  if (ret < 0) {
    printf("error: code(%d)\n", ret);
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xe34(%rip),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x50(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     11f5 <main+0x45>
mov    $0x0,%al
call   10c0 <print_help@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
jmp    11fa <main+0x4a>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdfc(%rip),%rdx
call   10b0 <getopt@plt>
mov    %eax,-0x4c(%rbp)
cmp    $0xffffffff,%eax
je     12f9 <main+0x149>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x54(%rbp)
sub    $0x66,%eax
je     12b1 <main+0x101>
jmp    122d <main+0x7d>
mov    -0x54(%rbp),%eax
sub    $0x69,%eax
jne    12df <main+0x12f>
jmp    123e <main+0x8e>
mov    -0x50(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    0x2daa(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1080 <strtol@plt>
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,-0x1b(%rbp)
mov    0x2d87(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1080 <strtol@plt>
movzbl %al,%eax
and    $0xff,%eax
mov    %al,-0x1a(%rbp)
movzbl -0x1c(%rbp),%esi
movzbl -0x1b(%rbp),%edx
movzbl -0x1a(%rbp),%ecx
movzbl -0x19(%rbp),%r8d
lea    0xd65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12f4 <main+0x144>
mov    -0x50(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x50(%rbp)
mov    0x2d37(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12f4 <main+0x144>
mov    $0x0,%al
call   10c0 <print_help@plt>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
jmp    11fa <main+0x4a>
mov    -0x50(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1334 <main+0x184>
mov    -0x48(%rbp),%rdi
mov    0x2ccd(%rip),%rax
mov    (%rax),%esi
mov    0x2cbc(%rip),%rax
or     (%rax),%esi
mov    0x2c7b(%rip),%rax
or     (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
jmp    135e <main+0x1ae>
mov    0x2ca5(%rip),%rax
mov    (%rax),%esi
mov    0x2c94(%rip),%rax
or     (%rax),%esi
mov    0x2c53(%rip),%rax
or     (%rax),%esi
lea    0xccb(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
mov    0x2c1b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2c3f(%rip),%rax
mov    (%rax),%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2be0(%rip),%rax
mov    (%rax),%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2c29(%rip),%rax
mov    (%rax),%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2bd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x40(%rbp),%rax
mov    0x2bba(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x40(%rbp),%rax
mov    0x2bd5(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
mov    0x2bb1(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
mov    -0x14(%rbp),%edi
mov    0x2bc8(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1090 <tcsetattr@plt>
mov    -0x14(%rbp),%edi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1442 <main+0x292>
mov    -0x18(%rbp),%esi
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movl   $0xf20000f1,0x10(%rsp)
f2
cmp    $0x2,%edi
jl     13ad <main+0x1fd>
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xe25(%rip),%r15
mov    0x2e16(%rip),%r13
movl   $0x0,0x14(%rsp)
movl   $0x0,0xc(%rsp)
xor    %r12d,%r12d
jmp    121b <main+0x6b>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%rbx
lea    0xe09(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2,%r12d
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   10b0 <getopt@plt>
cmp    $0x66,%eax
je     1200 <main+0x50>
cmp    $0xffffffff,%eax
je     1291 <main+0xe1>
cmp    $0x69,%eax
jne    13ad <main+0x1fd>
or     $0x1,%r12d
mov    0x0(%r13),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <strtol@plt>
shr    $0x8,%eax
mov    %eax,0xc(%rsp)
mov    0x0(%r13),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <strtol@plt>
movzbl 0xc(%rsp),%edx
movzbl %al,%ecx
lea    0xd91(%rip),%rdi
mov    $0xf1,%esi
mov    %edx,0x14(%rsp)
mov    %ecx,0xc(%rsp)
mov    $0xf2,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
jmp    121b <main+0x6b>
mov    0x14(%rsp),%eax
mov    %al,0x11(%rsp)
mov    0x2d40(%rip),%rax
mov    0x2d31(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0xc(%rsp),%eax
mov    %al,0x12(%rsp)
mov    0x2ce6(%rip),%rax
or     (%rax),%esi
test   $0x2,%r12b
lea    0xd56(%rip),%rax
cmove  %rax,%rbx
mov    %rbx,%rdi
call   10a0 <open@plt>
mov    %eax,%ebx
lea    0x18(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1060 <memset@plt>
mov    0x2ca0(%rip),%rax
mov    0x2cc9(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2c6e(%rip),%rax
or     (%rax),%ecx
mov    0x2cbd(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x34(%rsp)
mov    0x2c68(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x20(%rsp)
mov    0x18(%rsp),%rax
mov    0x2c56(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2c75(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2c54(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1040 <tcflush@plt>
mov    0x2c6c(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %rbp,%rdx
call   1090 <tcsetattr@plt>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <write@plt>
test   %eax,%eax
jns    1395 <main+0x1e5>
lea    0xca1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   10c0 <print_help@plt>
mov    0x2bdd(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.termios = type { i32*, i64, i64, i32, i32 }
@__const.main.buf = [4 x i8] c"\F1\00\00\F2"
@EXIT_FAILURE = global i32 0
@.str = [6 x i8] c"hi:f:\00"
@optarg = global i8* null
@.str.1 = [14 x i8] c"Set %x%x%x%x\0A\00"
@.str.2 = [9 x i8] c"tty: %s\0A\00"
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
@O_NDELAY = global i32 0
@.str.3 = [16 x i8] c"/dev/ttyPIFctrl\00"
@B115200 = global i32 0
@CS8 = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@IGNPAR = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.4 = [17 x i8] c"error: code(%d)\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 [4 x i8]
%9 = alloca %struct.termios
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [4 x i8]* %8 to i8*
store i32 0, i32* %12
%14 = load i32, i32* %4
%15 = icmp sle i32 %14, 1
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = call i32 (...) @print_help()
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
br label %21
21: ; preds = %67, %20
%22 = load i32, i32* %4
%23 = load i8**, i8*** %5
%24 = call i32 @getopt(i32 %22, i8** %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %24, i32* %11
%25 = icmp ne i32 %24, -1
br i1 %25, label %26, label %68
26: ; preds = %21
%27 = load i32, i32* %11
switch i32 %27, label %63 [
i32 105, label %28
i32 102, label %57
]
28: ; preds = %26
%29 = load i32, i32* %12
%30 = or i32 %29, 1
store i32 %30, i32* %12
%31 = load i8*, i8** @optarg
%32 = call i32 @strtol(i8* %31, i32* null, i32 16)
%33 = and i32 %32, 65280
%34 = ashr i32 %33, 8
%35 = trunc i32 %34 to i8
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 1
store i8 %35, i8* %36
%37 = load i8*, i8** @optarg
%38 = call i32 @strtol(i8* %37, i32* null, i32 16)
%39 = trunc i32 %38 to i8
%40 = zext i8 %39 to i32
%41 = and i32 %40, 255
%42 = trunc i32 %41 to i8
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 2
store i8 %42, i8* %43
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%45 = load i8, i8* %44
%46 = zext i8 %45 to i32
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 1
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 2
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 3
%54 = load i8, i8* %53
%55 = zext i8 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %46, i32 %49, i32 %52, i32 %55)
br label %67
57: ; preds = %26
%58 = load i32, i32* %12
%59 = or i32 %58, 2
store i32 %59, i32* %12
%60 = load i8*, i8** @optarg
store i8* %60, i8** %10
%61 = load i8*, i8** %10
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %61)
br label %67
63: ; preds = %26
%64 = call i32 (...) @print_help()
%65 = load i32, i32* @EXIT_FAILURE
%66 = call i32 @exit(i32 %65)
unreachable
67: ; preds = %57, %28
br label %21
68: ; preds = %21
%69 = load i32, i32* %12
%70 = and i32 %69, 2
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %80
72: ; preds = %68
%73 = load i8*, i8** %10
%74 = load i32, i32* @O_RDWR
%75 = load i32, i32* @O_NONBLOCK
%76 = or i32 %74, %75
%77 = load i32, i32* @O_NDELAY
%78 = or i32 %76, %77
%79 = call i32 @open(i8* %73, i32 %78)
store i32 %79, i32* %6
br label %87
80: ; preds = %68
%81 = load i32, i32* @O_RDWR
%82 = load i32, i32* @O_NONBLOCK
%83 = or i32 %81, %82
%84 = load i32, i32* @O_NDELAY
%85 = or i32 %83, %84
%86 = call i32 @open(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %85)
store i32 %86, i32* %6
br label %87
87: ; preds = %80, %72
%88 = call i32 @memset(%struct.termios* %9, i32 0, i32 32)
%89 = load i32, i32* @B115200
%90 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 4
store i32 %89, i32* %90
%91 = load i32, i32* @CS8
%92 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 4
%93 = load i32, i32* %92
%94 = or i32 %93, %91
store i32 %94, i32* %92
%95 = load i32, i32* @CLOCAL
%96 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 4
%97 = load i32, i32* %96
%98 = or i32 %97, %95
store i32 %98, i32* %96
%99 = load i32, i32* @CREAD
%100 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 4
%101 = load i32, i32* %100
%102 = or i32 %101, %99
store i32 %102, i32* %100
%103 = load i32, i32* @IGNPAR
%104 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 3
store i32 %103, i32* %104
%105 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 2
store i64 0, i64* %105
%106 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 1
store i64 0, i64* %106
%107 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 0
%108 = load i32*, i32** %107
%109 = load i64, i64* @VTIME
%110 = getelementptr inbounds i32, i32* %108, i64 %109
store i32 0, i32* %110
%111 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 0
%112 = load i32*, i32** %111
%113 = load i64, i64* @VMIN
%114 = getelementptr inbounds i32, i32* %112, i64 %113
store i32 1, i32* %114
%115 = load i32, i32* %6
%116 = load i32, i32* @TCIFLUSH
%117 = call i32 @tcflush(i32 %115, i32 %116)
%118 = load i32, i32* %6
%119 = load i32, i32* @TCSANOW
%120 = call i32 @tcsetattr(i32 %118, i32 %119, %struct.termios* %9)
%121 = load i32, i32* %6
%122 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%123 = call i32 @write(i32 %121, i8* %122, i32 4)
store i32 %123, i32* %7
%124 = load i32, i32* %7
%125 = icmp slt i32 %124, 0
br i1 %125, label %126, label %129
126: ; preds = %87
%127 = load i32, i32* %7
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %127)
br label %129
129: ; preds = %126, %87
%130 = load i32, i32* %6
%131 = call i32 @close(i32 %130)
ret i32 0
}

LLVM IR (-O2):
%struct.termios = type { i32*, i64, i64, i32, i32 }
@EXIT_FAILURE = global i32 0
@.str = [6 x i8] c"hi:f:\00"
@optarg = global i8* null
@.str.1 = [14 x i8] c"Set %x%x%x%x\0A\00"
@.str.2 = [9 x i8] c"tty: %s\0A\00"
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
@O_NDELAY = global i32 0
@.str.3 = [16 x i8] c"/dev/ttyPIFctrl\00"
@B115200 = global i32 0
@CS8 = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@IGNPAR = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.4 = [17 x i8] c"error: code(%d)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to [4 x i8]*
%5 = alloca %struct.termios
%6 = bitcast i32* %3 to i8*
store i32 -234880783, i32* %3
%7 = bitcast %struct.termios* %5 to i8*
%8 = icmp slt i32 %0, 2
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
br label %32
12: ; preds = %2
%13 = tail call i32 (...) @print_help()
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %32, %37
%17 = phi i8* [ %38, %37 ], [ %35, %32 ]
%18 = phi i32 [ 2, %37 ], [ %36, %32 ]
%19 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %19, label %40 [
i32 -1, label %44
i32 105, label %20
i32 102, label %37
]
20: ; preds = %16
%21 = or i32 %18, 1
%22 = load i8*, i8** @optarg
%23 = tail call i32 @strtol(i8* nocapture %22, i32* null, i32 16)
%24 = lshr i32 %23, 8
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** @optarg
%27 = tail call i32 @strtol(i8* nocapture %26, i32* null, i32 16)
%28 = trunc i32 %27 to i8
%29 = and i32 %24, 255
%30 = and i32 %27, 255
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 241, i32 %29, i32 %30, i32 242)
br label %32
32: ; preds = %20, %9
%33 = phi i8 [ %28, %20 ], [ 0, %9 ]
%34 = phi i8 [ %25, %20 ], [ 0, %9 ]
%35 = phi i8* [ %17, %20 ], [ undef, %9 ]
%36 = phi i32 [ %21, %20 ], [ 0, %9 ]
br label %16
37: ; preds = %16
%38 = load i8*, i8** @optarg
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %38)
br label %16
40: ; preds = %16
%41 = tail call i32 (...) @print_help()
%42 = load i32, i32* @EXIT_FAILURE
%43 = tail call i32 @exit(i32 %42)
unreachable
44: ; preds = %16
store i8 %34, i8* %10
store i8 %33, i8* %11
%45 = and i32 %18, 2
%46 = icmp eq i32 %45, 0
%47 = load i32, i32* @O_RDWR
%48 = load i32, i32* @O_NONBLOCK
%49 = or i32 %48, %47
%50 = load i32, i32* @O_NDELAY
%51 = or i32 %49, %50
%52 = select i1 %46, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %17
%53 = tail call i32 @open(i8* %52, i32 %51)
%54 = call i32 @memset(%struct.termios* %5, i32 0, i32 32)
%55 = load i32, i32* @B115200
%56 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 4
%57 = load i32, i32* @CS8
%58 = or i32 %57, %55
%59 = load i32, i32* @CLOCAL
%60 = or i32 %59, %58
%61 = load i32, i32* @CREAD
%62 = or i32 %61, %60
store i32 %62, i32* %56
%63 = load i32, i32* @IGNPAR
%64 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 3
store i32 %63, i32* %64
%65 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 1
%66 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 0
%67 = bitcast i64* %65 to i8*
%68 = load i32*, i32** %66
%69 = load i64, i64* @VTIME
%70 = getelementptr inbounds i32, i32* %68, i64 %69
store i32 0, i32* %70
%71 = load i64, i64* @VMIN
%72 = getelementptr inbounds i32, i32* %68, i64 %71
store i32 1, i32* %72
%73 = load i32, i32* @TCIFLUSH
%74 = call i32 @tcflush(i32 %53, i32 %73)
%75 = load i32, i32* @TCSANOW
%76 = call i32 @tcsetattr(i32 %53, i32 %75, %struct.termios* %5)
%77 = call i32 @write(i32 %53, i8* %6, i32 4)
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %81
79: ; preds = %44
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %77)
br label %81
81: ; preds = %79, %44
%82 = call i32 @close(i32 %53)
ret i32 0
}