#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 timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
void prTime() {
  char buffer[30];
  struct timeval tv;
  time_t curtime;
  gettimeofday(&tv, NULL);
  curtime = tv.tv_sec;
  strftime(buffer, 30, "%m-%d-%Y %T.", localtime(&curtime));
  printf("%s%ld", buffer, tv.tv_usec);
  return;
}


x86 assembly (clang, -O0):
<prTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x2c(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%ecx
mov    $0x1e,%esi
lea    0xe82(%rip),%rdx
call   1060 <strftime@plt>
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prTime>:
push   %rbx
sub    $0x30,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xe96(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1e,%esi
mov    %eax,%ecx
call   1060 <strftime@plt>
mov    0x8(%rsp),%edx
lea    0xe84(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [13 x i8] c"%m-%d-%Y %T.\00"
@.str.1 = [6 x i8] c"%s%ld\00"
define void @prTime() {
%1 = alloca [30 x i8]
%2 = alloca %struct.timeval
%3 = alloca i32
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%8 = call i32 @localtime(i32* %3)
%9 = call i32 @strftime(i8* %7, i32 30, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [13 x i8] c"%m-%d-%Y %T.\00"
@.str.1 = [6 x i8] c"%s%ld\00"
define void @prTime() {
%1 = alloca [30 x i8]
%2 = alloca %struct.timeval
%3 = alloca i32
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%5 = bitcast %struct.timeval* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%9 = load i32, i32* %8
store i32 %9, i32* %3
%10 = call i32 @localtime(i32* %3)
%11 = call i32 @strftime(i8* %4, i32 30, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %13)
ret void
}