#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*/);
void hi_mci_sys_ctrl_init(struct himci_host *host) {
  unsigned int reg_value;
  reg_value = himci_readl(IO_ADDRESS(0x2005003c));
  reg_value &= ~(1U << 2);
  himci_writel(reg_value, IO_ADDRESS(0x2005003c));
  reg_value = 0;
  reg_value = himci_readl(IO_ADDRESS(0x20030080));
  reg_value &= ~((1U << 2) | (1U << 3));
  reg_value |= (1U << 1);
  himci_writel(reg_value, IO_ADDRESS(0x20030080));
}


x86 assembly (clang, -O0):
<hi_mci_sys_ctrl_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2005003c,%edi
call   1050 <IO_ADDRESS@plt>
mov    %eax,%edi
call   1030 <himci_readl@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xfffffffb,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x2005003c,%edi
call   1050 <IO_ADDRESS@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1040 <himci_writel@plt>
movl   $0x0,-0xc(%rbp)
mov    $0x20030080,%edi
call   1050 <IO_ADDRESS@plt>
mov    %eax,%edi
call   1030 <himci_readl@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xfffffff3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x20030080,%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   %rbx
mov    $0x2005003c,%edi
call   1050 <IO_ADDRESS@plt>
mov    %eax,%edi
call   1030 <himci_readl@plt>
mov    %eax,%ebx
and    $0xfffffffb,%ebx
mov    $0x2005003c,%edi
call   1050 <IO_ADDRESS@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <himci_writel@plt>
mov    $0x20030080,%edi
call   1050 <IO_ADDRESS@plt>
mov    %eax,%edi
call   1030 <himci_readl@plt>
and    $0xfffffff1,%eax
lea    0x2(%rax),%ebx
mov    $0x20030080,%edi
call   1050 <IO_ADDRESS@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
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 537198652)
%5 = call i32 @himci_readl(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, -5
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @IO_ADDRESS(i32 537198652)
%10 = call i32 @himci_writel(i32 %8, i32 %9)
store i32 0, i32* %3
%11 = call i32 @IO_ADDRESS(i32 537067648)
%12 = call i32 @himci_readl(i32 %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = and i32 %13, -13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = or i32 %15, 2
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = call i32 @IO_ADDRESS(i32 537067648)
%19 = call i32 @himci_writel(i32 %17, i32 %18)
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 537198652)
%3 = tail call i32 @himci_readl(i32 %2)
%4 = and i32 %3, -5
%5 = tail call i32 @IO_ADDRESS(i32 537198652)
%6 = tail call i32 @himci_writel(i32 %4, i32 %5)
%7 = tail call i32 @IO_ADDRESS(i32 537067648)
%8 = tail call i32 @himci_readl(i32 %7)
%9 = and i32 %8, -15
%10 = or i32 %9, 2
%11 = tail call i32 @IO_ADDRESS(i32 537067648)
%12 = tail call i32 @himci_writel(i32 %10, i32 %11)
ret void
}