#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 */
#define EAGAIN 133
#define EINTR 132
#define EINVAL 131
#define ENOSYS 130
#define ERANGE 129
#define ESRCH 128
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ quitnow(int);
int /*<<< orphan*/ stderr;
void failure_errno(const char *what, int errnoval) {
  switch (errnoval) {
  case EINVAL:
    fprintf(stderr,
            "adns failure: %s: errno="
            "EINVAL"
            "\n",
            what);
    break;
  case EINTR:
    fprintf(stderr,
            "adns failure: %s: errno="
            "EINTR"
            "\n",
            what);
    break;
  case ESRCH:
    fprintf(stderr,
            "adns failure: %s: errno="
            "ESRCH"
            "\n",
            what);
    break;
  case EAGAIN:
    fprintf(stderr,
            "adns failure: %s: errno="
            "EAGAIN"
            "\n",
            what);
    break;
  case ENOSYS:
    fprintf(stderr,
            "adns failure: %s: errno="
            "ENOSYS"
            "\n",
            what);
    break;
  case ERANGE:
    fprintf(stderr,
            "adns failure: %s: errno="
            "ERANGE"
            "\n",
            what);
    break;
  default:
    fprintf(stderr, "adns failure: %s: errno=%d\n", what, errnoval);
    break;
  }
  quitnow(2);
}


x86 assembly (clang, -O0):
<failure_errno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     1218 <failure_errno+0xf8>
mov    -0x18(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1236 <failure_errno+0x116>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1236 <failure_errno+0x116>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1236 <failure_errno+0x116>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1236 <failure_errno+0x116>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1236 <failure_errno+0x116>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1236 <failure_errno+0x116>
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <quitnow@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<failure_errno>:
push   %rax
mov    %esi,%ecx
mov    %rdi,%rdx
lea    -0x80(%rcx),%eax
cmp    $0x5,%eax
ja     1150 <failure_errno+0x30>
lea    0xecb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xf09(%rip),%rsi
jmp    11c1 <failure_errno+0xa1>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xf76(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
jmp    11c8 <failure_errno+0xa8>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
lea    0xf3d(%rip),%rsi
jmp    11c1 <failure_errno+0xa1>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
lea    0xf0b(%rip),%rsi
jmp    11c1 <failure_errno+0xa1>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
jmp    11c1 <failure_errno+0xa1>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
jmp    11c1 <failure_errno+0xa1>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x2,%edi
pop    %rax
jmp    1040 <quitnow@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"adns failure: %s: errno=EINVAL\0A\00"
@.str.1 = [31 x i8] c"adns failure: %s: errno=EINTR\0A\00"
@.str.2 = [31 x i8] c"adns failure: %s: errno=ESRCH\0A\00"
@.str.3 = [32 x i8] c"adns failure: %s: errno=EAGAIN\0A\00"
@.str.4 = [32 x i8] c"adns failure: %s: errno=ENOSYS\0A\00"
@.str.5 = [32 x i8] c"adns failure: %s: errno=ERANGE\0A\00"
@.str.6 = [28 x i8] c"adns failure: %s: errno=%d\0A\00"
define void @failure_errno(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %30 [
i32 131, label %6
i32 132, label %10
i32 128, label %14
i32 133, label %18
i32 130, label %22
i32 129, label %26
]
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %3
%9 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %35
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %3
%13 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %35
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %16)
br label %35
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %3
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %35
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = load i8*, i8** %3
%25 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %24)
br label %35
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %3
%29 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %28)
br label %35
30: ; preds = %2
%31 = load i32, i32* @stderr
%32 = load i8*, i8** %3
%33 = load i32, i32* %4
%34 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %32, i32 %33)
br label %35
35: ; preds = %30, %26, %22, %18, %14, %10, %6
%36 = call i32 @quitnow(i32 2)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"adns failure: %s: errno=EINVAL\0A\00"
@.str.1 = [31 x i8] c"adns failure: %s: errno=EINTR\0A\00"
@.str.2 = [31 x i8] c"adns failure: %s: errno=ESRCH\0A\00"
@.str.3 = [32 x i8] c"adns failure: %s: errno=EAGAIN\0A\00"
@.str.4 = [32 x i8] c"adns failure: %s: errno=ENOSYS\0A\00"
@.str.5 = [32 x i8] c"adns failure: %s: errno=ERANGE\0A\00"
@.str.6 = [28 x i8] c"adns failure: %s: errno=%d\0A\00"
define void @failure_errno(i8* %0, i32 %1) {
switch i32 %1, label %21 [
i32 131, label %3
i32 132, label %6
i32 128, label %9
i32 133, label %12
i32 130, label %15
i32 129, label %18
]
3: ; preds = %2
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %24
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %24
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %24
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %24
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %24
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i8* %0)
br label %24
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %0, i32 %1)
br label %24
24: ; preds = %21, %18, %15, %12, %9, %6, %3
%25 = tail call i32 @quitnow(i32 2)
ret void
}