#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*/ text;

/* Variables and functions */
int /*<<< orphan*/ CHECK(int, int, int, int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int serClose(int);
int serDataAvailable(int);
int serOpen(char *, int, int /*<<< orphan*/);
int serRead(int, char *, int);
int serReadByte(int);
int serWrite(int, char *, int);
int serWriteByte(int, int);
int strcmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ time_sleep(double);
void ta() {
  int h, b, e;
  char *TEXT;
  char text[2048];
  printf("Serial link tests.\n");
  h = serOpen("/dev/ttyAMA0", 57600, 0);
  CHECK(10, 1, h, 0, 0, "serial open");
  b = serRead(h, text, sizeof(text));
  b = serDataAvailable(h);
  CHECK(10, 2, b, 0, 0, "serial data available");
  TEXT = "To be, or not to be, that is the question-Whether 'tis Nobler in the "
         "mind to sufferThe Slings and Arrows of outrageous Fortune,Or to take "
         "Arms against a Sea of troubles,";
  e = serWrite(h, TEXT, strlen(TEXT));
  CHECK(10, 3, e, 0, 0, "serial write");
  e = serWriteByte(h, 0xAA);
  e = serWriteByte(h, 0x55);
  e = serWriteByte(h, 0x00);
  e = serWriteByte(h, 0xFF);
  CHECK(10, 4, e, 0, 0, "serial write byte");
  time_sleep(0.1);
  b = serDataAvailable(h);
  CHECK(10, 5, b, strlen(TEXT) + 4, 0, "serial data available");
  b = serRead(h, text, strlen(TEXT));
  CHECK(10, 6, b, strlen(TEXT), 0, "serial read");
  if (b >= 0)
    text[b] = 0;
  CHECK(10, 7, strcmp(TEXT, text), 0, 0, "serial read");
  b = serReadByte(h);
  CHECK(10, 8, b, 0xAA, 0, "serial read byte");
  b = serReadByte(h);
  CHECK(10, 9, b, 0x55, 0, "serial read byte");
  b = serReadByte(h);
  CHECK(10, 10, b, 0x00, 0, "serial read byte");
  b = serReadByte(h);
  CHECK(10, 11, b, 0xFF, 0, "serial read byte");
  b = serDataAvailable(h);
  CHECK(10, 12, b, 0, 0, "serial data availabe");
  e = serClose(h);
  CHECK(10, 13, e, 0, 0, "serial close");
}


x86 assembly (clang, -O0):
<ta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%rsp
lea    0xe36(%rip),%rdi
call   1070 <printf@plt>
lea    0xe3e(%rip),%rdi
mov    $0xe100,%esi
xor    %edx,%edx
call   10e0 <serOpen@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0xa,%edi
mov    $0x1,%esi
xor    %r8d,%r8d
lea    0xe25(%rip),%r9
mov    %r8d,%ecx
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
lea    -0x820(%rbp),%rsi
mov    $0x800,%edx
call   1050 <serRead@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <serDataAvailable@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xa,%edi
mov    $0x2,%esi
xor    %r8d,%r8d
lea    0xdf0(%rip),%r9
mov    %r8d,%ecx
call   1040 <CHECK@plt>
lea    0xdf7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x844(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x840(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x844(%rbp),%edi
mov    -0x840(%rbp),%rsi
mov    %eax,%edx
call   1080 <serWrite@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xa,%edi
mov    $0x3,%esi
xor    %r8d,%r8d
lea    0xe52(%rip),%r9
mov    %r8d,%ecx
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0xaa,%esi
call   10b0 <serWriteByte@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x55,%esi
call   10b0 <serWriteByte@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   10b0 <serWriteByte@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xff,%esi
call   10b0 <serWriteByte@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xa,%edi
mov    $0x4,%esi
xor    %r8d,%r8d
lea    0xe03(%rip),%r9
mov    %r8d,%ecx
call   1040 <CHECK@plt>
movsd  0xcf1(%rip),%xmm0
call   10c0 <time_sleep@plt>
mov    -0x4(%rbp),%edi
call   1030 <serDataAvailable@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x838(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x838(%rbp),%edx
mov    %eax,%ecx
add    $0x4,%ecx
mov    $0xa,%edi
mov    $0x5,%esi
xor    %r8d,%r8d
lea    0xce5(%rip),%r9
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x834(%rbp)
lea    -0x820(%rbp),%rax
mov    %rax,-0x830(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x834(%rbp),%edi
mov    -0x830(%rbp),%rsi
mov    %eax,%edx
call   1050 <serRead@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x824(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x824(%rbp),%edx
mov    %eax,%ecx
mov    $0xa,%edi
mov    $0x6,%esi
xor    %r8d,%r8d
lea    0xd5a(%rip),%r9
call   1040 <CHECK@plt>
cmpl   $0x0,-0x8(%rbp)
jl     13d5 <ta+0x215>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x820(%rbp,%rax,1)
mov    -0x18(%rbp),%rdi
lea    -0x820(%rbp),%rsi
call   1090 <strcmp@plt>
mov    %eax,%edx
mov    $0xa,%edi
mov    $0x7,%esi
xor    %r8d,%r8d
lea    0xd19(%rip),%r9
mov    %r8d,%ecx
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
call   10d0 <serReadByte@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xa,%edi
mov    $0x8,%esi
mov    $0xaa,%ecx
xor    %r8d,%r8d
lea    0xcf6(%rip),%r9
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
call   10d0 <serReadByte@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xa,%edi
mov    $0x9,%esi
mov    $0x55,%ecx
xor    %r8d,%r8d
lea    0xcca(%rip),%r9
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
call   10d0 <serReadByte@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xa,%esi
xor    %r8d,%r8d
lea    0xca8(%rip),%r9
mov    %esi,%edi
mov    %r8d,%ecx
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
call   10d0 <serReadByte@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xa,%edi
mov    $0xb,%esi
mov    $0xff,%ecx
xor    %r8d,%r8d
lea    0xc77(%rip),%r9
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
call   1030 <serDataAvailable@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0xa,%edi
mov    $0xc,%esi
xor    %r8d,%r8d
lea    0xc61(%rip),%r9
mov    %r8d,%ecx
call   1040 <CHECK@plt>
mov    -0x4(%rbp),%edi
call   10a0 <serClose@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0xa,%edi
mov    $0xd,%esi
xor    %r8d,%r8d
lea    0xc4c(%rip),%r9
mov    %r8d,%ecx
call   1040 <CHECK@plt>
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ta>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x800,%rsp
lea    0xf69(%rip),%rdi
call   1050 <puts@plt>
lea    0xe26(%rip),%rdi
mov    $0xe100,%esi
xor    %edx,%edx
call   10e0 <serOpen@plt>
mov    %eax,%ebx
lea    0xe1e(%rip),%r9
mov    $0xa,%edi
mov    $0x1,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <CHECK@plt>
mov    %rsp,%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x800,%edx
call   1060 <serRead@plt>
mov    %ebx,%edi
call   1030 <serDataAvailable@plt>
lea    0xdf4(%rip),%r12
mov    $0xa,%edi
mov    $0x2,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r12,%r9
call   1040 <CHECK@plt>
lea    0xdea(%rip),%r15
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
call   1080 <serWrite@plt>
lea    0xe79(%rip),%r9
mov    $0xa,%edi
mov    $0x3,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <CHECK@plt>
mov    %ebx,%edi
mov    $0xaa,%esi
call   10b0 <serWriteByte@plt>
mov    %ebx,%edi
mov    $0x55,%esi
call   10b0 <serWriteByte@plt>
mov    %ebx,%edi
xor    %esi,%esi
call   10b0 <serWriteByte@plt>
mov    %ebx,%edi
mov    $0xff,%esi
call   10b0 <serWriteByte@plt>
lea    0xe3c(%rip),%r9
mov    $0xa,%edi
mov    $0x4,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <CHECK@plt>
movsd  0xd30(%rip),%xmm0
call   10c0 <time_sleep@plt>
mov    %ebx,%edi
call   1030 <serDataAvailable@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1070 <strlen@plt>
lea    0x4(%rax),%ecx
mov    $0xa,%edi
mov    $0x5,%esi
mov    %ebp,%edx
xor    %r8d,%r8d
mov    %r12,%r9
call   1040 <CHECK@plt>
mov    %r15,%rdi
call   1070 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1060 <serRead@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1070 <strlen@plt>
lea    0xddb(%rip),%r9
mov    $0xa,%edi
mov    $0x6,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %r8d,%r8d
call   1040 <CHECK@plt>
test   %ebp,%ebp
js     1345 <ta+0x185>
mov    %ebp,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xceb(%rip),%rdi
mov    %rsp,%rsi
call   1090 <strcmp@plt>
lea    0xda5(%rip),%r9
mov    $0xa,%edi
mov    $0x7,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <CHECK@plt>
mov    %ebx,%edi
call   10d0 <serReadByte@plt>
lea    0xd8d(%rip),%r14
mov    $0xa,%edi
mov    $0x8,%esi
mov    %eax,%edx
mov    $0xaa,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
call   1040 <CHECK@plt>
mov    %ebx,%edi
call   10d0 <serReadByte@plt>
mov    $0xa,%edi
mov    $0x9,%esi
mov    %eax,%edx
mov    $0x55,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
call   1040 <CHECK@plt>
mov    %ebx,%edi
call   10d0 <serReadByte@plt>
mov    $0xa,%edi
mov    $0xa,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
call   1040 <CHECK@plt>
mov    %ebx,%edi
call   10d0 <serReadByte@plt>
mov    $0xa,%edi
mov    $0xb,%esi
mov    %eax,%edx
mov    $0xff,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
call   1040 <CHECK@plt>
mov    %ebx,%edi
call   1030 <serDataAvailable@plt>
lea    0xd0e(%rip),%r9
mov    $0xa,%edi
mov    $0xc,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <CHECK@plt>
mov    %ebx,%edi
call   10a0 <serClose@plt>
lea    0xcff(%rip),%r9
mov    $0xa,%edi
mov    $0xd,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <CHECK@plt>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Serial link tests.\0A\00"
@.str.1 = [13 x i8] c"/dev/ttyAMA0\00"
@.str.2 = [12 x i8] c"serial open\00"
@.str.3 = [22 x i8] c"serial data available\00"
@.str.4 = [170 x i8] c"To be, or not to be, that is the question-Whether 'tis Nobler in the mind to sufferThe Slings and Arrows of outrageous Fortune,Or to take Arms against a Sea of troubles,\00"
@.str.5 = [13 x i8] c"serial write\00"
@.str.6 = [18 x i8] c"serial write byte\00"
@.str.7 = [12 x i8] c"serial read\00"
@.str.8 = [17 x i8] c"serial read byte\00"
@.str.9 = [21 x i8] c"serial data availabe\00"
@.str.10 = [13 x i8] c"serial close\00"
define void @ta() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [2048 x i8]
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @serOpen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 57600, i32 0)
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = call i32 @CHECK(i32 10, i32 1, i32 %8, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %1
%11 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%12 = call i32 @serRead(i32 %10, i8* %11, i32 2048)
store i32 %12, i32* %2
%13 = load i32, i32* %1
%14 = call i32 @serDataAvailable(i32 %13)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = call i32 @CHECK(i32 10, i32 2, i32 %15, i32 0, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str.4, i64 0, i64 0), i8** %4
%17 = load i32, i32* %1
%18 = load i8*, i8** %4
%19 = load i8*, i8** %4
%20 = call i32 @strlen(i8* %19)
%21 = call i32 @serWrite(i32 %17, i8* %18, i32 %20)
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = call i32 @CHECK(i32 10, i32 3, i32 %22, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%24 = load i32, i32* %1
%25 = call i32 @serWriteByte(i32 %24, i32 170)
store i32 %25, i32* %3
%26 = load i32, i32* %1
%27 = call i32 @serWriteByte(i32 %26, i32 85)
store i32 %27, i32* %3
%28 = load i32, i32* %1
%29 = call i32 @serWriteByte(i32 %28, i32 0)
store i32 %29, i32* %3
%30 = load i32, i32* %1
%31 = call i32 @serWriteByte(i32 %30, i32 255)
store i32 %31, i32* %3
%32 = load i32, i32* %3
%33 = call i32 @CHECK(i32 10, i32 4, i32 %32, i32 0, i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%34 = call i32 @time_sleep(double 1.000000e-01)
%35 = load i32, i32* %1
%36 = call i32 @serDataAvailable(i32 %35)
store i32 %36, i32* %2
%37 = load i32, i32* %2
%38 = load i8*, i8** %4
%39 = call i32 @strlen(i8* %38)
%40 = add nsw i32 %39, 4
%41 = call i32 @CHECK(i32 10, i32 5, i32 %37, i32 %40, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* %1
%43 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%44 = load i8*, i8** %4
%45 = call i32 @strlen(i8* %44)
%46 = call i32 @serRead(i32 %42, i8* %43, i32 %45)
store i32 %46, i32* %2
%47 = load i32, i32* %2
%48 = load i8*, i8** %4
%49 = call i32 @strlen(i8* %48)
%50 = call i32 @CHECK(i32 10, i32 6, i32 %47, i32 %49, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%51 = load i32, i32* %2
%52 = icmp sge i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %0
%54 = load i32, i32* %2
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 %55
store i8 0, i8* %56
br label %57
57: ; preds = %53, %0
%58 = load i8*, i8** %4
%59 = getelementptr inbounds [2048 x i8], [2048 x i8]* %5, i64 0, i64 0
%60 = call i32 @strcmp(i8* %58, i8* %59)
%61 = call i32 @CHECK(i32 10, i32 7, i32 %60, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%62 = load i32, i32* %1
%63 = call i32 @serReadByte(i32 %62)
store i32 %63, i32* %2
%64 = load i32, i32* %2
%65 = call i32 @CHECK(i32 10, i32 8, i32 %64, i32 170, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%66 = load i32, i32* %1
%67 = call i32 @serReadByte(i32 %66)
store i32 %67, i32* %2
%68 = load i32, i32* %2
%69 = call i32 @CHECK(i32 10, i32 9, i32 %68, i32 85, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%70 = load i32, i32* %1
%71 = call i32 @serReadByte(i32 %70)
store i32 %71, i32* %2
%72 = load i32, i32* %2
%73 = call i32 @CHECK(i32 10, i32 10, i32 %72, i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%74 = load i32, i32* %1
%75 = call i32 @serReadByte(i32 %74)
store i32 %75, i32* %2
%76 = load i32, i32* %2
%77 = call i32 @CHECK(i32 10, i32 11, i32 %76, i32 255, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%78 = load i32, i32* %1
%79 = call i32 @serDataAvailable(i32 %78)
store i32 %79, i32* %2
%80 = load i32, i32* %2
%81 = call i32 @CHECK(i32 10, i32 12, i32 %80, i32 0, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%82 = load i32, i32* %1
%83 = call i32 @serClose(i32 %82)
store i32 %83, i32* %3
%84 = load i32, i32* %3
%85 = call i32 @CHECK(i32 10, i32 13, i32 %84, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"/dev/ttyAMA0\00"
@.str.2 = [12 x i8] c"serial open\00"
@.str.3 = [22 x i8] c"serial data available\00"
@.str.4 = [170 x i8] c"To be, or not to be, that is the question-Whether 'tis Nobler in the mind to sufferThe Slings and Arrows of outrageous Fortune,Or to take Arms against a Sea of troubles,\00"
@.str.5 = [13 x i8] c"serial write\00"
@.str.6 = [18 x i8] c"serial write byte\00"
@.str.7 = [12 x i8] c"serial read\00"
@.str.8 = [17 x i8] c"serial read byte\00"
@.str.9 = [21 x i8] c"serial data availabe\00"
@.str.10 = [13 x i8] c"serial close\00"
@str = [19 x i8] c"Serial link tests.\00"
define void @ta() {
%1 = alloca [2048 x i8]
%2 = getelementptr inbounds [2048 x i8], [2048 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @serOpen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 57600, i32 0)
%5 = tail call i32 @CHECK(i32 10, i32 1, i32 %4, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @serRead(i32 %4, i8* %2, i32 2048)
%7 = call i32 @serDataAvailable(i32 %4)
%8 = call i32 @CHECK(i32 10, i32 2, i32 %7, i32 0, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @strlen(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @serWrite(i32 %4, i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = call i32 @CHECK(i32 10, i32 3, i32 %10, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @serWriteByte(i32 %4, i32 170)
%13 = call i32 @serWriteByte(i32 %4, i32 85)
%14 = call i32 @serWriteByte(i32 %4, i32 0)
%15 = call i32 @serWriteByte(i32 %4, i32 255)
%16 = call i32 @CHECK(i32 10, i32 4, i32 %15, i32 0, i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 @time_sleep(double 1.000000e-01)
%18 = call i32 @serDataAvailable(i32 %4)
%19 = call i32 @strlen(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str.4, i64 0, i64 0))
%20 = add nsw i32 %19, 4
%21 = call i32 @CHECK(i32 10, i32 5, i32 %18, i32 %20, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @strlen(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @serRead(i32 %4, i8* %2, i32 %22)
%24 = call i32 @strlen(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str.4, i64 0, i64 0))
%25 = call i32 @CHECK(i32 10, i32 6, i32 %23, i32 %24, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%26 = icmp sgt i32 %23, -1
br i1 %26, label %27, label %30
27: ; preds = %0
%28 = zext i32 %23 to i64
%29 = getelementptr inbounds [2048 x i8], [2048 x i8]* %1, i64 0, i64 %28
store i8 0, i8* %29
br label %30
30: ; preds = %27, %0
%31 = call i32 @strcmp(i8* dereferenceable(170) getelementptr inbounds ([170 x i8], [170 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%32 = call i32 @CHECK(i32 10, i32 7, i32 %31, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%33 = call i32 @serReadByte(i32 %4)
%34 = call i32 @CHECK(i32 10, i32 8, i32 %33, i32 170, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @serReadByte(i32 %4)
%36 = call i32 @CHECK(i32 10, i32 9, i32 %35, i32 85, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 @serReadByte(i32 %4)
%38 = call i32 @CHECK(i32 10, i32 10, i32 %37, i32 0, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%39 = call i32 @serReadByte(i32 %4)
%40 = call i32 @CHECK(i32 10, i32 11, i32 %39, i32 255, i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%41 = call i32 @serDataAvailable(i32 %4)
%42 = call i32 @CHECK(i32 10, i32 12, i32 %41, i32 0, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%43 = call i32 @serClose(i32 %4)
%44 = call i32 @CHECK(i32 10, i32 13, i32 %43, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
ret void
}