#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*/ LOG_ERR;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, char const *, int, char *);
int /*<<< orphan*/ pfpanic_show_stacktrace(unsigned short);
int /*<<< orphan*/ stderr;
char *strerror(int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char const *,
                          char const *, char const *, int, char *);
void pfpanic(const char *_msg, unsigned short _syslog, unsigned short _verbose,
             const char *_function_name, const char *_file_name,
             int _line_number, int _errno, int _status) {
  if (_syslog) {
    if (_verbose)
      syslog(LOG_ERR, "%s: file=%s, function=%s, line=%d (%s)\n", _msg,
             _file_name, _function_name, _line_number, strerror(_errno));
  } else
    fprintf(stderr, "%s: file=%s, function=%s, line=%d (%s)\n", _msg,
            _file_name, _function_name, _line_number, strerror(_errno));
  pfpanic_show_stacktrace(_syslog);
  if (_syslog)
    abort();
  else
    exit(_status);
}


x86 assembly (clang, -O0):
<pfpanic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %dx,%ax
mov    %si,%dx
mov    0x18(%rbp),%esi
mov    0x10(%rbp),%esi
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpw   $0x0,-0xa(%rbp)
je     11fc <pfpanic+0x9c>
cmpw   $0x0,-0xc(%rbp)
je     11f7 <pfpanic+0x97>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    0x10(%rbp),%edi
call   1080 <strerror@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%r9d
lea    0xe12(%rip),%rsi
mov    %rax,(%rsp)
call   1050 <syslog@plt>
jmp    1251 <pfpanic+0xf1>
mov    0x2ddd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    0x10(%rbp),%edi
call   1080 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x48(%rbp),%r9d
lea    0xdb8(%rip),%rsi
mov    %rax,(%rsp)
call   1040 <fprintf@plt>
movzwl -0xa(%rbp),%edi
call   1060 <pfpanic_show_stacktrace@plt>
cmpw   $0x0,-0xa(%rbp)
je     126c <pfpanic+0x10c>
mov    $0x0,%al
call   1030 <abort@plt>
mov    0x18(%rbp),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<pfpanic>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdi,%rbx
mov    0x40(%rsp),%edi
test   %esi,%esi
jne    11bf <pfpanic+0x5f>
mov    0x48(%rsp),%r13d
mov    0x2e55(%rip),%rax
mov    (%rax),%ebp
call   1080 <strerror@plt>
mov    %rax,(%rsp)
lea    0xe63(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14d,%r9d
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1060 <pfpanic_show_stacktrace@plt>
mov    %r13d,%edi
call   1070 <exit@plt>
mov    %esi,%ebp
test   %dx,%dx
je     11f4 <pfpanic+0x94>
mov    0x2e03(%rip),%rax
mov    (%rax),%r13d
call   1080 <strerror@plt>
mov    %rax,(%rsp)
lea    0xe20(%rip),%rsi
mov    %r13d,%edi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
mov    %r14d,%r9d
call   1050 <syslog@plt>
movzwl %bp,%edi
call   1060 <pfpanic_show_stacktrace@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [40 x i8] c"%s: file=%s, function=%s, line=%d (%s)\0A\00"
@stderr = global i32 0
define void @pfpanic(i8* %0, i16 zeroext %1, i16 zeroext %2, i8* %3, i8* %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i16
%11 = alloca i16
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %9
store i16 %1, i16* %10
store i16 %2, i16* %11
store i8* %3, i8** %12
store i8* %4, i8** %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i16, i16* %10
%18 = icmp ne i16 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %8
%20 = load i16, i16* %11
%21 = icmp ne i16 %20, 0
br i1 %21, label %22, label %31
22: ; preds = %19
%23 = load i32, i32* @LOG_ERR
%24 = load i8*, i8** %9
%25 = load i8*, i8** %13
%26 = load i8*, i8** %12
%27 = load i32, i32* %14
%28 = load i32, i32* %15
%29 = call i8* @strerror(i32 %28)
%30 = call i32 @syslog(i32 %23, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %25, i8* %26, i32 %27, i8* %29)
br label %31
31: ; preds = %22, %19
br label %41
32: ; preds = %8
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %9
%35 = load i8*, i8** %13
%36 = load i8*, i8** %12
%37 = load i32, i32* %14
%38 = load i32, i32* %15
%39 = call i8* @strerror(i32 %38)
%40 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %34, i8* %35, i8* %36, i32 %37, i8* %39)
br label %41
41: ; preds = %32, %31
%42 = load i16, i16* %10
%43 = call i32 @pfpanic_show_stacktrace(i16 zeroext %42)
%44 = load i16, i16* %10
%45 = icmp ne i16 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = call i32 (...) @abort()
unreachable
48: ; preds = %41
%49 = load i32, i32* %16
%50 = call i32 @exit(i32 %49)
unreachable
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [40 x i8] c"%s: file=%s, function=%s, line=%d (%s)\0A\00"
@stderr = global i32 0
define void @pfpanic(i8* %0, i16 zeroext %1, i16 zeroext %2, i8* %3, i8* %4, i32 %5, i32 %6, i32 %7) {
%9 = icmp eq i16 %1, 0
br i1 %9, label %19, label %10
10: ; preds = %8
%11 = icmp eq i16 %2, 0
br i1 %11, label %16, label %12
12: ; preds = %10
%13 = load i32, i32* @LOG_ERR
%14 = tail call i8* @strerror(i32 %6)
%15 = tail call i32 @syslog(i32 %13, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4, i8* %3, i32 %5, i8* %14)
br label %16
16: ; preds = %10, %12
%17 = tail call i32 @pfpanic_show_stacktrace(i16 zeroext %1)
%18 = tail call i32 (...) @abort()
unreachable
19: ; preds = %8
%20 = load i32, i32* @stderr
%21 = tail call i8* @strerror(i32 %6)
%22 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4, i8* %3, i32 %5, i8* %21)
%23 = tail call i32 @pfpanic_show_stacktrace(i16 zeroext 0)
%24 = tail call i32 @exit(i32 %7)
unreachable
}