unsigned int rtcSetAlarm(const unsigned int year, const unsigned int month,
                         const unsigned int day, const unsigned int hour,
                         const unsigned int minute, const unsigned int second,
                         const unsigned int mask) {
  while ((*((volatile unsigned int *const)((0x40010000 + 0) + 0x48))))
    ;
  ;
  (*((volatile unsigned int *const)(0x40010a00 + 0x18))) =
      ((day << 24) | (hour << 16) | (minute << 8) | second);
  (*((volatile unsigned int *const)(0x40010a00 + 0x1c))) =
      ((year << 16) | (month << 8));
  (*((volatile unsigned int *const)(0x40010a00 + 0x10))) |= (1 << 8);
  enableInterrupt(1, 65);
  return 0;
}


x86 assembly (clang, -O0):
<rtcSetAlarm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    $0x40010048,%eax
mov    (%rax),%eax
cmp    $0x0,%eax
je     1144 <rtcSetAlarm+0x34>
jmp    112f <rtcSetAlarm+0x1f>
mov    -0xc(%rbp),%ecx
shl    $0x18,%ecx
mov    -0x10(%rbp),%eax
shl    $0x10,%eax
or     %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
or     -0x18(%rbp),%ecx
mov    $0x40010a18,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
shl    $0x10,%ecx
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    $0x40010a1c,%eax
mov    %ecx,(%rax)
mov    $0x40010a10,%eax
mov    (%rax),%ecx
or     $0x100,%ecx
mov    $0x40010a10,%eax
mov    %ecx,(%rax)
mov    $0x1,%edi
mov    $0x41,%esi
mov    $0x0,%al
call   1030 <enableInterrupt@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtcSetAlarm>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,0x40010048
jne    1120 <rtcSetAlarm+0x10>
shl    $0x18,%edx
shl    $0x10,%ecx
or     %edx,%ecx
shl    $0x8,%r8d
or     %ecx,%r8d
or     %r9d,%r8d
mov    %r8d,0x40010a18
40
shl    $0x10,%edi
shl    $0x8,%esi
or     %edi,%esi
mov    %esi,0x40010a1c
orl    $0x100,0x40010a10
mov    $0x1,%edi
mov    $0x41,%esi
xor    %eax,%eax
call   1030 <enableInterrupt@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rtcSetAlarm(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = 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
store i32 %6, i32* %14
br label %15
15: ; preds = %18, %7
%16 = load volatile i32, i32* inttoptr (i64 1073807432 to i32*)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %15
19: ; preds = %15
%20 = load i32, i32* %10
%21 = shl i32 %20, 24
%22 = load i32, i32* %11
%23 = shl i32 %22, 16
%24 = or i32 %21, %23
%25 = load i32, i32* %12
%26 = shl i32 %25, 8
%27 = or i32 %24, %26
%28 = load i32, i32* %13
%29 = or i32 %27, %28
store volatile i32 %29, i32* inttoptr (i64 1073809944 to i32*)
%30 = load i32, i32* %8
%31 = shl i32 %30, 16
%32 = load i32, i32* %9
%33 = shl i32 %32, 8
%34 = or i32 %31, %33
store volatile i32 %34, i32* inttoptr (i64 1073809948 to i32*)
%35 = load volatile i32, i32* inttoptr (i64 1073809936 to i32*)
%36 = or i32 %35, 256
store volatile i32 %36, i32* inttoptr (i64 1073809936 to i32*)
%37 = call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 1, i32 65)
ret i32 0
}

LLVM IR (-O2):
define i32 @rtcSetAlarm(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
br label %8
8: ; preds = %8, %7
%9 = load volatile i32, i32* inttoptr (i64 1073807432 to i32*)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %8
11: ; preds = %8
%12 = shl i32 %2, 24
%13 = shl i32 %3, 16
%14 = or i32 %13, %12
%15 = shl i32 %4, 8
%16 = or i32 %14, %15
%17 = or i32 %16, %5
store volatile i32 %17, i32* inttoptr (i64 1073809944 to i32*)
%18 = shl i32 %0, 16
%19 = shl i32 %1, 8
%20 = or i32 %19, %18
store volatile i32 %20, i32* inttoptr (i64 1073809948 to i32*)
%21 = load volatile i32, i32* inttoptr (i64 1073809936 to i32*)
%22 = or i32 %21, 256
store volatile i32 %22, i32* inttoptr (i64 1073809936 to i32*)
%23 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @enableInterrupt to i32 (i32, i32, ...)*)(i32 1, i32 65)
ret i32 0
}