#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 /*<<< orphan*/ VIDEO_WaitVSync();
int /*<<< orphan*/ mask32(int, int, int /*<<< orphan*/);
int read32(int);
int /*<<< orphan*/ write32(int, int);
void VIDEO_BlackOut(void) {
  VIDEO_WaitVSync();
  int active = read32(((0xCC002000) + 0x00)) >> 4;
  write32(((0xCC002000) + 0x00),
          read32(((0xCC002000) + 0x00)) + ((active << 1) - 2));
  write32(((0xCC002000) + 0x00),
          read32(((0xCC002000) + 0x00)) + ((active << 1) - 2));
  write32(((0xCC002000) + 0x00), read32(((0xCC002000) + 0x00)) + 2);
  write32(((0xCC002000) + 0x00), read32(((0xCC002000) + 0x00)) + 2);
  mask32(((0xCC002000) + 0x00), 0xfffffff0, 0);
}


x86 assembly (clang, -O0):
<VIDEO_BlackOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <VIDEO_WaitVSync@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
sar    $0x4,%eax
mov    %eax,-0x4(%rbp)
mov    $0xcc002000,%edi
call   1060 <read32@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
sub    $0x2,%eax
add    %eax,%esi
mov    $0xcc002000,%edi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
sub    $0x2,%eax
add    %eax,%esi
mov    $0xcc002000,%edi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
mov    %eax,%esi
add    $0x2,%esi
mov    $0xcc002000,%edi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
mov    %eax,%esi
add    $0x2,%esi
mov    $0xcc002000,%edi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
mov    $0xfffffff0,%esi
xor    %edx,%edx
call   1050 <mask32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIDEO_BlackOut>:
push   %rbx
xor    %eax,%eax
call   1040 <VIDEO_WaitVSync@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
mov    %eax,%ebx
mov    $0xcc002000,%edi
call   1060 <read32@plt>
sar    $0x3,%ebx
add    $0xfffffffe,%ebx
and    $0xfffffffe,%ebx
lea    (%rax,%rbx,1),%esi
mov    $0xcc002000,%edi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
add    %eax,%ebx
mov    $0xcc002000,%edi
mov    %ebx,%esi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
lea    0x2(%rax),%esi
mov    $0xcc002000,%edi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
call   1060 <read32@plt>
lea    0x2(%rax),%esi
mov    $0xcc002000,%edi
call   1030 <write32@plt>
mov    $0xcc002000,%edi
mov    $0xfffffff0,%esi
xor    %edx,%edx
pop    %rbx
jmp    1050 <mask32@plt>

LLVM IR (-O0):
define void @VIDEO_BlackOut() {
%1 = alloca i32
%2 = call i32 (...) @VIDEO_WaitVSync()
%3 = call i32 @read32(i32 -872407040)
%4 = ashr i32 %3, 4
store i32 %4, i32* %1
%5 = call i32 @read32(i32 -872407040)
%6 = load i32, i32* %1
%7 = shl i32 %6, 1
%8 = sub nsw i32 %7, 2
%9 = add nsw i32 %5, %8
%10 = call i32 @write32(i32 -872407040, i32 %9)
%11 = call i32 @read32(i32 -872407040)
%12 = load i32, i32* %1
%13 = shl i32 %12, 1
%14 = sub nsw i32 %13, 2
%15 = add nsw i32 %11, %14
%16 = call i32 @write32(i32 -872407040, i32 %15)
%17 = call i32 @read32(i32 -872407040)
%18 = add nsw i32 %17, 2
%19 = call i32 @write32(i32 -872407040, i32 %18)
%20 = call i32 @read32(i32 -872407040)
%21 = add nsw i32 %20, 2
%22 = call i32 @write32(i32 -872407040, i32 %21)
%23 = call i32 @mask32(i32 -872407040, i32 -16, i32 0)
ret void
}

LLVM IR (-O2):
define void @VIDEO_BlackOut() {
%1 = tail call i32 (...) @VIDEO_WaitVSync()
%2 = tail call i32 @read32(i32 -872407040)
%3 = tail call i32 @read32(i32 -872407040)
%4 = ashr i32 %2, 3
%5 = add nsw i32 %4, -2
%6 = and i32 %5, -2
%7 = add nsw i32 %6, %3
%8 = tail call i32 @write32(i32 -872407040, i32 %7)
%9 = tail call i32 @read32(i32 -872407040)
%10 = add nsw i32 %9, %6
%11 = tail call i32 @write32(i32 -872407040, i32 %10)
%12 = tail call i32 @read32(i32 -872407040)
%13 = add nsw i32 %12, 2
%14 = tail call i32 @write32(i32 -872407040, i32 %13)
%15 = tail call i32 @read32(i32 -872407040)
%16 = add nsw i32 %15, 2
%17 = tail call i32 @write32(i32 -872407040, i32 %16)
%18 = tail call i32 @mask32(i32 -872407040, i32 -16, i32 0)
ret void
}