#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(unsigned int, int);
void hiusb_start_hcd(void) {
  unsigned int reg;
  writel(0x301, 0x12040194);
  wait_ms(1);
  writel(0x201, (0x12040194));
  wait_ms(1);
  writel(0x0c26, (0x12120088));
  wait_ms(1);
  writel(0x0, (0x12120088));
  wait_ms(5);
  writel(0x1, (0x12040194));
  wait_ms(1);
  reg = readl((0x12040000 + 0xb8));
  reg |= (1 << 0);
  writel(reg, (0x12040000 + 0xb8));
  wait_ms(100);
  reg = readl((0x12040000 + 0xb8));
  reg |= (1 << 3);
  writel(reg, (0x12040000 + 0xb8));
  wait_ms(100);
  reg = readl((0x12040000 + 0xb8));
  reg |= (1 << 13);
  reg |= (1 << 12);
  reg |= (1 << 11);
  reg |= (1 << 10);
  reg |= (1 << 9);
  reg |= (1 << 8);
  reg |= (1 << 3);
  reg |= (1 << 0);
  writel(reg, (0x12040000 + 0xb8));
  wait_ms(100);
  reg = readl((0x12040000 + 0xb8));
  reg &= ~((1 << 13));
  writel(reg, (0x12040000 + 0xb8));
  wait_ms(100);
  reg = readl(0x11040000 + 0xC2C0);
  reg |= (1 << 31);
  writel(reg, 0x11040000 + 0xC2C0);
  reg = readl(0x11040000 + 0xC200);
  reg &= ~(1 << 4);
  reg &= ~((1 << 3));
  writel(reg, 0x11040000 + 0xC200);
  wait_ms(20);
  reg = readl(0x11040000 + 0xC110);
  reg &= ~((1 << 12) | (1 << 13));
  reg |= (1 << 12);
  writel(reg, 0x11040000 + 0xC110);
  reg = readl((0x12040000 + 0xb8));
  reg &= ~(1 << 3);
  writel(reg, (0x12040000 + 0xb8));
  wait_ms(100);
  reg = readl(0x11040000 + 0xC2C0);
  reg &= ~(1 << 31);
  reg &= ~(1 << 17);
  writel(reg, 0x11040000 + 0xC2C0);
  wait_ms(100);
  reg = (1 << 29) | (3 << 24) | (0x10 << 16);
  writel(reg, 0x11040000 + 0xC108);
  reg = (1 << 29) | (3 << 24) | (0x10 << 16);
  writel(reg, 0x11040000 + 0xC10C);
  wait_ms(20);
}


x86 assembly (clang, -O0):
<hiusb_start_hcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x301,%edi
mov    $0x12040194,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
mov    $0x201,%edi
mov    $0x12040194,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
mov    $0xc26,%edi
mov    $0x12120088,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
xor    %edi,%edi
mov    $0x12120088,%esi
call   1040 <writel@plt>
mov    $0x5,%edi
call   1050 <wait_ms@plt>
mov    $0x1,%edi
mov    $0x12040194,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x2000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x1000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x800,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x400,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x200,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x100,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%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    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x1104c2c0,%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    $0x1104c2c0,%esi
call   1040 <writel@plt>
mov    $0x1104c200,%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),%edi
mov    $0x1104c200,%esi
call   1040 <writel@plt>
mov    $0x14,%edi
call   1050 <wait_ms@plt>
mov    $0x1104c110,%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    $0x1104c110,%esi
call   1040 <writel@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffffff7,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x1104c2c0,%edi
call   1030 <readl@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xfffdffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1104c2c0,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
movl   $0x23100000,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1104c108,%esi
call   1040 <writel@plt>
movl   $0x23100000,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1104c10c,%esi
call   1040 <writel@plt>
mov    $0x14,%edi
call   1050 <wait_ms@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hiusb_start_hcd>:
push   %rax
mov    $0x301,%edi
mov    $0x12040194,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
mov    $0x201,%edi
mov    $0x12040194,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
mov    $0xc26,%edi
mov    $0x12120088,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
xor    %edi,%edi
mov    $0x12120088,%esi
call   1040 <writel@plt>
mov    $0x5,%edi
call   1050 <wait_ms@plt>
mov    $0x1,%edi
mov    $0x12040194,%esi
call   1040 <writel@plt>
mov    $0x1,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
or     $0x1,%eax
mov    %eax,%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
or     $0x8,%eax
mov    %eax,%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
or     $0x3f09,%eax
mov    %eax,%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
and    $0xffffdfff,%eax
mov    %eax,%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x1104c2c0,%edi
call   1030 <readl@plt>
or     $0x80000000,%eax
mov    %eax,%edi
mov    $0x1104c2c0,%esi
call   1040 <writel@plt>
mov    $0x1104c200,%edi
call   1030 <readl@plt>
and    $0xffffffe7,%eax
mov    %eax,%edi
mov    $0x1104c200,%esi
call   1040 <writel@plt>
mov    $0x14,%edi
call   1050 <wait_ms@plt>
mov    $0x1104c110,%edi
call   1030 <readl@plt>
and    $0xffffcfff,%eax
lea    0x1000(%rax),%edi
mov    $0x1104c110,%esi
call   1040 <writel@plt>
mov    $0x120400b8,%edi
call   1030 <readl@plt>
and    $0xfffffff7,%eax
mov    %eax,%edi
mov    $0x120400b8,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x1104c2c0,%edi
call   1030 <readl@plt>
and    $0x7ffdffff,%eax
mov    %eax,%edi
mov    $0x1104c2c0,%esi
call   1040 <writel@plt>
mov    $0x64,%edi
call   1050 <wait_ms@plt>
mov    $0x23100000,%edi
mov    $0x1104c108,%esi
call   1040 <writel@plt>
mov    $0x23100000,%edi
mov    $0x1104c10c,%esi
call   1040 <writel@plt>
mov    $0x14,%edi
pop    %rax
jmp    1050 <wait_ms@plt>

LLVM IR (-O0):
define void @hiusb_start_hcd() {
%1 = alloca i32
%2 = call i32 @writel(i32 769, i32 302252436)
%3 = call i32 @wait_ms(i32 1)
%4 = call i32 @writel(i32 513, i32 302252436)
%5 = call i32 @wait_ms(i32 1)
%6 = call i32 @writel(i32 3110, i32 303169672)
%7 = call i32 @wait_ms(i32 1)
%8 = call i32 @writel(i32 0, i32 303169672)
%9 = call i32 @wait_ms(i32 5)
%10 = call i32 @writel(i32 1, i32 302252436)
%11 = call i32 @wait_ms(i32 1)
%12 = call i32 @readl(i32 302252216)
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = or i32 %13, 1
store i32 %14, i32* %1
%15 = load i32, i32* %1
%16 = call i32 @writel(i32 %15, i32 302252216)
%17 = call i32 @wait_ms(i32 100)
%18 = call i32 @readl(i32 302252216)
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = or i32 %19, 8
store i32 %20, i32* %1
%21 = load i32, i32* %1
%22 = call i32 @writel(i32 %21, i32 302252216)
%23 = call i32 @wait_ms(i32 100)
%24 = call i32 @readl(i32 302252216)
store i32 %24, i32* %1
%25 = load i32, i32* %1
%26 = or i32 %25, 8192
store i32 %26, i32* %1
%27 = load i32, i32* %1
%28 = or i32 %27, 4096
store i32 %28, i32* %1
%29 = load i32, i32* %1
%30 = or i32 %29, 2048
store i32 %30, i32* %1
%31 = load i32, i32* %1
%32 = or i32 %31, 1024
store i32 %32, i32* %1
%33 = load i32, i32* %1
%34 = or i32 %33, 512
store i32 %34, i32* %1
%35 = load i32, i32* %1
%36 = or i32 %35, 256
store i32 %36, i32* %1
%37 = load i32, i32* %1
%38 = or i32 %37, 8
store i32 %38, i32* %1
%39 = load i32, i32* %1
%40 = or i32 %39, 1
store i32 %40, i32* %1
%41 = load i32, i32* %1
%42 = call i32 @writel(i32 %41, i32 302252216)
%43 = call i32 @wait_ms(i32 100)
%44 = call i32 @readl(i32 302252216)
store i32 %44, i32* %1
%45 = load i32, i32* %1
%46 = and i32 %45, -8193
store i32 %46, i32* %1
%47 = load i32, i32* %1
%48 = call i32 @writel(i32 %47, i32 302252216)
%49 = call i32 @wait_ms(i32 100)
%50 = call i32 @readl(i32 285524672)
store i32 %50, i32* %1
%51 = load i32, i32* %1
%52 = or i32 %51, -2147483648
store i32 %52, i32* %1
%53 = load i32, i32* %1
%54 = call i32 @writel(i32 %53, i32 285524672)
%55 = call i32 @readl(i32 285524480)
store i32 %55, i32* %1
%56 = load i32, i32* %1
%57 = and i32 %56, -17
store i32 %57, i32* %1
%58 = load i32, i32* %1
%59 = and i32 %58, -9
store i32 %59, i32* %1
%60 = load i32, i32* %1
%61 = call i32 @writel(i32 %60, i32 285524480)
%62 = call i32 @wait_ms(i32 20)
%63 = call i32 @readl(i32 285524240)
store i32 %63, i32* %1
%64 = load i32, i32* %1
%65 = and i32 %64, -12289
store i32 %65, i32* %1
%66 = load i32, i32* %1
%67 = or i32 %66, 4096
store i32 %67, i32* %1
%68 = load i32, i32* %1
%69 = call i32 @writel(i32 %68, i32 285524240)
%70 = call i32 @readl(i32 302252216)
store i32 %70, i32* %1
%71 = load i32, i32* %1
%72 = and i32 %71, -9
store i32 %72, i32* %1
%73 = load i32, i32* %1
%74 = call i32 @writel(i32 %73, i32 302252216)
%75 = call i32 @wait_ms(i32 100)
%76 = call i32 @readl(i32 285524672)
store i32 %76, i32* %1
%77 = load i32, i32* %1
%78 = and i32 %77, 2147483647
store i32 %78, i32* %1
%79 = load i32, i32* %1
%80 = and i32 %79, -131073
store i32 %80, i32* %1
%81 = load i32, i32* %1
%82 = call i32 @writel(i32 %81, i32 285524672)
%83 = call i32 @wait_ms(i32 100)
store i32 588251136, i32* %1
%84 = load i32, i32* %1
%85 = call i32 @writel(i32 %84, i32 285524232)
store i32 588251136, i32* %1
%86 = load i32, i32* %1
%87 = call i32 @writel(i32 %86, i32 285524236)
%88 = call i32 @wait_ms(i32 20)
ret void
}

LLVM IR (-O2):
define void @hiusb_start_hcd() {
%1 = tail call i32 @writel(i32 769, i32 302252436)
%2 = tail call i32 @wait_ms(i32 1)
%3 = tail call i32 @writel(i32 513, i32 302252436)
%4 = tail call i32 @wait_ms(i32 1)
%5 = tail call i32 @writel(i32 3110, i32 303169672)
%6 = tail call i32 @wait_ms(i32 1)
%7 = tail call i32 @writel(i32 0, i32 303169672)
%8 = tail call i32 @wait_ms(i32 5)
%9 = tail call i32 @writel(i32 1, i32 302252436)
%10 = tail call i32 @wait_ms(i32 1)
%11 = tail call i32 @readl(i32 302252216)
%12 = or i32 %11, 1
%13 = tail call i32 @writel(i32 %12, i32 302252216)
%14 = tail call i32 @wait_ms(i32 100)
%15 = tail call i32 @readl(i32 302252216)
%16 = or i32 %15, 8
%17 = tail call i32 @writel(i32 %16, i32 302252216)
%18 = tail call i32 @wait_ms(i32 100)
%19 = tail call i32 @readl(i32 302252216)
%20 = or i32 %19, 16137
%21 = tail call i32 @writel(i32 %20, i32 302252216)
%22 = tail call i32 @wait_ms(i32 100)
%23 = tail call i32 @readl(i32 302252216)
%24 = and i32 %23, -8193
%25 = tail call i32 @writel(i32 %24, i32 302252216)
%26 = tail call i32 @wait_ms(i32 100)
%27 = tail call i32 @readl(i32 285524672)
%28 = or i32 %27, -2147483648
%29 = tail call i32 @writel(i32 %28, i32 285524672)
%30 = tail call i32 @readl(i32 285524480)
%31 = and i32 %30, -25
%32 = tail call i32 @writel(i32 %31, i32 285524480)
%33 = tail call i32 @wait_ms(i32 20)
%34 = tail call i32 @readl(i32 285524240)
%35 = and i32 %34, -12289
%36 = or i32 %35, 4096
%37 = tail call i32 @writel(i32 %36, i32 285524240)
%38 = tail call i32 @readl(i32 302252216)
%39 = and i32 %38, -9
%40 = tail call i32 @writel(i32 %39, i32 302252216)
%41 = tail call i32 @wait_ms(i32 100)
%42 = tail call i32 @readl(i32 285524672)
%43 = and i32 %42, 2147352575
%44 = tail call i32 @writel(i32 %43, i32 285524672)
%45 = tail call i32 @wait_ms(i32 100)
%46 = tail call i32 @writel(i32 588251136, i32 285524232)
%47 = tail call i32 @writel(i32 588251136, i32 285524236)
%48 = tail call i32 @wait_ms(i32 20)
ret void
}