#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 tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  int /*<<< orphan*/ tm_mon;
};
struct timeval {
  int /*<<< orphan*/ tv_sec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int, int, int,
                           int);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
char *mon2name(int /*<<< orphan*/);
int flogtime(FILE *f) {
  struct timeval tv;
  struct tm *tm;
  gettimeofday(&tv, NULL);
  tm = localtime((time_t *)&tv.tv_sec);
  fprintf(f, "%s %2d %02d:%02d:%02d: ", mon2name(tm->tm_mon), tm->tm_mday,
          tm->tm_hour, tm->tm_min, tm->tm_sec);
  return 0;
}


x86 assembly (clang, -O0):
<flogtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%edi
call   1060 <mon2name@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%r8d
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%eax
lea    0xe5b(%rip),%rsi
mov    %eax,(%rsp)
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flogtime>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    0x10(%rax),%edi
call   1060 <mon2name@plt>
mov    (%rbx),%ecx
mov    0x4(%rbx),%r8d
mov    0x8(%rbx),%r9d
mov    0xc(%rbx),%edx
mov    %edx,(%rsp)
lea    0xe7d(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1050 <fprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32 }
@.str = [24 x i8] c"%s %2d %02d:%02d:%02d: \00"
define i32 @flogtime(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.timeval
%4 = alloca %struct.tm*
store i32* %0, i32** %2
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%7 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %7, %struct.tm** %4
%8 = load i32*, i32** %2
%9 = load %struct.tm*, %struct.tm** %4
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 4
%11 = load i32, i32* %10
%12 = call i8* @mon2name(i32 %11)
%13 = load %struct.tm*, %struct.tm** %4
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = load %struct.tm*, %struct.tm** %4
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = load %struct.tm*, %struct.tm** %4
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 2
%21 = load i32, i32* %20
%22 = load %struct.tm*, %struct.tm** %4
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 3
%24 = load i32, i32* %23
%25 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %15, i32 %18, i32 %21, i32 %24)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32 }
@.str = [24 x i8] c"%s %2d %02d:%02d:%02d: \00"
define i32 @flogtime(i32* nocapture %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%6 = call %struct.tm* @localtime(i32* %5)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 4
%8 = load i32, i32* %7
%9 = call i8* @mon2name(i32 %8)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%17 = load i32, i32* %16
%18 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %11, i32 %13, i32 %15, i32 %17)
ret i32 0
}