#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 */
char *asctime(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char const *);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
char *szCat(char const *, char const *, char const *, char const *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void ERRORMESSAGE(char const *s1, char const *s2, char const *s3,
                  char const *s4) {
  time_t t = time(NULL);
  fprintf(stdout, "ERROR: %s %s\n", asctime(localtime(&t)),
          s2 ? szCat(s1, s2, s3, s4) : s1);
}


x86 assembly (clang, -O0):
<ERRORMESSAGE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x24(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
lea    -0x24(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11bd <ERRORMESSAGE+0x6d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <szCat@plt>
mov    %rax,-0x40(%rbp)
jmp    11c5 <ERRORMESSAGE+0x75>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%edi
mov    -0x40(%rbp),%rcx
lea    0xe29(%rip),%rsi
call   1060 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ERRORMESSAGE>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0x4(%rsp)
mov    0x2e67(%rip),%rax
mov    (%rax),%r12d
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
mov    %rax,%r13
test   %rbp,%rbp
je     11a9 <ERRORMESSAGE+0x59>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <szCat@plt>
mov    %rax,%rbx
lea    0xe50(%rip),%rsi
mov    %r12d,%edi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1060 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [14 x i8] c"ERROR: %s %s\0A\00"
define void @ERRORMESSAGE(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = call i32 @time(i32* null)
store i32 %10, i32* %9
%11 = load i32, i32* @stdout
%12 = call i32 @localtime(i32* %9)
%13 = call i8* @asctime(i32 %12)
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %22
16: ; preds = %4
%17 = load i8*, i8** %5
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = load i8*, i8** %8
%21 = call i8* @szCat(i8* %17, i8* %18, i8* %19, i8* %20)
br label %24
22: ; preds = %4
%23 = load i8*, i8** %5
br label %24
24: ; preds = %22, %16
%25 = phi i8* [ %21, %16 ], [ %23, %22 ]
%26 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %25)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [14 x i8] c"ERROR: %s %s\0A\00"
define void @ERRORMESSAGE(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = tail call i32 @time(i32* null)
store i32 %7, i32* %5
%8 = load i32, i32* @stdout
%9 = call i32 @localtime(i32* %5)
%10 = call i8* @asctime(i32 %9)
%11 = icmp eq i8* %1, null
br i1 %11, label %14, label %12
12: ; preds = %4
%13 = call i8* @szCat(i8* %0, i8* %1, i8* %2, i8* %3)
br label %14
14: ; preds = %4, %12
%15 = phi i8* [ %13, %12 ], [ %0, %4 ]
%16 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %15)
ret void
}