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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strftime(char *, int, char *, struct tm *);
void ShowTime(time_t *tv) {
  if (tv == NULL)
    return;
  struct tm *tmptr = localtime(tv);
  char buf[64];
  if (strftime(buf, 64, "%c", tmptr) != 0) {
    printf("%s\n", buf);
  }
}


x86 assembly (clang, -O0):
<ShowTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114c <ShowTime+0x1c>
jmp    118c <ShowTime+0x5c>
mov    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x40,%esi
lea    0xe93(%rip),%rdx
call   1050 <strftime@plt>
cmp    $0x0,%rax
je     118c <ShowTime+0x5c>
lea    -0x50(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowTime>:
test   %rdi,%rdi
je     116d <ShowTime+0x3d>
sub    $0x48,%rsp
call   1030 <localtime@plt>
lea    0xebb(%rip),%rdx
mov    %rsp,%rdi
mov    $0x40,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
test   %rax,%rax
je     1169 <ShowTime+0x39>
lea    0xea2(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
add    $0x48,%rsp
ret

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

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