#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 */
long EXIT_FAILURE;
char *ctime(scalar_t__ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ time(int /*<<< orphan*/ *);
long getTime() {
  time_t current_time;
  char *c_time_string;
  current_time = time(NULL);
  if (current_time == ((time_t)-1)) {
    (void)fprintf(stderr, "Failure to obtain the current time.\n");
    return (EXIT_FAILURE);
  }
  c_time_string = ctime(&current_time);
  if (c_time_string == NULL) {
    (void)fprintf(stderr, "Failure to convert the current time.\n");
    return 0;
  }
  return (long)current_time;
}


x86 assembly (clang, -O0):
<getTime>:
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    1178 <getTime+0x48>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    11ba <getTime+0x8a>
lea    -0x10(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b2 <getTime+0x82>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
call   1040 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    11ba <getTime+0x8a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTime>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,(%rsp)
cmp    $0xffffffffffffffff,%rax
je     1155 <getTime+0x25>
mov    %rsp,%rdi
call   1030 <ctime@plt>
test   %rax,%rax
je     1176 <getTime+0x46>
mov    (%rsp),%rax
pop    %rcx
ret
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%rax
pop    %rcx
ret
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Failure to obtain the current time.\0A\00"
@EXIT_FAILURE = global i64 0
@.str.1 = [38 x i8] c"Failure to convert the current time.\0A\00"
define i64 @getTime() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i8*
%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 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%10 = load i64, i64* @EXIT_FAILURE
store i64 %10, i64* %1
br label %20
11: ; preds = %0
%12 = call i8* @ctime(i64* %2)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
store i64 0, i64* %1
br label %20
18: ; preds = %11
%19 = load i64, i64* %2
store i64 %19, i64* %1
br label %20
20: ; preds = %18, %15, %7
%21 = load i64, i64* %1
ret i64 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Failure to obtain the current time.\0A\00"
@EXIT_FAILURE = global i64 0
@.str.1 = [38 x i8] c"Failure to convert the current time.\0A\00"
define i64 @getTime() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i64 @time(i32* null)
store i64 %3, i64* %1
%4 = icmp eq i64 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = load i64, i64* @EXIT_FAILURE
br label %17
9: ; preds = %0
%10 = call i8* @ctime(i64* %1)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %17
15: ; preds = %9
%16 = load i64, i64* %1
br label %17
17: ; preds = %15, %12, %5
%18 = phi i64 [ %8, %5 ], [ 0, %12 ], [ %16, %15 ]
ret i64 %18
}