#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 */
unsigned int GET32(int);
int /*<<< orphan*/ PUT32(int, int);
int /*<<< orphan*/ dummy(unsigned int);
void uart_init() {
  unsigned int ra;
  PUT32(0x3F215004, 1);
  PUT32(0x3F215044, 0);
  PUT32(0x3F215060, 0);
  PUT32(0x3F21504C, 3);
  PUT32(0x3F215050, 0);
  PUT32(0x3F215044, 0x5);
  PUT32(0x3F215048, 0xC6);
  PUT32(0x3F215068, 270);
  ra = GET32(0x3F200004);
  ra &= ~(7 << 12);
  ra |= 2 << 12;
  ra &= ~(7 << 15);
  ra |= 2 << 15;
  PUT32(0x3F200004, ra);
  PUT32(0x3F200094, 0);
  for (ra = 0; ra < 150; ra++)
    dummy(ra);
  PUT32(0x3F200098, (1 << 14) | (1 << 15));
  for (ra = 0; ra < 150; ra++)
    dummy(ra);
  PUT32(0x3F200098, 0);
  PUT32(0x3F215060, 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
mov    $0x5,%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>
movl   $0x0,-0x4(%rbp)
cmpl   $0x96,-0x4(%rbp)
jae    1223 <uart_init+0xf3>
mov    -0x4(%rbp),%edi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1200 <uart_init+0xd0>
mov    $0x3f200098,%edi
mov    $0xc000,%esi
call   1040 <PUT32@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x96,-0x4(%rbp)
jae    125c <uart_init+0x12c>
mov    -0x4(%rbp),%edi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1239 <uart_init+0x109>
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   %rbx
mov    $0x3f215004,%edi
mov    $0x1,%esi
call   1040 <PUT32@plt>
xor    %ebx,%ebx
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
mov    $0x5,%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>
nopl   (%rax)
mov    %ebx,%edi
call   1030 <dummy@plt>
add    $0x1,%ebx
cmp    $0x96,%ebx
jne    11d0 <uart_init+0xa0>
mov    $0x3f200098,%edi
mov    $0xc000,%esi
call   1040 <PUT32@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <dummy@plt>
add    $0x1,%ebx
cmp    $0x96,%ebx
jne    1200 <uart_init+0xd0>
mov    $0x3f200098,%edi
xor    %esi,%esi
call   1040 <PUT32@plt>
mov    $0x3f215060,%edi
mov    $0x3,%esi
pop    %rbx
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 5)
%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)
store i32 0, i32* %1
br label %22
22: ; preds = %28, %0
%23 = load i32, i32* %1
%24 = icmp ult i32 %23, 150
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %1
%27 = call i32 @dummy(i32 %26)
br label %28
28: ; preds = %25
%29 = load i32, i32* %1
%30 = add i32 %29, 1
store i32 %30, i32* %1
br label %22
31: ; preds = %22
%32 = call i32 @PUT32(i32 1059061912, i32 49152)
store i32 0, i32* %1
br label %33
33: ; preds = %39, %31
%34 = load i32, i32* %1
%35 = icmp ult i32 %34, 150
br i1 %35, label %36, label %42
36: ; preds = %33
%37 = load i32, i32* %1
%38 = call i32 @dummy(i32 %37)
br label %39
39: ; preds = %36
%40 = load i32, i32* %1
%41 = add i32 %40, 1
store i32 %41, i32* %1
br label %33
42: ; preds = %33
%43 = call i32 @PUT32(i32 1059061912, i32 0)
%44 = 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 5)
%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)
br label %14
14: ; preds = %0, %14
%15 = phi i32 [ 0, %0 ], [ %17, %14 ]
%16 = tail call i32 @dummy(i32 %15)
%17 = add nuw nsw i32 %15, 1
%18 = icmp eq i32 %17, 150
br i1 %18, label %19, label %14
19: ; preds = %14
%20 = tail call i32 @PUT32(i32 1059061912, i32 49152)
br label %21
21: ; preds = %19, %21
%22 = phi i32 [ 0, %19 ], [ %24, %21 ]
%23 = tail call i32 @dummy(i32 %22)
%24 = add nuw nsw i32 %22, 1
%25 = icmp eq i32 %24, 150
br i1 %25, label %26, label %21
26: ; preds = %21
%27 = tail call i32 @PUT32(i32 1059061912, i32 0)
%28 = tail call i32 @PUT32(i32 1059147872, i32 3)
ret void
}