#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;
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ asctime(struct tm *);
int /*<<< orphan*/ printf(char *, char *, long long, ...);
int check_date(struct tm *date, time_t time, char *name) {
  if (date == NULL) {
    printf("%s(%lld) returned null\n", name, (long long)time);
    return 1;
  } else {
    printf("%s(%lld): %s\n", name, (long long)time, asctime(date));
    return 0;
  }
}


x86 assembly (clang, -O0):
<check_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1161 <check_date+0x41>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1199 <check_date+0x79>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <asctime@plt>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_date>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
test   %rdi,%rdi
je     114e <check_date+0x2e>
call   1030 <asctime@plt>
lea    0xedd(%rip),%rdi
xor    %ebp,%ebp
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1167 <check_date+0x47>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [24 x i8] c"%s(%lld) returned null\0A\00"
@.str.1 = [14 x i8] c"%s(%lld): %s\0A\00"
define i32 @check_date(%struct.tm* %0, i64 %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.tm*
%6 = alloca i64
%7 = alloca i8*
store %struct.tm* %0, %struct.tm** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
%8 = load %struct.tm*, %struct.tm** %5
%9 = icmp eq %struct.tm* %8, null
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %7
%12 = load i64, i64* %6
%13 = call i32 (i8*, i8*, i64, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %11, i64 %12)
store i32 1, i32* %4
br label %20
14: ; preds = %3
%15 = load i8*, i8** %7
%16 = load i64, i64* %6
%17 = load %struct.tm*, %struct.tm** %5
%18 = call i32 @asctime(%struct.tm* %17)
%19 = call i32 (i8*, i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %15, i64 %16, i32 %18)
store i32 0, i32* %4
br label %20
20: ; preds = %14, %10
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [24 x i8] c"%s(%lld) returned null\0A\00"
@.str.1 = [14 x i8] c"%s(%lld): %s\0A\00"
define i32 @check_date(%struct.tm* %0, i64 %1, i8* %2) {
%4 = icmp eq %struct.tm* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (i8*, i8*, i64, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2, i64 %1)
br label %10
7: ; preds = %3
%8 = tail call i32 @asctime(%struct.tm* %0)
%9 = tail call i32 (i8*, i8*, i64, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %2, i64 %1, i32 %8)
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %11
}