#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;
int /*<<< orphan*/ EXIT_SUCCESS;
char *ctime(scalar_t__ *);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
char *strerror(int);
scalar_t__ time(int /*<<< orphan*/ *);
int main(int args, char *argv[]) {
  time_t tim = time(NULL);
  if (tim == (time_t)-1) {
    int errn = errno;
    printf("time: %s\n", strerror(errn));
    exit(EXIT_FAILURE);
  }
  printf("Human readable time %s\n", ctime(&tim));
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    11af <main+0x5f>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <strerror@plt>
mov    %rax,%rsi
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
lea    -0x18(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
lea    0xe48(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,(%rsp)
cmp    $0xffffffffffffffff,%rax
jne    118d <main+0x3d>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe89(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    %rsp,%rdi
call   1030 <ctime@plt>
lea    0xe6e(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [10 x i8] c"time: %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [24 x i8] c"Human readable time %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 @time(i32* null)
store i64 %8, i64* %6
%9 = load i64, i64* %6
%10 = icmp eq i64 %9, -1
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @errno
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @exit(i32 %16)
unreachable
18: ; preds = %2
%19 = call i8* @ctime(i64* %6)
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_SUCCESS
%22 = call i32 @exit(i32 %21)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [10 x i8] c"time: %s\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [24 x i8] c"Human readable time %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = tail call i64 @time(i32* null)
store i64 %5, i64* %3
%6 = icmp eq i64 %5, -1
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = call i8* @ctime(i64* %3)
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_SUCCESS
%17 = call i32 @exit(i32 %16)
unreachable
}