#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 time_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
char *asctime(int /*<<< orphan*/);
char *ctime(int *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ gmtime(int *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(void) {
  time_t highest_value = 0x7FFFFFFF;
  char *str_datec = ctime(&highest_value);
  if (str_datec == NULL) {
    fprintf(stderr, "Err. ctime() failed: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  printf("  Highest value (ctime): %s", str_datec);
  char *str_datea = asctime(gmtime(&highest_value));
  if (str_datea == NULL) {
    fprintf(stderr, "Err. asctime() failed: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  printf("Highest value (asctime): %s\n", str_datea);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7fffffff,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11d8 <main+0x68>
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe3b(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rsi
lea    0xe36(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1070 <gmtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1241 <main+0xd1>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xe07(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x18(%rbp),%rsi
lea    0xe04(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x7fffffff,0xc(%rsp)
7f
lea    0xc(%rsp),%rdi
call   1030 <ctime@plt>
test   %rax,%rax
je     11cf <main+0x5f>
lea    0xe86(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
lea    0xc(%rsp),%rdi
call   1070 <gmtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
test   %rax,%rax
je     11ef <main+0x7f>
lea    0xe98(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e0a(%rip),%rax
mov    (%rax),%ebx
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xe13(%rip),%rsi
jmp    120d <main+0x9d>
mov    0x2dea(%rip),%rax
mov    (%rax),%ebx
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
call   1090 <strerror@plt>
lea    0xe28(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1060 <fprintf@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Err. ctime() failed: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c" Highest value (ctime): %s\00"
@.str.2 = [27 x i8] c"Err. asctime() failed: %s\0A\00"
@.str.3 = [29 x i8] c"Highest value (asctime): %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
store i32 2147483647, i32* %2
%5 = call i8* @ctime(i32* %2)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %15
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = call i8* @strerror(i32 %10)
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = load i8*, i8** %3
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32 @gmtime(i32* %2)
%19 = call i8* @asctime(i32 %18)
store i8* %19, i8** %4
%20 = load i8*, i8** %4
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %29
22: ; preds = %15
%23 = load i32, i32* @stderr
%24 = load i32, i32* @errno
%25 = call i8* @strerror(i32 %24)
%26 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %15
%30 = load i8*, i8** %4
%31 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Err. ctime() failed: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c" Highest value (ctime): %s\00"
@.str.2 = [27 x i8] c"Err. asctime() failed: %s\0A\00"
@.str.3 = [29 x i8] c"Highest value (asctime): %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 2147483647, i32* %1
%3 = call i8* @ctime(i32* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %12
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = call i8* @strerror(i32 %7)
%9 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%14 = call i32 @gmtime(i32* %1)
%15 = call i8* @asctime(i32 %14)
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %24
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = load i32, i32* @errno
%20 = call i8* @strerror(i32 %19)
%21 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %12
%25 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}