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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *getprogname();
int /*<<< orphan*/ stderr;
char *strerror(int);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void verrc(int eval, int code, const char *fmt, va_list ap) {
  (void)fprintf(stderr, "%s: ", getprogname());
  if (fmt != NULL) {
    (void)vfprintf(stderr, fmt, ap);
    (void)fprintf(stderr, ": ");
  }
  (void)fprintf(stderr, "%s\n", strerror(code));
  exit(eval);
}


x86 assembly (clang, -O0):
<verrc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rdx
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11c3 <verrc+0x73>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
lea    0xe46(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<verrc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %rdx,%rbx
mov    %esi,%r12d
mov    %edi,%r14d
mov    0x2e72(%rip),%r13
mov    0x0(%r13),%ebp
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xe80(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rbx,%rbx
je     11b2 <verrc+0x62>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1050 <vfprintf@plt>
mov    0x0(%r13),%edi
lea    0xe57(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%r13),%ebx
mov    %r12d,%edi
call   1070 <strerror@plt>
lea    0xe40(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r14d,%edi
call   1060 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
@.str.1 = [3 x i8] c": \00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @verrc(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i8* (...) @getprogname()
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i8* %2, null
br i1 %8, label %14, label %9
9: ; preds = %4
%10 = load i32, i32* @stderr
%11 = tail call i32 @vfprintf(i32 %10, i8* %2, i32 %3)
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %9, %4
%15 = load i32, i32* @stderr
%16 = tail call i8* @strerror(i32 %1)
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 %0)
unreachable
}