#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);
unsigned int GETCPSR();
unsigned int GETPC();
unsigned int GETSCTLR();
int /*<<< orphan*/ PUT32(unsigned int, unsigned int);
int /*<<< orphan*/ hexstring(unsigned int);
int /*<<< orphan*/ leds_off();
int /*<<< orphan*/ uart_init();
unsigned int uart_recv();
int /*<<< orphan*/ uart_send(int);
int notmain(void) {
  unsigned int state;
  unsigned int byte_count;
  unsigned int address;
  unsigned int record_type;
  unsigned int segment;
  unsigned int data;
  unsigned int sum;
  unsigned int ra;
  leds_off();
  uart_init();
  hexstring(0x12345678);
  hexstring(GETPC());
  hexstring(GETCPSR());
  hexstring(GETSCTLR());
  uart_send('I');
  uart_send('H');
  uart_send('E');
  uart_send('X');
  uart_send(0x0D);
  uart_send(0x0A);
  state = 0;
  segment = 0;
  sum = 0;
  data = 0;
  record_type = 0;
  address = 0;
  byte_count = 0;
  while (1) {
    ra = uart_recv();
    if (ra == ':') {
      state = 1;
      continue;
    }
    if (ra == 0x0D) {
      state = 0;
      continue;
    }
    if (ra == 0x0A) {
      state = 0;
      continue;
    }
    if ((ra == 'g') || (ra == 'G')) {
      uart_send(0x0D);
      uart_send('-');
      uart_send('-');
      uart_send(0x0D);
      uart_send(0x0A);
      uart_send(0x0A);
      BRANCHTO(0x8000);
      state = 0;
      break;
    }
    switch (state) {
    case 0: {
      break;
    }
    case 1:
    case 2: {
      byte_count <<= 4;
      if (ra > 0x39)
        ra -= 7;
      byte_count |= (ra & 0xF);
      byte_count &= 0xFF;
      state++;
      break;
    }
    case 3:
    case 4:
    case 5:
    case 6: {
      address <<= 4;
      if (ra > 0x39)
        ra -= 7;
      address |= (ra & 0xF);
      address &= 0xFFFF;
      address |= segment;
      state++;
      break;
    }
    case 7: {
      record_type <<= 4;
      if (ra > 0x39)
        ra -= 7;
      record_type |= (ra & 0xF);
      record_type &= 0xFF;
      state++;
      break;
    }
    case 8: {
      record_type <<= 4;
      if (ra > 0x39)
        ra -= 7;
      record_type |= (ra & 0xF);
      record_type &= 0xFF;
      switch (record_type) {
      case 0x00: {
        state = 14;
        break;
      }
      case 0x01: {
        for (ra = 0; ra < 20; ra++)
          hexstring(sum);
        segment = 0;
        sum = 0;
        data = 0;
        record_type = 0;
        address = 0;
        byte_count = 0;
        state = 0;
        break;
      }
      case 0x02: {
        state = 9;
        break;
      }
      default: {
        state = 0;
        break;
      }
      }
      break;
    }
    case 9:
    case 10:
    case 11:
    case 12: {
      segment <<= 4;
      if (ra > 0x39)
        ra -= 7;
      segment |= (ra & 0xF);
      segment &= 0xFFFF;
      state++;
      break;
    }
    case 13: {
      segment <<= 4;
      state = 0;
      break;
    }
    case 14:
    case 15:
    case 16:
    case 17:
    case 18:
    case 19:
    case 20:
    case 21: {
      data <<= 4;
      if (ra > 0x39)
        ra -= 7;
      data |= (ra & 0xF);
      if (state == 21) {
        ra = (data >> 24) | (data << 24);
        ra |= (data >> 8) & 0x0000FF00;
        ra |= (data << 8) & 0x00FF0000;
        data = ra;
        PUT32(address, data);
        sum += address;
        sum += data;
        address += 4;
        state = 14;
      } else {
        state++;
      }
      break;
    }
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<notmain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   10b0 <leds_off@plt>
mov    $0x0,%al
call   1060 <uart_init@plt>
mov    $0x12345678,%edi
call   1070 <hexstring@plt>
mov    $0x0,%al
call   1090 <GETPC@plt>
mov    %eax,%edi
call   1070 <hexstring@plt>
mov    $0x0,%al
call   1030 <GETCPSR@plt>
mov    %eax,%edi
call   1070 <hexstring@plt>
mov    $0x0,%al
call   1040 <GETSCTLR@plt>
mov    %eax,%edi
call   1070 <hexstring@plt>
mov    $0x49,%edi
call   1050 <uart_send@plt>
mov    $0x48,%edi
call   1050 <uart_send@plt>
mov    $0x45,%edi
call   1050 <uart_send@plt>
mov    $0x58,%edi
call   1050 <uart_send@plt>
mov    $0xd,%edi
call   1050 <uart_send@plt>
mov    $0xa,%edi
call   1050 <uart_send@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   10c0 <uart_recv@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x3a,-0x20(%rbp)
jne    1277 <notmain+0xd7>
movl   $0x1,-0x4(%rbp)
jmp    1257 <notmain+0xb7>
cmpl   $0xd,-0x20(%rbp)
jne    128d <notmain+0xed>
movl   $0x0,-0x4(%rbp)
jmp    1257 <notmain+0xb7>
cmpl   $0xa,-0x20(%rbp)
jne    12a3 <notmain+0x103>
movl   $0x0,-0x4(%rbp)
jmp    1257 <notmain+0xb7>
cmpl   $0x67,-0x20(%rbp)
je     12b7 <notmain+0x117>
cmpl   $0x47,-0x20(%rbp)
jne    1309 <notmain+0x169>
mov    $0xd,%edi
call   1050 <uart_send@plt>
mov    $0x2d,%edi
call   1050 <uart_send@plt>
mov    $0x2d,%edi
call   1050 <uart_send@plt>
mov    $0xd,%edi
call   1050 <uart_send@plt>
mov    $0xa,%edi
call   1050 <uart_send@plt>
mov    $0xa,%edi
call   1050 <uart_send@plt>
mov    $0x8000,%edi
call   10a0 <BRANCHTO@plt>
movl   $0x0,-0x4(%rbp)
jmp    15ec <notmain+0x44c>
mov    -0x4(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0x15,%rax
ja     15e7 <notmain+0x447>
mov    -0x28(%rbp),%rax
lea    0xcdb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    15e7 <notmain+0x447>
mov    -0x8(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x39,-0x20(%rbp)
jbe    134f <notmain+0x1af>
mov    -0x20(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
and    $0xf,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <notmain+0x447>
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x39,-0x20(%rbp)
jbe    1390 <notmain+0x1f0>
mov    -0x20(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
and    $0xf,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <notmain+0x447>
mov    -0x10(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x39,-0x20(%rbp)
jbe    13da <notmain+0x23a>
mov    -0x20(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
and    $0xf,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <notmain+0x447>
mov    -0x10(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x39,-0x20(%rbp)
jbe    141b <notmain+0x27b>
mov    -0x20(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
and    $0xf,%ecx
mov    -0x10(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
movzbl -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
je     1465 <notmain+0x2c5>
jmp    1443 <notmain+0x2a3>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
je     1471 <notmain+0x2d1>
jmp    1454 <notmain+0x2b4>
mov    -0x2c(%rbp),%eax
sub    $0x2,%eax
je     14ce <notmain+0x32e>
jmp    14da <notmain+0x33a>
movl   $0xe,-0x4(%rbp)
jmp    14e1 <notmain+0x341>
movl   $0x0,-0x20(%rbp)
cmpl   $0x14,-0x20(%rbp)
jae    1498 <notmain+0x2f8>
mov    -0x1c(%rbp),%edi
call   1070 <hexstring@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1478 <notmain+0x2d8>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    14e1 <notmain+0x341>
movl   $0x9,-0x4(%rbp)
jmp    14e1 <notmain+0x341>
movl   $0x0,-0x4(%rbp)
jmp    15e7 <notmain+0x447>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x39,-0x20(%rbp)
jbe    1502 <notmain+0x362>
mov    -0x20(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
and    $0xf,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <notmain+0x447>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    15e7 <notmain+0x447>
mov    -0x18(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x39,-0x20(%rbp)
jbe    1558 <notmain+0x3b8>
mov    -0x20(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
and    $0xf,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x15,-0x4(%rbp)
jne    15d9 <notmain+0x439>
mov    -0x18(%rbp),%eax
shr    $0x18,%eax
mov    -0x18(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
shr    $0x8,%eax
and    $0xff00,%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x8,%eax
and    $0xff0000,%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1080 <PUT32@plt>
mov    -0xc(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
movl   $0xe,-0x4(%rbp)
jmp    15e2 <notmain+0x442>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15e7 <notmain+0x447>
jmp    1257 <notmain+0xb7>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<notmain>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   10b0 <leds_off@plt>
xor    %eax,%eax
call   1060 <uart_init@plt>
mov    $0x12345678,%edi
call   1070 <hexstring@plt>
xor    %eax,%eax
call   1090 <GETPC@plt>
mov    %eax,%edi
call   1070 <hexstring@plt>
xor    %eax,%eax
call   1030 <GETCPSR@plt>
mov    %eax,%edi
call   1070 <hexstring@plt>
xor    %eax,%eax
call   1040 <GETSCTLR@plt>
mov    %eax,%edi
call   1070 <hexstring@plt>
mov    $0x49,%edi
call   1050 <uart_send@plt>
mov    $0x48,%edi
call   1050 <uart_send@plt>
mov    $0x45,%edi
call   1050 <uart_send@plt>
mov    $0x58,%edi
call   1050 <uart_send@plt>
mov    $0xd,%edi
call   1050 <uart_send@plt>
mov    $0xa,%edi
call   1050 <uart_send@plt>
lea    0xdd0(%rip),%r15
xor    %r13d,%r13d
xor    %ebp,%ebp
movl   $0x0,0x4(%rsp)
xor    %r12d,%r12d
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    1270 <notmain+0xd0>
shl    $0x4,%r12d
lea    0x9(%rax),%ecx
cmp    $0x3a,%eax
cmovb  %eax,%ecx
and    $0xf,%ecx
movzwl %r12w,%r12d
or     %ecx,%r12d
add    $0x1,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13d,%ecx
jmp    1287 <notmain+0xe7>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0xd,%eax
jne    12b0 <notmain+0x110>
xor    %ecx,%ecx
mov    %ecx,%r13d
xor    %eax,%eax
call   10c0 <uart_recv@plt>
cmp    $0xa,%eax
je     1285 <notmain+0xe5>
mov    $0x1,%ecx
cmp    $0x3a,%eax
jne    1280 <notmain+0xe0>
jmp    1287 <notmain+0xe7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
and    $0xffffffdf,%ecx
cmp    $0x47,%ecx
je     1485 <notmain+0x2e5>
lea    -0x1(%r13),%ecx
cmp    $0x14,%ecx
ja     1270 <notmain+0xd0>
movslq (%r15,%rcx,4),%rcx
add    %r15,%rcx
jmp    *%rcx
mov    %ebx,%ecx
shl    $0x4,%ecx
lea    0x9(%rax),%edx
cmp    $0x3a,%eax
cmovb  %eax,%edx
and    $0xf,%edx
or     %ecx,%edx
cmp    $0x15,%r13d
je     1314 <notmain+0x174>
add    $0x1,%r13d
mov    %edx,%ebx
jmp    1270 <notmain+0xd0>
shl    $0x4,%ebp
lea    0x9(%rax),%ecx
cmp    $0x3a,%eax
cmovb  %eax,%ecx
and    $0xf,%ecx
movzwl %bp,%ebp
or     %r12d,%ebp
or     %ecx,%ebp
add    $0x1,%r13d
jmp    1270 <notmain+0xd0>
mov    %ecx,%eax
shr    $0x18,%eax
shl    $0x18,%edx
or     %eax,%edx
shr    $0x8,%ecx
and    $0xff00,%ecx
or     %edx,%ecx
shl    $0xc,%ebx
and    $0xff0000,%ebx
or     %ecx,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1080 <PUT32@plt>
add    %ebp,%r14d
add    %ebx,%r14d
add    $0x4,%ebp
mov    $0xe,%r13d
jmp    1270 <notmain+0xd0>
add    $0x1,%r13d
jmp    1270 <notmain+0xd0>
mov    0x4(%rsp),%edx
shl    $0x4,%edx
lea    0x9(%rax),%ecx
cmp    $0x3a,%eax
cmovb  %eax,%ecx
and    $0xf,%ecx
movzbl %dl,%eax
or     %ecx,%eax
mov    $0xe,%r13d
movl   $0x0,0x4(%rsp)
test   %eax,%eax
je     1270 <notmain+0xd0>
cmp    $0x2,%al
je     13c3 <notmain+0x223>
cmp    $0x1,%al
je     13e0 <notmain+0x240>
xor    %r13d,%r13d
mov    %eax,0x4(%rsp)
jmp    1270 <notmain+0xd0>
shl    $0x4,%r12d
xor    %r13d,%r13d
jmp    1270 <notmain+0xd0>
lea    0x9(%rax),%ecx
cmp    $0x3a,%eax
cmovb  %eax,%ecx
and    $0xf,%ecx
mov    %ecx,0x4(%rsp)
mov    $0x8,%r13d
jmp    1270 <notmain+0xd0>
movl   $0x2,0x4(%rsp)
mov    $0x9,%r13d
jmp    1270 <notmain+0xd0>
cs nopw 0x0(%rax,%rax,1)
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
mov    %r14d,%edi
call   1070 <hexstring@plt>
jmp    1230 <notmain+0x90>
mov    $0xd,%edi
call   1050 <uart_send@plt>
mov    $0x2d,%edi
call   1050 <uart_send@plt>
mov    $0x2d,%edi
call   1050 <uart_send@plt>
mov    $0xd,%edi
call   1050 <uart_send@plt>
mov    $0xa,%edi
call   1050 <uart_send@plt>
mov    $0xa,%edi
call   1050 <uart_send@plt>
mov    $0x8000,%edi
call   10a0 <BRANCHTO@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @notmain() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = call i32 (...) @leds_off()
%10 = call i32 (...) @uart_init()
%11 = call i32 @hexstring(i32 305419896)
%12 = call i32 (...) @GETPC()
%13 = call i32 @hexstring(i32 %12)
%14 = call i32 (...) @GETCPSR()
%15 = call i32 @hexstring(i32 %14)
%16 = call i32 (...) @GETSCTLR()
%17 = call i32 @hexstring(i32 %16)
%18 = call i32 @uart_send(i32 73)
%19 = call i32 @uart_send(i32 72)
%20 = call i32 @uart_send(i32 69)
%21 = call i32 @uart_send(i32 88)
%22 = call i32 @uart_send(i32 13)
%23 = call i32 @uart_send(i32 10)
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %7
store i32 0, i32* %6
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
br label %24
24: ; preds = %0, %28, %32, %36, %206
%25 = call i32 (...) @uart_recv()
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, 58
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 1, i32* %1
br label %24
29: ; preds = %24
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, 13
br i1 %31, label %32, label %33
32: ; preds = %29
store i32 0, i32* %1
br label %24
33: ; preds = %29
%34 = load i32, i32* %8
%35 = icmp eq i32 %34, 10
br i1 %35, label %36, label %37
36: ; preds = %33
store i32 0, i32* %1
br label %24
37: ; preds = %33
%38 = load i32, i32* %8
%39 = icmp eq i32 %38, 103
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* %8
%42 = icmp eq i32 %41, 71
br i1 %42, label %43, label %51
43: ; preds = %40, %37
%44 = call i32 @uart_send(i32 13)
%45 = call i32 @uart_send(i32 45)
%46 = call i32 @uart_send(i32 45)
%47 = call i32 @uart_send(i32 13)
%48 = call i32 @uart_send(i32 10)
%49 = call i32 @uart_send(i32 10)
%50 = call i32 @BRANCHTO(i32 32768)
store i32 0, i32* %1
br label %207
51: ; preds = %40
%52 = load i32, i32* %1
switch i32 %52, label %206 [
i32 0, label %53
i32 1, label %54
i32 2, label %54
i32 3, label %71
i32 4, label %71
i32 5, label %71
i32 6, label %71
i32 7, label %91
i32 8, label %108
i32 9, label %139
i32 10, label %139
i32 11, label %139
i32 12, label %139
i32 13, label %156
i32 14, label %159
i32 15, label %159
i32 16, label %159
i32 17, label %159
i32 18, label %159
i32 19, label %159
i32 20, label %159
i32 21, label %159
]
53: ; preds = %51
br label %206
54: ; preds = %51, %51
%55 = load i32, i32* %2
%56 = shl i32 %55, 4
store i32 %56, i32* %2
%57 = load i32, i32* %8
%58 = icmp ugt i32 %57, 57
br i1 %58, label %59, label %62
59: ; preds = %54
%60 = load i32, i32* %8
%61 = sub i32 %60, 7
store i32 %61, i32* %8
br label %62
62: ; preds = %59, %54
%63 = load i32, i32* %8
%64 = and i32 %63, 15
%65 = load i32, i32* %2
%66 = or i32 %65, %64
store i32 %66, i32* %2
%67 = load i32, i32* %2
%68 = and i32 %67, 255
store i32 %68, i32* %2
%69 = load i32, i32* %1
%70 = add i32 %69, 1
store i32 %70, i32* %1
br label %206
71: ; preds = %51, %51, %51, %51
%72 = load i32, i32* %3
%73 = shl i32 %72, 4
store i32 %73, i32* %3
%74 = load i32, i32* %8
%75 = icmp ugt i32 %74, 57
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = load i32, i32* %8
%78 = sub i32 %77, 7
store i32 %78, i32* %8
br label %79
79: ; preds = %76, %71
%80 = load i32, i32* %8
%81 = and i32 %80, 15
%82 = load i32, i32* %3
%83 = or i32 %82, %81
store i32 %83, i32* %3
%84 = load i32, i32* %3
%85 = and i32 %84, 65535
store i32 %85, i32* %3
%86 = load i32, i32* %5
%87 = load i32, i32* %3
%88 = or i32 %87, %86
store i32 %88, i32* %3
%89 = load i32, i32* %1
%90 = add i32 %89, 1
store i32 %90, i32* %1
br label %206
91: ; preds = %51
%92 = load i32, i32* %4
%93 = shl i32 %92, 4
store i32 %93, i32* %4
%94 = load i32, i32* %8
%95 = icmp ugt i32 %94, 57
br i1 %95, label %96, label %99
96: ; preds = %91
%97 = load i32, i32* %8
%98 = sub i32 %97, 7
store i32 %98, i32* %8
br label %99
99: ; preds = %96, %91
%100 = load i32, i32* %8
%101 = and i32 %100, 15
%102 = load i32, i32* %4
%103 = or i32 %102, %101
store i32 %103, i32* %4
%104 = load i32, i32* %4
%105 = and i32 %104, 255
store i32 %105, i32* %4
%106 = load i32, i32* %1
%107 = add i32 %106, 1
store i32 %107, i32* %1
br label %206
108: ; preds = %51
%109 = load i32, i32* %4
%110 = shl i32 %109, 4
store i32 %110, i32* %4
%111 = load i32, i32* %8
%112 = icmp ugt i32 %111, 57
br i1 %112, label %113, label %116
113: ; preds = %108
%114 = load i32, i32* %8
%115 = sub i32 %114, 7
store i32 %115, i32* %8
br label %116
116: ; preds = %113, %108
%117 = load i32, i32* %8
%118 = and i32 %117, 15
%119 = load i32, i32* %4
%120 = or i32 %119, %118
store i32 %120, i32* %4
%121 = load i32, i32* %4
%122 = and i32 %121, 255
store i32 %122, i32* %4
%123 = load i32, i32* %4
switch i32 %123, label %137 [
i32 0, label %124
i32 1, label %125
i32 2, label %136
]
124: ; preds = %116
store i32 14, i32* %1
br label %138
125: ; preds = %116
store i32 0, i32* %8
br label %126
126: ; preds = %132, %125
%127 = load i32, i32* %8
%128 = icmp ult i32 %127, 20
br i1 %128, label %129, label %135
129: ; preds = %126
%130 = load i32, i32* %7
%131 = call i32 @hexstring(i32 %130)
br label %132
132: ; preds = %129
%133 = load i32, i32* %8
%134 = add i32 %133, 1
store i32 %134, i32* %8
br label %126
135: ; preds = %126
store i32 0, i32* %5
store i32 0, i32* %7
store i32 0, i32* %6
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
store i32 0, i32* %1
br label %138
136: ; preds = %116
store i32 9, i32* %1
br label %138
137: ; preds = %116
store i32 0, i32* %1
br label %138
138: ; preds = %137, %136, %135, %124
br label %206
139: ; preds = %51, %51, %51, %51
%140 = load i32, i32* %5
%141 = shl i32 %140, 4
store i32 %141, i32* %5
%142 = load i32, i32* %8
%143 = icmp ugt i32 %142, 57
br i1 %143, label %144, label %147
144: ; preds = %139
%145 = load i32, i32* %8
%146 = sub i32 %145, 7
store i32 %146, i32* %8
br label %147
147: ; preds = %144, %139
%148 = load i32, i32* %8
%149 = and i32 %148, 15
%150 = load i32, i32* %5
%151 = or i32 %150, %149
store i32 %151, i32* %5
%152 = load i32, i32* %5
%153 = and i32 %152, 65535
store i32 %153, i32* %5
%154 = load i32, i32* %1
%155 = add i32 %154, 1
store i32 %155, i32* %1
br label %206
156: ; preds = %51
%157 = load i32, i32* %5
%158 = shl i32 %157, 4
store i32 %158, i32* %5
store i32 0, i32* %1
br label %206
159: ; preds = %51, %51, %51, %51, %51, %51, %51, %51
%160 = load i32, i32* %6
%161 = shl i32 %160, 4
store i32 %161, i32* %6
%162 = load i32, i32* %8
%163 = icmp ugt i32 %162, 57
br i1 %163, label %164, label %167
164: ; preds = %159
%165 = load i32, i32* %8
%166 = sub i32 %165, 7
store i32 %166, i32* %8
br label %167
167: ; preds = %164, %159
%168 = load i32, i32* %8
%169 = and i32 %168, 15
%170 = load i32, i32* %6
%171 = or i32 %170, %169
store i32 %171, i32* %6
%172 = load i32, i32* %1
%173 = icmp eq i32 %172, 21
br i1 %173, label %174, label %202
174: ; preds = %167
%175 = load i32, i32* %6
%176 = lshr i32 %175, 24
%177 = load i32, i32* %6
%178 = shl i32 %177, 24
%179 = or i32 %176, %178
store i32 %179, i32* %8
%180 = load i32, i32* %6
%181 = lshr i32 %180, 8
%182 = and i32 %181, 65280
%183 = load i32, i32* %8
%184 = or i32 %183, %182
store i32 %184, i32* %8
%185 = load i32, i32* %6
%186 = shl i32 %185, 8
%187 = and i32 %186, 16711680
%188 = load i32, i32* %8
%189 = or i32 %188, %187
store i32 %189, i32* %8
%190 = load i32, i32* %8
store i32 %190, i32* %6
%191 = load i32, i32* %3
%192 = load i32, i32* %6
%193 = call i32 @PUT32(i32 %191, i32 %192)
%194 = load i32, i32* %3
%195 = load i32, i32* %7
%196 = add i32 %195, %194
store i32 %196, i32* %7
%197 = load i32, i32* %6
%198 = load i32, i32* %7
%199 = add i32 %198, %197
store i32 %199, i32* %7
%200 = load i32, i32* %3
%201 = add i32 %200, 4
store i32 %201, i32* %3
store i32 14, i32* %1
br label %205
202: ; preds = %167
%203 = load i32, i32* %1
%204 = add i32 %203, 1
store i32 %204, i32* %1
br label %205
205: ; preds = %202, %174
br label %206
206: ; preds = %51, %205, %156, %147, %138, %99, %79, %62, %53
br label %24
207: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
define i32 @notmain() {
%1 = tail call i32 (...) @leds_off()
%2 = tail call i32 (...) @uart_init()
%3 = tail call i32 @hexstring(i32 305419896)
%4 = tail call i32 (...) @GETPC()
%5 = tail call i32 @hexstring(i32 %4)
%6 = tail call i32 (...) @GETCPSR()
%7 = tail call i32 @hexstring(i32 %6)
%8 = tail call i32 (...) @GETSCTLR()
%9 = tail call i32 @hexstring(i32 %8)
%10 = tail call i32 @uart_send(i32 73)
%11 = tail call i32 @uart_send(i32 72)
%12 = tail call i32 @uart_send(i32 69)
%13 = tail call i32 @uart_send(i32 88)
%14 = tail call i32 @uart_send(i32 13)
%15 = tail call i32 @uart_send(i32 10)
br label %16
16: ; preds = %89, %0
%17 = phi i32 [ 0, %0 ], [ %90, %89 ]
%18 = phi i32 [ 0, %0 ], [ %91, %89 ]
%19 = phi i32 [ 0, %0 ], [ %92, %89 ]
%20 = phi i32 [ 0, %0 ], [ %93, %89 ]
%21 = phi i32 [ 0, %0 ], [ %94, %89 ]
%22 = phi i32 [ 0, %0 ], [ %95, %89 ]
br label %23
23: ; preds = %27, %16
%24 = phi i32 [ %17, %16 ], [ %28, %27 ]
%25 = tail call i32 (...) @uart_recv()
switch i32 %25, label %30 [
i32 58, label %27
i32 13, label %26
i32 10, label %29
]
26: ; preds = %23
br label %27
27: ; preds = %26, %29, %23
%28 = phi i32 [ 0, %26 ], [ 0, %29 ], [ 1, %23 ]
br label %23
29: ; preds = %23
br label %27
30: ; preds = %23
%31 = and i32 %25, -33
%32 = icmp eq i32 %31, 71
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = tail call i32 @uart_send(i32 13)
%35 = tail call i32 @uart_send(i32 45)
%36 = tail call i32 @uart_send(i32 45)
%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 @BRANCHTO(i32 32768)
ret i32 0
41: ; preds = %30
switch i32 %24, label %89 [
i32 21, label %109
i32 1, label %42
i32 2, label %42
i32 3, label %44
i32 4, label %44
i32 5, label %44
i32 6, label %44
i32 7, label %54
i32 8, label %59
i32 9, label %98
i32 10, label %98
i32 11, label %98
i32 12, label %98
i32 13, label %107
i32 14, label %109
i32 15, label %109
i32 16, label %109
i32 17, label %109
i32 18, label %109
i32 19, label %109
i32 20, label %109
]
42: ; preds = %41, %41
%43 = add nuw nsw i32 %24, 1
br label %89
44: ; preds = %41, %41, %41, %41
%45 = shl i32 %18, 4
%46 = icmp ugt i32 %25, 57
%47 = add i32 %25, 9
%48 = select i1 %46, i32 %47, i32 %25
%49 = and i32 %48, 15
%50 = and i32 %45, 65520
%51 = or i32 %20, %50
%52 = or i32 %51, %49
%53 = add nuw nsw i32 %24, 1
br label %89
54: ; preds = %41
%55 = icmp ugt i32 %25, 57
%56 = add i32 %25, 9
%57 = select i1 %55, i32 %56, i32 %25
%58 = and i32 %57, 15
br label %89
59: ; preds = %41
%60 = shl i32 %19, 4
%61 = icmp ugt i32 %25, 57
%62 = add i32 %25, 9
%63 = select i1 %61, i32 %62, i32 %25
%64 = and i32 %63, 15
%65 = and i32 %60, 240
%66 = or i32 %64, %65
%67 = trunc i32 %66 to i8
switch i8 %67, label %97 [
i8 0, label %89
i8 1, label %68
i8 2, label %96
]
68: ; preds = %59
%69 = tail call i32 @hexstring(i32 %22)
%70 = tail call i32 @hexstring(i32 %22)
%71 = tail call i32 @hexstring(i32 %22)
%72 = tail call i32 @hexstring(i32 %22)
%73 = tail call i32 @hexstring(i32 %22)
%74 = tail call i32 @hexstring(i32 %22)
%75 = tail call i32 @hexstring(i32 %22)
%76 = tail call i32 @hexstring(i32 %22)
%77 = tail call i32 @hexstring(i32 %22)
%78 = tail call i32 @hexstring(i32 %22)
%79 = tail call i32 @hexstring(i32 %22)
%80 = tail call i32 @hexstring(i32 %22)
%81 = tail call i32 @hexstring(i32 %22)
%82 = tail call i32 @hexstring(i32 %22)
%83 = tail call i32 @hexstring(i32 %22)
%84 = tail call i32 @hexstring(i32 %22)
%85 = tail call i32 @hexstring(i32 %22)
%86 = tail call i32 @hexstring(i32 %22)
%87 = tail call i32 @hexstring(i32 %22)
%88 = tail call i32 @hexstring(i32 %22)
br label %89
89: ; preds = %68, %59, %117, %131, %96, %97, %41, %107, %98, %54, %44, %42
%90 = phi i32 [ %24, %41 ], [ 0, %107 ], [ %106, %98 ], [ 0, %97 ], [ 9, %96 ], [ 8, %54 ], [ %53, %44 ], [ %43, %42 ], [ 14, %117 ], [ %132, %131 ], [ 14, %59 ], [ 0, %68 ]
%91 = phi i32 [ %18, %41 ], [ %18, %107 ], [ %18, %98 ], [ %18, %97 ], [ %18, %96 ], [ %18, %54 ], [ %52, %44 ], [ %18, %42 ], [ %130, %117 ], [ %18, %131 ], [ %18, %59 ], [ 0, %68 ]
%92 = phi i32 [ %19, %41 ], [ %19, %107 ], [ %19, %98 ], [ %66, %97 ], [ 2, %96 ], [ %58, %54 ], [ %19, %44 ], [ %19, %42 ], [ %19, %117 ], [ %19, %131 ], [ 0, %59 ], [ 0, %68 ]
%93 = phi i32 [ %20, %41 ], [ %108, %107 ], [ %105, %98 ], [ %20, %97 ], [ %20, %96 ], [ %20, %54 ], [ %20, %44 ], [ %20, %42 ], [ %20, %117 ], [ %20, %131 ], [ %20, %59 ], [ 0, %68 ]
%94 = phi i32 [ %21, %41 ], [ %21, %107 ], [ %21, %98 ], [ %21, %97 ], [ %21, %96 ], [ %21, %54 ], [ %21, %44 ], [ %21, %42 ], [ %126, %117 ], [ %115, %131 ], [ %21, %59 ], [ 0, %68 ]
%95 = phi i32 [ %22, %41 ], [ %22, %107 ], [ %22, %98 ], [ %22, %97 ], [ %22, %96 ], [ %22, %54 ], [ %22, %44 ], [ %22, %42 ], [ %129, %117 ], [ %22, %131 ], [ %22, %59 ], [ 0, %68 ]
br label %16
96: ; preds = %59
br label %89
97: ; preds = %59
br label %89
98: ; preds = %41, %41, %41, %41
%99 = shl i32 %20, 4
%100 = icmp ugt i32 %25, 57
%101 = add i32 %25, 9
%102 = select i1 %100, i32 %101, i32 %25
%103 = and i32 %102, 15
%104 = and i32 %99, 65520
%105 = or i32 %103, %104
%106 = add nuw nsw i32 %24, 1
br label %89
107: ; preds = %41
%108 = shl i32 %20, 4
br label %89
109: ; preds = %41, %41, %41, %41, %41, %41, %41, %41
%110 = shl i32 %21, 4
%111 = icmp ugt i32 %25, 57
%112 = add i32 %25, 9
%113 = select i1 %111, i32 %112, i32 %25
%114 = and i32 %113, 15
%115 = or i32 %114, %110
%116 = icmp eq i32 %24, 21
br i1 %116, label %117, label %131
117: ; preds = %109
%118 = lshr i32 %110, 24
%119 = shl i32 %115, 24
%120 = or i32 %119, %118
%121 = lshr i32 %110, 8
%122 = and i32 %121, 65280
%123 = or i32 %120, %122
%124 = shl i32 %21, 12
%125 = and i32 %124, 16711680
%126 = or i32 %123, %125
%127 = tail call i32 @PUT32(i32 %18, i32 %126)
%128 = add i32 %22, %18
%129 = add i32 %128, %126
%130 = add i32 %18, 4
br label %89
131: ; preds = %109
%132 = add nuw nsw i32 %24, 1
br label %89
}