#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*/ HibernateBatCheckStart();
int /*<<< orphan*/ HibernateClockSelect(int);
int /*<<< orphan*/ HibernateEnableExpClk(int /*<<< orphan*/);
int /*<<< orphan*/ HibernateGPIORetentionEnable();
int /*<<< orphan*/ HibernateIntEnable(int);
int /*<<< orphan*/ HibernateLowBatSet(int);
int /*<<< orphan*/ HibernateRTCEnable();
scalar_t__ HibernateRTCGet();
int /*<<< orphan*/ HibernateRTCMatch0Set(scalar_t__);
int /*<<< orphan*/ HibernateRTCTrimSet(int);
int /*<<< orphan*/ HibernateWakeSet(int);
int /*<<< orphan*/ SysCtlClockGet();
int /*<<< orphan*/ SysCtlDelay(int);
int /*<<< orphan*/ SysCtlPeripheralEnable(int);
void rtc_init() {
  SysCtlPeripheralEnable(0x00000040);
  HibernateEnableExpClk(SysCtlClockGet());
  HibernateClockSelect(0x00000004);
  HibernateRTCTrimSet(0x7FFF);
  HibernateGPIORetentionEnable();
  SysCtlDelay(6400);
  HibernateRTCEnable();
  HibernateIntEnable(0x00000001);
  HibernateBatCheckStart();
  HibernateWakeSet(0x00000200);
  HibernateLowBatSet(0x000000A0 | 0x00002000);
  HibernateRTCMatch0Set(HibernateRTCGet() + 5);
}


x86 assembly (clang, -O0):
<rtc_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40,%edi
call   1040 <SysCtlPeripheralEnable@plt>
mov    $0x0,%al
call   1050 <SysCtlClockGet@plt>
mov    %eax,%edi
call   10c0 <HibernateEnableExpClk@plt>
mov    $0x4,%edi
call   1060 <HibernateClockSelect@plt>
mov    $0x7fff,%edi
call   1100 <HibernateRTCTrimSet@plt>
mov    $0x0,%al
call   1030 <HibernateGPIORetentionEnable@plt>
mov    $0x1900,%edi
call   10f0 <SysCtlDelay@plt>
mov    $0x0,%al
call   10a0 <HibernateRTCEnable@plt>
mov    $0x1,%edi
call   1080 <HibernateIntEnable@plt>
mov    $0x0,%al
call   1070 <HibernateBatCheckStart@plt>
mov    $0x200,%edi
call   10e0 <HibernateWakeSet@plt>
mov    $0x20a0,%edi
call   10b0 <HibernateLowBatSet@plt>
mov    $0x0,%al
call   10d0 <HibernateRTCGet@plt>
mov    %rax,%rdi
add    $0x5,%rdi
call   1090 <HibernateRTCMatch0Set@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtc_init>:
push   %rax
mov    $0x40,%edi
call   1040 <SysCtlPeripheralEnable@plt>
xor    %eax,%eax
call   1050 <SysCtlClockGet@plt>
mov    %eax,%edi
call   10c0 <HibernateEnableExpClk@plt>
mov    $0x4,%edi
call   1060 <HibernateClockSelect@plt>
mov    $0x7fff,%edi
call   1100 <HibernateRTCTrimSet@plt>
xor    %eax,%eax
call   1030 <HibernateGPIORetentionEnable@plt>
mov    $0x1900,%edi
call   10f0 <SysCtlDelay@plt>
xor    %eax,%eax
call   10a0 <HibernateRTCEnable@plt>
mov    $0x1,%edi
call   1080 <HibernateIntEnable@plt>
xor    %eax,%eax
call   1070 <HibernateBatCheckStart@plt>
mov    $0x200,%edi
call   10e0 <HibernateWakeSet@plt>
mov    $0x20a0,%edi
call   10b0 <HibernateLowBatSet@plt>
xor    %eax,%eax
call   10d0 <HibernateRTCGet@plt>
lea    0x5(%rax),%rdi
pop    %rax
jmp    1090 <HibernateRTCMatch0Set@plt>

LLVM IR (-O0):
define void @rtc_init() {
%1 = call i32 @SysCtlPeripheralEnable(i32 64)
%2 = call i32 (...) @SysCtlClockGet()
%3 = call i32 @HibernateEnableExpClk(i32 %2)
%4 = call i32 @HibernateClockSelect(i32 4)
%5 = call i32 @HibernateRTCTrimSet(i32 32767)
%6 = call i32 (...) @HibernateGPIORetentionEnable()
%7 = call i32 @SysCtlDelay(i32 6400)
%8 = call i32 (...) @HibernateRTCEnable()
%9 = call i32 @HibernateIntEnable(i32 1)
%10 = call i32 (...) @HibernateBatCheckStart()
%11 = call i32 @HibernateWakeSet(i32 512)
%12 = call i32 @HibernateLowBatSet(i32 8352)
%13 = call i64 (...) @HibernateRTCGet()
%14 = add nsw i64 %13, 5
%15 = call i32 @HibernateRTCMatch0Set(i64 %14)
ret void
}

LLVM IR (-O2):
define void @rtc_init() {
%1 = tail call i32 @SysCtlPeripheralEnable(i32 64)
%2 = tail call i32 (...) @SysCtlClockGet()
%3 = tail call i32 @HibernateEnableExpClk(i32 %2)
%4 = tail call i32 @HibernateClockSelect(i32 4)
%5 = tail call i32 @HibernateRTCTrimSet(i32 32767)
%6 = tail call i32 (...) @HibernateGPIORetentionEnable()
%7 = tail call i32 @SysCtlDelay(i32 6400)
%8 = tail call i32 (...) @HibernateRTCEnable()
%9 = tail call i32 @HibernateIntEnable(i32 1)
%10 = tail call i32 (...) @HibernateBatCheckStart()
%11 = tail call i32 @HibernateWakeSet(i32 512)
%12 = tail call i32 @HibernateLowBatSet(i32 8352)
%13 = tail call i64 (...) @HibernateRTCGet()
%14 = add nsw i64 %13, 5
%15 = tail call i32 @HibernateRTCMatch0Set(i64 %14)
ret void
}