#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  FILE *fw = fopen("/dev/ttyUSB0", "w");
  FILE *fr = fopen("/dev/ttyUSB0", "r");
  int out = 0;
  int h = 0, i, f = 0;
  if (!fw || !fr) {
    fprintf(stderr, "/dev/ttyUSB0 is not accessible\n");
    exit(1);
  }
  while (out != 0x31) {
    out = fgetc(fr);
    printf("%i ", out);
  }
  printf("Received Start -> ");
  fputc(0x37, fw);
  fputc(0x0a, fw);
  printf("Sent Start\n");
  printf("# Sending Motors\n");
  while (out != 0x30) {
    out = fgetc(fr);
    printf("%i ", out);
  }
  printf("Received Ready\n");
  while (h < 2) {
    printf("BUFFER --> ");
    fputc(0x39, fw);
    for (i = 1 + f * 9; i <= 9 + f * 9; i++) {
      out = 0x4B + i * 10;
      printf("%i ", out);
      fputc(out, fw);
    }
    printf("\n");
    fputc(0x39, fw);
    fputc(0x0a, fw);
    f++;
    f %= 2;
    h++;
    sleep(1);
    while (out != 0x30) {
      out = fgetc(fr);
      printf("%i ", out);
    }
    printf("Received Ready\n");
  }
  printf("# Testing Frames\n");
  for (i = 0; i < 40; i++) {
    while (out != 0x02) {
      out = fgetc(fr);
      printf("%c", out);
    }
    sleep(1);
    printf("\n# Next Frame\n");
    fputc(0x03, fw);
    fputc(0x0a, fw);
    out = 0;
  }
  printf("# Exiting\n");
  fclose(fw);
  fclose(fr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe63(%rip),%rdi
lea    0xe69(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe4c(%rip),%rdi
lea    0xe54(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11ef <main+0x6f>
cmpq   $0x0,-0x20(%rbp)
jne    120e <main+0x8e>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
lea    0xe12(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1213 <main+0x93>
cmpl   $0x31,-0x24(%rbp)
je     123f <main+0xbf>
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1213 <main+0x93>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    $0x37,%edi
call   1060 <fputc@plt>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <fputc@plt>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x30,-0x24(%rbp)
je     12b1 <main+0x131>
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1285 <main+0x105>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x2,-0x28(%rbp)
jge    13c9 <main+0x249>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    $0x39,%edi
call   1060 <fputc@plt>
imul   $0x9,-0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
imul   $0x9,-0x30(%rbp),%ecx
add    $0x9,%ecx
cmp    %ecx,%eax
jg     1336 <main+0x1b6>
imul   $0xa,-0x2c(%rbp),%eax
add    $0x4b,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1060 <fputc@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12ef <main+0x16f>
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    $0x39,%edi
call   1060 <fputc@plt>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <fputc@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x30(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    $0x1,%edi
call   10a0 <sleep@plt>
cmpl   $0x30,-0x24(%rbp)
je     13b6 <main+0x236>
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    138a <main+0x20a>
lea    0xca9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12bf <main+0x13f>
lea    0xcb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x28,-0x2c(%rbp)
jge    1462 <main+0x2e2>
jmp    13ed <main+0x26d>
cmpl   $0x2,-0x24(%rbp)
je     1419 <main+0x299>
mov    -0x20(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xc87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13ed <main+0x26d>
mov    $0x1,%edi
call   10a0 <sleep@plt>
lea    0xc6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
mov    $0x3,%edi
call   1060 <fputc@plt>
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1060 <fputc@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13de <main+0x25e>
lea    0xc3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe4e(%rip),%rbx
lea    0xe54(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r14
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %r14,%r14
je     14e9 <main+0x349>
mov    %rax,%rbx
test   %rax,%rax
je     14e9 <main+0x349>
lea    0xe42(%rip),%r15
nop
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x31,%ebp
jne    11f0 <main+0x50>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x37,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0xe1a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe19(%rip),%rdi
call   1040 <puts@plt>
lea    0xddf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x30,%ebp
jne    1260 <main+0xc0>
lea    0xe17(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%al
lea    0xda1(%rip),%r13
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,0x4(%rsp)
lea    0xd9d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x39,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
imul   $0x5a,%r15d,%ebp
lea    0x55(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0x5f(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0x69(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0x73(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0x7d(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0x87(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0x91(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
lea    0x9b(%rbp),%r12d
mov    %r13,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
add    $0xa5,%ebp
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x39,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    %r15d,%eax
add    $0x1,%eax
shr    $0x1f,%eax
add    %r15d,%eax
add    $0x1,%eax
and    $0xfffffffe,%eax
neg    %eax
add    %eax,%r15d
add    $0x1,%r15d
mov    $0x1,%edi
call   10c0 <sleep@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %eax,%ebp
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x30,%ebp
jne    1420 <main+0x280>
lea    0xc57(%rip),%rdi
call   1040 <puts@plt>
xor    %r12d,%r12d
testb  $0x1,0x4(%rsp)
mov    $0x0,%eax
jne    12a0 <main+0x100>
lea    0xc0f(%rip),%rdi
call   1040 <puts@plt>
lea    0xc1e(%rip),%r15
nopl   (%rax)
mov    %rbx,%rdi
call   1070 <fgetc@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1030 <putchar@plt>
cmp    $0x2,%ebp
jne    1470 <main+0x2d0>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    $0x3,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
mov    $0xa,%edi
mov    %r14,%rsi
call   1080 <fputc@plt>
add    $0x1,%r12d
cmp    $0x28,%r12d
jne    1470 <main+0x2d0>
lea    0xbbe(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2af0(%rip),%rax
mov    (%rax),%edi
lea    0xb18(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [32 x i8] c"/dev/ttyUSB0 is not accessible\0A\00"
@.str.4 = [4 x i8] c"%i \00"
@.str.5 = [19 x i8] c"Received Start -> \00"
@.str.6 = [12 x i8] c"Sent Start\0A\00"
@.str.7 = [18 x i8] c"# Sending Motors\0A\00"
@.str.8 = [16 x i8] c"Received Ready\0A\00"
@.str.9 = [12 x i8] c"BUFFER --> \00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [18 x i8] c"# Testing Frames\0A\00"
@.str.12 = [3 x i8] c"%c\00"
@.str.13 = [15 x i8] c"\0A# Next Frame\0A\00"
@.str.14 = [11 x i8] c"# Exiting\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %6
%13 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %13, i32** %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %11
%14 = load i32*, i32** %6
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load i32*, i32** %7
%18 = icmp ne i32* %17, null
br i1 %18, label %23, label %19
19: ; preds = %16, %2
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %16
br label %24
24: ; preds = %27, %23
%25 = load i32, i32* %8
%26 = icmp ne i32 %25, 49
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load i32*, i32** %7
%29 = call i32 @fgetc(i32* %28)
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %30)
br label %24
32: ; preds = %24
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32*, i32** %6
%35 = call i32 @fputc(i32 55, i32* %34)
%36 = load i32*, i32** %6
%37 = call i32 @fputc(i32 10, i32* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %40
40: ; preds = %43, %32
%41 = load i32, i32* %8
%42 = icmp ne i32 %41, 48
br i1 %42, label %43, label %48
43: ; preds = %40
%44 = load i32*, i32** %7
%45 = call i32 @fgetc(i32* %44)
store i32 %45, i32* %8
%46 = load i32, i32* %8
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %46)
br label %40
48: ; preds = %40
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %50
50: ; preds = %99, %48
%51 = load i32, i32* %9
%52 = icmp slt i32 %51, 2
br i1 %52, label %53, label %101
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%55 = load i32*, i32** %6
%56 = call i32 @fputc(i32 57, i32* %55)
%57 = load i32, i32* %11
%58 = mul nsw i32 %57, 9
%59 = add nsw i32 1, %58
store i32 %59, i32* %10
br label %60
60: ; preds = %75, %53
%61 = load i32, i32* %10
%62 = load i32, i32* %11
%63 = mul nsw i32 %62, 9
%64 = add nsw i32 9, %63
%65 = icmp sle i32 %61, %64
br i1 %65, label %66, label %78
66: ; preds = %60
%67 = load i32, i32* %10
%68 = mul nsw i32 %67, 10
%69 = add nsw i32 75, %68
store i32 %69, i32* %8
%70 = load i32, i32* %8
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %8
%73 = load i32*, i32** %6
%74 = call i32 @fputc(i32 %72, i32* %73)
br label %75
75: ; preds = %66
%76 = load i32, i32* %10
%77 = add nsw i32 %76, 1
store i32 %77, i32* %10
br label %60
78: ; preds = %60
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%80 = load i32*, i32** %6
%81 = call i32 @fputc(i32 57, i32* %80)
%82 = load i32*, i32** %6
%83 = call i32 @fputc(i32 10, i32* %82)
%84 = load i32, i32* %11
%85 = add nsw i32 %84, 1
store i32 %85, i32* %11
%86 = load i32, i32* %11
%87 = srem i32 %86, 2
store i32 %87, i32* %11
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
store i32 %89, i32* %9
%90 = call i32 @sleep(i32 1)
br label %91
91: ; preds = %94, %78
%92 = load i32, i32* %8
%93 = icmp ne i32 %92, 48
br i1 %93, label %94, label %99
94: ; preds = %91
%95 = load i32*, i32** %7
%96 = call i32 @fgetc(i32* %95)
store i32 %96, i32* %8
%97 = load i32, i32* %8
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %97)
br label %91
99: ; preds = %91
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %50
101: ; preds = %50
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %10
br label %103
103: ; preds = %122, %101
%104 = load i32, i32* %10
%105 = icmp slt i32 %104, 40
br i1 %105, label %106, label %125
106: ; preds = %103
br label %107
107: ; preds = %110, %106
%108 = load i32, i32* %8
%109 = icmp ne i32 %108, 2
br i1 %109, label %110, label %115
110: ; preds = %107
%111 = load i32*, i32** %7
%112 = call i32 @fgetc(i32* %111)
store i32 %112, i32* %8
%113 = load i32, i32* %8
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i32 %113)
br label %107
115: ; preds = %107
%116 = call i32 @sleep(i32 1)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.13, i64 0, i64 0))
%118 = load i32*, i32** %6
%119 = call i32 @fputc(i32 3, i32* %118)
%120 = load i32*, i32** %6
%121 = call i32 @fputc(i32 10, i32* %120)
store i32 0, i32* %8
br label %122
122: ; preds = %115
%123 = load i32, i32* %10
%124 = add nsw i32 %123, 1
store i32 %124, i32* %10
br label %103
125: ; preds = %103
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
%127 = load i32*, i32** %6
%128 = call i32 @fclose(i32* %127)
%129 = load i32*, i32** %7
%130 = call i32 @fclose(i32* %129)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.3 = [32 x i8] c"/dev/ttyUSB0 is not accessible\0A\00"
@.str.4 = [4 x i8] c"%i \00"
@.str.5 = [19 x i8] c"Received Start -> \00"
@.str.9 = [12 x i8] c"BUFFER --> \00"
@str = [11 x i8] c"Sent Start\00"
@str.15 = [17 x i8] c"# Sending Motors\00"
@str.17 = [17 x i8] c"# Testing Frames\00"
@str.18 = [10 x i8] c"# Exiting\00"
@str.19 = [14 x i8] c"\0A# Next Frame\00"
@str.20 = [15 x i8] c"Received Ready\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = icmp ne i32* %3, null
%6 = icmp ne i32* %4, null
%7 = and i1 %5, %6
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2, %12
%13 = tail call i32 @fgetc(i32* %4)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %13, 49
br i1 %15, label %16, label %12
16: ; preds = %12
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%18 = tail call i32 @fputc(i32 55, i32* %3)
%19 = tail call i32 @fputc(i32 10, i32* %3)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.15, i64 0, i64 0))
br label %22
22: ; preds = %16, %22
%23 = tail call i32 @fgetc(i32* %4)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = icmp eq i32 %23, 48
br i1 %25, label %26, label %22
26: ; preds = %22
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.20, i64 0, i64 0))
br label %28
28: ; preds = %26, %79
%29 = phi i32 [ 0, %26 ], [ %73, %79 ]
%30 = phi i1 [ true, %26 ], [ false, %79 ]
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
%32 = tail call i32 @fputc(i32 57, i32* %3)
%33 = mul nsw i32 %29, 90
%34 = add nsw i32 %33, 85
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = tail call i32 @fputc(i32 %34, i32* %3)
%37 = mul nsw i32 %29, 90
%38 = add nsw i32 %37, 95
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = tail call i32 @fputc(i32 %38, i32* %3)
%41 = mul nsw i32 %29, 90
%42 = add nsw i32 %41, 105
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%44 = tail call i32 @fputc(i32 %42, i32* %3)
%45 = mul nsw i32 %29, 90
%46 = add nsw i32 %45, 115
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %46)
%48 = tail call i32 @fputc(i32 %46, i32* %3)
%49 = mul nsw i32 %29, 90
%50 = add nsw i32 %49, 125
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %50)
%52 = tail call i32 @fputc(i32 %50, i32* %3)
%53 = mul nsw i32 %29, 90
%54 = add nsw i32 %53, 135
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %54)
%56 = tail call i32 @fputc(i32 %54, i32* %3)
%57 = mul nsw i32 %29, 90
%58 = add nsw i32 %57, 145
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %58)
%60 = tail call i32 @fputc(i32 %58, i32* %3)
%61 = mul nsw i32 %29, 90
%62 = add nsw i32 %61, 155
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = tail call i32 @fputc(i32 %62, i32* %3)
%65 = mul nsw i32 %29, 90
%66 = add nsw i32 %65, 165
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %66)
%68 = tail call i32 @fputc(i32 %66, i32* %3)
%69 = tail call i32 @putchar(i32 10)
%70 = tail call i32 @fputc(i32 57, i32* %3)
%71 = tail call i32 @fputc(i32 10, i32* %3)
%72 = add nsw i32 %29, 1
%73 = srem i32 %72, 2
%74 = tail call i32 @sleep(i32 1)
br label %75
75: ; preds = %28, %75
%76 = tail call i32 @fgetc(i32* %4)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %76)
%78 = icmp eq i32 %76, 48
br i1 %78, label %79, label %75
79: ; preds = %75
%80 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.20, i64 0, i64 0))
br i1 %30, label %28, label %81
81: ; preds = %79
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.17, i64 0, i64 0))
br label %83
83: ; preds = %81, %89
%84 = phi i32 [ 0, %81 ], [ %94, %89 ]
br label %85
85: ; preds = %83, %85
%86 = tail call i32 @fgetc(i32* %4)
%87 = tail call i32 @putchar(i32 %86)
%88 = icmp eq i32 %86, 2
br i1 %88, label %89, label %85
89: ; preds = %85
%90 = tail call i32 @sleep(i32 1)
%91 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.19, i64 0, i64 0))
%92 = tail call i32 @fputc(i32 3, i32* %3)
%93 = tail call i32 @fputc(i32 10, i32* %3)
%94 = add nuw nsw i32 %84, 1
%95 = icmp eq i32 %94, 40
br i1 %95, label %96, label %83
96: ; preds = %89
%97 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.18, i64 0, i64 0))
%98 = tail call i32 @fclose(i32* %3)
%99 = tail call i32 @fclose(i32* %4)
ret i32 0
}