#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*/ dummy();
unsigned int get_mem(int);
int /*<<< orphan*/ put_mem(int, int);
void uart_init() {
  unsigned int tmp;
  put_mem(0x3F000000 + 0x00215004, 1);
  put_mem(0x3F000000 + 0x00215044, 0);
  put_mem(0x3F000000 + 0x00215060, 0);
  put_mem(0x3F000000 + 0x0021504C, 3);
  put_mem(0x3F000000 + 0x00215044, 0);
  put_mem(0x3F000000 + 0x00215048, 0xC6);
  put_mem(0x3F000000 + 0x00215068, 270);
  tmp = get_mem(0x3F000000 + 0x00200004);
  tmp &= ~(7 << 12);
  tmp |= 2 << 12;
  tmp &= ~(7 << 15);
  tmp |= 2 << 15;
  put_mem(0x3F000000 + 0x00200004, tmp);
  put_mem(0x3F000000 + 0x00200094, 0);
  for (int i = 0; i < 150; ++i) {
    dummy();
  }
  put_mem(0x3F000000 + 0x00200098, ((1 << 14) | (1 << 15)));
  for (int i = 0; i < 150; ++i) {
    dummy();
  }
  put_mem(0x3F000000 + 0x00200098, 0);
  put_mem(0x3F000000 + 0x00215060, 3);
}


x86 assembly (clang, -O0):
<uart_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3f215004,%edi
mov    $0x1,%esi
call   1040 <put_mem@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f215060,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f21504c,%edi
mov    $0x3,%esi
call   1040 <put_mem@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f215048,%edi
mov    $0xc6,%esi
call   1040 <put_mem@plt>
mov    $0x3f215068,%edi
mov    $0x10e,%esi
call   1040 <put_mem@plt>
mov    $0x3f200004,%edi
call   1050 <get_mem@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 <put_mem@plt>
mov    $0x3f200094,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x96,-0x8(%rbp)
jge    1213 <uart_init+0xe3>
mov    $0x0,%al
call   1030 <dummy@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11f1 <uart_init+0xc1>
mov    $0x3f200098,%edi
mov    $0xc000,%esi
call   1040 <put_mem@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x96,-0xc(%rbp)
jge    124b <uart_init+0x11b>
mov    $0x0,%al
call   1030 <dummy@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1229 <uart_init+0xf9>
mov    $0x3f200098,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f215060,%edi
mov    $0x3,%esi
call   1040 <put_mem@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_init>:
push   %rbx
mov    $0x3f215004,%edi
mov    $0x1,%esi
call   1040 <put_mem@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f215060,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f21504c,%edi
mov    $0x3,%esi
call   1040 <put_mem@plt>
mov    $0x3f215044,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f215048,%edi
mov    $0xc6,%esi
call   1040 <put_mem@plt>
mov    $0x3f215068,%edi
mov    $0x10e,%esi
call   1040 <put_mem@plt>
mov    $0x3f200004,%edi
call   1050 <get_mem@plt>
and    $0xfffc0fff,%eax
lea    0x12000(%rax),%esi
mov    $0x3f200004,%edi
call   1040 <put_mem@plt>
mov    $0x3f200094,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x96,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <dummy@plt>
add    $0xffffffff,%ebx
jne    11d0 <uart_init+0xa0>
mov    $0x3f200098,%edi
mov    $0xc000,%esi
call   1040 <put_mem@plt>
mov    $0x96,%ebx
xor    %eax,%eax
call   1030 <dummy@plt>
add    $0xffffffff,%ebx
jne    11f0 <uart_init+0xc0>
mov    $0x3f200098,%edi
xor    %esi,%esi
call   1040 <put_mem@plt>
mov    $0x3f215060,%edi
mov    $0x3,%esi
pop    %rbx
jmp    1040 <put_mem@plt>

LLVM IR (-O0):
define void @uart_init() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @put_mem(i32 1059147780, i32 1)
%5 = call i32 @put_mem(i32 1059147844, i32 0)
%6 = call i32 @put_mem(i32 1059147872, i32 0)
%7 = call i32 @put_mem(i32 1059147852, i32 3)
%8 = call i32 @put_mem(i32 1059147844, i32 0)
%9 = call i32 @put_mem(i32 1059147848, i32 198)
%10 = call i32 @put_mem(i32 1059147880, i32 270)
%11 = call i32 @get_mem(i32 1059061764)
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = and i32 %12, -28673
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = or i32 %14, 8192
store i32 %15, i32* %1
%16 = load i32, i32* %1
%17 = and i32 %16, -229377
store i32 %17, i32* %1
%18 = load i32, i32* %1
%19 = or i32 %18, 65536
store i32 %19, i32* %1
%20 = load i32, i32* %1
%21 = call i32 @put_mem(i32 1059061764, i32 %20)
%22 = call i32 @put_mem(i32 1059061908, i32 0)
store i32 0, i32* %2
br label %23
23: ; preds = %28, %0
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 150
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = call i32 (...) @dummy()
br label %28
28: ; preds = %26
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %23
31: ; preds = %23
%32 = call i32 @put_mem(i32 1059061912, i32 49152)
store i32 0, i32* %3
br label %33
33: ; preds = %38, %31
%34 = load i32, i32* %3
%35 = icmp slt i32 %34, 150
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = call i32 (...) @dummy()
br label %38
38: ; preds = %36
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %33
41: ; preds = %33
%42 = call i32 @put_mem(i32 1059061912, i32 0)
%43 = call i32 @put_mem(i32 1059147872, i32 3)
ret void
}

LLVM IR (-O2):
define void @uart_init() {
%1 = tail call i32 @put_mem(i32 1059147780, i32 1)
%2 = tail call i32 @put_mem(i32 1059147844, i32 0)
%3 = tail call i32 @put_mem(i32 1059147872, i32 0)
%4 = tail call i32 @put_mem(i32 1059147852, i32 3)
%5 = tail call i32 @put_mem(i32 1059147844, i32 0)
%6 = tail call i32 @put_mem(i32 1059147848, i32 198)
%7 = tail call i32 @put_mem(i32 1059147880, i32 270)
%8 = tail call i32 @get_mem(i32 1059061764)
%9 = and i32 %8, -258049
%10 = or i32 %9, 73728
%11 = tail call i32 @put_mem(i32 1059061764, i32 %10)
%12 = tail call i32 @put_mem(i32 1059061908, i32 0)
br label %15
13: ; preds = %15
%14 = tail call i32 @put_mem(i32 1059061912, i32 49152)
br label %23
15: ; preds = %0, %15
%16 = phi i32 [ 0, %0 ], [ %18, %15 ]
%17 = tail call i32 (...) @dummy()
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, 150
br i1 %19, label %13, label %15
20: ; preds = %23
%21 = tail call i32 @put_mem(i32 1059061912, i32 0)
%22 = tail call i32 @put_mem(i32 1059147872, i32 3)
ret void
23: ; preds = %13, %23
%24 = phi i32 [ 0, %13 ], [ %26, %23 ]
%25 = tail call i32 (...) @dummy()
%26 = add nuw nsw i32 %24, 1
%27 = icmp eq i32 %26, 150
br i1 %27, label %20, label %23
}