#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 get_rtc_date();
int get_rtc_day();
int get_rtc_hour();
int get_rtc_minute();
int get_rtc_month();
int get_rtc_second();
int get_rtc_year();
int /*<<< orphan*/ uart_printf(char *);
int /*<<< orphan*/ uart_send_int(int);
void read_rtc_time(void) {
  int value = 0;
  value = get_rtc_year();
  uart_send_int(value);
  uart_printf("-");
  value = get_rtc_month();
  uart_send_int(value);
  uart_printf("-");
  value = get_rtc_date();
  uart_send_int(value);
  uart_printf(" (");
  value = get_rtc_day();
  uart_send_int(value);
  uart_printf(")  ");
  value = get_rtc_hour();
  uart_send_int(value);
  uart_printf(":");
  value = get_rtc_minute();
  uart_send_int(value);
  uart_printf(":");
  value = get_rtc_second();
  uart_send_int(value);
  return;
}


x86 assembly (clang, -O0):
<read_rtc_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <get_rtc_year@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <uart_send_int@plt>
lea    0xe48(%rip),%rdi
call   1070 <uart_printf@plt>
mov    $0x0,%al
call   10b0 <get_rtc_month@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <uart_send_int@plt>
lea    0xe2a(%rip),%rdi
call   1070 <uart_printf@plt>
mov    $0x0,%al
call   1030 <get_rtc_date@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <uart_send_int@plt>
lea    0xe0e(%rip),%rdi
call   1070 <uart_printf@plt>
mov    $0x0,%al
call   1040 <get_rtc_day@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <uart_send_int@plt>
lea    0xdf3(%rip),%rdi
call   1070 <uart_printf@plt>
mov    $0x0,%al
call   1050 <get_rtc_hour@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <uart_send_int@plt>
lea    0xdd9(%rip),%rdi
call   1070 <uart_printf@plt>
mov    $0x0,%al
call   1060 <get_rtc_minute@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <uart_send_int@plt>
lea    0xdbb(%rip),%rdi
call   1070 <uart_printf@plt>
mov    $0x0,%al
call   10a0 <get_rtc_second@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1090 <uart_send_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_rtc_time>:
push   %rbx
xor    %eax,%eax
call   1080 <get_rtc_year@plt>
mov    %eax,%edi
call   1090 <uart_send_int@plt>
lea    0xe5a(%rip),%rbx
mov    %rbx,%rdi
call   1070 <uart_printf@plt>
xor    %eax,%eax
call   10b0 <get_rtc_month@plt>
mov    %eax,%edi
call   1090 <uart_send_int@plt>
mov    %rbx,%rdi
call   1070 <uart_printf@plt>
xor    %eax,%eax
call   1030 <get_rtc_date@plt>
mov    %eax,%edi
call   1090 <uart_send_int@plt>
lea    0xe29(%rip),%rdi
call   1070 <uart_printf@plt>
xor    %eax,%eax
call   1040 <get_rtc_day@plt>
mov    %eax,%edi
call   1090 <uart_send_int@plt>
lea    0xe12(%rip),%rdi
call   1070 <uart_printf@plt>
xor    %eax,%eax
call   1050 <get_rtc_hour@plt>
mov    %eax,%edi
call   1090 <uart_send_int@plt>
lea    0xdfc(%rip),%rbx
mov    %rbx,%rdi
call   1070 <uart_printf@plt>
xor    %eax,%eax
call   1060 <get_rtc_minute@plt>
mov    %eax,%edi
call   1090 <uart_send_int@plt>
mov    %rbx,%rdi
call   1070 <uart_printf@plt>
xor    %eax,%eax
call   10a0 <get_rtc_second@plt>
mov    %eax,%edi
pop    %rbx
jmp    1090 <uart_send_int@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c" (\00"
@.str.2 = [4 x i8] c") \00"
@.str.3 = [2 x i8] c":\00"
define void @read_rtc_time() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @get_rtc_year()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @uart_send_int(i32 %3)
%5 = call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @get_rtc_month()
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = call i32 @uart_send_int(i32 %7)
%9 = call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @get_rtc_date()
store i32 %10, i32* %1
%11 = load i32, i32* %1
%12 = call i32 @uart_send_int(i32 %11)
%13 = call i32 @uart_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (...) @get_rtc_day()
store i32 %14, i32* %1
%15 = load i32, i32* %1
%16 = call i32 @uart_send_int(i32 %15)
%17 = call i32 @uart_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (...) @get_rtc_hour()
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = call i32 @uart_send_int(i32 %19)
%21 = call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 (...) @get_rtc_minute()
store i32 %22, i32* %1
%23 = load i32, i32* %1
%24 = call i32 @uart_send_int(i32 %23)
%25 = call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 (...) @get_rtc_second()
store i32 %26, i32* %1
%27 = load i32, i32* %1
%28 = call i32 @uart_send_int(i32 %27)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [3 x i8] c" (\00"
@.str.2 = [4 x i8] c") \00"
@.str.3 = [2 x i8] c":\00"
define void @read_rtc_time() {
%1 = tail call i32 (...) @get_rtc_year()
%2 = tail call i32 @uart_send_int(i32 %1)
%3 = tail call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @get_rtc_month()
%5 = tail call i32 @uart_send_int(i32 %4)
%6 = tail call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @get_rtc_date()
%8 = tail call i32 @uart_send_int(i32 %7)
%9 = tail call i32 @uart_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (...) @get_rtc_day()
%11 = tail call i32 @uart_send_int(i32 %10)
%12 = tail call i32 @uart_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 (...) @get_rtc_hour()
%14 = tail call i32 @uart_send_int(i32 %13)
%15 = tail call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 (...) @get_rtc_minute()
%17 = tail call i32 @uart_send_int(i32 %16)
%18 = tail call i32 @uart_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = tail call i32 (...) @get_rtc_second()
%20 = tail call i32 @uart_send_int(i32 %19)
ret void
}