#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*/ BRANCHTO(int);
int GETPC();
int /*<<< orphan*/ hexstring(int);
int /*<<< orphan*/ timer_init();
unsigned int timer_tick();
scalar_t__ uart_check();
int /*<<< orphan*/ uart_flush();
int /*<<< orphan*/ uart_init();
unsigned int uart_recv();
int /*<<< orphan*/ uart_send(int);
int /*<<< orphan*/ uart_writeline(char *);
int notmain(void) {
  unsigned int ra;
  unsigned int rb;
  unsigned int rx;
  unsigned int block;
  unsigned int state;
  unsigned int csum;
  unsigned char *xstring;
  uart_init();
  hexstring(0x12345678);
  hexstring(GETPC());
  hexstring(0x8000);
  timer_init();
  while (1) {
    block = 1;
    state = 192;
    csum = 0;
    xstring = (unsigned char *)0x8000;
    uart_send(0x15);
    rx = timer_tick();
    while (1) {
      ra = timer_tick();
      if ((ra - rx) >= 4000000) {
        uart_send(0x15);
        rx += 4000000;
      }
      if (uart_check())
        break;
    }
    while (state != 255) {
      rb = uart_recv();
      switch (state) {
      case 192: {
        switch (rb) {
        case 0x01: {
          csum = rb;
          state++;
          break;
        }
        case 0x04: {
          uart_send(0x06);
          rx = timer_tick();
          while (1) {
            ra = timer_tick();
            if ((ra - rx) >= 2000000)
              break;
          }
          uart_send(0x0D);
          uart_send(0x0A);
          uart_send(0x0A);
          uart_send('\n');
          uart_writeline("Ready to run. Press g/G to run.\0");
          while (1) {
            rb = uart_recv();
            if ((rb == 'g') || (rb == 'G')) {
              uart_send(0x0D);
              uart_send('-');
              uart_send('-');
              uart_send(0x0D);
              uart_send(0x0A);
              uart_send(0x0A);
              uart_writeline("Branching to program. Good bye!\0");
              BRANCHTO(0x8000);
            }
          }
          break;
        }
        default: {
          state = 255;
          break;
        }
        }
        break;
      }
      case 193: {
        if (rb == block) {
          csum += rb;
          state++;
        } else {
          state = 255;
        }
        break;
      }
      case 194: {
        if (rb == (0xFF - block)) {
          csum += rb;
          state = 0;
        } else {
          state = 255;
        }
        break;
      }
      case 128: {
        csum &= 0xFF;
        if (rb == csum) {
          uart_send(0x06);
          block = (block + 1) & 0xFF;
          xstring += 128;
          state = 192;
        } else {
          state = 255;
        }
        break;
      }
      default: {
        csum += rb;
        xstring[state] = rb & 0xFF;
        state++;
        break;
      }
      }
    }
    uart_send(0x18);
    uart_send(0x18);
    uart_send(0x18);
    uart_send(0x18);
    uart_send(0x18);
    rx = timer_tick();
    while (1) {
      ra = timer_tick();
      if ((ra - rx) >= 2000000)
        break;
    }
    uart_send(0x0D);
    uart_send(0x0A);
    uart_send(0x0A);
    hexstring(0xBADBAD);
    uart_flush();
    while (1) {
      if (uart_check()) {
        uart_recv();
      } else {
        break;
      }
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<notmain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1040 <uart_init@plt>
mov    $0x12345678,%edi
call   1060 <hexstring@plt>
mov    $0x0,%al
call   1070 <GETPC@plt>
mov    %eax,%edi
call   1060 <hexstring@plt>
mov    $0x8000,%edi
call   1060 <hexstring@plt>
mov    $0x0,%al
call   1080 <timer_init@plt>
movl   $0x1,-0x10(%rbp)
movl   $0xc0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x8000,%eax
mov    %rax,-0x20(%rbp)
mov    $0x15,%edi
call   1030 <uart_send@plt>
mov    $0x0,%al
call   10b0 <timer_tick@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   10b0 <timer_tick@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x3d0900,%eax
jb     124a <notmain+0x9a>
mov    $0x15,%edi
call   1030 <uart_send@plt>
mov    -0xc(%rbp),%eax
add    $0x3d0900,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <uart_check@plt>
cmp    $0x0,%rax
je     1260 <notmain+0xb0>
jmp    1265 <notmain+0xb5>
jmp    121a <notmain+0x6a>
jmp    126a <notmain+0xba>
cmpl   $0xff,-0x14(%rbp)
je     14da <notmain+0x32a>
xor    %eax,%eax
call   10d0 <uart_recv@plt>
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x80,%eax
je     145a <notmain+0x2aa>
jmp    1297 <notmain+0xe7>
mov    -0x24(%rbp),%eax
sub    $0xc0,%eax
je     12d0 <notmain+0x120>
jmp    12aa <notmain+0xfa>
mov    -0x24(%rbp),%eax
sub    $0xc1,%eax
je     13f7 <notmain+0x247>
jmp    12bd <notmain+0x10d>
mov    -0x24(%rbp),%eax
sub    $0xc2,%eax
je     1426 <notmain+0x276>
jmp    14af <notmain+0x2ff>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     12f5 <notmain+0x145>
jmp    12e4 <notmain+0x134>
mov    -0x28(%rbp),%eax
sub    $0x4,%eax
je     1309 <notmain+0x159>
jmp    13eb <notmain+0x23b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13f2 <notmain+0x242>
mov    $0x6,%edi
call   1030 <uart_send@plt>
mov    $0x0,%al
call   10b0 <timer_tick@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   10b0 <timer_tick@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x1e8480,%eax
jb     133d <notmain+0x18d>
jmp    1342 <notmain+0x192>
jmp    131d <notmain+0x16d>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
lea    0xc8f(%rip),%rdi
call   1090 <uart_writeline@plt>
mov    $0x0,%al
call   10d0 <uart_recv@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x67,-0x8(%rbp)
je     1394 <notmain+0x1e4>
cmpl   $0x47,-0x8(%rbp)
jne    13e6 <notmain+0x236>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0x2d,%edi
call   1030 <uart_send@plt>
mov    $0x2d,%edi
call   1030 <uart_send@plt>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
lea    0xc4a(%rip),%rdi
call   1090 <uart_writeline@plt>
mov    $0x8000,%edi
call   10a0 <BRANCHTO@plt>
jmp    1376 <notmain+0x1c6>
movl   $0xff,-0x14(%rbp)
jmp    14d5 <notmain+0x325>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    141a <notmain+0x26a>
mov    -0x8(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1421 <notmain+0x271>
movl   $0xff,-0x14(%rbp)
jmp    14d5 <notmain+0x325>
mov    -0x8(%rbp),%eax
mov    $0xff,%ecx
sub    -0x10(%rbp),%ecx
cmp    %ecx,%eax
jne    144e <notmain+0x29e>
mov    -0x8(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    1455 <notmain+0x2a5>
movl   $0xff,-0x14(%rbp)
jmp    14d5 <notmain+0x325>
mov    -0x18(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    14a3 <notmain+0x2f3>
mov    $0x6,%edi
call   1030 <uart_send@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x80,%rax
mov    %rax,-0x20(%rbp)
movl   $0xc0,-0x14(%rbp)
jmp    14aa <notmain+0x2fa>
movl   $0xff,-0x14(%rbp)
jmp    14d5 <notmain+0x325>
mov    -0x8(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    126a <notmain+0xba>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x0,%al
call   10b0 <timer_tick@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   10b0 <timer_tick@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x1e8480,%eax
jb     1536 <notmain+0x386>
jmp    153b <notmain+0x38b>
jmp    1516 <notmain+0x366>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xbadbad,%edi
call   1060 <hexstring@plt>
mov    $0x0,%al
call   10c0 <uart_flush@plt>
mov    $0x0,%al
call   1050 <uart_check@plt>
cmp    $0x0,%rax
je     1587 <notmain+0x3d7>
mov    $0x0,%al
call   10d0 <uart_recv@plt>
jmp    158c <notmain+0x3dc>
jmp    1591 <notmain+0x3e1>
jmp    156a <notmain+0x3ba>
jmp    11e8 <notmain+0x38>

x86 assembly (clang, -O2):
<notmain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <uart_init@plt>
mov    $0x12345678,%edi
call   1060 <hexstring@plt>
xor    %eax,%eax
call   1070 <GETPC@plt>
mov    %eax,%edi
call   1060 <hexstring@plt>
mov    $0x8000,%edi
call   1060 <hexstring@plt>
xor    %eax,%eax
call   1080 <timer_init@plt>
xchg   %ax,%ax
mov    $0x15,%edi
call   1030 <uart_send@plt>
xor    %eax,%eax
call   10b0 <timer_tick@plt>
mov    %eax,%ebx
jmp    121c <notmain+0x6c>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <uart_check@plt>
test   %rax,%rax
jne    1240 <notmain+0x90>
xor    %eax,%eax
call   10b0 <timer_tick@plt>
sub    %ebx,%eax
cmp    $0x3d0900,%eax
jb     1210 <notmain+0x60>
mov    $0x15,%edi
call   1030 <uart_send@plt>
add    $0x3d0900,%ebx
jmp    1210 <notmain+0x60>
xchg   %ax,%ax
mov    $0x1,%r12d
mov    $0xc0,%ebp
xor    %r13d,%r13d
mov    $0x8000,%r15d
jmp    127b <notmain+0xcb>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%eax
mov    %bl,(%r15,%rax,1)
add    %r13d,%ebx
add    $0x1,%ebp
mov    %ebx,%r13d
cmp    $0xff,%ebp
je     1340 <notmain+0x190>
xor    %eax,%eax
call   10d0 <uart_recv@plt>
mov    %eax,%ebx
cmp    $0xc0,%ebp
jg     12b0 <notmain+0x100>
cmp    $0x80,%ebp
je     12e0 <notmain+0x130>
cmp    $0xc0,%ebp
jne    1260 <notmain+0xb0>
mov    $0xc1,%ebp
cmp    $0x1,%ebx
je     126c <notmain+0xbc>
jmp    1330 <notmain+0x180>
nopl   0x0(%rax,%rax,1)
cmp    $0xc1,%ebp
je     1310 <notmain+0x160>
cmp    $0xc2,%ebp
jne    1260 <notmain+0xb0>
mov    $0xff,%eax
sub    %r12d,%eax
xor    %ebp,%ebp
cmp    %eax,%ebx
cmovne %ebp,%ebx
jne    1340 <notmain+0x190>
add    %r13d,%ebx
jmp    126c <notmain+0xbc>
cs nopw 0x0(%rax,%rax,1)
movzbl %r13b,%eax
cmp    %eax,%ebx
jne    1340 <notmain+0x190>
mov    $0x6,%edi
call   1030 <uart_send@plt>
add    $0x1,%r12d
movzbl %r12b,%r12d
sub    $0xffffffffffffff80,%r15
mov    $0xc0,%ebp
jmp    126c <notmain+0xbc>
nopl   0x0(%rax,%rax,1)
cmp    %r12d,%ebx
cmovne %r14d,%ebx
jne    1340 <notmain+0x190>
add    %r13d,%ebx
mov    $0xc2,%ebp
jmp    126c <notmain+0xbc>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x4,%ebx
je     13d9 <notmain+0x229>
nopl   0x0(%rax)
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
mov    $0x18,%edi
call   1030 <uart_send@plt>
xor    %eax,%eax
call   10b0 <timer_tick@plt>
mov    %eax,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <timer_tick@plt>
sub    %ebx,%eax
cmp    $0x1e8480,%eax
jb     1380 <notmain+0x1d0>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xbadbad,%edi
call   1060 <hexstring@plt>
xor    %eax,%eax
call   10c0 <uart_flush@plt>
nop
xor    %eax,%eax
call   1050 <uart_check@plt>
test   %rax,%rax
je     11f0 <notmain+0x40>
xor    %eax,%eax
call   10d0 <uart_recv@plt>
jmp    13c0 <notmain+0x210>
mov    $0x6,%edi
call   1030 <uart_send@plt>
xor    %eax,%eax
call   10b0 <timer_tick@plt>
mov    %eax,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   10b0 <timer_tick@plt>
sub    %ebx,%eax
cmp    $0x1e8480,%eax
jb     13f0 <notmain+0x240>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
lea    0xbd1(%rip),%rdi
call   1090 <uart_writeline@plt>
lea    0xbe6(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10d0 <uart_recv@plt>
and    $0xffffffdf,%eax
cmp    $0x47,%eax
jne    1440 <notmain+0x290>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0x2d,%edi
call   1030 <uart_send@plt>
mov    $0x2d,%edi
call   1030 <uart_send@plt>
mov    $0xd,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    $0xa,%edi
call   1030 <uart_send@plt>
mov    %rbx,%rdi
call   1090 <uart_writeline@plt>
mov    $0x8000,%edi
call   10a0 <BRANCHTO@plt>
jmp    1440 <notmain+0x290>

LLVM IR (-O0):
@.str = [33 x i8] c"Ready to run. Press g/G to run.\00\00"
@.str.1 = [33 x i8] c"Branching to program. Good bye!\00\00"
define i32 @notmain() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = call i32 (...) @uart_init()
%9 = call i32 @hexstring(i32 305419896)
%10 = call i32 (...) @GETPC()
%11 = call i32 @hexstring(i32 %10)
%12 = call i32 @hexstring(i32 32768)
%13 = call i32 (...) @timer_init()
br label %14
14: ; preds = %0, %161
store i32 1, i32* %4
store i32 192, i32* %5
store i32 0, i32* %6
store i8* inttoptr (i64 32768 to i8*), i8** %7
%15 = call i32 @uart_send(i32 21)
%16 = call i32 (...) @timer_tick()
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %31
%18 = call i32 (...) @timer_tick()
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = load i32, i32* %3
%21 = sub i32 %19, %20
%22 = icmp uge i32 %21, 4000000
br i1 %22, label %23, label %27
23: ; preds = %17
%24 = call i32 @uart_send(i32 21)
%25 = load i32, i32* %3
%26 = add i32 %25, 4000000
store i32 %26, i32* %3
br label %27
27: ; preds = %23, %17
%28 = call i64 (...) @uart_check()
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
br label %32
31: ; preds = %27
br label %17
32: ; preds = %30
br label %33
33: ; preds = %132, %32
%34 = load i32, i32* %5
%35 = icmp ne i32 %34, 255
br i1 %35, label %36, label %133
36: ; preds = %33
%37 = call i32 (...) @uart_recv()
store i32 %37, i32* %2
%38 = load i32, i32* %5
switch i32 %38, label %119 [
i32 192, label %39
i32 193, label %81
i32 194, label %93
i32 128, label %104
]
39: ; preds = %36
%40 = load i32, i32* %2
switch i32 %40, label %79 [
i32 1, label %41
i32 4, label %45
]
41: ; preds = %39
%42 = load i32, i32* %2
store i32 %42, i32* %6
%43 = load i32, i32* %5
%44 = add i32 %43, 1
store i32 %44, i32* %5
br label %80
45: ; preds = %39
%46 = call i32 @uart_send(i32 6)
%47 = call i32 (...) @timer_tick()
store i32 %47, i32* %3
br label %48
48: ; preds = %45, %55
%49 = call i32 (...) @timer_tick()
store i32 %49, i32* %1
%50 = load i32, i32* %1
%51 = load i32, i32* %3
%52 = sub i32 %50, %51
%53 = icmp uge i32 %52, 2000000
br i1 %53, label %54, label %55
54: ; preds = %48
br label %56
55: ; preds = %48
br label %48
56: ; preds = %54
%57 = call i32 @uart_send(i32 13)
%58 = call i32 @uart_send(i32 10)
%59 = call i32 @uart_send(i32 10)
%60 = call i32 @uart_send(i32 10)
%61 = call i32 @uart_writeline(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %62
62: ; preds = %56, %78
%63 = call i32 (...) @uart_recv()
store i32 %63, i32* %2
%64 = load i32, i32* %2
%65 = icmp eq i32 %64, 103
br i1 %65, label %69, label %66
66: ; preds = %62
%67 = load i32, i32* %2
%68 = icmp eq i32 %67, 71
br i1 %68, label %69, label %78
69: ; preds = %66, %62
%70 = call i32 @uart_send(i32 13)
%71 = call i32 @uart_send(i32 45)
%72 = call i32 @uart_send(i32 45)
%73 = call i32 @uart_send(i32 13)
%74 = call i32 @uart_send(i32 10)
%75 = call i32 @uart_send(i32 10)
%76 = call i32 @uart_writeline(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%77 = call i32 @BRANCHTO(i32 32768)
br label %78
78: ; preds = %69, %66
br label %62
79: ; preds = %39
store i32 255, i32* %5
br label %80
80: ; preds = %79, %41
br label %132
81: ; preds = %36
%82 = load i32, i32* %2
%83 = load i32, i32* %4
%84 = icmp eq i32 %82, %83
br i1 %84, label %85, label %91
85: ; preds = %81
%86 = load i32, i32* %2
%87 = load i32, i32* %6
%88 = add i32 %87, %86
store i32 %88, i32* %6
%89 = load i32, i32* %5
%90 = add i32 %89, 1
store i32 %90, i32* %5
br label %92
91: ; preds = %81
store i32 255, i32* %5
br label %92
92: ; preds = %91, %85
br label %132
93: ; preds = %36
%94 = load i32, i32* %2
%95 = load i32, i32* %4
%96 = sub i32 255, %95
%97 = icmp eq i32 %94, %96
br i1 %97, label %98, label %102
98: ; preds = %93
%99 = load i32, i32* %2
%100 = load i32, i32* %6
%101 = add i32 %100, %99
store i32 %101, i32* %6
store i32 0, i32* %5
br label %103
102: ; preds = %93
store i32 255, i32* %5
br label %103
103: ; preds = %102, %98
br label %132
104: ; preds = %36
%105 = load i32, i32* %6
%106 = and i32 %105, 255
store i32 %106, i32* %6
%107 = load i32, i32* %2
%108 = load i32, i32* %6
%109 = icmp eq i32 %107, %108
br i1 %109, label %110, label %117
110: ; preds = %104
%111 = call i32 @uart_send(i32 6)
%112 = load i32, i32* %4
%113 = add i32 %112, 1
%114 = and i32 %113, 255
store i32 %114, i32* %4
%115 = load i8*, i8** %7
%116 = getelementptr inbounds i8, i8* %115, i64 128
store i8* %116, i8** %7
store i32 192, i32* %5
br label %118
117: ; preds = %104
store i32 255, i32* %5
br label %118
118: ; preds = %117, %110
br label %132
119: ; preds = %36
%120 = load i32, i32* %2
%121 = load i32, i32* %6
%122 = add i32 %121, %120
store i32 %122, i32* %6
%123 = load i32, i32* %2
%124 = and i32 %123, 255
%125 = trunc i32 %124 to i8
%126 = load i8*, i8** %7
%127 = load i32, i32* %5
%128 = zext i32 %127 to i64
%129 = getelementptr inbounds i8, i8* %126, i64 %128
store i8 %125, i8* %129
%130 = load i32, i32* %5
%131 = add i32 %130, 1
store i32 %131, i32* %5
br label %132
132: ; preds = %119, %118, %103, %92, %80
br label %33
133: ; preds = %33
%134 = call i32 @uart_send(i32 24)
%135 = call i32 @uart_send(i32 24)
%136 = call i32 @uart_send(i32 24)
%137 = call i32 @uart_send(i32 24)
%138 = call i32 @uart_send(i32 24)
%139 = call i32 (...) @timer_tick()
store i32 %139, i32* %3
br label %140
140: ; preds = %133, %147
%141 = call i32 (...) @timer_tick()
store i32 %141, i32* %1
%142 = load i32, i32* %1
%143 = load i32, i32* %3
%144 = sub i32 %142, %143
%145 = icmp uge i32 %144, 2000000
br i1 %145, label %146, label %147
146: ; preds = %140
br label %148
147: ; preds = %140
br label %140
148: ; preds = %146
%149 = call i32 @uart_send(i32 13)
%150 = call i32 @uart_send(i32 10)
%151 = call i32 @uart_send(i32 10)
%152 = call i32 @hexstring(i32 12245933)
%153 = call i32 (...) @uart_flush()
br label %154
154: ; preds = %148, %160
%155 = call i64 (...) @uart_check()
%156 = icmp ne i64 %155, 0
br i1 %156, label %157, label %159
157: ; preds = %154
%158 = call i32 (...) @uart_recv()
br label %160
159: ; preds = %154
br label %161
160: ; preds = %157
br label %154
161: ; preds = %159
br label %14
}

LLVM IR (-O2):
@.str = [33 x i8] c"Ready to run. Press g/G to run.\00\00"
@.str.1 = [33 x i8] c"Branching to program. Good bye!\00\00"
define i32 @notmain() {
%1 = tail call i32 (...) @uart_init()
%2 = tail call i32 @hexstring(i32 305419896)
%3 = tail call i32 (...) @GETPC()
%4 = tail call i32 @hexstring(i32 %3)
%5 = tail call i32 @hexstring(i32 32768)
%6 = tail call i32 (...) @timer_init()
br label %7
7: ; preds = %104, %0
%8 = tail call i32 @uart_send(i32 21)
%9 = tail call i32 (...) @timer_tick()
br label %10
10: ; preds = %18, %7
%11 = phi i32 [ %9, %7 ], [ %19, %18 ]
%12 = tail call i32 (...) @timer_tick()
%13 = sub i32 %12, %11
%14 = icmp ugt i32 %13, 3999999
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = tail call i32 @uart_send(i32 21)
%17 = add i32 %11, 4000000
br label %18
18: ; preds = %15, %10
%19 = phi i32 [ %17, %15 ], [ %11, %10 ]
%20 = tail call i64 (...) @uart_check()
%21 = icmp eq i64 %20, 0
br i1 %21, label %10, label %22
22: ; preds = %18, %79
%23 = phi i8* [ %83, %79 ], [ inttoptr (i64 32768 to i8*), %18 ]
%24 = phi i32 [ %82, %79 ], [ 0, %18 ]
%25 = phi i32 [ %81, %79 ], [ 192, %18 ]
%26 = phi i32 [ %80, %79 ], [ 1, %18 ]
%27 = tail call i32 (...) @uart_recv()
switch i32 %25, label %73 [
i32 192, label %28
i32 193, label %56
i32 194, label %60
i32 128, label %65
]
28: ; preds = %22
switch i32 %27, label %85 [
i32 1, label %79
i32 4, label %29
]
29: ; preds = %28
%30 = tail call i32 @uart_send(i32 6)
%31 = tail call i32 (...) @timer_tick()
br label %32
32: ; preds = %32, %29
%33 = tail call i32 (...) @timer_tick()
%34 = sub i32 %33, %31
%35 = icmp ugt i32 %34, 1999999
br i1 %35, label %36, label %32
36: ; preds = %32
%37 = tail call i32 @uart_send(i32 13)
%38 = tail call i32 @uart_send(i32 10)
%39 = tail call i32 @uart_send(i32 10)
%40 = tail call i32 @uart_send(i32 10)
%41 = tail call i32 @uart_writeline(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %42
42: ; preds = %46, %36
%43 = tail call i32 (...) @uart_recv()
%44 = and i32 %43, -33
%45 = icmp eq i32 %44, 71
br i1 %45, label %47, label %46
46: ; preds = %42, %47
br label %42
47: ; preds = %42
%48 = tail call i32 @uart_send(i32 13)
%49 = tail call i32 @uart_send(i32 45)
%50 = tail call i32 @uart_send(i32 45)
%51 = tail call i32 @uart_send(i32 13)
%52 = tail call i32 @uart_send(i32 10)
%53 = tail call i32 @uart_send(i32 10)
%54 = tail call i32 @uart_writeline(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%55 = tail call i32 @BRANCHTO(i32 32768)
br label %46
56: ; preds = %22
%57 = icmp eq i32 %27, %26
%58 = select i1 %57, i32 %27, i32 0
%59 = add i32 %24, %58
br i1 %57, label %79, label %85
60: ; preds = %22
%61 = sub i32 255, %26
%62 = icmp eq i32 %27, %61
%63 = select i1 %62, i32 %27, i32 0
%64 = add i32 %63, %24
br i1 %62, label %79, label %85
65: ; preds = %22
%66 = and i32 %24, 255
%67 = icmp eq i32 %27, %66
br i1 %67, label %68, label %85
68: ; preds = %65
%69 = tail call i32 @uart_send(i32 6)
%70 = add i32 %26, 1
%71 = and i32 %70, 255
%72 = getelementptr inbounds i8, i8* %23, i64 128
br label %79
73: ; preds = %22
%74 = add i32 %27, %24
%75 = trunc i32 %27 to i8
%76 = zext i32 %25 to i64
%77 = getelementptr inbounds i8, i8* %23, i64 %76
store i8 %75, i8* %77
%78 = add i32 %25, 1
br label %79
79: ; preds = %56, %60, %28, %68, %73
%80 = phi i32 [ %26, %73 ], [ %71, %68 ], [ %26, %28 ], [ %26, %60 ], [ %26, %56 ]
%81 = phi i32 [ %78, %73 ], [ 192, %68 ], [ 193, %28 ], [ 0, %60 ], [ 194, %56 ]
%82 = phi i32 [ %74, %73 ], [ %27, %68 ], [ %27, %28 ], [ %64, %60 ], [ %59, %56 ]
%83 = phi i8* [ %23, %73 ], [ %72, %68 ], [ %23, %28 ], [ %23, %60 ], [ %23, %56 ]
%84 = icmp eq i32 %81, 255
br i1 %84, label %85, label %22
85: ; preds = %56, %60, %65, %28, %79
%86 = tail call i32 @uart_send(i32 24)
%87 = tail call i32 @uart_send(i32 24)
%88 = tail call i32 @uart_send(i32 24)
%89 = tail call i32 @uart_send(i32 24)
%90 = tail call i32 @uart_send(i32 24)
%91 = tail call i32 (...) @timer_tick()
br label %92
92: ; preds = %92, %85
%93 = tail call i32 (...) @timer_tick()
%94 = sub i32 %93, %91
%95 = icmp ugt i32 %94, 1999999
br i1 %95, label %96, label %92
96: ; preds = %92
%97 = tail call i32 @uart_send(i32 13)
%98 = tail call i32 @uart_send(i32 10)
%99 = tail call i32 @uart_send(i32 10)
%100 = tail call i32 @hexstring(i32 12245933)
%101 = tail call i32 (...) @uart_flush()
%102 = tail call i64 (...) @uart_check()
%103 = icmp eq i64 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %105, %96
br label %7
105: ; preds = %96, %105
%106 = tail call i32 (...) @uart_recv()
%107 = tail call i64 (...) @uart_check()
%108 = icmp eq i64 %107, 0
br i1 %108, label %104, label %105
}