#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*/ delay(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int printf(char *, ...);
scalar_t__ serialDataAvail(int);
int /*<<< orphan*/ serialFlush(int);
char serialGetchar(int);
int serialOpen(char *, int);
int /*<<< orphan*/ serialPuts(int, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
int main() {
  int fd;
  int b = 0;
  int a = 0;
  int i = 0;
  char mac[] = "78A5048C47AF";
  char check[20] = "\0";
  if ((fd = serialOpen("/dev/ttyAMA0", 9600)) < 0) {
    fprintf(stderr, "Unable to open serial device: %s\n", strerror(errno));
    return 1;
  }
  fflush(stdout);
  serialPuts(fd, "AT+MODE1");
  delay(500);
  serialFlush(fd);
  printf("go\n");
  serialPuts(fd, "AT+CON");
  serialPuts(fd, mac);
  while (serialDataAvail(fd) == 0)
    ;
  i = 0;
  while ((serialDataAvail(fd)) != 0) {
    delay(10);
    check[i] = serialGetchar(fd);
    i++;
  }
  check[i] = 0;
  printf("%s \n", check);
  if (strcmp(check, "OK+CONNA") == 0) {
    check[0] = 0;
    printf("comando recebido\n");
  } else {
    if (strcmp(check, "OK+CONNAOK+CONN") == 0) {
      check[0] = 0;
      printf("conectou!\n");
    } else
      return printf("erro!\n");
  }
  while (serialDataAvail(fd) == 0)
    ;
  i = 0;
  while ((serialDataAvail(fd)) != 0) {
    delay(10);
    check[i] = serialGetchar(fd);
    i++;
  }
  check[i] = 0;
  if ((strcmp(check, "OK+CONN") == 0)) {
    check[0] = 0;
    printf("conectou!\n");
  } else {
    check[0] = 0;
    printf("conexao falhou!\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0xe15(%rip),%rax
mov    %rax,-0x21(%rbp)
mov    0xe13(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xe0e(%rip),%al
mov    %al,-0x15(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1060 <memset@plt>
lea    0xdf5(%rip),%rdi
mov    $0x2580,%esi
call   1030 <serialOpen@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    1266 <main+0xa6>
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    %rax,%rdx
lea    0xdc5(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    145b <main+0x29b>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    -0x8(%rbp),%edi
lea    0xdbe(%rip),%rsi
call   10d0 <serialPuts@plt>
mov    $0x1f4,%edi
call   1070 <delay@plt>
mov    -0x8(%rbp),%edi
call   10b0 <serialFlush@plt>
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
lea    0xd9c(%rip),%rsi
call   10d0 <serialPuts@plt>
mov    -0x8(%rbp),%edi
lea    -0x21(%rbp),%rsi
call   10d0 <serialPuts@plt>
mov    -0x8(%rbp),%edi
call   10c0 <serialDataAvail@plt>
cmp    $0x0,%rax
jne    12d5 <main+0x115>
jmp    12be <main+0xfe>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   10c0 <serialDataAvail@plt>
cmp    $0x0,%rax
je     1318 <main+0x158>
mov    $0xa,%edi
call   1070 <delay@plt>
mov    -0x8(%rbp),%edi
call   1050 <serialGetchar@plt>
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12dc <main+0x11c>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x40(%rbp,%rax,1)
lea    -0x40(%rbp),%rsi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    0xd17(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1364 <main+0x1a4>
movb   $0x0,-0x40(%rbp)
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13b0 <main+0x1f0>
lea    -0x40(%rbp),%rdi
lea    0xd01(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1395 <main+0x1d5>
movb   $0x0,-0x40(%rbp)
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13ab <main+0x1eb>
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    %eax,-0x4(%rbp)
jmp    145b <main+0x29b>
jmp    13b0 <main+0x1f0>
jmp    13b5 <main+0x1f5>
mov    -0x8(%rbp),%edi
call   10c0 <serialDataAvail@plt>
cmp    $0x0,%rax
jne    13cc <main+0x20c>
jmp    13b5 <main+0x1f5>
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   10c0 <serialDataAvail@plt>
cmp    $0x0,%rax
je     140f <main+0x24f>
mov    $0xa,%edi
call   1070 <delay@plt>
mov    -0x8(%rbp),%edi
call   1050 <serialGetchar@plt>
mov    %al,%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13d3 <main+0x213>
movslq -0x14(%rbp),%rax
movb   $0x0,-0x40(%rbp,%rax,1)
lea    -0x40(%rbp),%rdi
lea    0xc55(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1449 <main+0x289>
movb   $0x0,-0x40(%rbp)
lea    0xc43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    145b <main+0x29b>
movb   $0x0,-0x40(%rbp)
lea    0xc3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x30,%rsp
movabs $0x46413734433834,%rax
mov    %rax,0x25(%rsp)
movabs $0x4338343035413837,%rax
34 38 43
mov    %rax,0x20(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xe11(%rip),%rdi
mov    $0x2580,%esi
call   1030 <serialOpen@plt>
test   %eax,%eax
js     12b8 <main+0xf8>
mov    %eax,%ebp
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
lea    0xe17(%rip),%rsi
mov    %ebp,%edi
call   10d0 <serialPuts@plt>
mov    $0x1f4,%edi
call   1070 <delay@plt>
mov    %ebp,%edi
call   10b0 <serialFlush@plt>
lea    0xe2d(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf5(%rip),%rsi
mov    %ebp,%edi
call   10d0 <serialPuts@plt>
lea    0x20(%rsp),%rsi
mov    %ebp,%edi
call   10d0 <serialPuts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,%edi
call   10c0 <serialDataAvail@plt>
test   %rax,%rax
je     1270 <main+0xb0>
mov    %ebp,%edi
call   10c0 <serialDataAvail@plt>
test   %rax,%rax
je     12ea <main+0x12a>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1070 <delay@plt>
mov    %ebp,%edi
call   1060 <serialGetchar@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %ebp,%edi
call   10c0 <serialDataAvail@plt>
test   %rax,%rax
jne    1290 <main+0xd0>
mov    %ebx,%eax
jmp    12ec <main+0x12c>
mov    0x2d21(%rip),%rax
mov    (%rax),%ebx
mov    0x2d10(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd44(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1090 <fprintf@plt>
mov    $0x1,%eax
jmp    13dd <main+0x21d>
xor    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xd55(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd46(%rip),%rsi
mov    %r14,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     133f <main+0x17f>
lea    0xd3b(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     1348 <main+0x188>
lea    0xd37(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    13dd <main+0x21d>
lea    0xd48(%rip),%rdi
jmp    134f <main+0x18f>
lea    0xd35(%rip),%rdi
movb   $0x0,(%rsp)
call   1040 <puts@plt>
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   10c0 <serialDataAvail@plt>
test   %rax,%rax
je     1360 <main+0x1a0>
mov    %ebp,%edi
call   10c0 <serialDataAvail@plt>
test   %rax,%rax
je     13a8 <main+0x1e8>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1070 <delay@plt>
mov    %ebp,%edi
call   1060 <serialGetchar@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %ebp,%edi
call   10c0 <serialDataAvail@plt>
test   %rax,%rax
jne    1380 <main+0x1c0>
mov    %ebx,%eax
jmp    13aa <main+0x1ea>
xor    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xcad(%rip),%rsi
mov    %rsp,%rdi
call   1080 <strcmp@plt>
movb   $0x0,(%rsp)
test   %rax,%rax
je     13cf <main+0x20f>
lea    0xca7(%rip),%rdi
jmp    13d6 <main+0x216>
lea    0xcae(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.mac = [13 x i8] c"78A5048C47AF\00"
@.str = [13 x i8] c"/dev/ttyAMA0\00"
@stderr = global i32 0
@.str.1 = [34 x i8] c"Unable to open serial device: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
@.str.2 = [9 x i8] c"AT+MODE1\00"
@.str.3 = [4 x i8] c"go\0A\00"
@.str.4 = [7 x i8] c"AT+CON\00"
@.str.5 = [5 x i8] c"%s \0A\00"
@.str.6 = [9 x i8] c"OK+CONNA\00"
@.str.7 = [18 x i8] c"comando recebido\0A\00"
@.str.8 = [16 x i8] c"OK+CONNAOK+CONN\00"
@.str.9 = [11 x i8] c"conectou!\0A\00"
@.str.10 = [7 x i8] c"erro!\0A\00"
@.str.11 = [8 x i8] c"OK+CONN\00"
@.str.12 = [17 x i8] c"conexao falhou!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [13 x i8]
%7 = alloca [20 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%8 = bitcast [13 x i8]* %6 to i8*
%9 = bitcast [20 x i8]* %7 to i8*
%10 = call i32 @serialOpen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 9600)
store i32 %10, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %0
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = call i8* @strerror(i32 %14)
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %15)
store i32 1, i32* %1
br label %105
17: ; preds = %0
%18 = load i32, i32* @stdout
%19 = call i32 @fflush(i32 %18)
%20 = load i32, i32* %2
%21 = call i32 @serialPuts(i32 %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @delay(i32 500)
%23 = load i32, i32* %2
%24 = call i32 @serialFlush(i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32, i32* %2
%27 = call i32 @serialPuts(i32 %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* %2
%29 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%30 = call i32 @serialPuts(i32 %28, i8* %29)
br label %31
31: ; preds = %35, %17
%32 = load i32, i32* %2
%33 = call i64 @serialDataAvail(i32 %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %31
br label %31
36: ; preds = %31
store i32 0, i32* %5
br label %37
37: ; preds = %41, %36
%38 = load i32, i32* %2
%39 = call i64 @serialDataAvail(i32 %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %50
41: ; preds = %37
%42 = call i32 @delay(i32 10)
%43 = load i32, i32* %2
%44 = call signext i8 @serialGetchar(i32 %43)
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %46
store i8 %44, i8* %47
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %37
50: ; preds = %37
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %52
store i8 0, i8* %53
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %54)
%56 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %50
%60 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8 0, i8* %60
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %72
62: ; preds = %50
%63 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8 0, i8* %67
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
br label %71
69: ; preds = %62
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
store i32 %70, i32* %1
br label %105
71: ; preds = %66
br label %72
72: ; preds = %71, %59
br label %73
73: ; preds = %77, %72
%74 = load i32, i32* %2
%75 = call i64 @serialDataAvail(i32 %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %78
77: ; preds = %73
br label %73
78: ; preds = %73
store i32 0, i32* %5
br label %79
79: ; preds = %83, %78
%80 = load i32, i32* %2
%81 = call i64 @serialDataAvail(i32 %80)
%82 = icmp ne i64 %81, 0
br i1 %82, label %83, label %92
83: ; preds = %79
%84 = call i32 @delay(i32 10)
%85 = load i32, i32* %2
%86 = call signext i8 @serialGetchar(i32 %85)
%87 = load i32, i32* %5
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %88
store i8 %86, i8* %89
%90 = load i32, i32* %5
%91 = add nsw i32 %90, 1
store i32 %91, i32* %5
br label %79
92: ; preds = %79
%93 = load i32, i32* %5
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %94
store i8 0, i8* %95
%96 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%97 = call i64 @strcmp(i8* %96, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%98 = icmp eq i64 %97, 0
br i1 %98, label %99, label %102
99: ; preds = %92
%100 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8 0, i8* %100
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
br label %105
102: ; preds = %92
%103 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8 0, i8* %103
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
br label %105
105: ; preds = %12, %69, %102, %99
%106 = load i32, i32* %1
ret i32 %106
}

LLVM IR (-O2):
@__const.main.mac = [13 x i8] c"78A5048C47AF\00"
@.str = [13 x i8] c"/dev/ttyAMA0\00"
@stderr = global i32 0
@.str.1 = [34 x i8] c"Unable to open serial device: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
@.str.2 = [9 x i8] c"AT+MODE1\00"
@.str.4 = [7 x i8] c"AT+CON\00"
@.str.5 = [5 x i8] c"%s \0A\00"
@.str.6 = [9 x i8] c"OK+CONNA\00"
@.str.8 = [16 x i8] c"OK+CONNAOK+CONN\00"
@.str.10 = [7 x i8] c"erro!\0A\00"
@.str.11 = [8 x i8] c"OK+CONN\00"
@str = [3 x i8] c"go\00"
@str.14 = [16 x i8] c"conexao falhou!\00"
@str.15 = [10 x i8] c"conectou!\00"
@str.16 = [17 x i8] c"comando recebido\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @serialOpen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 9600)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0
%8 = load i32, i32* @stderr
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %76
12: ; preds = %0
%13 = load i32, i32* @stdout
%14 = tail call i32 @fflush(i32 %13)
%15 = tail call i32 @serialPuts(i32 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 @delay(i32 500)
%17 = tail call i32 @serialFlush(i32 %5)
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%19 = tail call i32 @serialPuts(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @serialPuts(i32 %5, i8* %3)
br label %21
21: ; preds = %21, %12
%22 = call i64 @serialDataAvail(i32 %5)
%23 = icmp eq i64 %22, 0
br i1 %23, label %21, label %24
24: ; preds = %21
%25 = call i64 @serialDataAvail(i32 %5)
%26 = icmp eq i64 %25, 0
br i1 %26, label %37, label %27
27: ; preds = %24, %27
%28 = phi i64 [ %32, %27 ], [ 0, %24 ]
%29 = call i32 @delay(i32 10)
%30 = call signext i8 @serialGetchar(i32 %5)
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %28
store i8 %30, i8* %31
%32 = add nuw i64 %28, 1
%33 = call i64 @serialDataAvail(i32 %5)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %27
35: ; preds = %27
%36 = and i64 %32, 4294967295
br label %37
37: ; preds = %35, %24
%38 = phi i64 [ 0, %24 ], [ %36, %35 ]
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %38
store i8 0, i8* %39
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%41 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %37
%44 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %43
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %76
48: ; preds = %43, %37
%49 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.16, i64 0, i64 0), %37 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0), %43 ]
store i8 0, i8* %4
%50 = call i32 @puts(i8* dereferenceable(1) %49)
br label %51
51: ; preds = %51, %48
%52 = call i64 @serialDataAvail(i32 %5)
%53 = icmp eq i64 %52, 0
br i1 %53, label %51, label %54
54: ; preds = %51
%55 = call i64 @serialDataAvail(i32 %5)
%56 = icmp eq i64 %55, 0
br i1 %56, label %67, label %57
57: ; preds = %54, %57
%58 = phi i64 [ %62, %57 ], [ 0, %54 ]
%59 = call i32 @delay(i32 10)
%60 = call signext i8 @serialGetchar(i32 %5)
%61 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %58
store i8 %60, i8* %61
%62 = add nuw i64 %58, 1
%63 = call i64 @serialDataAvail(i32 %5)
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %57
65: ; preds = %57
%66 = and i64 %62, 4294967295
br label %67
67: ; preds = %65, %54
%68 = phi i64 [ 0, %54 ], [ %66, %65 ]
%69 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %68
store i8 0, i8* %69
%70 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
store i8 0, i8* %4
br i1 %71, label %72, label %74
72: ; preds = %67
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
br label %76
74: ; preds = %67
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.14, i64 0, i64 0))
br label %76
76: ; preds = %72, %74, %46, %7
%77 = phi i32 [ 1, %7 ], [ %47, %46 ], [ 0, %74 ], [ 0, %72 ]
ret i32 %77
}