#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*/ LOG_ERR;
char *ctime(int /*<<< orphan*/ *);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void diep(char *s) {
  time_t now;
  char *ts;
  time(&now);
  ts = ctime(&now) + 4;
  ts[20] = '\0';
  if (errno) {
    perror(s);
  } else {
    puts(s);
  }
  syslog(LOG_ERR, s);
  exit(1);
}


x86 assembly (clang, -O0):
<diep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <time@plt>
lea    -0xc(%rbp),%rdi
call   1040 <ctime@plt>
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,0x14(%rax)
mov    0x2e4b(%rip),%rax
cmpq   $0x0,(%rax)
je     11ad <diep+0x4d>
mov    -0x8(%rbp),%rdi
call   1070 <perror@plt>
jmp    11b6 <diep+0x56>
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1060 <syslog@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<diep>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <time@plt>
mov    %r14,%rdi
call   1040 <ctime@plt>
movb   $0x0,0x18(%rax)
mov    0x2e59(%rip),%rax
cmpq   $0x0,(%rax)
je     11b0 <diep+0x50>
mov    %rbx,%rdi
call   1070 <perror@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1060 <syslog@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1195 <diep+0x35>

LLVM IR (-O0):
@errno = global i64 0
@LOG_ERR = global i32 0
define void @diep(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i32 @time(i32* %3)
%6 = call i8* @ctime(i32* %3)
%7 = getelementptr inbounds i8, i8* %6, i64 4
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 20
store i8 0, i8* %9
%10 = load i64, i64* @errno
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = call i32 @perror(i8* %13)
br label %18
15: ; preds = %1
%16 = load i8*, i8** %2
%17 = call i32 @puts(i8* %16)
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* @LOG_ERR
%20 = load i8*, i8** %2
%21 = call i32 @syslog(i32 %19, i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@errno = global i64 0
@LOG_ERR = global i32 0
define void @diep(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @time(i32* %2)
%5 = call i8* @ctime(i32* %2)
%6 = getelementptr inbounds i8, i8* %5, i64 24
store i8 0, i8* %6
%7 = load i64, i64* @errno
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 @perror(i8* %0)
br label %13
11: ; preds = %1
%12 = call i32 @puts(i8* dereferenceable(1) %0)
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* @LOG_ERR
%15 = call i32 @syslog(i32 %14, i8* %0)
%16 = call i32 @exit(i32 1)
unreachable
}