#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 */
int hdmi_rd_reg(int);
int /*<<< orphan*/ hdmi_wr_reg(int, int);
void hdmi_hw_powerdown(void) {
  (*(volatile unsigned long *)(0xc1100000 | (0x1073 << 2)) =
       ((1 << 9) | (1 << 8) | (3 << 0)));
  hdmi_wr_reg((0x04000 + 0x05A), 0x0);
  hdmi_wr_reg((0x04000 + 0x059), 0x0);
  hdmi_wr_reg(0x04000 + 0x864, hdmi_rd_reg(0x04000 + 0x864) | (1 << 7));
  hdmi_wr_reg(0x04000 + 0x86C, hdmi_rd_reg(0x04000 + 0x86C) | (1 << 7));
  hdmi_wr_reg(0x04000 + 0x874, hdmi_rd_reg(0x04000 + 0x874) | (1 << 7));
  hdmi_wr_reg(0x04000 + 0x87C, hdmi_rd_reg(0x04000 + 0x87C) | (1 << 7));
  hdmi_wr_reg(0x04000 + 0x866, hdmi_rd_reg(0x04000 + 0x866) | (1 << 6));
  hdmi_wr_reg(0x04000 + 0x86E, hdmi_rd_reg(0x04000 + 0x86E) | (1 << 6));
  hdmi_wr_reg(0x04000 + 0x876, hdmi_rd_reg(0x04000 + 0x876) | (1 << 6));
  hdmi_wr_reg(0x04000 + 0x87E, hdmi_rd_reg(0x04000 + 0x87E) | (1 << 6));
  hdmi_wr_reg(0x04000 + 0x005, 0 << 0);
  hdmi_wr_reg(0x04000 + 0x097,
              hdmi_rd_reg(0x04000 + 0x097) | (1 << 7) | (1 << 6) | (1 << 5));
}


x86 assembly (clang, -O0):
<hdmi_hw_powerdown>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc11041cc,%eax
movq   $0x303,(%rax)
mov    $0x405a,%edi
xor    %esi,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4059,%edi
xor    %esi,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4864,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x80,%esi
mov    $0x4864,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x486c,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x80,%esi
mov    $0x486c,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4874,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x80,%esi
mov    $0x4874,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x487c,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x80,%esi
mov    $0x487c,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4866,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x40,%esi
mov    $0x4866,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x486e,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x40,%esi
mov    $0x486e,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4876,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x40,%esi
mov    $0x4876,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x487e,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x40,%esi
mov    $0x487e,%edi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4005,%edi
xor    %esi,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4097,%edi
call   1040 <hdmi_rd_reg@plt>
mov    %eax,%esi
or     $0x80,%esi
or     $0x40,%esi
or     $0x20,%esi
mov    $0x4097,%edi
call   1030 <hdmi_wr_reg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdmi_hw_powerdown>:
push   %rax
mov    $0xc11041cc,%eax
movq   $0x303,(%rax)
mov    $0x405a,%edi
xor    %esi,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4059,%edi
xor    %esi,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4864,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x80,%eax
mov    $0x4864,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x486c,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x80,%eax
mov    $0x486c,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4874,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x80,%eax
mov    $0x4874,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x487c,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x80,%eax
mov    $0x487c,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4866,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x40,%eax
mov    $0x4866,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x486e,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x40,%eax
mov    $0x486e,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4876,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x40,%eax
mov    $0x4876,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x487e,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0x40,%eax
mov    $0x487e,%edi
mov    %eax,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4005,%edi
xor    %esi,%esi
call   1030 <hdmi_wr_reg@plt>
mov    $0x4097,%edi
call   1040 <hdmi_rd_reg@plt>
or     $0xe0,%eax
mov    $0x4097,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <hdmi_wr_reg@plt>

LLVM IR (-O0):
define void @hdmi_hw_powerdown() {
store volatile i64 771, i64* inttoptr (i64 3239068108 to i64*)
%1 = call i32 @hdmi_wr_reg(i32 16474, i32 0)
%2 = call i32 @hdmi_wr_reg(i32 16473, i32 0)
%3 = call i32 @hdmi_rd_reg(i32 18532)
%4 = or i32 %3, 128
%5 = call i32 @hdmi_wr_reg(i32 18532, i32 %4)
%6 = call i32 @hdmi_rd_reg(i32 18540)
%7 = or i32 %6, 128
%8 = call i32 @hdmi_wr_reg(i32 18540, i32 %7)
%9 = call i32 @hdmi_rd_reg(i32 18548)
%10 = or i32 %9, 128
%11 = call i32 @hdmi_wr_reg(i32 18548, i32 %10)
%12 = call i32 @hdmi_rd_reg(i32 18556)
%13 = or i32 %12, 128
%14 = call i32 @hdmi_wr_reg(i32 18556, i32 %13)
%15 = call i32 @hdmi_rd_reg(i32 18534)
%16 = or i32 %15, 64
%17 = call i32 @hdmi_wr_reg(i32 18534, i32 %16)
%18 = call i32 @hdmi_rd_reg(i32 18542)
%19 = or i32 %18, 64
%20 = call i32 @hdmi_wr_reg(i32 18542, i32 %19)
%21 = call i32 @hdmi_rd_reg(i32 18550)
%22 = or i32 %21, 64
%23 = call i32 @hdmi_wr_reg(i32 18550, i32 %22)
%24 = call i32 @hdmi_rd_reg(i32 18558)
%25 = or i32 %24, 64
%26 = call i32 @hdmi_wr_reg(i32 18558, i32 %25)
%27 = call i32 @hdmi_wr_reg(i32 16389, i32 0)
%28 = call i32 @hdmi_rd_reg(i32 16535)
%29 = or i32 %28, 128
%30 = or i32 %29, 64
%31 = or i32 %30, 32
%32 = call i32 @hdmi_wr_reg(i32 16535, i32 %31)
ret void
}

LLVM IR (-O2):
define void @hdmi_hw_powerdown() {
store volatile i64 771, i64* inttoptr (i64 3239068108 to i64*)
%1 = tail call i32 @hdmi_wr_reg(i32 16474, i32 0)
%2 = tail call i32 @hdmi_wr_reg(i32 16473, i32 0)
%3 = tail call i32 @hdmi_rd_reg(i32 18532)
%4 = or i32 %3, 128
%5 = tail call i32 @hdmi_wr_reg(i32 18532, i32 %4)
%6 = tail call i32 @hdmi_rd_reg(i32 18540)
%7 = or i32 %6, 128
%8 = tail call i32 @hdmi_wr_reg(i32 18540, i32 %7)
%9 = tail call i32 @hdmi_rd_reg(i32 18548)
%10 = or i32 %9, 128
%11 = tail call i32 @hdmi_wr_reg(i32 18548, i32 %10)
%12 = tail call i32 @hdmi_rd_reg(i32 18556)
%13 = or i32 %12, 128
%14 = tail call i32 @hdmi_wr_reg(i32 18556, i32 %13)
%15 = tail call i32 @hdmi_rd_reg(i32 18534)
%16 = or i32 %15, 64
%17 = tail call i32 @hdmi_wr_reg(i32 18534, i32 %16)
%18 = tail call i32 @hdmi_rd_reg(i32 18542)
%19 = or i32 %18, 64
%20 = tail call i32 @hdmi_wr_reg(i32 18542, i32 %19)
%21 = tail call i32 @hdmi_rd_reg(i32 18550)
%22 = or i32 %21, 64
%23 = tail call i32 @hdmi_wr_reg(i32 18550, i32 %22)
%24 = tail call i32 @hdmi_rd_reg(i32 18558)
%25 = or i32 %24, 64
%26 = tail call i32 @hdmi_wr_reg(i32 18558, i32 %25)
%27 = tail call i32 @hdmi_wr_reg(i32 16389, i32 0)
%28 = tail call i32 @hdmi_rd_reg(i32 16535)
%29 = or i32 %28, 224
%30 = tail call i32 @hdmi_wr_reg(i32 16535, i32 %29)
ret void
}