unsigned int ccuEnable(const unsigned int global_control) {
  scuUngatePeripheralClock((1 << 2));
  if (((*((volatile unsigned int *const)(0x48040000 + 0x0080))) >> 8) !=
      0x0000A6C0) {
    return 1;
  }
  enableInterrupt(21, 61);
  enableInterrupt(22, 62);
  enableInterrupt(23, 63);
  enableInterrupt(24, 64);
  ccuStopSlices((1 << 3) | (1 << 2) | (1 << 1) | (1 << 0));
  (*((volatile unsigned int *const)((0x40010000 + 0) + 0x30))) = 0;
  (*((volatile unsigned int *const)(0x48040000 + 0x0000))) = global_control;
  return 0;
}


x86 assembly (clang, -O0):
<ccuEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x4,%edi
mov    $0x0,%al
call   1040 <scuUngatePeripheralClock@plt>
mov    $0x48040080,%eax
mov    (%rax),%eax
shr    $0x8,%eax
cmp    $0xa6c0,%eax
je     1168 <ccuEnable+0x38>
movl   $0x1,-0x4(%rbp)
jmp    11d4 <ccuEnable+0xa4>
mov    $0x15,%edi
mov    $0x3d,%esi
mov    $0x0,%al
call   1030 <enableInterrupt@plt>
mov    $0x16,%edi
mov    $0x3e,%esi
mov    $0x0,%al
call   1030 <enableInterrupt@plt>
mov    $0x17,%edi
mov    $0x3f,%esi
mov    $0x0,%al
call   1030 <enableInterrupt@plt>
mov    $0x18,%edi
mov    $0x40,%esi
mov    $0x0,%al
call   1030 <enableInterrupt@plt>
mov    $0xf,%edi
mov    $0x0,%al
call   1050 <ccuStopSlices@plt>
mov    $0x40010030,%eax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%ecx
mov    $0x48040000,%eax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccuEnable>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
xor    %eax,%eax
call   1040 <scuUngatePeripheralClock@plt>
mov    $0xffffff00,%ecx
and    0x48040080,%ecx
mov    $0x1,%eax
cmp    $0xa6c000,%ecx
jne    11bc <ccuEnable+0x8c>
mov    $0x15,%edi
mov    $0x3d,%esi
xor    %eax,%eax
call   1030 <enableInterrupt@plt>
mov    $0x16,%edi
mov    $0x3e,%esi
xor    %eax,%eax
call   1030 <enableInterrupt@plt>
mov    $0x17,%edi
mov    $0x3f,%esi
xor    %eax,%eax
call   1030 <enableInterrupt@plt>
mov    $0x18,%edi
mov    $0x40,%esi
xor    %eax,%eax
call   1030 <enableInterrupt@plt>
mov    $0xf,%edi
xor    %eax,%eax
call   1050 <ccuStopSlices@plt>
movl   $0x0,0x40010030
mov    %ebx,0x48040000
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ccuEnable(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @scuUngatePeripheralClock to i32 (i32, ...)*)(i32 4)
%5 = load volatile i32, i32* inttoptr (i64 1208221824 to i32*)
%6 = lshr i32 %5, 8
%7 = icmp ne i32 %6, 42688
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %16
9: ; preds = %1
%10 = call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 21, i32 61)
%11 = call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 22, i32 62)
%12 = call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 23, i32 63)
%13 = call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 24, i32 64)
%14 = call i32 (i32, ...) bitcast (i32 (...)* @ccuStopSlices to i32 (i32, ...)*)(i32 15)
store volatile i32 0, i32* inttoptr (i64 1073807408 to i32*)
%15 = load i32, i32* %3
store volatile i32 %15, i32* inttoptr (i64 1208221696 to i32*)
store i32 0, i32* %2
br label %16
16: ; preds = %9, %8
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @ccuEnable(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @scuUngatePeripheralClock to i32 (i32, ...)*)(i32 4)
%3 = load volatile i32, i32* inttoptr (i64 1208221824 to i32*)
%4 = and i32 %3, -256
%5 = icmp eq i32 %4, 10928128
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 21, i32 61)
%8 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 22, i32 62)
%9 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 23, i32 63)
%10 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 24, i32 64)
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @ccuStopSlices to i32 (i32, ...)*)(i32 15)
store volatile i32 0, i32* inttoptr (i64 1073807408 to i32*)
store volatile i32 %0, i32* inttoptr (i64 1208221696 to i32*)
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ 0, %6 ], [ 1, %1 ]
ret i32 %13
}