#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;
};
typedef int /*<<< orphan*/ outstr;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stdout;
scalar_t__ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int printTimeStamp() {
  char outstr[64];
  time_t t;
  struct tm *tmp;
  t = time(NULL);
  tmp = localtime(&t);
  if (tmp == NULL) {
    perror("error: localtime");
    return -1;
  }
  if (strftime(outstr, sizeof(outstr), "%F %T %s ", tmp) == 0) {
    perror("error: strftime");
    return -1;
  }
  fprintf(stdout, "%s", outstr);
  return 0;
}


x86 assembly (clang, -O0):
<printTimeStamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x54(%rbp)
lea    -0x54(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1194 <printTimeStamp+0x44>
lea    0xe7d(%rip),%rdi
call   1070 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ef <printTimeStamp+0x9f>
lea    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rcx
mov    $0x40,%esi
lea    0xe69(%rip),%rdx
call   1060 <strftime@plt>
cmp    $0x0,%rax
jne    11cf <printTimeStamp+0x7f>
lea    0xe5d(%rip),%rdi
call   1070 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ef <printTimeStamp+0x9f>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    -0x50(%rbp),%rdx
lea    0xe48(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTimeStamp>:
sub    $0x58,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     11ad <printTimeStamp+0x5d>
lea    0xe9c(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x40,%esi
mov    %rax,%rcx
call   1060 <strftime@plt>
test   %rax,%rax
je     11b6 <printTimeStamp+0x66>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
lea    0x10(%rsp),%rdx
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret
lea    0xe4c(%rip),%rdi
jmp    11bd <printTimeStamp+0x6d>
lea    0xe5e(%rip),%rdi
call   1070 <perror@plt>
mov    $0xffffffff,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [17 x i8] c"error: localtime\00"
@.str.1 = [10 x i8] c"%F %T %s \00"
@.str.2 = [16 x i8] c"error: strftime\00"
@stdout = global i32 0
@.str.3 = [3 x i8] c"%s\00"
define i32 @printTimeStamp() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = alloca i32
%4 = alloca %struct.tm*
%5 = call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %6, %struct.tm** %4
%7 = load %struct.tm*, %struct.tm** %4
%8 = icmp eq %struct.tm* %7, null
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %22
11: ; preds = %0
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%13 = load %struct.tm*, %struct.tm** %4
%14 = call i64 @strftime(i8* %12, i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %22
18: ; preds = %11
%19 = load i32, i32* @stdout
%20 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%21 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %20)
store i32 0, i32* %1
br label %22
22: ; preds = %18, %16, %9
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [17 x i8] c"error: localtime\00"
@.str.1 = [10 x i8] c"%F %T %s \00"
@.str.2 = [16 x i8] c"error: strftime\00"
@stdout = global i32 0
@.str.3 = [3 x i8] c"%s\00"
define i32 @printTimeStamp() {
%1 = alloca [64 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = call %struct.tm* @localtime(i32* %2)
%7 = icmp eq %struct.tm* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %18
10: ; preds = %0
%11 = call i64 @strftime(i8* %3, i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %18
15: ; preds = %10
%16 = load i32, i32* @stdout
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
br label %18
18: ; preds = %15, %13, %8
%19 = phi i32 [ -1, %8 ], [ -1, %13 ], [ 0, %15 ]
ret i32 %19
}