#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 */
int /*<<< orphan*/ asctime(struct tm *);
struct tm *localtime(int /*<<< orphan*/ *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
const char *logTime() {
  static char buf[128];
  struct tm *tm1;
  time_t lTime;
  time(&lTime);
  tm1 = localtime(&lTime);
  strcpy(buf, asctime(tm1));
  char *p = strchr(buf, '\n');
  if (p)
    *p = '\0';
  return buf;
}


x86 assembly (clang, -O0):
<logTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0xc(%rbp),%rdi
call   1070 <time@plt>
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <asctime@plt>
mov    %eax,%esi
lea    0x2ee0(%rip),%rdi
call   1040 <strcpy@plt>
lea    0x2ed4(%rip),%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11ac <logTime+0x5c>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2ead(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logTime>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rdi
call   1050 <asctime@plt>
lea    0x2ee7(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1198 <logTime+0x48>
movb   $0x0,(%rax)
lea    0x2ec1(%rip),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@logTime.buf = internal global [128 x i8] zeroinitializer
define i8* @logTime() {
%1 = alloca %struct.tm*
%2 = alloca i32
%3 = alloca i8*
%4 = call i32 @time(i32* %2)
%5 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %5, %struct.tm** %1
%6 = load %struct.tm*, %struct.tm** %1
%7 = call i32 @asctime(%struct.tm* %6)
%8 = call i32 @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @logTime.buf, i64 0, i64 0), i32 %7)
%9 = call i8* @strchr(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @logTime.buf, i64 0, i64 0), i8 signext 10)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = load i8*, i8** %3
store i8 0, i8* %13
br label %14
14: ; preds = %12, %0
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @logTime.buf, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@logTime.buf = internal global [128 x i8] zeroinitializer
define i8* @logTime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = call i32 @asctime(%struct.tm* %4)
%6 = call i32 @strcpy(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @logTime.buf, i64 0, i64 0), i32 %5)
%7 = call i8* @strchr(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @logTime.buf, i64 0, i64 0), i8 signext 10)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %0
store i8 0, i8* %7
br label %10
10: ; preds = %9, %0
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @logTime.buf, i64 0, i64 0)
}