#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void pgr_abort(int code) {
  switch (code) {
  case 2:
    fprintf(stderr, "MEMORY ALLOCATION FAILURE; ABORTING.\n");
    break;
  case 3:
    fprintf(stderr, "THREAD (UN)LOCKING FAILURE; ABORTING.\n");
    break;
  case 4:
    fprintf(stderr, "UNRECOVERABLE NETWORK FAILURE; ABORTING.\n");
    break;
  case 5:
    fprintf(stderr, "INTERRUPTED DURING SYSCALL; ABORTING.\n");
    break;
  case 6:
    fprintf(stderr, "RANDOMNESS/ENTROPY FAILURE; ABORTING.\n");
    break;
  case 7:
    fprintf(stderr, "UNIMPLEMENTED FEAUTRE; ABORTING.\n");
    break;
  case 8:
    fprintf(stderr, "IMPOSSIBLE STATE (FILE A BUG); ABORTING.\n");
    break;
  default:
    fprintf(stderr, "UNKNOWN FAILURE (FILE A BUG); ABORTING.\n");
    break;
  }
  exit(code);
}


x86 assembly (clang, -O0):
<pgr_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     120a <pgr_abort+0xea>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121f <pgr_abort+0xff>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121f <pgr_abort+0xff>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121f <pgr_abort+0xff>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
lea    0xee1(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121f <pgr_abort+0xff>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
lea    0xeee(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121f <pgr_abort+0xff>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xefb(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121f <pgr_abort+0xff>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
lea    0xf03(%rip),%rsi
call   1030 <fprintf@plt>
jmp    121f <pgr_abort+0xff>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
lea    0xf13(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<pgr_abort>:
push   %rbx
mov    %edi,%ebx
lea    -0x2(%rbx),%eax
cmp    $0x6,%eax
ja     113d <pgr_abort+0x1d>
cltq
lea    0x1008(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
jmp    1144 <pgr_abort+0x24>
lea    0xfcd(%rip),%rsi
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"MEMORY ALLOCATION FAILURE; ABORTING.\0A\00"
@.str.1 = [39 x i8] c"THREAD (UN)LOCKING FAILURE; ABORTING.\0A\00"
@.str.2 = [42 x i8] c"UNRECOVERABLE NETWORK FAILURE; ABORTING.\0A\00"
@.str.3 = [39 x i8] c"INTERRUPTED DURING SYSCALL; ABORTING.\0A\00"
@.str.4 = [39 x i8] c"RANDOMNESS/ENTROPY FAILURE; ABORTING.\0A\00"
@.str.5 = [34 x i8] c"UNIMPLEMENTED FEAUTRE; ABORTING.\0A\00"
@.str.6 = [42 x i8] c"IMPOSSIBLE STATE (FILE A BUG); ABORTING.\0A\00"
@.str.7 = [41 x i8] c"UNKNOWN FAILURE (FILE A BUG); ABORTING.\0A\00"
define void @pgr_abort(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %25 [
i32 2, label %4
i32 3, label %7
i32 4, label %10
i32 5, label %13
i32 6, label %16
i32 7, label %19
i32 8, label %22
]
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %28
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
br label %28
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %28
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
br label %28
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
br label %28
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %28
22: ; preds = %1
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0))
br label %28
25: ; preds = %1
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
br label %28
28: ; preds = %25, %22, %19, %16, %13, %10, %7, %4
%29 = load i32, i32* %2
%30 = call i32 @exit(i32 %29)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"MEMORY ALLOCATION FAILURE; ABORTING.\0A\00"
@.str.1 = [39 x i8] c"THREAD (UN)LOCKING FAILURE; ABORTING.\0A\00"
@.str.2 = [42 x i8] c"UNRECOVERABLE NETWORK FAILURE; ABORTING.\0A\00"
@.str.3 = [39 x i8] c"INTERRUPTED DURING SYSCALL; ABORTING.\0A\00"
@.str.4 = [39 x i8] c"RANDOMNESS/ENTROPY FAILURE; ABORTING.\0A\00"
@.str.5 = [34 x i8] c"UNIMPLEMENTED FEAUTRE; ABORTING.\0A\00"
@.str.6 = [42 x i8] c"IMPOSSIBLE STATE (FILE A BUG); ABORTING.\0A\00"
@.str.7 = [41 x i8] c"UNKNOWN FAILURE (FILE A BUG); ABORTING.\0A\00"
@reltable.pgr_abort = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([38 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.pgr_abort to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.pgr_abort to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([42 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.pgr_abort to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.pgr_abort to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.pgr_abort to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.pgr_abort to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([42 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.pgr_abort to i64)) to i32)]
define void @pgr_abort(i32 %0) {
%2 = add i32 %0, -2
%3 = icmp ult i32 %2, 7
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.pgr_abort to i8*), i64 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i8* [ %7, %4 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), %1 ]
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* %9)
%12 = tail call i32 @exit(i32 %0)
unreachable
}