#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 */
unsigned int rtcSetDateTime(unsigned int const, unsigned int const,
                            unsigned int const, unsigned int const,
                            unsigned int const, unsigned int const);
int /*<<< orphan*/ scuUngatePeripheralClock(int);
unsigned int rtcEnable(const unsigned int year, const unsigned int month,
                       const unsigned int day, const unsigned int hour,
                       const unsigned int minute, const unsigned int second) {
  scuUngatePeripheralClock((1 << 10));
  if (((*((volatile unsigned int *const)(0x40010a00 + 0x00))) >> 8) !=
      0x0000A3C0) {
    return 1;
  }
  return rtcSetDateTime(year, month, day, hour, minute, second);
}


x86 assembly (clang, -O0):
<rtcEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    $0x400,%edi
call   1040 <scuUngatePeripheralClock@plt>
mov    $0x40010a00,%eax
mov    (%rax),%eax
shr    $0x8,%eax
cmp    $0xa3c0,%eax
je     1167 <rtcEnable+0x47>
movl   $0x1,-0x4(%rbp)
jmp    1183 <rtcEnable+0x63>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
call   1030 <rtcSetDateTime@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtcEnable>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x400,%edi
call   1040 <scuUngatePeripheralClock@plt>
mov    $0xffffff00,%eax
and    0x40010a00,%eax
cmp    $0xa3c000,%eax
jne    117b <rtcEnable+0x5b>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <rtcSetDateTime@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rtcEnable(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%14 = call i32 @scuUngatePeripheralClock(i32 1024)
%15 = load volatile i32, i32* inttoptr (i64 1073809920 to i32*)
%16 = lshr i32 %15, 8
%17 = icmp ne i32 %16, 41920
br i1 %17, label %18, label %19
18: ; preds = %6
store i32 1, i32* %7
br label %27
19: ; preds = %6
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = load i32, i32* %10
%23 = load i32, i32* %11
%24 = load i32, i32* %12
%25 = load i32, i32* %13
%26 = call i32 @rtcSetDateTime(i32 %20, i32 %21, i32 %22, i32 %23, i32 %24, i32 %25)
store i32 %26, i32* %7
br label %27
27: ; preds = %19, %18
%28 = load i32, i32* %7
ret i32 %28
}

LLVM IR (-O2):
define i32 @rtcEnable(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @scuUngatePeripheralClock(i32 1024)
%8 = load volatile i32, i32* inttoptr (i64 1073809920 to i32*)
%9 = and i32 %8, -256
%10 = icmp eq i32 %9, 10731520
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @rtcSetDateTime(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5)
br label %13
13: ; preds = %6, %11
%14 = phi i32 [ %12, %11 ], [ 1, %6 ]
ret i32 %14
}