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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void ax_log(char *str) {
  time_t t;
  char t_str[30];
  time(&t);
  strftime(t_str, 30, "[%d.%m.%Y %X] ", localtime(&t));
  fprintf(stderr, t_str);
  fprintf(stderr, str);
}


x86 assembly (clang, -O0):
<ax_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <time@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%ecx
mov    $0x1e,%esi
lea    0xe88(%rip),%rdx
call   1060 <strftime@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
call   1040 <fprintf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1040 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ax_log>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%r14
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe98(%rip),%rdx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x1e,%esi
mov    %eax,%ecx
call   1060 <strftime@plt>
mov    0x2e5d(%rip),%rbx
mov    (%rbx),%edi
mov    %r15,%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    %r14,%rsi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"[%d.%m.%Y %X] \00"
@stderr = global i32 0
define void @ax_log(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [30 x i8]
store i8* %0, i8** %2
%5 = call i32 @time(i32* %3)
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%7 = call i32 @localtime(i32* %3)
%8 = call i32 @strftime(i8* %6, i32 30, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stderr
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%11 = call i32 @fprintf(i32 %9, i8* %10)
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %2
%14 = call i32 @fprintf(i32 %12, i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"[%d.%m.%Y %X] \00"
@stderr = global i32 0
define void @ax_log(i8* %0) {
%2 = alloca i32
%3 = alloca [30 x i8]
%4 = bitcast i32* %2 to i8*
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%6 = call i32 @time(i32* %2)
%7 = call i32 @localtime(i32* %2)
%8 = call i32 @strftime(i8* %5, i32 30, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* %5)
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* %0)
ret void
}