#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 */
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int const, char const *,
                           char const *, ...);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
void pd_error(const char *message, const char *file_origin,
              const int line_origin) {
  if (errno) {
    fprintf(stderr, "(%d : %s) :: %s: %s\n", line_origin, file_origin, message,
            strerror(errno));
  } else {
    fprintf(stderr, "(%d : %s) :: %s \n", line_origin, file_origin, message);
  }
}


x86 assembly (clang, -O0):
<pd_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2e9e(%rip),%rax
cmpq   $0x0,(%rax)
je     1199 <pd_error+0x79>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%rdi
call   1040 <strerror@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    %rax,%r9
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11bb <pd_error+0x9b>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pd_error>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%r14
mov    0x2ea2(%rip),%rax
mov    (%rax),%rdi
mov    0x2ea0(%rip),%rax
mov    (%rax),%ebx
test   %rdi,%rdi
je     1171 <pd_error+0x51>
call   1040 <strerror@plt>
lea    0xead(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r14,%r8
mov    %rax,%r9
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xe9d(%rip),%rsi
mov    %ebx,%edi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %r14,%r8
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@errno = global i64 0
@stderr = global i32 0
@.str = [21 x i8] c"(%d : %s) :: %s: %s\0A\00"
@.str.1 = [18 x i8] c"(%d : %s) :: %s \0A\00"
define void @pd_error(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 i64, i64* @errno
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = load i32, i32* %6
%12 = load i8*, i8** %5
%13 = load i8*, i8** %4
%14 = load i64, i64* @errno
%15 = call i8* @strerror(i64 %14)
%16 = call i32 (i32, i8*, i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %12, i8* %13, i8* %15)
br label %23
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = load i32, i32* %6
%20 = load i8*, i8** %5
%21 = load i8*, i8** %4
%22 = call i32 (i32, i8*, i32, i8*, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %20, i8* %21)
br label %23
23: ; preds = %17, %9
ret void
}

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