#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 */
struct himci_host {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ IO_ADDRESS(int);
unsigned int himci_readl(int /*<<< orphan*/);
int /*<<< orphan*/ himci_writel(unsigned int, int /*<<< orphan*/);
int /*<<< orphan*/ udelay(int);
void hi_mci_sys_ctrl_init(struct himci_host *host) {
  unsigned int tmp_reg;
  tmp_reg = himci_readl(IO_ADDRESS(0x101f5000 + 0xf8));
  tmp_reg &= ~((0x01 << 0) | (0x01 << 8) | (0x01 << 9) | (0x01 << 17));
  tmp_reg |= (0x01 << 8) | (0x01 << 9) | (0x01 << 16);
  himci_writel(tmp_reg, IO_ADDRESS(0x101f5000 + 0xf8));
  tmp_reg |= (0x01 << 0);
  himci_writel(tmp_reg, IO_ADDRESS(0x101f5000 + 0xf8));
  udelay(1000);
  tmp_reg &= ~(0x01 << 0);
  himci_writel(tmp_reg, IO_ADDRESS(0x101f5000 + 0xf8));
}


x86 assembly (clang, -O0):
<hi_mci_sys_ctrl_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    %eax,%edi
call   1030 <himci_readl@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xfffdfcfe,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     $0x10300,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1040 <himci_writel@plt>
mov    -0xc(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1040 <himci_writel@plt>
mov    $0x3e8,%edi
call   1060 <udelay@plt>
mov    -0xc(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1040 <himci_writel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hi_mci_sys_ctrl_init>:
push   %rbp
push   %rbx
push   %rax
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    %eax,%edi
call   1030 <himci_readl@plt>
mov    %eax,%ebx
and    $0xfffcfcfe,%ebx
lea    0x10300(%rbx),%ebp
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <himci_writel@plt>
or     $0x10301,%ebx
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <himci_writel@plt>
mov    $0x3e8,%edi
call   1060 <udelay@plt>
mov    $0x101f50f8,%edi
call   1050 <IO_ADDRESS@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <himci_writel@plt>

LLVM IR (-O0):
%struct.himci_host = type { i32 }
define void @hi_mci_sys_ctrl_init(%struct.himci_host* %0) {
%2 = alloca %struct.himci_host*
%3 = alloca i32
store %struct.himci_host* %0, %struct.himci_host** %2
%4 = call i32 @IO_ADDRESS(i32 270487800)
%5 = call i32 @himci_readl(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, -131842
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = or i32 %8, 66304
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @IO_ADDRESS(i32 270487800)
%12 = call i32 @himci_writel(i32 %10, i32 %11)
%13 = load i32, i32* %3
%14 = or i32 %13, 1
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = call i32 @IO_ADDRESS(i32 270487800)
%17 = call i32 @himci_writel(i32 %15, i32 %16)
%18 = call i32 @udelay(i32 1000)
%19 = load i32, i32* %3
%20 = and i32 %19, -2
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = call i32 @IO_ADDRESS(i32 270487800)
%23 = call i32 @himci_writel(i32 %21, i32 %22)
ret void
}

LLVM IR (-O2):
%struct.himci_host = type { i32 }
define void @hi_mci_sys_ctrl_init(%struct.himci_host* nocapture readnone %0) {
%2 = tail call i32 @IO_ADDRESS(i32 270487800)
%3 = tail call i32 @himci_readl(i32 %2)
%4 = and i32 %3, -197378
%5 = or i32 %4, 66304
%6 = tail call i32 @IO_ADDRESS(i32 270487800)
%7 = tail call i32 @himci_writel(i32 %5, i32 %6)
%8 = or i32 %4, 66305
%9 = tail call i32 @IO_ADDRESS(i32 270487800)
%10 = tail call i32 @himci_writel(i32 %8, i32 %9)
%11 = tail call i32 @udelay(i32 1000)
%12 = tail call i32 @IO_ADDRESS(i32 270487800)
%13 = tail call i32 @himci_writel(i32 %5, i32 %12)
ret void
}