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

/* Variables and functions */
struct tm *localtime(long *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
const char *strxf_time(__u64 time) {
  static char str[32];
  if (time == 0)
    strcpy(str, "-");
  else {
    time_t t;
    struct tm *tp;
    t = (long)time;
    tp = localtime(&t);
    strftime(str, sizeof(str), "%Y-%m-%d %T", tp);
  }
  return str;
}


x86 assembly (clang, -O0):
<strxf_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115f <strxf_time+0x2f>
lea    0x2f02(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1190 <strxf_time+0x60>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
lea    0x2ed1(%rip),%rdi
mov    $0x20,%esi
lea    0xe77(%rip),%rdx
call   1050 <strftime@plt>
lea    0x2eb9(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxf_time>:
push   %rax
test   %rdi,%rdi
je     115f <strxf_time+0x2f>
mov    %rdi,(%rsp)
mov    %rsp,%rdi
call   1030 <localtime@plt>
lea    0x2f07(%rip),%rdi
lea    0xeb2(%rip),%rdx
mov    $0x20,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
jmp    1172 <strxf_time+0x42>
lea    0x2eea(%rip),%rdi
lea    0xe93(%rip),%rsi
call   1040 <strcpy@plt>
lea    0x2ed7(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@strxf_time.str = internal global [32 x i8] zeroinitializer
@.str = [2 x i8] c"-\00"
@.str.1 = [12 x i8] c"%Y-%m-%d %T\00"
define i8* @strxf_time(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca %struct.tm*
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_time.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
9: ; preds = %1
%10 = load i64, i64* %2
store i64 %10, i64* %3
%11 = call %struct.tm* @localtime(i64* %3)
store %struct.tm* %11, %struct.tm** %4
%12 = load %struct.tm*, %struct.tm** %4
%13 = call i32 @strftime(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_time.str, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %12)
br label %14
14: ; preds = %9, %7
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_time.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@strxf_time.str = internal global [32 x i8] zeroinitializer
@.str = [2 x i8] c"-\00"
@.str.1 = [12 x i8] c"%Y-%m-%d %T\00"
define i8* @strxf_time(i64 %0) {
%2 = alloca i64
%3 = icmp eq i64 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_time.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %1
%7 = bitcast i64* %2 to i8*
store i64 %0, i64* %2
%8 = call %struct.tm* @localtime(i64* %2)
%9 = call i32 @strftime(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_time.str, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %struct.tm* %8)
br label %10
10: ; preds = %6, %4
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_time.str, i64 0, i64 0)
}