#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*/ fprintf(int /*<<< orphan*/, char *, char *,
                           int /*<<< orphan*/);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
void print_timeofday() {
  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));
  fprintf(stderr, "%s%ld\n", buffer, tv.tv_usec);
}


x86 assembly (clang, -O0):
<print_timeofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <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>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%ecx
lea    0xe74(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_timeofday>:
push   %rbx
sub    $0x30,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <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    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rsp),%ecx
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdx
call   1050 <fprintf@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [14 x i8] c"%m-%d-%Y %T.\00"
@stderr = global i32 0
@.str.1 = [7 x i8] c"%s%ld\0A\00"
define void @print_timeofday() {
%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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stderr
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %13)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [14 x i8] c"%m-%d-%Y %T.\00"
@stderr = global i32 0
@.str.1 = [7 x i8] c"%s%ld\0A\00"
define void @print_timeofday() {
%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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @stderr
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%14 = load i32, i32* %13
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %14)
ret void
}