#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 scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
short getLeapYears_Num(int);
int /*<<< orphan*/ printDate(scalar_t__, short, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ time(int /*<<< orphan*/ *);
void main() {
  short leapYears_Num;
  time_t seconds_1970 = time(NULL);
  if (seconds_1970 == (time_t)-1) {
    printf("Error to get time \n");
    exit(EXIT_FAILURE);
  }
  printf(
      "\nTime in second since \"UNIX EPOCH\" Thursday, 1 January 1970: %d \n",
      (int)seconds_1970);
  int elapsedYears = (int)seconds_1970 / (60 * 60 * 24 * 365);
  leapYears_Num = getLeapYears_Num(1970 + elapsedYears);
  printf("\n\tNumber of Leap Years Since %d is %d \n", 1970, leapYears_Num);
  printDate(seconds_1970, leapYears_Num, 1970 + elapsedYears);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
jne    118c <main+0x3c>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    $0x1e13380,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x7b2,%edi
call   1040 <getLeapYears_Num@plt>
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
lea    0xe8a(%rip),%rdi
mov    $0x7b2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x2(%rbp),%ax
mov    -0x14(%rbp),%edx
add    $0x7b2,%edx
movswl %ax,%esi
call   1060 <printDate@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %edi,%edi
call   1060 <time@plt>
cmp    $0xffffffffffffffff,%rax
je     11d5 <main+0x75>
mov    %rax,%rbx
lea    0xe85(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebx,%rax
imul   $0x4418a47b,%rax,%rax
mov    %rax,%rcx
sar    $0x37,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%r14d
add    $0x7b2,%r14d
mov    %r14d,%edi
call   1050 <getLeapYears_Num@plt>
movswl %ax,%ebp
lea    0xe8c(%rip),%rdi
mov    $0x7b2,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <printDate@plt>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
mov    0x2df8(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Error to get time \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [66 x i8] c"\0ATime in second since \22UNIX EPOCH\22 Thursday, 1 January 1970: %d \0A\00"
@.str.2 = [40 x i8] c"\0A\09Number of Leap Years Since %d is %d \0A\00"
define void @main() {
%1 = alloca i16
%2 = alloca i64
%3 = alloca i32
%4 = call i64 @time(i32* null)
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = icmp eq i64 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = load i64, i64* %2
%13 = trunc i64 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i64, i64* %2
%16 = trunc i64 %15 to i32
%17 = sdiv i32 %16, 31536000
store i32 %17, i32* %3
%18 = load i32, i32* %3
%19 = add nsw i32 1970, %18
%20 = call signext i16 @getLeapYears_Num(i32 %19)
store i16 %20, i16* %1
%21 = load i16, i16* %1
%22 = sext i16 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 1970, i32 %22)
%24 = load i64, i64* %2
%25 = load i16, i16* %1
%26 = load i32, i32* %3
%27 = add nsw i32 1970, %26
%28 = call i32 @printDate(i64 %24, i16 signext %25, i32 %27)
ret void
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [66 x i8] c"\0ATime in second since \22UNIX EPOCH\22 Thursday, 1 January 1970: %d \0A\00"
@.str.2 = [40 x i8] c"\0A\09Number of Leap Years Since %d is %d \0A\00"
@str = [19 x i8] c"Error to get time \00"
define void @main() {
%1 = tail call i64 @time(i32* null)
%2 = icmp eq i64 %1, -1
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %0
%8 = trunc i64 %1 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = sdiv i32 %8, 31536000
%11 = add nsw i32 %10, 1970
%12 = tail call signext i16 @getLeapYears_Num(i32 %11)
%13 = sext i16 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 1970, i32 %13)
%15 = tail call i32 @printDate(i64 %1, i16 signext %12, i32 %11)
ret void
}