#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*/ delay(int);
int /*<<< orphan*/ mmio_write(int, int);
void uart_init() {
  mmio_write((0x20201000 + 0x30), 0x00000000);
  mmio_write((0x20200000 + 0x98), (1 << 14) | (1 << 15));
  delay(150);
  mmio_write((0x20200000 + 0x98), 0x00000000);
  mmio_write((0x20201000 + 0x44), 0x7FF);
  mmio_write((0x20201000 + 0x24), 1);
  mmio_write((0x20201000 + 0x28), 40);
  mmio_write((0x20201000 + 0x2C), (1 << 4) | (1 << 5) | (1 << 6));
  mmio_write((0x20201000 + 0x38), (1 << 1) | (1 << 4) | (1 << 5) | (1 << 6) |
                                      (1 << 7) | (1 << 8) | (1 << 9) |
                                      (1 << 10));
  mmio_write((0x20201000 + 0x30), (1 << 0) | (1 << 8) | (1 << 9));
}


x86 assembly (clang, -O0):
<uart_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20201030,%edi
xor    %esi,%esi
call   1040 <mmio_write@plt>
mov    $0x20200098,%edi
mov    $0xc000,%esi
call   1040 <mmio_write@plt>
mov    $0x96,%edi
call   1030 <delay@plt>
mov    $0x20200098,%edi
xor    %esi,%esi
call   1040 <mmio_write@plt>
mov    $0x20201044,%edi
mov    $0x7ff,%esi
call   1040 <mmio_write@plt>
mov    $0x20201024,%edi
mov    $0x1,%esi
call   1040 <mmio_write@plt>
mov    $0x20201028,%edi
mov    $0x28,%esi
call   1040 <mmio_write@plt>
mov    $0x2020102c,%edi
mov    $0x70,%esi
call   1040 <mmio_write@plt>
mov    $0x20201038,%edi
mov    $0x7f2,%esi
call   1040 <mmio_write@plt>
mov    $0x20201030,%edi
mov    $0x301,%esi
call   1040 <mmio_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_init>:
push   %rax
mov    $0x20201030,%edi
xor    %esi,%esi
call   1040 <mmio_write@plt>
mov    $0x20200098,%edi
mov    $0xc000,%esi
call   1040 <mmio_write@plt>
mov    $0x96,%edi
call   1030 <delay@plt>
mov    $0x20200098,%edi
xor    %esi,%esi
call   1040 <mmio_write@plt>
mov    $0x20201044,%edi
mov    $0x7ff,%esi
call   1040 <mmio_write@plt>
mov    $0x20201024,%edi
mov    $0x1,%esi
call   1040 <mmio_write@plt>
mov    $0x20201028,%edi
mov    $0x28,%esi
call   1040 <mmio_write@plt>
mov    $0x2020102c,%edi
mov    $0x70,%esi
call   1040 <mmio_write@plt>
mov    $0x20201038,%edi
mov    $0x7f2,%esi
call   1040 <mmio_write@plt>
mov    $0x20201030,%edi
mov    $0x301,%esi
pop    %rax
jmp    1040 <mmio_write@plt>

LLVM IR (-O0):
define void @uart_init() {
%1 = call i32 @mmio_write(i32 538972208, i32 0)
%2 = call i32 @mmio_write(i32 538968216, i32 49152)
%3 = call i32 @delay(i32 150)
%4 = call i32 @mmio_write(i32 538968216, i32 0)
%5 = call i32 @mmio_write(i32 538972228, i32 2047)
%6 = call i32 @mmio_write(i32 538972196, i32 1)
%7 = call i32 @mmio_write(i32 538972200, i32 40)
%8 = call i32 @mmio_write(i32 538972204, i32 112)
%9 = call i32 @mmio_write(i32 538972216, i32 2034)
%10 = call i32 @mmio_write(i32 538972208, i32 769)
ret void
}

LLVM IR (-O2):
define void @uart_init() {
%1 = tail call i32 @mmio_write(i32 538972208, i32 0)
%2 = tail call i32 @mmio_write(i32 538968216, i32 49152)
%3 = tail call i32 @delay(i32 150)
%4 = tail call i32 @mmio_write(i32 538968216, i32 0)
%5 = tail call i32 @mmio_write(i32 538972228, i32 2047)
%6 = tail call i32 @mmio_write(i32 538972196, i32 1)
%7 = tail call i32 @mmio_write(i32 538972200, i32 40)
%8 = tail call i32 @mmio_write(i32 538972204, i32 112)
%9 = tail call i32 @mmio_write(i32 538972216, i32 2034)
%10 = tail call i32 @mmio_write(i32 538972208, i32 769)
ret void
}