#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*/ ClearScreen();
void *GET32(int);
int /*<<< orphan*/ PUT32(int, unsigned int);
int /*<<< orphan*/ hexstring(int);
int /*<<< orphan*/ i2c_delay();
int /*<<< orphan*/ scl_high();
int /*<<< orphan*/ sda_high();
int /*<<< orphan*/ send_command(int);
int /*<<< orphan*/ show_text(int /*<<< orphan*/, char *);
int /*<<< orphan*/ show_text_hex(int, unsigned int const);
int /*<<< orphan*/ uart_init();
int notmain(void) {
  unsigned int ra = 0u;
  uart_init();
  hexstring(0x12345678);
  PUT32(0x2000B408, 0x00000000);
  PUT32(0x2000B408, 0x00000200);
  ra = GET32(0x20200000);
  ra &= ~(7 << (2 * 3));
  ra &= ~(7 << (3 * 3));
  ra |= 1 << (2 * 3);
  ra |= 1 << (3 * 3);
  PUT32(0x20200000, ra);
  scl_high();
  sda_high();
  i2c_delay();
  i2c_delay();
  i2c_delay();
  send_command(0xAE);
  send_command(0xD5);
  send_command(0x80);
  send_command(0xA8);
  send_command(0x3F);
  send_command(0xD3);
  send_command(0x0);
  send_command(0x40 | 0x0);
  send_command(0x8D);
  send_command(0x14);
  send_command(0x20);
  send_command(0x02);
  send_command(0xA0 | 0x1);
  send_command(0xC8);
  send_command(0xDA);
  send_command(0x12);
  send_command(0x81);
  send_command(0x7F);
  send_command(0xD9);
  send_command(0xF1);
  send_command(0xDB);
  send_command(0x40);
  send_command(0xA6);
  send_command(0xA4);
  ClearScreen();
  send_command(0xAF);
  const unsigned int instr1 = GET32(0x8000);
  const unsigned int instr2 = GET32(0x8004);
  show_text(0, "Hello world!");
  show_text_hex(2, instr1);
  show_text_hex(3, instr2);
  for (ra = 0; ra <= 0x200; ra++) {
    show_text_hex(7, ra);
  }
  hexstring(0x12341234);
  return 0;
}


x86 assembly (clang, -O0):
<notmain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <uart_init@plt>
mov    $0x12345678,%edi
call   1070 <hexstring@plt>
mov    $0x2000b408,%edi
xor    %esi,%esi
call   1090 <PUT32@plt>
mov    $0x2000b408,%edi
mov    $0x200,%esi
call   1090 <PUT32@plt>
mov    $0x20200000,%edi
call   10d0 <GET32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffe3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffff1ff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x40,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x200,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x20200000,%edi
call   1090 <PUT32@plt>
mov    $0x0,%al
call   1030 <scl_high@plt>
mov    $0x0,%al
call   1060 <sda_high@plt>
mov    $0x0,%al
call   1040 <i2c_delay@plt>
mov    $0x0,%al
call   1040 <i2c_delay@plt>
mov    $0x0,%al
call   1040 <i2c_delay@plt>
mov    $0xae,%edi
call   10c0 <send_command@plt>
mov    $0xd5,%edi
call   10c0 <send_command@plt>
mov    $0x80,%edi
call   10c0 <send_command@plt>
mov    $0xa8,%edi
call   10c0 <send_command@plt>
mov    $0x3f,%edi
call   10c0 <send_command@plt>
mov    $0xd3,%edi
call   10c0 <send_command@plt>
xor    %edi,%edi
call   10c0 <send_command@plt>
mov    $0x40,%edi
call   10c0 <send_command@plt>
mov    $0x8d,%edi
call   10c0 <send_command@plt>
mov    $0x14,%edi
call   10c0 <send_command@plt>
mov    $0x20,%edi
call   10c0 <send_command@plt>
mov    $0x2,%edi
call   10c0 <send_command@plt>
mov    $0xa1,%edi
call   10c0 <send_command@plt>
mov    $0xc8,%edi
call   10c0 <send_command@plt>
mov    $0xda,%edi
call   10c0 <send_command@plt>
mov    $0x12,%edi
call   10c0 <send_command@plt>
mov    $0x81,%edi
call   10c0 <send_command@plt>
mov    $0x7f,%edi
call   10c0 <send_command@plt>
mov    $0xd9,%edi
call   10c0 <send_command@plt>
mov    $0xf1,%edi
call   10c0 <send_command@plt>
mov    $0xdb,%edi
call   10c0 <send_command@plt>
mov    $0x40,%edi
call   10c0 <send_command@plt>
mov    $0xa6,%edi
call   10c0 <send_command@plt>
mov    $0xa4,%edi
call   10c0 <send_command@plt>
mov    $0x0,%al
call   10a0 <ClearScreen@plt>
mov    $0xaf,%edi
call   10c0 <send_command@plt>
mov    $0x8000,%edi
call   10d0 <GET32@plt>
mov    %eax,-0x8(%rbp)
mov    $0x8004,%edi
call   10d0 <GET32@plt>
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
lea    0xc8d(%rip),%rsi
call   10b0 <show_text@plt>
mov    -0x8(%rbp),%esi
mov    $0x2,%edi
call   1080 <show_text_hex@plt>
mov    -0xc(%rbp),%esi
mov    $0x3,%edi
call   1080 <show_text_hex@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
ja     13c1 <notmain+0x211>
mov    -0x4(%rbp),%esi
mov    $0x7,%edi
call   1080 <show_text_hex@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1399 <notmain+0x1e9>
mov    $0x12341234,%edi
call   1070 <hexstring@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<notmain>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <uart_init@plt>
mov    $0x12345678,%edi
call   1070 <hexstring@plt>
mov    $0x2000b408,%edi
xor    %esi,%esi
call   1090 <PUT32@plt>
mov    $0x2000b408,%edi
mov    $0x200,%esi
call   1090 <PUT32@plt>
mov    $0x20200000,%edi
call   10d0 <GET32@plt>
and    $0xfffff03f,%eax
lea    0x240(%rax),%esi
mov    $0x20200000,%edi
call   1090 <PUT32@plt>
xor    %eax,%eax
call   1030 <scl_high@plt>
xor    %eax,%eax
call   1060 <sda_high@plt>
xor    %eax,%eax
call   1040 <i2c_delay@plt>
xor    %eax,%eax
call   1040 <i2c_delay@plt>
xor    %eax,%eax
call   1040 <i2c_delay@plt>
mov    $0xae,%edi
call   10c0 <send_command@plt>
mov    $0xd5,%edi
call   10c0 <send_command@plt>
mov    $0x80,%edi
call   10c0 <send_command@plt>
mov    $0xa8,%edi
call   10c0 <send_command@plt>
mov    $0x3f,%edi
call   10c0 <send_command@plt>
mov    $0xd3,%edi
call   10c0 <send_command@plt>
xor    %edi,%edi
call   10c0 <send_command@plt>
mov    $0x40,%edi
call   10c0 <send_command@plt>
mov    $0x8d,%edi
call   10c0 <send_command@plt>
mov    $0x14,%edi
call   10c0 <send_command@plt>
mov    $0x20,%edi
call   10c0 <send_command@plt>
mov    $0x2,%edi
call   10c0 <send_command@plt>
mov    $0xa1,%edi
call   10c0 <send_command@plt>
mov    $0xc8,%edi
call   10c0 <send_command@plt>
mov    $0xda,%edi
call   10c0 <send_command@plt>
mov    $0x12,%edi
call   10c0 <send_command@plt>
mov    $0x81,%edi
call   10c0 <send_command@plt>
mov    $0x7f,%edi
call   10c0 <send_command@plt>
mov    $0xd9,%edi
call   10c0 <send_command@plt>
mov    $0xf1,%edi
call   10c0 <send_command@plt>
mov    $0xdb,%edi
call   10c0 <send_command@plt>
mov    $0x40,%edi
call   10c0 <send_command@plt>
mov    $0xa6,%edi
call   10c0 <send_command@plt>
mov    $0xa4,%edi
call   10c0 <send_command@plt>
xor    %eax,%eax
call   10a0 <ClearScreen@plt>
mov    $0xaf,%edi
call   10c0 <send_command@plt>
mov    $0x8000,%edi
call   10d0 <GET32@plt>
mov    %rax,%r14
mov    $0x8004,%edi
call   10d0 <GET32@plt>
mov    %rax,%r15
lea    0xcbc(%rip),%rsi
xor    %edi,%edi
call   10b0 <show_text@plt>
mov    $0x2,%edi
mov    %r14d,%esi
call   1080 <show_text_hex@plt>
mov    $0x3,%edi
mov    %r15d,%esi
call   1080 <show_text_hex@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x7,%edi
mov    %ebx,%esi
call   1080 <show_text_hex@plt>
add    $0x1,%ebx
cmp    $0x201,%ebx
jne    1370 <notmain+0x1c0>
mov    $0x12341234,%edi
call   1070 <hexstring@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
define i32 @notmain() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @uart_init()
%5 = call i32 @hexstring(i32 305419896)
%6 = call i32 @PUT32(i32 536917000, i32 0)
%7 = call i32 @PUT32(i32 536917000, i32 512)
%8 = call i8* @GET32(i32 538968064)
%9 = ptrtoint i8* %8 to i32
store i32 %9, i32* %1
%10 = load i32, i32* %1
%11 = and i32 %10, -449
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = and i32 %12, -3585
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = or i32 %14, 64
store i32 %15, i32* %1
%16 = load i32, i32* %1
%17 = or i32 %16, 512
store i32 %17, i32* %1
%18 = load i32, i32* %1
%19 = call i32 @PUT32(i32 538968064, i32 %18)
%20 = call i32 (...) @scl_high()
%21 = call i32 (...) @sda_high()
%22 = call i32 (...) @i2c_delay()
%23 = call i32 (...) @i2c_delay()
%24 = call i32 (...) @i2c_delay()
%25 = call i32 @send_command(i32 174)
%26 = call i32 @send_command(i32 213)
%27 = call i32 @send_command(i32 128)
%28 = call i32 @send_command(i32 168)
%29 = call i32 @send_command(i32 63)
%30 = call i32 @send_command(i32 211)
%31 = call i32 @send_command(i32 0)
%32 = call i32 @send_command(i32 64)
%33 = call i32 @send_command(i32 141)
%34 = call i32 @send_command(i32 20)
%35 = call i32 @send_command(i32 32)
%36 = call i32 @send_command(i32 2)
%37 = call i32 @send_command(i32 161)
%38 = call i32 @send_command(i32 200)
%39 = call i32 @send_command(i32 218)
%40 = call i32 @send_command(i32 18)
%41 = call i32 @send_command(i32 129)
%42 = call i32 @send_command(i32 127)
%43 = call i32 @send_command(i32 217)
%44 = call i32 @send_command(i32 241)
%45 = call i32 @send_command(i32 219)
%46 = call i32 @send_command(i32 64)
%47 = call i32 @send_command(i32 166)
%48 = call i32 @send_command(i32 164)
%49 = call i32 (...) @ClearScreen()
%50 = call i32 @send_command(i32 175)
%51 = call i8* @GET32(i32 32768)
%52 = ptrtoint i8* %51 to i32
store i32 %52, i32* %2
%53 = call i8* @GET32(i32 32772)
%54 = ptrtoint i8* %53 to i32
store i32 %54, i32* %3
%55 = call i32 @show_text(i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%56 = load i32, i32* %2
%57 = call i32 @show_text_hex(i32 2, i32 %56)
%58 = load i32, i32* %3
%59 = call i32 @show_text_hex(i32 3, i32 %58)
store i32 0, i32* %1
br label %60
60: ; preds = %66, %0
%61 = load i32, i32* %1
%62 = icmp ule i32 %61, 512
br i1 %62, label %63, label %69
63: ; preds = %60
%64 = load i32, i32* %1
%65 = call i32 @show_text_hex(i32 7, i32 %64)
br label %66
66: ; preds = %63
%67 = load i32, i32* %1
%68 = add i32 %67, 1
store i32 %68, i32* %1
br label %60
69: ; preds = %60
%70 = call i32 @hexstring(i32 305402420)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
define i32 @notmain() {
%1 = tail call i32 (...) @uart_init()
%2 = tail call i32 @hexstring(i32 305419896)
%3 = tail call i32 @PUT32(i32 536917000, i32 0)
%4 = tail call i32 @PUT32(i32 536917000, i32 512)
%5 = tail call i8* @GET32(i32 538968064)
%6 = ptrtoint i8* %5 to i64
%7 = trunc i64 %6 to i32
%8 = and i32 %7, -4033
%9 = or i32 %8, 576
%10 = tail call i32 @PUT32(i32 538968064, i32 %9)
%11 = tail call i32 (...) @scl_high()
%12 = tail call i32 (...) @sda_high()
%13 = tail call i32 (...) @i2c_delay()
%14 = tail call i32 (...) @i2c_delay()
%15 = tail call i32 (...) @i2c_delay()
%16 = tail call i32 @send_command(i32 174)
%17 = tail call i32 @send_command(i32 213)
%18 = tail call i32 @send_command(i32 128)
%19 = tail call i32 @send_command(i32 168)
%20 = tail call i32 @send_command(i32 63)
%21 = tail call i32 @send_command(i32 211)
%22 = tail call i32 @send_command(i32 0)
%23 = tail call i32 @send_command(i32 64)
%24 = tail call i32 @send_command(i32 141)
%25 = tail call i32 @send_command(i32 20)
%26 = tail call i32 @send_command(i32 32)
%27 = tail call i32 @send_command(i32 2)
%28 = tail call i32 @send_command(i32 161)
%29 = tail call i32 @send_command(i32 200)
%30 = tail call i32 @send_command(i32 218)
%31 = tail call i32 @send_command(i32 18)
%32 = tail call i32 @send_command(i32 129)
%33 = tail call i32 @send_command(i32 127)
%34 = tail call i32 @send_command(i32 217)
%35 = tail call i32 @send_command(i32 241)
%36 = tail call i32 @send_command(i32 219)
%37 = tail call i32 @send_command(i32 64)
%38 = tail call i32 @send_command(i32 166)
%39 = tail call i32 @send_command(i32 164)
%40 = tail call i32 (...) @ClearScreen()
%41 = tail call i32 @send_command(i32 175)
%42 = tail call i8* @GET32(i32 32768)
%43 = ptrtoint i8* %42 to i64
%44 = trunc i64 %43 to i32
%45 = tail call i8* @GET32(i32 32772)
%46 = ptrtoint i8* %45 to i64
%47 = trunc i64 %46 to i32
%48 = tail call i32 @show_text(i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%49 = tail call i32 @show_text_hex(i32 2, i32 %44)
%50 = tail call i32 @show_text_hex(i32 3, i32 %47)
br label %51
51: ; preds = %0, %51
%52 = phi i32 [ 0, %0 ], [ %54, %51 ]
%53 = tail call i32 @show_text_hex(i32 7, i32 %52)
%54 = add nuw nsw i32 %52, 1
%55 = icmp eq i32 %54, 513
br i1 %55, label %56, label %51
56: ; preds = %51
%57 = tail call i32 @hexstring(i32 305402420)
ret i32 0
}