#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int /*<<< orphan*/ tm_sec;
  int /*<<< orphan*/ tm_min;
  scalar_t__ tm_hour;
  int /*<<< orphan*/ tm_mday;
  int /*<<< orphan*/ tm_mon;
  scalar_t__ tm_year;
};

/* Variables and functions */
int /*<<< orphan*/ lcd_printf(char *, scalar_t__, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ lcd_send_command(int);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void print_time_and_date() {
  time_t rawtime;
  struct tm *timeinfo;
  time(&rawtime);
  timeinfo = localtime(&rawtime);
  lcd_send_command(0x80);
  lcd_printf("%d-%d-%d", 1900 + timeinfo->tm_year, timeinfo->tm_mon,
             timeinfo->tm_mday);
  lcd_send_command((0x80 | 0x40));
  lcd_printf("%d:%d:%d", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
}


x86 assembly (clang, -O0):
<print_time_and_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1060 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    $0x80,%edi
call   1050 <lcd_send_command@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
add    $0x76c,%rsi
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%ecx
lea    0xe74(%rip),%rdi
call   1040 <lcd_printf@plt>
mov    $0xc0,%edi
call   1050 <lcd_send_command@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
lea    0xe52(%rip),%rdi
call   1040 <lcd_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time_and_date>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    $0x80,%edi
call   1050 <lcd_send_command@plt>
mov    $0x76c,%esi
add    0x18(%rbx),%rsi
mov    0x10(%rbx),%ecx
mov    0x14(%rbx),%edx
lea    0xe83(%rip),%rdi
call   1040 <lcd_printf@plt>
mov    $0xc0,%edi
call   1050 <lcd_send_command@plt>
mov    0x8(%rbx),%rsi
mov    (%rbx),%ecx
mov    0x4(%rbx),%edx
lea    0xe6d(%rip),%rdi
call   1040 <lcd_printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i64, i32, i32, i64 }
@.str = [9 x i8] c"%d-%d-%d\00"
@.str.1 = [9 x i8] c"%d:%d:%d\00"
define void @print_time_and_date() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = call i32 @lcd_send_command(i32 128)
%6 = load %struct.tm*, %struct.tm** %2
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 5
%8 = load i64, i64* %7
%9 = add nsw i64 1900, %8
%10 = load %struct.tm*, %struct.tm** %2
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 4
%12 = load i32, i32* %11
%13 = load %struct.tm*, %struct.tm** %2
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 3
%15 = load i32, i32* %14
%16 = call i32 @lcd_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %9, i32 %12, i32 %15)
%17 = call i32 @lcd_send_command(i32 192)
%18 = load %struct.tm*, %struct.tm** %2
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 2
%20 = load i64, i64* %19
%21 = load %struct.tm*, %struct.tm** %2
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = load %struct.tm*, %struct.tm** %2
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 0
%26 = load i32, i32* %25
%27 = call i32 @lcd_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %20, i32 %23, i32 %26)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i64, i32, i32, i64 }
@.str = [9 x i8] c"%d-%d-%d\00"
@.str.1 = [9 x i8] c"%d:%d:%d\00"
define void @print_time_and_date() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i32 @lcd_send_command(i32 128)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%7 = load i64, i64* %6
%8 = add nsw i64 %7, 1900
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%12 = load i32, i32* %11
%13 = call i32 @lcd_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %8, i32 %10, i32 %12)
%14 = call i32 @lcd_send_command(i32 192)
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%20 = load i32, i32* %19
%21 = call i32 @lcd_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %16, i32 %18, i32 %20)
ret void
}