unsigned int rtcSetDateTime(const unsigned int year, const unsigned int month,
                            const unsigned int day, const unsigned int hour,
                            const unsigned int minute,
                            const unsigned int second) {
  rtcDisable();
  while ((*((volatile unsigned int *const)((0x40010000 + 0) + 0x48))))
    ;
  ;
  (*((volatile unsigned int *const)(0x40010a00 + 0x20))) =
      ((day << 24) | (hour << 16) | (minute << 8) | second);
  (*((volatile unsigned int *const)(0x40010a00 + 0x24))) =
      ((year << 16) | (month << 8));
  while ((*((volatile unsigned int *const)((0x40010000 + 0) + 0x48))))
    ;
  ;
  (*((volatile unsigned int *const)(0x40010a00 + 0x04))) =
      (0x7fff << 16) | (1 << 0);
  return 0;
}


x86 assembly (clang, -O0):
<rtcSetDateTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
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    $0x0,%al
call   1030 <rtcDisable@plt>
mov    $0x40010048,%eax
mov    (%rax),%eax
cmp    $0x0,%eax
je     1148 <rtcSetDateTime+0x38>
jmp    1133 <rtcSetDateTime+0x23>
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    $0x40010a20,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
shl    $0x10,%ecx
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    $0x40010a24,%eax
mov    %ecx,(%rax)
mov    $0x40010048,%eax
mov    (%rax),%eax
cmp    $0x0,%eax
je     1192 <rtcSetDateTime+0x82>
jmp    117d <rtcSetDateTime+0x6d>
mov    $0x40010a04,%eax
movl   $0x7fff0001,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtcSetDateTime>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%ebp
mov    %ecx,%ebx
mov    %edx,%r13d
mov    %esi,%r12d
mov    %edi,%r15d
xor    %eax,%eax
call   1030 <rtcDisable@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpl   $0x0,0x40010048
jne    1140 <rtcSetDateTime+0x30>
shl    $0x18,%r13d
shl    $0x10,%ebx
or     %r13d,%ebx
shl    $0x8,%ebp
or     %ebx,%ebp
or     %r14d,%ebp
mov    %ebp,0x40010a20
shl    $0x10,%r15d
shl    $0x8,%r12d
or     %r15d,%r12d
mov    %r12d,0x40010a24
40
cs nopw 0x0(%rax,%rax,1)
cmpl   $0x0,0x40010048
jne    1180 <rtcSetDateTime+0x70>
movl   $0x7fff0001,0x40010a04
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @rtcSetDateTime(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 (...) @rtcDisable()
br label %8
8: ; preds = %8, %6
%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 1073809952 to i32*)
%18 = shl i32 %0, 16
%19 = shl i32 %1, 8
%20 = or i32 %19, %18
store volatile i32 %20, i32* inttoptr (i64 1073809956 to i32*)
br label %21
21: ; preds = %21, %11
%22 = load volatile i32, i32* inttoptr (i64 1073807432 to i32*)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %21
24: ; preds = %21
store volatile i32 2147418113, i32* inttoptr (i64 1073809924 to i32*)
ret i32 0
}