#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 dummy;
};

/* Variables and functions */
char *asctime(struct tm *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
long time(int /*<<< orphan*/ *);
int main() {
  char *cp;
  struct tm *sp;
  long t;
  time_t *tp, tv;
  tp = &tv;
  t = time(tp);
  sp = localtime(tp);
  cp = asctime(sp);
  printf("Date and time in seconds = %ld\n", t);
  printf("Local Date and Time now:\n    %s\n", asctime(sp));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1060 <time@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <asctime@plt>
mov    %rax,%rsi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1060 <time@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <asctime@plt>
lea    0xe8d(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <asctime@plt>
lea    0xe94(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [32 x i8] c"Date and time in seconds = %ld\0A\00"
@.str.1 = [33 x i8] c"Local Date and Time now:\0A %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca %struct.tm*
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32
store i32 0, i32* %1
store i32* %6, i32** %5
%7 = load i32*, i32** %5
%8 = call i64 @time(i32* %7)
store i64 %8, i64* %4
%9 = load i32*, i32** %5
%10 = call %struct.tm* @localtime(i32* %9)
store %struct.tm* %10, %struct.tm** %3
%11 = load %struct.tm*, %struct.tm** %3
%12 = call i8* @asctime(%struct.tm* %11)
store i8* %12, i8** %2
%13 = load i64, i64* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %13)
%15 = load %struct.tm*, %struct.tm** %3
%16 = call i8* @asctime(%struct.tm* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [32 x i8] c"Date and time in seconds = %ld\0A\00"
@.str.1 = [33 x i8] c"Local Date and Time now:\0A %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i8* @asctime(%struct.tm* %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %3)
%7 = call i8* @asctime(%struct.tm* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i32 0
}