#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;
};
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, long);
scalar_t__ getpid();
struct tm *gmtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void PrintLogPrefix(void) {
  time_t t = time(NULL);
  struct tm tm_buf;
  struct tm *tm = gmtime_r(&t, &tm_buf);
  char s[32];
  if (!strftime(s, sizeof(s), "%Y-%m-%dT%H:%M:%SZ ", tm)) {
    *s = 0;
  }
  fprintf(stderr, "%s%ld xsecurelock: ", s, (long)getpid());
}


x86 assembly (clang, -O0):
<PrintLogPrefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <gmtime_r@plt>
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x20,%esi
lea    0xe77(%rip),%rdx
call   1070 <strftime@plt>
cmp    $0x0,%eax
jne    119b <PrintLogPrefix+0x4b>
movb   $0x0,-0x30(%rbp)
mov    0x2e3e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rdx
mov    %rax,%rcx
lea    0xe4d(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintLogPrefix>:
push   %rbx
sub    $0x30,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1040 <gmtime_r@plt>
lea    0xe8a(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x20,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
test   %eax,%eax
jne    1191 <PrintLogPrefix+0x41>
movb   $0x0,0x10(%rsp)
mov    0x2e48(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xe6c(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
call   1050 <fprintf@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%Y-%m-%dT%H:%M:%SZ \00"
@stderr = global i32 0
@.str.1 = [20 x i8] c"%s%ld xsecurelock: \00"
define void @PrintLogPrefix() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca %struct.tm*
%4 = alloca [32 x i8]
%5 = call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = call %struct.tm* @gmtime_r(i32* %1, %struct.tm* %2)
store %struct.tm* %6, %struct.tm** %3
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = load %struct.tm*, %struct.tm** %3
%9 = call i32 @strftime(i8* %7, i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %0
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
store i8 0, i8* %12
br label %13
13: ; preds = %11, %0
%14 = load i32, i32* @stderr
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%16 = call i64 (...) @getpid()
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %15, i64 %16)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%Y-%m-%dT%H:%M:%SZ \00"
@stderr = global i32 0
@.str.1 = [20 x i8] c"%s%ld xsecurelock: \00"
define void @PrintLogPrefix() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca [32 x i8]
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = bitcast %struct.tm* %2 to i8*
%7 = call %struct.tm* @gmtime_r(i32* %1, %struct.tm* %2)
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%9 = call i32 @strftime(i8* %8, i32 32, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %7)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %0
store i8 0, i8* %8
br label %12
12: ; preds = %11, %0
%13 = load i32, i32* @stderr
%14 = call i64 (...) @getpid()
%15 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %8, i64 %14)
ret void
}