#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 */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ LCD_Goto(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ LCD_Init();
int /*<<< orphan*/ LCD_WriteString(char *);
int /*<<< orphan*/ RTC_GetValue(struct tm *);
int /*<<< orphan*/ RTC_Init(struct tm *);
struct tm *localtime(int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int main() {
  char timestr[80];
  struct tm *dt = localtime(0);
  LCD_Init();
  RTC_Init(dt);
  while (1) {
    RTC_GetValue(dt);
    strftime(timestr, 80, "%D   %R", dt);
    LCD_Goto(0, 0);
    LCD_WriteString(timestr);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <localtime@plt>
mov    %rax,-0x68(%rbp)
mov    $0x0,%al
call   1070 <LCD_Init@plt>
mov    -0x68(%rbp),%rdi
call   1040 <RTC_Init@plt>
mov    -0x68(%rbp),%rdi
call   1090 <RTC_GetValue@plt>
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rcx
mov    $0x50,%esi
lea    0xe49(%rip),%rdx
call   1080 <strftime@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1060 <LCD_Goto@plt>
lea    -0x60(%rbp),%rdi
call   1050 <LCD_WriteString@plt>
jmp    119a <main+0x2a>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
xor    %edi,%edi
call   1030 <localtime@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1070 <LCD_Init@plt>
mov    %rbx,%rdi
call   1040 <RTC_Init@plt>
lea    0xe67(%rip),%r14
mov    %rsp,%r15
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1090 <RTC_GetValue@plt>
mov    %r15,%rdi
mov    $0x50,%esi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1080 <strftime@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1060 <LCD_Goto@plt>
mov    %r15,%rdi
call   1050 <LCD_WriteString@plt>
jmp    11a0 <main+0x30>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [8 x i8] c"%D %R\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca %struct.tm*
store i32 0, i32* %1
%4 = call %struct.tm* @localtime(i32 0)
store %struct.tm* %4, %struct.tm** %3
%5 = call i32 (...) @LCD_Init()
%6 = load %struct.tm*, %struct.tm** %3
%7 = call i32 @RTC_Init(%struct.tm* %6)
br label %8
8: ; preds = %0, %8
%9 = load %struct.tm*, %struct.tm** %3
%10 = call i32 @RTC_GetValue(%struct.tm* %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%12 = load %struct.tm*, %struct.tm** %3
%13 = call i32 @strftime(i8* %11, i32 80, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.tm* %12)
%14 = call i32 @LCD_Goto(i32 0, i32 0)
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%16 = call i32 @LCD_WriteString(i8* %15)
br label %8
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [8 x i8] c"%D %R\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call %struct.tm* @localtime(i32 0)
%4 = tail call i32 (...) @LCD_Init()
%5 = tail call i32 @RTC_Init(%struct.tm* %3)
br label %6
6: ; preds = %6, %0
%7 = call i32 @RTC_GetValue(%struct.tm* %3)
%8 = call i32 @strftime(i8* %2, i32 80, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
%9 = call i32 @LCD_Goto(i32 0, i32 0)
%10 = call i32 @LCD_WriteString(i8* %2)
br label %6
}