#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;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void vpn_log_err(char *msg, char *error) {
  time_t timer;
  struct tm *tm_info;
  char time_f[28];
  time(&timer);
  tm_info = localtime(&timer);
  strftime(time_f, 28, "%d/%b/%Y %H:%M:%S %z", tm_info);
  fprintf(stderr, "%s ERROR %s %s \n", time_f, msg, error);
}


x86 assembly (clang, -O0):
<vpn_log_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x1c,%esi
lea    0xe86(%rip),%rdx
call   1060 <strftime@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    -0x40(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe7a(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpn_log_err>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe95(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1c,%esi
mov    %rax,%rcx
call   1060 <strftime@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe85(%rip),%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [21 x i8] c"%d/%b/%Y %H:%M:%S %z\00"
@stderr = global i32 0
@.str.1 = [17 x i8] c"%s ERROR %s %s \0A\00"
define void @vpn_log_err(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca %struct.tm*
%7 = alloca [28 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = call i32 @time(i32* %5)
%9 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %9, %struct.tm** %6
%10 = getelementptr inbounds [28 x i8], [28 x i8]* %7, i64 0, i64 0
%11 = load %struct.tm*, %struct.tm** %6
%12 = call i32 @strftime(i8* %10, i32 28, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
%13 = load i32, i32* @stderr
%14 = getelementptr inbounds [28 x i8], [28 x i8]* %7, i64 0, i64 0
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [21 x i8] c"%d/%b/%Y %H:%M:%S %z\00"
@stderr = global i32 0
@.str.1 = [17 x i8] c"%s ERROR %s %s \0A\00"
define void @vpn_log_err(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca [28 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [28 x i8], [28 x i8]* %4, i64 0, i64 0
%7 = call i32 @time(i32* %3)
%8 = call %struct.tm* @localtime(i32* %3)
%9 = call i32 @strftime(i8* %6, i32 28, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.tm* %8)
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %0, i8* %1)
ret void
}