#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;
char *ctime(scalar_t__ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ time(int /*<<< orphan*/ *);
void prtime(void) {
  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");
    exit(EXIT_FAILURE);
  }
  c_time_string = ctime(&current_time);
  if (c_time_string == NULL) {
    (void)fprintf(stderr, "Failure to convert the current time.\n");
    exit(EXIT_FAILURE);
  }
  (void)printf("%s", c_time_string);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<prtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0xffffffffffffffff,-0x8(%rbp)
jne    11a3 <prtime+0x43>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe70(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    -0x8(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11de <prtime+0x7e>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rsi
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prtime>:
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %rax,(%rsp)
cmp    $0xffffffffffffffff,%rax
je     119e <prtime+0x3e>
mov    %rsp,%rdi
call   1030 <ctime@plt>
test   %rax,%rax
je     11b0 <prtime+0x50>
lea    0xec5(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
pop    %rax
ret
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
jmp    11c0 <prtime+0x60>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

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

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