#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*/ gdGdcInitSystem();
int /*<<< orphan*/ gdGdcReset();
void cdops_init() {
  register unsigned long p, x;
  *((volatile unsigned long *)0xa05f74e4) = 0x1fffff;
  for (p = 0; p < 0x200000 / 4; p++)
    x = ((volatile unsigned long *)0xa0000000)[p];
  gdGdcInitSystem();
  gdGdcReset();
}


x86 assembly (clang, -O0):
<cdops_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa05f74e4,%eax
movq   $0x1fffff,(%rax)
movq   $0x0,-0x8(%rbp)
cmpq   $0x80000,-0x8(%rbp)
jae    116c <cdops_init+0x4c>
mov    -0x8(%rbp),%rcx
mov    $0xa0000000,%eax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    113c <cdops_init+0x1c>
mov    $0x0,%al
call   1030 <gdGdcInitSystem@plt>
mov    $0x0,%al
call   1040 <gdGdcReset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdops_init>:
push   %rax
mov    $0xa0000038,%eax
movq   $0x1fffff,0x5f74ac(%rax)
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0x38(%rax,%rcx,8),%rdx
mov    -0x30(%rax,%rcx,8),%rdx
mov    -0x28(%rax,%rcx,8),%rdx
mov    -0x20(%rax,%rcx,8),%rdx
mov    -0x18(%rax,%rcx,8),%rdx
mov    -0x10(%rax,%rcx,8),%rdx
mov    -0x8(%rax,%rcx,8),%rdx
mov    (%rax,%rcx,8),%rdx
add    $0x8,%rcx
cmp    $0x80000,%rcx
jne    1140 <cdops_init+0x20>
xor    %eax,%eax
call   1030 <gdGdcInitSystem@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <gdGdcReset@plt>

LLVM IR (-O0):
define void @cdops_init() {
%1 = alloca i64
%2 = alloca i64
store volatile i64 2097151, i64* inttoptr (i64 2690610404 to i64*)
store i64 0, i64* %1
br label %3
3: ; preds = %10, %0
%4 = load i64, i64* %1
%5 = icmp ult i64 %4, 524288
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i64, i64* %1
%8 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %7
%9 = load volatile i64, i64* %8
store i64 %9, i64* %2
br label %10
10: ; preds = %6
%11 = load i64, i64* %1
%12 = add i64 %11, 1
store i64 %12, i64* %1
br label %3
13: ; preds = %3
%14 = call i32 (...) @gdGdcInitSystem()
%15 = call i32 (...) @gdGdcReset()
ret void
}

LLVM IR (-O2):
define void @cdops_init() {
store volatile i64 2097151, i64* inttoptr (i64 2690610404 to i64*)
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %26, %1 ]
%3 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %2
%4 = load volatile i64, i64* %3
%5 = or i64 %2, 1
%6 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %5
%7 = load volatile i64, i64* %6
%8 = or i64 %2, 2
%9 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %8
%10 = load volatile i64, i64* %9
%11 = or i64 %2, 3
%12 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %11
%13 = load volatile i64, i64* %12
%14 = or i64 %2, 4
%15 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %14
%16 = load volatile i64, i64* %15
%17 = or i64 %2, 5
%18 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %17
%19 = load volatile i64, i64* %18
%20 = or i64 %2, 6
%21 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %20
%22 = load volatile i64, i64* %21
%23 = or i64 %2, 7
%24 = getelementptr inbounds i64, i64* inttoptr (i64 2684354560 to i64*), i64 %23
%25 = load volatile i64, i64* %24
%26 = add nuw nsw i64 %2, 8
%27 = icmp eq i64 %26, 524288
br i1 %27, label %28, label %1
28: ; preds = %1
%29 = tail call i32 (...) @gdGdcInitSystem()
%30 = tail call i32 (...) @gdGdcReset()
ret void
}