#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*/ _sleep(int /*<<< orphan*/);
unsigned int get32(int);
int /*<<< orphan*/ put32(int, int);
void uart_init(void) {
  unsigned int ra;
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015004), 1);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015044), 0);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015060), 0);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x0001504C), 3);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015050), 0);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015044), 0);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015048), 0xC6);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015068), 270);
  ra = get32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00000004));
  ra &= ~(7 << 12);
  ra |= 2 << 12;
  ra &= ~(7 << 15);
  ra |= 2 << 15;
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00000004), ra);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00000094), 0);
  _sleep(0);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00000098),
        (1 << 14) | (1 << 15));
  _sleep(0);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00000098), 0);
  put32((0xFFFFFF0000000000uL + 0x3F200000uL + 0x00015060), 3);
}


x86 assembly (clang, -O0):
<uart_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3f215004,%edi
mov    $0x1,%esi
call   1040 <put32@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215060,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f21504c,%edi
mov    $0x3,%esi
call   1040 <put32@plt>
mov    $0x3f215050,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215048,%edi
mov    $0xc6,%esi
call   1040 <put32@plt>
mov    $0x3f215068,%edi
mov    $0x10e,%esi
call   1040 <put32@plt>
mov    $0x3f200004,%edi
call   1050 <get32@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff8fff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x2000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffc7fff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x10000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x3f200004,%edi
call   1040 <put32@plt>
mov    $0x3f200094,%edi
xor    %esi,%esi
call   1040 <put32@plt>
xor    %edi,%edi
call   1030 <_sleep@plt>
mov    $0x3f200098,%edi
mov    $0xc000,%esi
call   1040 <put32@plt>
xor    %edi,%edi
call   1030 <_sleep@plt>
mov    $0x3f200098,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215060,%edi
mov    $0x3,%esi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_init>:
push   %rax
mov    $0x3f215004,%edi
mov    $0x1,%esi
call   1040 <put32@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215060,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f21504c,%edi
mov    $0x3,%esi
call   1040 <put32@plt>
mov    $0x3f215050,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215048,%edi
mov    $0xc6,%esi
call   1040 <put32@plt>
mov    $0x3f215068,%edi
mov    $0x10e,%esi
call   1040 <put32@plt>
mov    $0x3f200004,%edi
call   1050 <get32@plt>
and    $0xfffc0fff,%eax
lea    0x12000(%rax),%esi
mov    $0x3f200004,%edi
call   1040 <put32@plt>
mov    $0x3f200094,%edi
xor    %esi,%esi
call   1040 <put32@plt>
xor    %edi,%edi
call   1030 <_sleep@plt>
mov    $0x3f200098,%edi
mov    $0xc000,%esi
call   1040 <put32@plt>
xor    %edi,%edi
call   1030 <_sleep@plt>
mov    $0x3f200098,%edi
xor    %esi,%esi
call   1040 <put32@plt>
mov    $0x3f215060,%edi
mov    $0x3,%esi
pop    %rax
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @uart_init() {
%1 = alloca i32
%2 = call i32 @put32(i32 1059147780, i32 1)
%3 = call i32 @put32(i32 1059147844, i32 0)
%4 = call i32 @put32(i32 1059147872, i32 0)
%5 = call i32 @put32(i32 1059147852, i32 3)
%6 = call i32 @put32(i32 1059147856, i32 0)
%7 = call i32 @put32(i32 1059147844, i32 0)
%8 = call i32 @put32(i32 1059147848, i32 198)
%9 = call i32 @put32(i32 1059147880, i32 270)
%10 = call i32 @get32(i32 1059061764)
store i32 %10, i32* %1
%11 = load i32, i32* %1
%12 = and i32 %11, -28673
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = or i32 %13, 8192
store i32 %14, i32* %1
%15 = load i32, i32* %1
%16 = and i32 %15, -229377
store i32 %16, i32* %1
%17 = load i32, i32* %1
%18 = or i32 %17, 65536
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = call i32 @put32(i32 1059061764, i32 %19)
%21 = call i32 @put32(i32 1059061908, i32 0)
%22 = call i32 @_sleep(i32 0)
%23 = call i32 @put32(i32 1059061912, i32 49152)
%24 = call i32 @_sleep(i32 0)
%25 = call i32 @put32(i32 1059061912, i32 0)
%26 = call i32 @put32(i32 1059147872, i32 3)
ret void
}

LLVM IR (-O2):
define void @uart_init() {
%1 = tail call i32 @put32(i32 1059147780, i32 1)
%2 = tail call i32 @put32(i32 1059147844, i32 0)
%3 = tail call i32 @put32(i32 1059147872, i32 0)
%4 = tail call i32 @put32(i32 1059147852, i32 3)
%5 = tail call i32 @put32(i32 1059147856, i32 0)
%6 = tail call i32 @put32(i32 1059147844, i32 0)
%7 = tail call i32 @put32(i32 1059147848, i32 198)
%8 = tail call i32 @put32(i32 1059147880, i32 270)
%9 = tail call i32 @get32(i32 1059061764)
%10 = and i32 %9, -258049
%11 = or i32 %10, 73728
%12 = tail call i32 @put32(i32 1059061764, i32 %11)
%13 = tail call i32 @put32(i32 1059061908, i32 0)
%14 = tail call i32 @_sleep(i32 0)
%15 = tail call i32 @put32(i32 1059061912, i32 49152)
%16 = tail call i32 @_sleep(i32 0)
%17 = tail call i32 @put32(i32 1059061912, i32 0)
%18 = tail call i32 @put32(i32 1059147872, i32 3)
ret void
}