#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 */
struct sigaction {
  int /*<<< orphan*/ sa_handler;
  scalar_t__ sa_flags;
  int /*<<< orphan*/ sa_mask;
};
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ sa;

/* Variables and functions */
int /*<<< orphan*/ LOG_CRIT;
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct sigaction *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sigaction(int /*<<< orphan*/, struct sigaction *,
                             int /*<<< orphan*/ *);
int /*<<< orphan*/ sigdelset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigfillset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char const *);
void __fail(const char *msg) {
  struct sigaction sa;
  sigset_t mask;
  (void)sigfillset(&mask);
  (void)sigdelset(&mask, SIGABRT);
  (void)sigprocmask(SIG_BLOCK, &mask, NULL);
  syslog(LOG_CRIT, msg);
  (void)memset(&sa, 0, sizeof(sa));
  (void)sigemptyset(&sa.sa_mask);
  sa.sa_flags = 0;
  sa.sa_handler = SIG_DFL;
  (void)sigaction(SIGABRT, &sa, NULL);
  (void)kill(getpid(), SIGABRT);
  _exit(127);
}


x86 assembly (clang, -O0):
<__fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x24(%rbp),%rdi
call   1090 <sigfillset@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%esi
lea    -0x24(%rbp),%rdi
call   10c0 <sigdelset@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    -0x24(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   10b0 <syslog@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
lea    -0x20(%rbp),%rdi
add    $0x10,%rdi
call   1080 <sigemptyset@plt>
movq   $0x0,-0x18(%rbp)
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <sigaction@plt>
mov    $0x0,%al
call   1060 <getpid@plt>
mov    %eax,%edi
mov    0x2d82(%rip),%rax
mov    (%rax),%esi
call   10a0 <kill@plt>
mov    $0x7f,%edi
call   1040 <_exit@plt>

x86 assembly (clang, -O2):
<__fail>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r14
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1090 <sigfillset@plt>
mov    0x2e08(%rip),%r15
mov    (%r15),%esi
mov    %rbx,%rdi
call   10c0 <sigdelset@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   10b0 <syslog@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
lea    0x18(%rsp),%rdi
call   1080 <sigemptyset@plt>
movq   $0x0,0x10(%rsp)
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <sigaction@plt>
xor    %eax,%eax
call   1060 <getpid@plt>
mov    (%r15),%esi
mov    %eax,%edi
call   10a0 <kill@plt>
mov    $0x7f,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
%struct.sigaction = type { i32, i64, i32 }
@SIGABRT = global i32 0
@SIG_BLOCK = global i32 0
@LOG_CRIT = global i32 0
@SIG_DFL = global i32 0
define void @__fail(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.sigaction
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @sigfillset(i32* %4)
%6 = load i32, i32* @SIGABRT
%7 = call i32 @sigdelset(i32* %4, i32 %6)
%8 = load i32, i32* @SIG_BLOCK
%9 = call i32 @sigprocmask(i32 %8, i32* %4, i32* null)
%10 = load i32, i32* @LOG_CRIT
%11 = load i8*, i8** %2
%12 = call i32 @syslog(i32 %10, i8* %11)
%13 = call i32 @memset(%struct.sigaction* %3, i32 0, i32 24)
%14 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i32 0, i32 2
%15 = call i32 @sigemptyset(i32* %14)
%16 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i32 0, i32 1
store i64 0, i64* %16
%17 = load i32, i32* @SIG_DFL
%18 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i32 0, i32 0
store i32 %17, i32* %18
%19 = load i32, i32* @SIGABRT
%20 = call i32 @sigaction(i32 %19, %struct.sigaction* %3, i32* null)
%21 = call i32 (...) @getpid()
%22 = load i32, i32* @SIGABRT
%23 = call i32 @kill(i32 %21, i32 %22)
%24 = call i32 @_exit(i32 127)
unreachable
}

LLVM IR (-O2):
%struct.sigaction = type { i32, i64, i32 }
@SIGABRT = global i32 0
@SIG_BLOCK = global i32 0
@LOG_CRIT = global i32 0
@SIG_DFL = global i32 0
define void @__fail(i8* %0) {
%2 = alloca %struct.sigaction
%3 = alloca i32
%4 = bitcast %struct.sigaction* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @sigfillset(i32* %3)
%7 = load i32, i32* @SIGABRT
%8 = call i32 @sigdelset(i32* %3, i32 %7)
%9 = load i32, i32* @SIG_BLOCK
%10 = call i32 @sigprocmask(i32 %9, i32* %3, i32* null)
%11 = load i32, i32* @LOG_CRIT
%12 = call i32 @syslog(i32 %11, i8* %0)
%13 = call i32 @memset(%struct.sigaction* %2, i32 0, i32 24)
%14 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 2
%15 = call i32 @sigemptyset(i32* %14)
%16 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 1
store i64 0, i64* %16
%17 = load i32, i32* @SIG_DFL
%18 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 0
store i32 %17, i32* %18
%19 = load i32, i32* @SIGABRT
%20 = call i32 @sigaction(i32 %19, %struct.sigaction* %2, i32* null)
%21 = call i32 (...) @getpid()
%22 = load i32, i32* @SIGABRT
%23 = call i32 @kill(i32 %21, i32 %22)
%24 = call i32 @_exit(i32 127)
unreachable
}