#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*/ OS_Kill();
int /*<<< orphan*/ UART_InString(char *, int);
int /*<<< orphan*/ UART_OutString(char *);
int /*<<< orphan*/ term_ClearClock();
int /*<<< orphan*/ term_JitterHistogram();
int /*<<< orphan*/ term_JitterMax();
int /*<<< orphan*/ term_ML();
int /*<<< orphan*/ term_MR();
int /*<<< orphan*/ term_OSClearStats();
int /*<<< orphan*/ term_OSProfile();
int /*<<< orphan*/ term_OSProfileClear();
int /*<<< orphan*/ term_OSStats();
int /*<<< orphan*/ term_ReadClock();
int /*<<< orphan*/ term_help();
void term_main() {
  unsigned char length;
  char inBuff[(100 + 1)];
  UART_OutString("\n\n\rWelcome to Serial Command Line Interface!");
  while (1) {
    UART_OutString("\n\rCLI> ");
    UART_InString(inBuff, 99);
    for (length = 0; inBuff[length] != 0 && length < 100; length++)
      if ((inBuff[length] >= 97) && (inBuff[length] <= 122))
        inBuff[length] -= 32;
    if (inBuff[0] == 'H')
      term_help();
    else if (length >= 2 && inBuff[0] == 'R' && inBuff[1] == 'C')
      term_ReadClock();
    else if (length >= 2 && inBuff[0] == 'C' && inBuff[1] == 'C')
      term_ClearClock();
    else if (length >= 2 && inBuff[0] == 'J' && inBuff[1] == 'M')
      term_JitterMax();
    else if (length >= 2 && inBuff[0] == 'J' && inBuff[1] == 'H')
      term_JitterHistogram();
    else if (length == 2 && inBuff[0] == 'O' && inBuff[1] == 'S')
      term_OSStats();
    else if (length == 2 && inBuff[0] == 'O' && inBuff[1] == 'P')
      term_OSProfile();
    else if (length >= 3 && inBuff[0] == 'O' && inBuff[1] == 'P' &&
             inBuff[2] == 'C')
      term_OSProfileClear();
    else if (length >= 3 && inBuff[0] == 'O' && inBuff[1] == 'S' &&
             inBuff[2] == 'C')
      term_OSClearStats();
    else if (length == 2 && inBuff[0] == 'M' && inBuff[1] == 'R')
      term_MR();
    else if (length == 2 && inBuff[0] == 'M' && inBuff[1] == 'L')
      term_ML();
    else if (inBuff[0] == 'Q') {
      UART_OutString("\n\rBYE!\n\r");
      break;
    } else
      UART_OutString("\n\n\rUnrecognized Command. RTFM and try again.");
  }
  OS_Kill();
}


x86 assembly (clang, -O0):
<term_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    0xe0e(%rip),%rdi
call   1060 <UART_OutString@plt>
lea    0xe2f(%rip),%rdi
call   1060 <UART_OutString@plt>
lea    -0x70(%rbp),%rdi
mov    $0x63,%esi
call   1090 <UART_InString@plt>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
movsbl -0x70(%rbp,%rax,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x71(%rbp)
je     1239 <term_main+0x59>
movzbl -0x1(%rbp),%eax
cmp    $0x64,%eax
setl   %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    1249 <term_main+0x69>
jmp    128f <term_main+0xaf>
movzbl -0x1(%rbp),%eax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     127d <term_main+0x9d>
movzbl -0x1(%rbp),%eax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     127d <term_main+0x9d>
movzbl -0x1(%rbp),%eax
movsbl -0x70(%rbp,%rax,1),%ecx
sub    $0x20,%ecx
mov    %cl,-0x70(%rbp,%rax,1)
jmp    1282 <term_main+0xa2>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    1215 <term_main+0x35>
movsbl -0x70(%rbp),%eax
cmp    $0x48,%eax
jne    12a8 <term_main+0xc8>
mov    $0x0,%al
call   1040 <term_help@plt>
jmp    1521 <term_main+0x341>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jl     12db <term_main+0xfb>
movsbl -0x70(%rbp),%eax
cmp    $0x52,%eax
jne    12db <term_main+0xfb>
movsbl -0x6f(%rbp),%eax
cmp    $0x43,%eax
jne    12db <term_main+0xfb>
mov    $0x0,%al
call   10e0 <term_ReadClock@plt>
jmp    151c <term_main+0x33c>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jl     130e <term_main+0x12e>
movsbl -0x70(%rbp),%eax
cmp    $0x43,%eax
jne    130e <term_main+0x12e>
movsbl -0x6f(%rbp),%eax
cmp    $0x43,%eax
jne    130e <term_main+0x12e>
mov    $0x0,%al
call   1070 <term_ClearClock@plt>
jmp    1517 <term_main+0x337>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jl     1341 <term_main+0x161>
movsbl -0x70(%rbp),%eax
cmp    $0x4a,%eax
jne    1341 <term_main+0x161>
movsbl -0x6f(%rbp),%eax
cmp    $0x4d,%eax
jne    1341 <term_main+0x161>
mov    $0x0,%al
call   1100 <term_JitterMax@plt>
jmp    1512 <term_main+0x332>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jl     1374 <term_main+0x194>
movsbl -0x70(%rbp),%eax
cmp    $0x4a,%eax
jne    1374 <term_main+0x194>
movsbl -0x6f(%rbp),%eax
cmp    $0x48,%eax
jne    1374 <term_main+0x194>
mov    $0x0,%al
call   1030 <term_JitterHistogram@plt>
jmp    150d <term_main+0x32d>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    13a7 <term_main+0x1c7>
movsbl -0x70(%rbp),%eax
cmp    $0x4f,%eax
jne    13a7 <term_main+0x1c7>
movsbl -0x6f(%rbp),%eax
cmp    $0x53,%eax
jne    13a7 <term_main+0x1c7>
mov    $0x0,%al
call   1080 <term_OSStats@plt>
jmp    1508 <term_main+0x328>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    13da <term_main+0x1fa>
movsbl -0x70(%rbp),%eax
cmp    $0x4f,%eax
jne    13da <term_main+0x1fa>
movsbl -0x6f(%rbp),%eax
cmp    $0x50,%eax
jne    13da <term_main+0x1fa>
mov    $0x0,%al
call   10f0 <term_OSProfile@plt>
jmp    1503 <term_main+0x323>
movzbl -0x1(%rbp),%eax
cmp    $0x3,%eax
jl     141a <term_main+0x23a>
movsbl -0x70(%rbp),%eax
cmp    $0x4f,%eax
jne    141a <term_main+0x23a>
movsbl -0x6f(%rbp),%eax
cmp    $0x50,%eax
jne    141a <term_main+0x23a>
movsbl -0x6e(%rbp),%eax
cmp    $0x43,%eax
jne    141a <term_main+0x23a>
mov    $0x0,%al
call   10b0 <term_OSProfileClear@plt>
jmp    14fe <term_main+0x31e>
movzbl -0x1(%rbp),%eax
cmp    $0x3,%eax
jl     145a <term_main+0x27a>
movsbl -0x70(%rbp),%eax
cmp    $0x4f,%eax
jne    145a <term_main+0x27a>
movsbl -0x6f(%rbp),%eax
cmp    $0x53,%eax
jne    145a <term_main+0x27a>
movsbl -0x6e(%rbp),%eax
cmp    $0x43,%eax
jne    145a <term_main+0x27a>
mov    $0x0,%al
call   1050 <term_OSClearStats@plt>
jmp    14f9 <term_main+0x319>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    148d <term_main+0x2ad>
movsbl -0x70(%rbp),%eax
cmp    $0x4d,%eax
jne    148d <term_main+0x2ad>
movsbl -0x6f(%rbp),%eax
cmp    $0x52,%eax
jne    148d <term_main+0x2ad>
mov    $0x0,%al
call   10d0 <term_MR@plt>
jmp    14f4 <term_main+0x314>
movzbl -0x1(%rbp),%eax
cmp    $0x2,%eax
jne    14c0 <term_main+0x2e0>
movsbl -0x70(%rbp),%eax
cmp    $0x4d,%eax
jne    14c0 <term_main+0x2e0>
movsbl -0x6f(%rbp),%eax
cmp    $0x4c,%eax
jne    14c0 <term_main+0x2e0>
mov    $0x0,%al
call   10c0 <term_ML@plt>
jmp    14ef <term_main+0x30f>
movsbl -0x70(%rbp),%eax
cmp    $0x51,%eax
jne    14de <term_main+0x2fe>
lea    0xb61(%rip),%rdi
call   1060 <UART_OutString@plt>
jmp    1526 <term_main+0x346>
lea    0xb59(%rip),%rdi
call   1060 <UART_OutString@plt>
jmp    14ef <term_main+0x30f>
jmp    14f4 <term_main+0x314>
jmp    14f9 <term_main+0x319>
jmp    14fe <term_main+0x31e>
jmp    1503 <term_main+0x323>
jmp    1508 <term_main+0x328>
jmp    150d <term_main+0x32d>
jmp    1512 <term_main+0x332>
jmp    1517 <term_main+0x337>
jmp    151c <term_main+0x33c>
jmp    1521 <term_main+0x341>
jmp    11f7 <term_main+0x17>
mov    $0x0,%al
call   10a0 <OS_Kill@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<term_main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xe0e(%rip),%rdi
call   1060 <UART_OutString@plt>
lea    0xe2f(%rip),%r14
mov    %rsp,%r12
lea    0xe36(%rip),%r15
jmp    1228 <term_main+0x48>
cmp    $0x51,%al
je     13d6 <term_main+0x1f6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1060 <UART_OutString@plt>
mov    %r14,%rdi
call   1060 <UART_OutString@plt>
mov    %r12,%rdi
mov    $0x63,%esi
call   1090 <UART_InString@plt>
mov    (%rsp),%al
test   %al,%al
je     1220 <term_main+0x40>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
lea    -0x61(%rax),%edx
cmp    $0x19,%dl
ja     125d <term_main+0x7d>
add    $0xe0,%al
mov    %al,(%rsp,%rcx,1)
lea    0x1(%rcx),%rdx
movzbl 0x1(%rsp,%rcx,1),%eax
test   %al,%al
je     1273 <term_main+0x93>
cmp    $0x63,%rcx
mov    %rdx,%rcx
jb     1250 <term_main+0x70>
mov    (%rsp),%al
cmp    $0x48,%al
jne    1290 <term_main+0xb0>
xor    %eax,%eax
call   1040 <term_help@plt>
jmp    1228 <term_main+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x1(%rsp),%r8b
cmp    $0x2,%dl
jb     12b0 <term_main+0xd0>
cmp    $0x52,%al
jne    12b0 <term_main+0xd0>
cmp    $0x43,%r8b
jne    12b0 <term_main+0xd0>
xor    %eax,%eax
call   10e0 <term_ReadClock@plt>
jmp    1228 <term_main+0x48>
cmp    $0x2,%dl
jb     12cb <term_main+0xeb>
cmp    $0x43,%al
jne    12cb <term_main+0xeb>
cmp    $0x43,%r8b
jne    12cb <term_main+0xeb>
xor    %eax,%eax
call   1070 <term_ClearClock@plt>
jmp    1228 <term_main+0x48>
cmp    $0x2,%dl
setae  %sil
cmp    $0x4a,%al
sete   %bl
and    %sil,%bl
cmp    $0x1,%bl
jne    12f1 <term_main+0x111>
cmp    $0x4d,%r8b
jne    12f1 <term_main+0x111>
xor    %eax,%eax
call   1100 <term_JitterMax@plt>
jmp    1228 <term_main+0x48>
cmp    $0x48,%r8b
sete   %cl
and    %cl,%bl
cmp    $0x1,%bl
jne    130b <term_main+0x12b>
xor    %eax,%eax
call   1030 <term_JitterHistogram@plt>
jmp    1228 <term_main+0x48>
mov    %edx,%esi
xor    $0x2,%sil
mov    %eax,%ecx
xor    $0x4f,%cl
or     %sil,%cl
sete   %bl
jne    1330 <term_main+0x150>
cmp    $0x53,%r8b
jne    1330 <term_main+0x150>
xor    %eax,%eax
call   1080 <term_OSStats@plt>
jmp    1228 <term_main+0x48>
cmp    $0x50,%r8b
sete   %cl
and    %cl,%bl
cmp    $0x1,%bl
jne    134a <term_main+0x16a>
xor    %eax,%eax
call   10f0 <term_OSProfile@plt>
jmp    1228 <term_main+0x48>
cmp    $0x4f,%al
sete   %cl
cmp    $0x3,%dl
setae  %dl
and    %cl,%dl
mov    0x2(%rsp),%dil
cmp    $0x1,%dl
jne    1379 <term_main+0x199>
cmp    $0x50,%r8b
jne    1379 <term_main+0x199>
cmp    $0x43,%dil
jne    1379 <term_main+0x199>
xor    %eax,%eax
call   10b0 <term_OSProfileClear@plt>
jmp    1228 <term_main+0x48>
cmp    $0x53,%r8b
sete   %cl
and    %cl,%dl
cmp    $0x1,%dl
jne    1399 <term_main+0x1b9>
cmp    $0x43,%dil
jne    1399 <term_main+0x1b9>
xor    %eax,%eax
call   1050 <term_OSClearStats@plt>
jmp    1228 <term_main+0x48>
mov    %eax,%ecx
xor    $0x4d,%cl
or     %cl,%sil
sete   %dl
jne    13b8 <term_main+0x1d8>
cmp    $0x52,%r8b
jne    13b8 <term_main+0x1d8>
xor    %eax,%eax
call   10d0 <term_MR@plt>
jmp    1228 <term_main+0x48>
cmp    $0x4c,%r8b
sete   %cl
and    %cl,%dl
cmp    $0x1,%dl
jne    120a <term_main+0x2a>
xor    %eax,%eax
call   10c0 <term_ML@plt>
jmp    1228 <term_main+0x48>
lea    0xc58(%rip),%rdi
call   1060 <UART_OutString@plt>
xor    %eax,%eax
call   10a0 <OS_Kill@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"\0A\0A\0DWelcome to Serial Command Line Interface!\00"
@.str.1 = [8 x i8] c"\0A\0DCLI> \00"
@.str.2 = [9 x i8] c"\0A\0DBYE!\0A\0D\00"
@.str.3 = [45 x i8] c"\0A\0A\0DUnrecognized Command. RTFM and try again.\00"
define void @term_main() {
%1 = alloca i8
%2 = alloca [101 x i8]
%3 = call i32 @UART_OutString(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %244
%5 = call i32 @UART_OutString(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%7 = call i32 @UART_InString(i8* %6, i32 99)
store i8 0, i8* %1
br label %8
8: ; preds = %44, %4
%9 = load i8, i8* %1
%10 = zext i8 %9 to i64
%11 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %8
%16 = load i8, i8* %1
%17 = zext i8 %16 to i32
%18 = icmp slt i32 %17, 100
br label %19
19: ; preds = %15, %8
%20 = phi i1 [ false, %8 ], [ %18, %15 ]
br i1 %20, label %21, label %47
21: ; preds = %19
%22 = load i8, i8* %1
%23 = zext i8 %22 to i64
%24 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 97
br i1 %27, label %28, label %43
28: ; preds = %21
%29 = load i8, i8* %1
%30 = zext i8 %29 to i64
%31 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp sle i32 %33, 122
br i1 %34, label %35, label %43
35: ; preds = %28
%36 = load i8, i8* %1
%37 = zext i8 %36 to i64
%38 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = sub nsw i32 %40, 32
%42 = trunc i32 %41 to i8
store i8 %42, i8* %38
br label %43
43: ; preds = %35, %28, %21
br label %44
44: ; preds = %43
%45 = load i8, i8* %1
%46 = add i8 %45, 1
store i8 %46, i8* %1
br label %8
47: ; preds = %19
%48 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 72
br i1 %51, label %52, label %54
52: ; preds = %47
%53 = call i32 (...) @term_help()
br label %244
54: ; preds = %47
%55 = load i8, i8* %1
%56 = zext i8 %55 to i32
%57 = icmp sge i32 %56, 2
br i1 %57, label %58, label %70
58: ; preds = %54
%59 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 82
br i1 %62, label %63, label %70
63: ; preds = %58
%64 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 67
br i1 %67, label %68, label %70
68: ; preds = %63
%69 = call i32 (...) @term_ReadClock()
br label %243
70: ; preds = %63, %58, %54
%71 = load i8, i8* %1
%72 = zext i8 %71 to i32
%73 = icmp sge i32 %72, 2
br i1 %73, label %74, label %86
74: ; preds = %70
%75 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 67
br i1 %78, label %79, label %86
79: ; preds = %74
%80 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 67
br i1 %83, label %84, label %86
84: ; preds = %79
%85 = call i32 (...) @term_ClearClock()
br label %242
86: ; preds = %79, %74, %70
%87 = load i8, i8* %1
%88 = zext i8 %87 to i32
%89 = icmp sge i32 %88, 2
br i1 %89, label %90, label %102
90: ; preds = %86
%91 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 74
br i1 %94, label %95, label %102
95: ; preds = %90
%96 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 77
br i1 %99, label %100, label %102
100: ; preds = %95
%101 = call i32 (...) @term_JitterMax()
br label %241
102: ; preds = %95, %90, %86
%103 = load i8, i8* %1
%104 = zext i8 %103 to i32
%105 = icmp sge i32 %104, 2
br i1 %105, label %106, label %118
106: ; preds = %102
%107 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = icmp eq i32 %109, 74
br i1 %110, label %111, label %118
111: ; preds = %106
%112 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp eq i32 %114, 72
br i1 %115, label %116, label %118
116: ; preds = %111
%117 = call i32 (...) @term_JitterHistogram()
br label %240
118: ; preds = %111, %106, %102
%119 = load i8, i8* %1
%120 = zext i8 %119 to i32
%121 = icmp eq i32 %120, 2
br i1 %121, label %122, label %134
122: ; preds = %118
%123 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp eq i32 %125, 79
br i1 %126, label %127, label %134
127: ; preds = %122
%128 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp eq i32 %130, 83
br i1 %131, label %132, label %134
132: ; preds = %127
%133 = call i32 (...) @term_OSStats()
br label %239
134: ; preds = %127, %122, %118
%135 = load i8, i8* %1
%136 = zext i8 %135 to i32
%137 = icmp eq i32 %136, 2
br i1 %137, label %138, label %150
138: ; preds = %134
%139 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = icmp eq i32 %141, 79
br i1 %142, label %143, label %150
143: ; preds = %138
%144 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%145 = load i8, i8* %144
%146 = sext i8 %145 to i32
%147 = icmp eq i32 %146, 80
br i1 %147, label %148, label %150
148: ; preds = %143
%149 = call i32 (...) @term_OSProfile()
br label %238
150: ; preds = %143, %138, %134
%151 = load i8, i8* %1
%152 = zext i8 %151 to i32
%153 = icmp sge i32 %152, 3
br i1 %153, label %154, label %171
154: ; preds = %150
%155 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%156 = load i8, i8* %155
%157 = sext i8 %156 to i32
%158 = icmp eq i32 %157, 79
br i1 %158, label %159, label %171
159: ; preds = %154
%160 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%161 = load i8, i8* %160
%162 = sext i8 %161 to i32
%163 = icmp eq i32 %162, 80
br i1 %163, label %164, label %171
164: ; preds = %159
%165 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 2
%166 = load i8, i8* %165
%167 = sext i8 %166 to i32
%168 = icmp eq i32 %167, 67
br i1 %168, label %169, label %171
169: ; preds = %164
%170 = call i32 (...) @term_OSProfileClear()
br label %237
171: ; preds = %164, %159, %154, %150
%172 = load i8, i8* %1
%173 = zext i8 %172 to i32
%174 = icmp sge i32 %173, 3
br i1 %174, label %175, label %192
175: ; preds = %171
%176 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%177 = load i8, i8* %176
%178 = sext i8 %177 to i32
%179 = icmp eq i32 %178, 79
br i1 %179, label %180, label %192
180: ; preds = %175
%181 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%182 = load i8, i8* %181
%183 = sext i8 %182 to i32
%184 = icmp eq i32 %183, 83
br i1 %184, label %185, label %192
185: ; preds = %180
%186 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 2
%187 = load i8, i8* %186
%188 = sext i8 %187 to i32
%189 = icmp eq i32 %188, 67
br i1 %189, label %190, label %192
190: ; preds = %185
%191 = call i32 (...) @term_OSClearStats()
br label %236
192: ; preds = %185, %180, %175, %171
%193 = load i8, i8* %1
%194 = zext i8 %193 to i32
%195 = icmp eq i32 %194, 2
br i1 %195, label %196, label %208
196: ; preds = %192
%197 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%198 = load i8, i8* %197
%199 = sext i8 %198 to i32
%200 = icmp eq i32 %199, 77
br i1 %200, label %201, label %208
201: ; preds = %196
%202 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%203 = load i8, i8* %202
%204 = sext i8 %203 to i32
%205 = icmp eq i32 %204, 82
br i1 %205, label %206, label %208
206: ; preds = %201
%207 = call i32 (...) @term_MR()
br label %235
208: ; preds = %201, %196, %192
%209 = load i8, i8* %1
%210 = zext i8 %209 to i32
%211 = icmp eq i32 %210, 2
br i1 %211, label %212, label %224
212: ; preds = %208
%213 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%214 = load i8, i8* %213
%215 = sext i8 %214 to i32
%216 = icmp eq i32 %215, 77
br i1 %216, label %217, label %224
217: ; preds = %212
%218 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 1
%219 = load i8, i8* %218
%220 = sext i8 %219 to i32
%221 = icmp eq i32 %220, 76
br i1 %221, label %222, label %224
222: ; preds = %217
%223 = call i32 (...) @term_ML()
br label %234
224: ; preds = %217, %212, %208
%225 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%226 = load i8, i8* %225
%227 = sext i8 %226 to i32
%228 = icmp eq i32 %227, 81
br i1 %228, label %229, label %231
229: ; preds = %224
%230 = call i32 @UART_OutString(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %245
231: ; preds = %224
%232 = call i32 @UART_OutString(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %233
233: ; preds = %231
br label %234
234: ; preds = %233, %222
br label %235
235: ; preds = %234, %206
br label %236
236: ; preds = %235, %190
br label %237
237: ; preds = %236, %169
br label %238
238: ; preds = %237, %148
br label %239
239: ; preds = %238, %132
br label %240
240: ; preds = %239, %116
br label %241
241: ; preds = %240, %100
br label %242
242: ; preds = %241, %84
br label %243
243: ; preds = %242, %68
br label %244
244: ; preds = %243, %52
br label %4
245: ; preds = %229
%246 = call i32 (...) @OS_Kill()
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"\0A\0A\0DWelcome to Serial Command Line Interface!\00"
@.str.1 = [8 x i8] c"\0A\0DCLI> \00"
@.str.2 = [9 x i8] c"\0A\0DBYE!\0A\0D\00"
@.str.3 = [45 x i8] c"\0A\0A\0DUnrecognized Command. RTFM and try again.\00"
define void @term_main() {
%1 = alloca [101 x i8]
%2 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @UART_OutString(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 1
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 2
br label %6
6: ; preds = %41, %0
%7 = call i32 @UART_OutString(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @UART_InString(i8* %2, i32 99)
%9 = load i8, i8* %2
%10 = icmp eq i8 %9, 0
br i1 %10, label %104, label %11
11: ; preds = %6, %19
%12 = phi i64 [ %20, %19 ], [ 0, %6 ]
%13 = phi i8 [ %22, %19 ], [ %9, %6 ]
%14 = phi i8* [ %21, %19 ], [ %2, %6 ]
%15 = add i8 %13, -97
%16 = icmp ult i8 %15, 26
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = add nsw i8 %13, -32
store i8 %18, i8* %14
br label %19
19: ; preds = %11, %17
%20 = add nuw nsw i64 %12, 1
%21 = getelementptr inbounds [101 x i8], [101 x i8]* %1, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
%24 = icmp ult i64 %12, 99
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %11, label %26
26: ; preds = %19
%27 = trunc i64 %20 to i8
%28 = load i8, i8* %2
%29 = icmp eq i8 %28, 72
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (...) @term_help()
br label %41
32: ; preds = %26
%33 = icmp ugt i8 %27, 1
%34 = icmp eq i8 %28, 82
%35 = select i1 %33, i1 %34, i1 false
%36 = load i8, i8* %4
%37 = icmp eq i8 %36, 67
%38 = select i1 %35, i1 %37, i1 false
br i1 %38, label %39, label %42
39: ; preds = %32
%40 = call i32 (...) @term_ReadClock()
br label %41
41: ; preds = %39, %53, %66, %80, %92, %104, %97, %85, %71, %58, %46, %30
br label %6
42: ; preds = %32
%43 = icmp eq i8 %28, 67
%44 = select i1 %33, i1 %43, i1 false
%45 = select i1 %44, i1 %37, i1 false
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 (...) @term_ClearClock()
br label %41
48: ; preds = %42
%49 = icmp eq i8 %28, 74
%50 = select i1 %33, i1 %49, i1 false
%51 = icmp eq i8 %36, 77
%52 = select i1 %50, i1 %51, i1 false
br i1 %52, label %53, label %55
53: ; preds = %48
%54 = call i32 (...) @term_JitterMax()
br label %41
55: ; preds = %48
%56 = icmp eq i8 %36, 72
%57 = select i1 %50, i1 %56, i1 false
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 (...) @term_JitterHistogram()
br label %41
60: ; preds = %55
%61 = icmp eq i8 %27, 2
%62 = icmp eq i8 %28, 79
%63 = select i1 %61, i1 %62, i1 false
%64 = icmp eq i8 %36, 83
%65 = select i1 %63, i1 %64, i1 false
br i1 %65, label %66, label %68
66: ; preds = %60
%67 = call i32 (...) @term_OSStats()
br label %41
68: ; preds = %60
%69 = icmp eq i8 %36, 80
%70 = select i1 %63, i1 %69, i1 false
br i1 %70, label %71, label %73
71: ; preds = %68
%72 = call i32 (...) @term_OSProfile()
br label %41
73: ; preds = %68
%74 = icmp ugt i8 %27, 2
%75 = select i1 %74, i1 %62, i1 false
%76 = select i1 %75, i1 %69, i1 false
%77 = load i8, i8* %5
%78 = icmp eq i8 %77, 67
%79 = select i1 %76, i1 %78, i1 false
br i1 %79, label %80, label %82
80: ; preds = %73
%81 = call i32 (...) @term_OSProfileClear()
br label %41
82: ; preds = %73
%83 = select i1 %75, i1 %64, i1 false
%84 = select i1 %83, i1 %78, i1 false
br i1 %84, label %85, label %87
85: ; preds = %82
%86 = call i32 (...) @term_OSClearStats()
br label %41
87: ; preds = %82
%88 = icmp eq i8 %28, 77
%89 = select i1 %61, i1 %88, i1 false
%90 = icmp eq i8 %36, 82
%91 = select i1 %89, i1 %90, i1 false
br i1 %91, label %92, label %94
92: ; preds = %87
%93 = call i32 (...) @term_MR()
br label %41
94: ; preds = %87
%95 = icmp eq i8 %36, 76
%96 = select i1 %89, i1 %95, i1 false
br i1 %96, label %97, label %99
97: ; preds = %94
%98 = call i32 (...) @term_ML()
br label %41
99: ; preds = %94
%100 = icmp eq i8 %28, 81
br i1 %100, label %101, label %104
101: ; preds = %99
%102 = call i32 @UART_OutString(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%103 = call i32 (...) @OS_Kill()
ret void
104: ; preds = %6, %99
%105 = call i32 @UART_OutString(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0))
br label %41
}