#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;
};
struct timezone {
  int dummy;
};
struct timeval {
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
scalar_t__ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *getCurTime() {
  time_t curTimeValue;
  struct tm *ltime;
  static struct timeval _t;
  static struct timezone tz;
  static char CurTime[100];
  time(&curTimeValue);
  ltime = (struct tm *)localtime(&curTimeValue);
  gettimeofday(&_t, &tz);
  strftime(CurTime, 100, "%Y%m%d-%H:%M:%S", ltime);
  sprintf(CurTime, "%s.%06d", CurTime, (int)_t.tv_usec);
  return CurTime;
}


x86 assembly (clang, -O0):
<getCurTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
lea    0x2eeb(%rip),%rdi
lea    0x2eec(%rip),%rsi
call   1040 <gettimeofday@plt>
mov    -0x10(%rbp),%rcx
lea    0x2ee4(%rip),%rdi
mov    $0x64,%esi
lea    0xe68(%rip),%rdx
call   1060 <strftime@plt>
mov    0x2ebc(%rip),%rax
mov    %eax,%ecx
lea    0x2ec3(%rip),%rdx
lea    0xe5c(%rip),%rsi
mov    %rdx,%rdi
call   1070 <sprintf@plt>
lea    0x2ead(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCurTime>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%r14
lea    0x2eed(%rip),%rdi
lea    0x2eee(%rip),%rsi
call   1040 <gettimeofday@plt>
lea    0x2eea(%rip),%rbx
lea    0xe73(%rip),%rdx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r14,%rcx
call   1060 <strftime@plt>
mov    0x2ebd(%rip),%ecx
lea    0xe66(%rip),%rsi
mov    %rbx,%rdi
mov    %rbx,%rdx
call   1070 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
%struct.timezone = type { i32 }
%struct.tm = type { i32 }
@getCurTime._t = internal global %struct.timeval zeroinitializer
@getCurTime.tz = internal global %struct.timezone zeroinitializer
@getCurTime.CurTime = internal global [100 x i8] zeroinitializer
@.str = [16 x i8] c"%Y%m%d-%H:%M:%S\00"
@.str.1 = [8 x i8] c"%s.%06d\00"
define i8* @getCurTime() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* %1)
%4 = call i64 @localtime(i32* %1)
%5 = inttoptr i64 %4 to %struct.tm*
store %struct.tm* %5, %struct.tm** %2
%6 = call i32 @gettimeofday(%struct.timeval* @getCurTime._t, %struct.timezone* @getCurTime.tz)
%7 = load %struct.tm*, %struct.tm** %2
%8 = call i32 @strftime(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0), i32 100, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %struct.tm* %7)
%9 = load i64, i64* getelementptr inbounds (%struct.timeval, %struct.timeval* @getCurTime._t, i32 0, i32 0)
%10 = trunc i64 %9 to i32
%11 = call i32 @sprintf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0), i32 %10)
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
%struct.timezone = type { i32 }
%struct.tm = type { i32 }
@getCurTime._t = internal global %struct.timeval zeroinitializer
@getCurTime.tz = internal global %struct.timezone zeroinitializer
@getCurTime.CurTime = internal global [100 x i8] zeroinitializer
@.str = [16 x i8] c"%Y%m%d-%H:%M:%S\00"
@.str.1 = [8 x i8] c"%s.%06d\00"
define i8* @getCurTime() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call i64 @localtime(i32* %1)
%5 = inttoptr i64 %4 to %struct.tm*
%6 = call i32 @gettimeofday(%struct.timeval* @getCurTime._t, %struct.timezone* @getCurTime.tz)
%7 = call i32 @strftime(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0), i32 100, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%8 = load i64, i64* getelementptr inbounds (%struct.timeval, %struct.timeval* @getCurTime._t, i64 0, i32 0)
%9 = trunc i64 %8 to i32
%10 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0), i32 %9)
ret i8* getelementptr inbounds ([100 x i8], [100 x i8]* @getCurTime.CurTime, i64 0, i64 0)
}