#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 errno;
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 verr(int eval, const char *fmt, va_list ap) {
  int sverrno;
  sverrno = errno;
  (void)fprintf(stderr, "%s: ", getprogname());
  if (fmt != NULL) {
    (void)vfprintf(stderr, fmt, ap);
    (void)fprintf(stderr, ": ");
  }
  (void)fprintf(stderr, "%s\n", strerror(sverrno));
  exit(eval);
}


x86 assembly (clang, -O0):
<verr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2e6f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe72(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11cc <verr+0x7c>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1070 <strerror@plt>
mov    -0x20(%rbp),%edi
mov    %rax,%rdx
lea    0xe18(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<verr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %edi,%r14d
mov    0x2e6d(%rip),%rax
mov    (%rax),%r12d
mov    0x2e6b(%rip),%r13
mov    0x0(%r13),%ebp
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xe79(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
test   %rbx,%rbx
je     11b9 <verr+0x69>
mov    0x0(%r13),%edi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1050 <vfprintf@plt>
mov    0x0(%r13),%edi
lea    0xe50(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%r13),%ebx
mov    %r12d,%edi
call   1070 <strerror@plt>
lea    0xe39(%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):
@errno = global i32 0
@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 @verr(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* @errno
store i32 %8, i32* %7
%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** %5
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %21
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%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, %3
%22 = load i32, i32* @stderr
%23 = load i32, i32* %7
%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* %4
%27 = call i32 @exit(i32 %26)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@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 @verr(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @errno
%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* %1, null
br i1 %8, label %14, label %9
9: ; preds = %3
%10 = load i32, i32* @stderr
%11 = tail call i32 @vfprintf(i32 %10, i8* %1, i32 %2)
%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, %3
%15 = load i32, i32* @stderr
%16 = tail call i8* @strerror(i32 %4)
%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
}