#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 */
struct tm {
  int dummy;
};
struct timeval {
  int /*<<< orphan*/ tv_sec;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *timeStamp() {
  static char buf[32];
  struct timeval now;
  struct tm tmp;
  gettimeofday(&now, NULL);
  localtime_r(&now.tv_sec, &tmp);
  strftime(buf, sizeof(buf), "%F %T", &tmp);
  return buf;
}


x86 assembly (clang, -O0):
<timeStamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <localtime_r@plt>
lea    0x2ef7(%rip),%rdi
mov    $0x20,%esi
lea    0xe9b(%rip),%rdx
lea    -0x10(%rbp),%rcx
call   1050 <strftime@plt>
lea    0x2edb(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeStamp>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <localtime_r@plt>
lea    0x2ef3(%rip),%rbx
lea    0xe9c(%rip),%rdx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %r14,%rcx
call   1050 <strftime@plt>
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.tm = type { i32 }
@timeStamp.buf = internal global [32 x i8] zeroinitializer
@.str = [6 x i8] c"%F %T\00"
define i8* @timeStamp() {
%1 = alloca %struct.timeval
%2 = alloca %struct.tm
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = call i32 @localtime_r(i32* %4, %struct.tm* %2)
%6 = call i32 @strftime(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timeStamp.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timeStamp.buf, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.tm = type { i32 }
@timeStamp.buf = internal global [32 x i8] zeroinitializer
@.str = [6 x i8] c"%F %T\00"
define i8* @timeStamp() {
%1 = alloca %struct.timeval
%2 = alloca %struct.tm
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = call i32 @localtime_r(i32* %6, %struct.tm* %2)
%8 = call i32 @strftime(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timeStamp.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %struct.tm* %2)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timeStamp.buf, i64 0, i64 0)
}