#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;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void writervnlog(FILE *fd, char *msg) {
  time_t now;
  char atime[30] = "";
  now = time(NULL);
  strcpy(atime, ctime(&now));
  atime[strlen(atime) - 1] = '\0';
  fprintf(fd, "%s: %s\n", atime, msg);
}


x86 assembly (clang, -O0):
<writervnlog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x1e,%edx
call   1060 <memset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <ctime@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x40(%rbp,%rax,1)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe32(%rip),%rsi
call   1070 <fprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writervnlog>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
xorps  %xmm0,%xmm0
movups %xmm0,0x1e(%rsp)
movaps %xmm0,0x10(%rsp)
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <ctime@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
lea    0xe5a(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1060 <fprintf@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %s\0A\00"
define void @writervnlog(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [30 x i8]
store i32* %0, i32** %3
store i8* %1, i8** %4
%7 = bitcast [30 x i8]* %6 to i8*
%8 = call i32 @time(i32* null)
store i32 %8, i32* %5
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%10 = call i32 @ctime(i32* %5)
%11 = call i32 @strcpy(i8* %9, i32 %10)
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 %15
store i8 0, i8* %16
%17 = load i32*, i32** %3
%18 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%19 = load i8*, i8** %4
%20 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %19)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\0A\00"
define void @writervnlog(i32* nocapture %0, i8* %1) {
%3 = alloca i32
%4 = alloca [30 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @time(i32* null)
store i32 %7, i32* %3
%8 = call i32 @ctime(i32* %3)
%9 = call i32 @strcpy(i8* %6, i32 %8)
%10 = call i32 @strlen(i8* %6)
%11 = add nsw i32 %10, -1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 %12
store i8 0, i8* %13
%14 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %1)
ret void
}