#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 const *, char *,
                           int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror(int);
int _getconf_error(char const *message, int ret) {
  fputs("getconf"
        ": ",
        stderr);
  if (ret < 0) {
    fprintf(stderr, "%s%s%s\n", (message != NULL) ? message : "",
            (message != NULL) ? ": " : "", strerror(-ret));
    return -ret;
  }
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_getconf_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
lea    0xea1(%rip),%rdi
call   1030 <fputs@plt>
cmpl   $0x0,-0x14(%rbp)
jge    11f9 <_getconf_error+0xb9>
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1192 <_getconf_error+0x52>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    11a2 <_getconf_error+0x62>
lea    0xe78(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11a2 <_getconf_error+0x62>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdx
lea    0xe5c(%rip),%rax
lea    0xe4b(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x28(%rbp)
xor    %edi,%edi
sub    -0x14(%rbp),%edi
call   1060 <strerror@plt>
mov    -0x18(%rbp),%edi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    %eax,%r8d
lea    0xe23(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1208 <_getconf_error+0xc8>
mov    -0x10(%rbp),%rdi
call   1050 <perror@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getconf_error>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%rbx
mov    0x2e8c(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1030 <fputs@plt>
test   %r15d,%r15d
jns    11b6 <_getconf_error+0x76>
mov    0x0(%rbp),%r14d
test   %rbx,%rbx
lea    0xe9b(%rip),%rax
cmove  %rax,%rbx
lea    0xe86(%rip),%rbp
cmove  %rax,%rbp
neg    %r15d
mov    %r15d,%edi
call   1060 <strerror@plt>
lea    0xe73(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %eax,%r8d
call   1040 <fprintf@plt>
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
call   1050 <perror@plt>
jmp    11a8 <_getconf_error+0x68>

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

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