#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 readl(int);
int /*<<< orphan*/ wait_ms(int);
int /*<<< orphan*/ writel(int, int);
void hiusb_start_hcd(void) {
  unsigned int reg;
  reg = readl((0x20030000 + 0xb8));
  reg &= 0xff;
  reg |= (0x0ff48000);
  writel(reg, (0x20030000 + 0xb8));
  wait_ms(200);
  reg = readl((0x20030000 + 0xb8));
  reg &= ~((1 << 12));
  writel(reg, (0x20030000 + 0xb8));
  wait_ms(100);
  reg = readl(0x12000000 + 0xc2c0);
  reg |= (0x1 << 31);
  writel(reg, 0x12000000 + 0xc2c0);
  reg = readl(0x12000000 + 0xC200);
  reg &= ~(0x1 << 4);
  reg &= ~((0x1 << 3));
  reg &= ~(1 << 6);
  writel(reg, 0x12000000 + 0xC200);
  wait_ms(20);
  reg = readl(0x12000000 + 0xc110);
  reg &= ~(0x3 << 12);
  reg |= (0x1 << 12);
  writel(reg, 0x12000000 + 0xc110);
  reg = readl((0x20030000 + 0xb8));
  reg &= ~(1 << 13);
  writel(reg, (0x20030000 + 0xb8));
  wait_ms(100);
  reg = readl((0x20030000 + 0xb8));
  reg &= ~(1 << 14);
  writel(reg, (0x20030000 + 0xb8));
  reg = readl(0x12000000 + 0xc2c0);
  reg &= ~(0x1 << 31);
  writel(reg, 0x12000000 + 0xc2c0);
  wait_ms(100);
  wait_ms(20);
  reg = readl((0x20120000 + 0x84));
  reg &= ~(1 << 12);
  writel(reg, (0x20120000 + 0x84));
  wait_ms(100);
  writel(0x000040f0, (0x20120000 + 0x94));
  writel(0x00001002, (0x20120000 + 0x98));
  writel(0x100040f0, (0x20120000 + 0x94));
  writel(0x000040f0, (0x20120000 + 0x94));
  writel(0x00004aff, (0x20120000 + 0x98));
  writel(0x200040f0, (0x20120000 + 0x94));
  writel(0x000040f0, (0x20120000 + 0x94));
  writel(0x800040f0, (0x20120000 + 0x94));
  writel(0x000040f0, (0x20120000 + 0x94));
  writel(0x1, (0x200f00ec));
  writel(0x1, (0x200f00f0));
}


x86 assembly (clang, -O0):
<hiusb_start_hcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x200300b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0xff48000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0xc8,%edi
call   1050 <wait_ms@plt>
mov    $0x200300b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffefff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x1200c2c0,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x80000000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1200c2c0,%esi
call   1040 <writel@plt>
mov    $0x1200c200,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffef,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffff7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffbf,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1200c200,%esi
call   1040 <writel@plt>
mov    $0x14,%edi
call   1050 <wait_ms@plt>
mov    $0x1200c110,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffcfff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x1000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1200c110,%esi
call   1040 <writel@plt>
mov    $0x200300b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffdfff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x200300b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffbfff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0x1200c2c0,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1200c2c0,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x14,%edi
call   1050 <wait_ms@plt>
mov    $0x20120084,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffefff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20120084,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x1002,%edi
mov    $0x20120098,%esi
call   1040 <writel@plt>
mov    $0x100040f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x4aff,%edi
mov    $0x20120098,%esi
call   1040 <writel@plt>
mov    $0x200040f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x800040f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
mov    $0x200f00ec,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
mov    $0x200f00f0,%esi
call   1040 <writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hiusb_start_hcd>:
push   %rax
mov    $0x200300b8,%edi
call   1030 <readl@plt>
movzbl %al,%edi
or     $0xff48000,%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0xc8,%edi
call   1050 <wait_ms@plt>
mov    $0x200300b8,%edi
call   1030 <readl@plt>
and    $0xffffefff,%eax
mov    %eax,%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x1200c2c0,%edi
call   1030 <readl@plt>
or     $0x80000000,%eax
mov    %eax,%edi
mov    $0x1200c2c0,%esi
call   1040 <writel@plt>
mov    $0x1200c200,%edi
call   1030 <readl@plt>
and    $0xffffffa7,%eax
mov    %eax,%edi
mov    $0x1200c200,%esi
call   1040 <writel@plt>
mov    $0x14,%edi
call   1050 <wait_ms@plt>
mov    $0x1200c110,%edi
call   1030 <readl@plt>
and    $0xffffcfff,%eax
lea    0x1000(%rax),%edi
mov    $0x1200c110,%esi
call   1040 <writel@plt>
mov    $0x200300b8,%edi
call   1030 <readl@plt>
and    $0xffffdfff,%eax
mov    %eax,%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x200300b8,%edi
call   1030 <readl@plt>
and    $0xffffbfff,%eax
mov    %eax,%edi
mov    $0x200300b8,%esi
call   1040 <writel@plt>
mov    $0x1200c2c0,%edi
call   1030 <readl@plt>
and    $0x7fffffff,%eax
mov    %eax,%edi
mov    $0x1200c2c0,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x14,%edi
call   1050 <wait_ms@plt>
mov    $0x20120084,%edi
call   1030 <readl@plt>
and    $0xffffefff,%eax
mov    %eax,%edi
mov    $0x20120084,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x1002,%edi
mov    $0x20120098,%esi
call   1040 <writel@plt>
mov    $0x100040f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x4aff,%edi
mov    $0x20120098,%esi
call   1040 <writel@plt>
mov    $0x200040f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x800040f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x40f0,%edi
mov    $0x20120094,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
mov    $0x200f00ec,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
mov    $0x200f00f0,%esi
pop    %rax
jmp    1040 <writel@plt>

LLVM IR (-O0):
define void @hiusb_start_hcd() {
%1 = alloca i32
%2 = call i32 @readl(i32 537067704)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = and i32 %3, 255
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = or i32 %5, 267681792
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = call i32 @writel(i32 %7, i32 537067704)
%9 = call i32 @wait_ms(i32 200)
%10 = call i32 @readl(i32 537067704)
store i32 %10, i32* %1
%11 = load i32, i32* %1
%12 = and i32 %11, -4097
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = call i32 @writel(i32 %13, i32 537067704)
%15 = call i32 @wait_ms(i32 100)
%16 = call i32 @readl(i32 302039744)
store i32 %16, i32* %1
%17 = load i32, i32* %1
%18 = or i32 %17, -2147483648
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = call i32 @writel(i32 %19, i32 302039744)
%21 = call i32 @readl(i32 302039552)
store i32 %21, i32* %1
%22 = load i32, i32* %1
%23 = and i32 %22, -17
store i32 %23, i32* %1
%24 = load i32, i32* %1
%25 = and i32 %24, -9
store i32 %25, i32* %1
%26 = load i32, i32* %1
%27 = and i32 %26, -65
store i32 %27, i32* %1
%28 = load i32, i32* %1
%29 = call i32 @writel(i32 %28, i32 302039552)
%30 = call i32 @wait_ms(i32 20)
%31 = call i32 @readl(i32 302039312)
store i32 %31, i32* %1
%32 = load i32, i32* %1
%33 = and i32 %32, -12289
store i32 %33, i32* %1
%34 = load i32, i32* %1
%35 = or i32 %34, 4096
store i32 %35, i32* %1
%36 = load i32, i32* %1
%37 = call i32 @writel(i32 %36, i32 302039312)
%38 = call i32 @readl(i32 537067704)
store i32 %38, i32* %1
%39 = load i32, i32* %1
%40 = and i32 %39, -8193
store i32 %40, i32* %1
%41 = load i32, i32* %1
%42 = call i32 @writel(i32 %41, i32 537067704)
%43 = call i32 @wait_ms(i32 100)
%44 = call i32 @readl(i32 537067704)
store i32 %44, i32* %1
%45 = load i32, i32* %1
%46 = and i32 %45, -16385
store i32 %46, i32* %1
%47 = load i32, i32* %1
%48 = call i32 @writel(i32 %47, i32 537067704)
%49 = call i32 @readl(i32 302039744)
store i32 %49, i32* %1
%50 = load i32, i32* %1
%51 = and i32 %50, 2147483647
store i32 %51, i32* %1
%52 = load i32, i32* %1
%53 = call i32 @writel(i32 %52, i32 302039744)
%54 = call i32 @wait_ms(i32 100)
%55 = call i32 @wait_ms(i32 20)
%56 = call i32 @readl(i32 538050692)
store i32 %56, i32* %1
%57 = load i32, i32* %1
%58 = and i32 %57, -4097
store i32 %58, i32* %1
%59 = load i32, i32* %1
%60 = call i32 @writel(i32 %59, i32 538050692)
%61 = call i32 @wait_ms(i32 100)
%62 = call i32 @writel(i32 16624, i32 538050708)
%63 = call i32 @writel(i32 4098, i32 538050712)
%64 = call i32 @writel(i32 268452080, i32 538050708)
%65 = call i32 @writel(i32 16624, i32 538050708)
%66 = call i32 @writel(i32 19199, i32 538050712)
%67 = call i32 @writel(i32 536887536, i32 538050708)
%68 = call i32 @writel(i32 16624, i32 538050708)
%69 = call i32 @writel(i32 -2147467024, i32 538050708)
%70 = call i32 @writel(i32 16624, i32 538050708)
%71 = call i32 @writel(i32 1, i32 537854188)
%72 = call i32 @writel(i32 1, i32 537854192)
ret void
}

LLVM IR (-O2):
define void @hiusb_start_hcd() {
%1 = tail call i32 @readl(i32 537067704)
%2 = and i32 %1, 255
%3 = or i32 %2, 267681792
%4 = tail call i32 @writel(i32 %3, i32 537067704)
%5 = tail call i32 @wait_ms(i32 200)
%6 = tail call i32 @readl(i32 537067704)
%7 = and i32 %6, -4097
%8 = tail call i32 @writel(i32 %7, i32 537067704)
%9 = tail call i32 @wait_ms(i32 100)
%10 = tail call i32 @readl(i32 302039744)
%11 = or i32 %10, -2147483648
%12 = tail call i32 @writel(i32 %11, i32 302039744)
%13 = tail call i32 @readl(i32 302039552)
%14 = and i32 %13, -89
%15 = tail call i32 @writel(i32 %14, i32 302039552)
%16 = tail call i32 @wait_ms(i32 20)
%17 = tail call i32 @readl(i32 302039312)
%18 = and i32 %17, -12289
%19 = or i32 %18, 4096
%20 = tail call i32 @writel(i32 %19, i32 302039312)
%21 = tail call i32 @readl(i32 537067704)
%22 = and i32 %21, -8193
%23 = tail call i32 @writel(i32 %22, i32 537067704)
%24 = tail call i32 @wait_ms(i32 100)
%25 = tail call i32 @readl(i32 537067704)
%26 = and i32 %25, -16385
%27 = tail call i32 @writel(i32 %26, i32 537067704)
%28 = tail call i32 @readl(i32 302039744)
%29 = and i32 %28, 2147483647
%30 = tail call i32 @writel(i32 %29, i32 302039744)
%31 = tail call i32 @wait_ms(i32 100)
%32 = tail call i32 @wait_ms(i32 20)
%33 = tail call i32 @readl(i32 538050692)
%34 = and i32 %33, -4097
%35 = tail call i32 @writel(i32 %34, i32 538050692)
%36 = tail call i32 @wait_ms(i32 100)
%37 = tail call i32 @writel(i32 16624, i32 538050708)
%38 = tail call i32 @writel(i32 4098, i32 538050712)
%39 = tail call i32 @writel(i32 268452080, i32 538050708)
%40 = tail call i32 @writel(i32 16624, i32 538050708)
%41 = tail call i32 @writel(i32 19199, i32 538050712)
%42 = tail call i32 @writel(i32 536887536, i32 538050708)
%43 = tail call i32 @writel(i32 16624, i32 538050708)
%44 = tail call i32 @writel(i32 -2147467024, i32 538050708)
%45 = tail call i32 @writel(i32 16624, i32 538050708)
%46 = tail call i32 @writel(i32 1, i32 537854188)
%47 = tail call i32 @writel(i32 1, i32 537854192)
ret void
}