#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*/ clear_screen();
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ kbhit();
int open_port();
char option_selected();
int /*<<< orphan*/ parse_and_print(unsigned char *);
int /*<<< orphan*/ perror(char *);
char print_welcome();
int /*<<< orphan*/ printf(char *);
scalar_t__ read(int, unsigned char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ write(int, char *, int);
int main() {
  while (1) {
    char usb_or_eth = print_welcome();
    if (usb_or_eth == '1') {
      clear_screen();
      printf("Chose Debugging Output Method\n");
      printf("\n1- CDC\n");
      printf("\n2- UART\n");
      printf("\nq- Return\n");
      printf("\nTo select press [1/2/q]: ");
      fflush(stdout);
      char cdcORuart = option_selected();
      if (cdcORuart == 'q')
        print_welcome();
      else {
        int fd = open_port();
        if (fd < 0)
          return 0;
        unsigned char buf[100];
        unsigned char start = 0XAA;
        int index;
        unsigned char debug_arr[16];
        if (cdcORuart == '1') {
          while (!kbhit()) {
            write(fd, "DS", 2);
            if (read(fd, buf, 100) < 0)
              perror("read");
            parse_and_print(buf);
            sleep(1);
          }
          getchar();
          close(fd);
        } else if (cdcORuart == '2') {
          while (!kbhit()) {
            index = 1;
            while (buf[0] != start) {
              if (read(fd, buf, 100) < 0)
                perror("read");
            }
            while (index < 14) {
              read(fd, buf, 10);
              debug_arr[index] = buf[0];
              index = index + 1;
            }
            parse_and_print(debug_arr);
          }
          getchar();
          close(fd);
        }
      }
    } else if (usb_or_eth == '2') {
      clear_screen();
      printf("Packets are on their way....feature coming soon\n");
      printf("Press ENTER to return\n");
      while (!kbhit())
        ;
      getchar();
    } else {
      printf("Thank You\n");
      printf("TimVideos - World wide Leader in Live Event Streaming\n");
      return 0;
    }
    getchar();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10b0 <print_welcome@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x31,%eax
jne    1412 <main+0x232>
mov    $0x0,%al
call   10c0 <clear_screen@plt>
lea    0xde9(%rip),%rdi
call   1050 <printf@plt>
lea    0xdfc(%rip),%rdi
call   1050 <printf@plt>
lea    0xdf9(%rip),%rdi
call   1050 <printf@plt>
lea    0xdf7(%rip),%rdi
call   1050 <printf@plt>
lea    0xdf7(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    $0x0,%al
call   10e0 <option_selected@plt>
mov    %al,-0x6(%rbp)
movsbl -0x6(%rbp),%eax
cmp    $0x71,%eax
jne    127d <main+0x9d>
mov    $0x0,%al
call   10b0 <print_welcome@plt>
jmp    140d <main+0x22d>
mov    $0x0,%al
call   10f0 <open_port@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    129d <main+0xbd>
movl   $0x0,-0x4(%rbp)
jmp    14a0 <main+0x2c0>
movb   $0xaa,-0x71(%rbp)
movsbl -0x6(%rbp),%eax
cmp    $0x31,%eax
jne    1336 <main+0x156>
jmp    12b3 <main+0xd3>
mov    $0x0,%al
call   1060 <kbhit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12cf <main+0xef>
jmp    1322 <main+0x142>
mov    -0xc(%rbp),%edi
lea    0xd80(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0xc(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
call   1080 <read@plt>
cmp    $0x0,%rax
jge    130a <main+0x12a>
lea    0xd57(%rip),%rdi
call   10d0 <perror@plt>
lea    -0x70(%rbp),%rdi
call   1030 <parse_and_print@plt>
mov    $0x1,%edi
call   1100 <sleep@plt>
jmp    12b3 <main+0xd3>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
jmp    1408 <main+0x228>
movsbl -0x6(%rbp),%eax
cmp    $0x32,%eax
jne    1403 <main+0x223>
jmp    1348 <main+0x168>
mov    $0x0,%al
call   1060 <kbhit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1364 <main+0x184>
jmp    13f4 <main+0x214>
movl   $0x1,-0x78(%rbp)
movzbl -0x70(%rbp),%eax
movzbl -0x71(%rbp),%ecx
cmp    %ecx,%eax
je     13a7 <main+0x1c7>
mov    -0xc(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
call   1080 <read@plt>
cmp    $0x0,%rax
jge    13a2 <main+0x1c2>
lea    0xcbf(%rip),%rdi
call   10d0 <perror@plt>
jmp    136b <main+0x18b>
jmp    13ac <main+0x1cc>
cmpl   $0xe,-0x78(%rbp)
jge    13e3 <main+0x203>
mov    -0xc(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0xa,%edx
call   1080 <read@plt>
mov    -0x70(%rbp),%cl
movslq -0x78(%rbp),%rax
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    13ac <main+0x1cc>
lea    -0x90(%rbp),%rdi
call   1030 <parse_and_print@plt>
jmp    1348 <main+0x168>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
jmp    1408 <main+0x228>
jmp    140d <main+0x22d>
jmp    1494 <main+0x2b4>
movsbl -0x5(%rbp),%eax
cmp    $0x32,%eax
jne    146b <main+0x28b>
mov    $0x0,%al
call   10c0 <clear_screen@plt>
lea    0xc34(%rip),%rdi
call   1050 <printf@plt>
lea    0xc59(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <kbhit@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    145a <main+0x27a>
jmp    145f <main+0x27f>
jmp    143e <main+0x25e>
mov    $0x0,%al
call   1090 <getchar@plt>
jmp    148f <main+0x2af>
lea    0xc37(%rip),%rdi
call   1050 <printf@plt>
lea    0xc36(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    14a0 <main+0x2c0>
jmp    1494 <main+0x2b4>
mov    $0x0,%al
call   1090 <getchar@plt>
jmp    11f2 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xe5e(%rip),%r15
lea    0xe87(%rip),%r13
lea    0xe96(%rip),%rbp
lea    0xead(%rip),%rbx
lea    0x10(%rsp),%r12
jmp    123e <main+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10c0 <print_welcome@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
xor    %eax,%eax
call   10c0 <print_welcome@plt>
cmp    $0x32,%al
je     1450 <main+0x260>
cmp    $0x31,%al
jne    150e <main+0x31e>
xor    %eax,%eax
call   10d0 <clear_screen@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe59(%rip),%rdi
call   1040 <puts@plt>
lea    0xd75(%rip),%rdi
call   1060 <printf@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
xor    %eax,%eax
call   10f0 <option_selected@plt>
cmp    $0x71,%al
je     1230 <main+0x40>
mov    %eax,%r14d
xor    %eax,%eax
call   1100 <open_port@plt>
test   %eax,%eax
js     1526 <main+0x336>
mov    %eax,%ebp
cmp    $0x31,%r14b
je     1487 <main+0x297>
cmp    $0x32,%r14b
jne    14a7 <main+0x2b7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <kbhit@plt>
test   %eax,%eax
je     1310 <main+0x120>
jmp    1499 <main+0x2a9>
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0x64,%edx
call   1090 <read@plt>
test   %rax,%rax
jns    1310 <main+0x120>
lea    0xd13(%rip),%rdi
call   10e0 <perror@plt>
cmpb   $0xaa,0x10(%rsp)
jne    12f0 <main+0x100>
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x1(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x2(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x3(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x4(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x5(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x6(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x7(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x8(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0x9(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0xa(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0xb(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0xc(%rsp)
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1090 <read@plt>
mov    0x10(%rsp),%al
mov    %al,0xd(%rsp)
mov    %rsp,%rdi
call   1030 <parse_and_print@plt>
jmp    12e0 <main+0xf0>
nop
xor    %eax,%eax
call   10d0 <clear_screen@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <kbhit@plt>
test   %eax,%eax
je     1470 <main+0x280>
xor    %eax,%eax
call   10a0 <getchar@plt>
jmp    1237 <main+0x47>
xor    %eax,%eax
call   1070 <kbhit@plt>
test   %eax,%eax
lea    0xb84(%rip),%rbx
je     14dd <main+0x2ed>
xor    %eax,%eax
call   10a0 <getchar@plt>
mov    %ebp,%edi
call   1080 <close@plt>
lea    0xbfb(%rip),%rbp
lea    0xc12(%rip),%rbx
jmp    1237 <main+0x47>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <parse_and_print@plt>
mov    $0x1,%edi
call   1110 <sleep@plt>
xor    %eax,%eax
call   1070 <kbhit@plt>
test   %eax,%eax
jne    1499 <main+0x2a9>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1050 <write@plt>
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0x64,%edx
call   1090 <read@plt>
test   %rax,%rax
jns    14c0 <main+0x2d0>
lea    0xb17(%rip),%rdi
call   10e0 <perror@plt>
jmp    14c0 <main+0x2d0>
lea    0xb0e(%rip),%rdi
call   1040 <puts@plt>
lea    0xb0c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Chose Debugging Output Method\0A\00"
@.str.1 = [9 x i8] c"\0A1- CDC\0A\00"
@.str.2 = [10 x i8] c"\0A2- UART\0A\00"
@.str.3 = [12 x i8] c"\0Aq- Return\0A\00"
@.str.4 = [27 x i8] c"\0ATo select press [1/2/q]: \00"
@stdout = global i32 0
@.str.5 = [3 x i8] c"DS\00"
@.str.6 = [5 x i8] c"read\00"
@.str.7 = [49 x i8] c"Packets are on their way....feature coming soon\0A\00"
@.str.8 = [23 x i8] c"Press ENTER to return\0A\00"
@.str.9 = [11 x i8] c"Thank You\0A\00"
@.str.10 = [55 x i8] c"TimVideos - World wide Leader in Live Event Streaming\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca i8
%7 = alloca i32
%8 = alloca [16 x i8]
store i32 0, i32* %1
br label %9
9: ; preds = %0, %129
%10 = call signext i8 (...) @print_welcome()
store i8 %10, i8* %2
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 49
br i1 %13, label %14, label %110
14: ; preds = %9
%15 = call i32 (...) @clear_screen()
%16 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%21 = load i32, i32* @stdout
%22 = call i32 @fflush(i32 %21)
%23 = call signext i8 (...) @option_selected()
store i8 %23, i8* %3
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 113
br i1 %26, label %27, label %29
27: ; preds = %14
%28 = call signext i8 (...) @print_welcome()
br label %109
29: ; preds = %14
%30 = call i32 (...) @open_port()
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 0, i32* %1
br label %131
34: ; preds = %29
store i8 -86, i8* %6
%35 = load i8, i8* %3
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 49
br i1 %37, label %38, label %60
38: ; preds = %34
br label %39
39: ; preds = %52, %38
%40 = call i32 (...) @kbhit()
%41 = icmp ne i32 %40, 0
%42 = xor i1 %41, true
br i1 %42, label %43, label %56
43: ; preds = %39
%44 = load i32, i32* %4
%45 = call i32 @write(i32 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%46 = load i32, i32* %4
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%48 = call i64 @read(i32 %46, i8* %47, i32 100)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %43
%51 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %52
52: ; preds = %50, %43
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%54 = call i32 @parse_and_print(i8* %53)
%55 = call i32 @sleep(i32 1)
br label %39
56: ; preds = %39
%57 = call i32 (...) @getchar()
%58 = load i32, i32* %4
%59 = call i32 @close(i32 %58)
br label %108
60: ; preds = %34
%61 = load i8, i8* %3
%62 = sext i8 %61 to i32
%63 = icmp eq i32 %62, 50
br i1 %63, label %64, label %107
64: ; preds = %60
br label %65
65: ; preds = %100, %64
%66 = call i32 (...) @kbhit()
%67 = icmp ne i32 %66, 0
%68 = xor i1 %67, true
br i1 %68, label %69, label %103
69: ; preds = %65
store i32 1, i32* %7
br label %70
70: ; preds = %84, %69
%71 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%72 = load i8, i8* %71
%73 = zext i8 %72 to i32
%74 = load i8, i8* %6
%75 = zext i8 %74 to i32
%76 = icmp ne i32 %73, %75
br i1 %76, label %77, label %85
77: ; preds = %70
%78 = load i32, i32* %4
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%80 = call i64 @read(i32 %78, i8* %79, i32 100)
%81 = icmp slt i64 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %77
%83 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %84
84: ; preds = %82, %77
br label %70
85: ; preds = %70
br label %86
86: ; preds = %89, %85
%87 = load i32, i32* %7
%88 = icmp slt i32 %87, 14
br i1 %88, label %89, label %100
89: ; preds = %86
%90 = load i32, i32* %4
%91 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%92 = call i64 @read(i32 %90, i8* %91, i32 10)
%93 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%94 = load i8, i8* %93
%95 = load i32, i32* %7
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 %96
store i8 %94, i8* %97
%98 = load i32, i32* %7
%99 = add nsw i32 %98, 1
store i32 %99, i32* %7
br label %86
100: ; preds = %86
%101 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%102 = call i32 @parse_and_print(i8* %101)
br label %65
103: ; preds = %65
%104 = call i32 (...) @getchar()
%105 = load i32, i32* %4
%106 = call i32 @close(i32 %105)
br label %107
107: ; preds = %103, %60
br label %108
108: ; preds = %107, %56
br label %109
109: ; preds = %108, %27
br label %129
110: ; preds = %9
%111 = load i8, i8* %2
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 50
br i1 %113, label %114, label %125
114: ; preds = %110
%115 = call i32 (...) @clear_screen()
%116 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
%117 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %118
118: ; preds = %122, %114
%119 = call i32 (...) @kbhit()
%120 = icmp ne i32 %119, 0
%121 = xor i1 %120, true
br i1 %121, label %122, label %123
122: ; preds = %118
br label %118
123: ; preds = %118
%124 = call i32 (...) @getchar()
br label %128
125: ; preds = %110
%126 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0))
%127 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %131
128: ; preds = %123
br label %129
129: ; preds = %128, %109
%130 = call i32 (...) @getchar()
br label %9
131: ; preds = %125, %33
%132 = load i32, i32* %1
ret i32 %132
}

LLVM IR (-O2):
@.str.4 = [27 x i8] c"\0ATo select press [1/2/q]: \00"
@stdout = global i32 0
@.str.5 = [3 x i8] c"DS\00"
@.str.6 = [5 x i8] c"read\00"
@str = [10 x i8] c"Thank You\00"
@str.11 = [54 x i8] c"TimVideos - World wide Leader in Live Event Streaming\00"
@str.12 = [48 x i8] c"Packets are on their way....feature coming soon\00"
@str.13 = [22 x i8] c"Press ENTER to return\00"
@str.14 = [30 x i8] c"Chose Debugging Output Method\00"
@str.15 = [8 x i8] c"\0A1- CDC\00"
@str.16 = [9 x i8] c"\0A2- UART\00"
@str.17 = [11 x i8] c"\0Aq- Return\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 1
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 2
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 3
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 4
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 5
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 6
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 7
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 8
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 9
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 10
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 11
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 12
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 13
br label %18
18: ; preds = %111, %0
%19 = call signext i8 (...) @print_welcome()
switch i8 %19, label %108 [
i8 49, label %20
i8 50, label %99
]
20: ; preds = %18
%21 = call i32 (...) @clear_screen()
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.14, i64 0, i64 0))
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.15, i64 0, i64 0))
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.16, i64 0, i64 0))
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.17, i64 0, i64 0))
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%27 = load i32, i32* @stdout
%28 = call i32 @fflush(i32 %27)
%29 = call signext i8 (...) @option_selected()
%30 = icmp eq i8 %29, 113
br i1 %30, label %31, label %33
31: ; preds = %20
%32 = call signext i8 (...) @print_welcome()
br label %111
33: ; preds = %20
%34 = call i32 (...) @open_port()
%35 = icmp slt i32 %34, 0
br i1 %35, label %113, label %36
36: ; preds = %33
switch i8 %29, label %98 [
i8 49, label %40
i8 50, label %37
]
37: ; preds = %36
%38 = call i32 (...) @kbhit()
%39 = icmp eq i32 %38, 0
br i1 %39, label %54, label %95
40: ; preds = %36
%41 = call i32 (...) @kbhit()
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %95
43: ; preds = %40, %49
%44 = call i32 @write(i32 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 2)
%45 = call i64 @read(i32 %34, i8* %3, i32 100)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %49
49: ; preds = %47, %43
%50 = call i32 @parse_and_print(i8* %3)
%51 = call i32 @sleep(i32 1)
%52 = call i32 (...) @kbhit()
%53 = icmp eq i32 %52, 0
br i1 %53, label %43, label %95
54: ; preds = %37, %57
%55 = load i8, i8* %3
%56 = icmp eq i8 %55, -86
br i1 %56, label %57, label %87
57: ; preds = %92, %54
%58 = call i64 @read(i32 %34, i8* %3, i32 10)
%59 = load i8, i8* %3
store i8 %59, i8* %5
%60 = call i64 @read(i32 %34, i8* %3, i32 10)
%61 = load i8, i8* %3
store i8 %61, i8* %6
%62 = call i64 @read(i32 %34, i8* %3, i32 10)
%63 = load i8, i8* %3
store i8 %63, i8* %7
%64 = call i64 @read(i32 %34, i8* %3, i32 10)
%65 = load i8, i8* %3
store i8 %65, i8* %8
%66 = call i64 @read(i32 %34, i8* %3, i32 10)
%67 = load i8, i8* %3
store i8 %67, i8* %9
%68 = call i64 @read(i32 %34, i8* %3, i32 10)
%69 = load i8, i8* %3
store i8 %69, i8* %10
%70 = call i64 @read(i32 %34, i8* %3, i32 10)
%71 = load i8, i8* %3
store i8 %71, i8* %11
%72 = call i64 @read(i32 %34, i8* %3, i32 10)
%73 = load i8, i8* %3
store i8 %73, i8* %12
%74 = call i64 @read(i32 %34, i8* %3, i32 10)
%75 = load i8, i8* %3
store i8 %75, i8* %13
%76 = call i64 @read(i32 %34, i8* %3, i32 10)
%77 = load i8, i8* %3
store i8 %77, i8* %14
%78 = call i64 @read(i32 %34, i8* %3, i32 10)
%79 = load i8, i8* %3
store i8 %79, i8* %15
%80 = call i64 @read(i32 %34, i8* %3, i32 10)
%81 = load i8, i8* %3
store i8 %81, i8* %16
%82 = call i64 @read(i32 %34, i8* %3, i32 10)
%83 = load i8, i8* %3
store i8 %83, i8* %17
%84 = call i32 @parse_and_print(i8* %4)
%85 = call i32 (...) @kbhit()
%86 = icmp eq i32 %85, 0
br i1 %86, label %54, label %95
87: ; preds = %54, %92
%88 = call i64 @read(i32 %34, i8* %3, i32 100)
%89 = icmp slt i64 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %87
%91 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %92
92: ; preds = %90, %87
%93 = load i8, i8* %3
%94 = icmp eq i8 %93, -86
br i1 %94, label %57, label %87
95: ; preds = %57, %49, %37, %40
%96 = call i32 (...) @getchar()
%97 = call i32 @close(i32 %34)
br label %98
98: ; preds = %95, %36
br label %111
99: ; preds = %18
%100 = call i32 (...) @clear_screen()
%101 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.12, i64 0, i64 0))
%102 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
br label %103
103: ; preds = %103, %99
%104 = call i32 (...) @kbhit()
%105 = icmp eq i32 %104, 0
br i1 %105, label %103, label %106
106: ; preds = %103
%107 = call i32 (...) @getchar()
br label %111
108: ; preds = %18
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%110 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.11, i64 0, i64 0))
br label %113
111: ; preds = %106, %31, %98
%112 = call i32 (...) @getchar()
br label %18
113: ; preds = %33, %108
ret i32 0
}