#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 */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *,
                           char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
scalar_t__ strlen(char *);
void eprint(char *name, char *message, int error) {
  fprintf(stderr, "%s: %s%s %s\n", name, message,
          ((strlen(message) != 0 && error == 0) ? "" : ":"),
          (error != 0 ? strerror(error) : ""));
}


x86 assembly (clang, -O0):
<eprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2e96(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
je     1184 <eprint+0x54>
cmpl   $0x0,-0x14(%rbp)
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%dl
lea    0xe7f(%rip),%rax
lea    0xe77(%rip),%rcx
test   $0x1,%dl
cmovne %rcx,%rax
mov    %rax,-0x38(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11bb <eprint+0x8b>
mov    -0x14(%rbp),%edi
call   1050 <strerror@plt>
mov    %rax,-0x40(%rbp)
jmp    11cb <eprint+0x9b>
lea    0xe4a(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    11cb <eprint+0x9b>
mov    -0x38(%rbp),%r8
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%edi
mov    -0x40(%rbp),%r9
lea    0xe1b(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eprint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2ea6(%rip),%rax
mov    (%rax),%r12d
mov    (%rsi),%r13b
lea    0xec5(%rip),%rbx
mov    %rbx,%r9
test   %edx,%edx
je     1158 <eprint+0x38>
mov    %ebp,%edi
call   1040 <strerror@plt>
mov    %rax,%r9
test   %r13b,%r13b
lea    0xeab(%rip),%rax
cmove  %rax,%rbx
test   %ebp,%ebp
cmovne %rax,%rbx
lea    0xe8d(%rip),%rsi
mov    %r12d,%edi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"%s: %s%s %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c":\00"
define void @eprint(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 0
br label %16
16: ; preds = %13, %3
%17 = phi i1 [ false, %3 ], [ %15, %13 ]
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = load i32, i32* %6
%24 = call i8* @strerror(i32 %23)
br label %26
25: ; preds = %16
br label %26
26: ; preds = %25, %22
%27 = phi i8* [ %24, %22 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %25 ]
%28 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i8* %19, i8* %27)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"%s: %s%s %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c":\00"
define void @eprint(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = load i8, i8* %1
%6 = icmp eq i32 %2, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i8* @strerror(i32 %2)
br label %9
9: ; preds = %3, %7
%10 = phi i8* [ %8, %7 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %3 ]
%11 = icmp ne i8 %5, 0
%12 = and i1 %6, %11
%13 = select i1 %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%14 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %13, i8* %10)
ret void
}