#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 tm_year;
  int tm_mon;
  int tm_mday;
};

/* Variables and functions */
int CLOCKS_PER_SEC;
int clock();
char *ctime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int sec = clock() / CLOCKS_PER_SEC;
  printf("%lu\n", CLOCKS_PER_SEC);
  printf("%lu : %d seconds returned by clock()\n", clock(), sec);
  time_t now;
  time(&now);
  printf("%s\n", ctime(&now));
  struct tm *tmnow = localtime(&now);
  printf("Date: %d-%d-%d\n", tmnow->tm_year + 1900, tmnow->tm_mon + 1,
         tmnow->tm_mday);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <clock@plt>
mov    0x2e7b(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x8(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %eax,%esi
mov    -0x8(%rbp),%edx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1070 <time@plt>
lea    -0xc(%rbp),%rdi
call   1050 <ctime@plt>
mov    %rax,%rsi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
add    $0x76c,%esi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%ecx
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <clock@plt>
mov    0x2e75(%rip),%rcx
mov    (%rcx),%esi
cltd
idiv   %esi
mov    %eax,%ebx
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1050 <clock@plt>
lea    0xe6f(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <time@plt>
mov    %rbx,%rdi
call   1060 <ctime@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    $0x76c,%esi
add    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
add    $0x1,%edx
lea    0xe4e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@CLOCKS_PER_SEC = global i32 0
@.str = [5 x i8] c"%lu\0A\00"
@.str.1 = [38 x i8] c"%lu : %d seconds returned by clock()\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [16 x i8] c"Date: %d-%d-%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm*
store i32 0, i32* %1
%5 = call i32 (...) @clock()
%6 = load i32, i32* @CLOCKS_PER_SEC
%7 = sdiv i32 %5, %6
store i32 %7, i32* %2
%8 = load i32, i32* @CLOCKS_PER_SEC
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @clock()
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11)
%13 = call i32 @time(i32* %3)
%14 = call i8* @ctime(i32* %3)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %16, %struct.tm** %4
%17 = load %struct.tm*, %struct.tm** %4
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1900
%21 = load %struct.tm*, %struct.tm** %4
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1
%25 = load %struct.tm*, %struct.tm** %4
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 2
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %20, i32 %24, i32 %27)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@CLOCKS_PER_SEC = global i32 0
@.str = [5 x i8] c"%lu\0A\00"
@.str.1 = [38 x i8] c"%lu : %d seconds returned by clock()\0A\00"
@.str.3 = [16 x i8] c"Date: %d-%d-%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 (...) @clock()
%3 = load i32, i32* @CLOCKS_PER_SEC
%4 = sdiv i32 %2, %3
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%6 = tail call i32 (...) @clock()
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %4)
%8 = bitcast i32* %1 to i8*
%9 = call i32 @time(i32* %1)
%10 = call i8* @ctime(i32* %1)
%11 = call i32 @puts(i8* dereferenceable(1) %10)
%12 = call %struct.tm* @localtime(i32* %1)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 0
%14 = load i32, i32* %13
%15 = add nsw i32 %14, 1900
%16 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
%19 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 2
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %15, i32 %18, i32 %20)
ret i32 0
}