#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*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sigdelset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigfillset(int /*<<< orphan*/ *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
void abort() {
  sigset_t mask;
  sigfillset(&mask);
  sigdelset(&mask, SIGABRT);
  (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
  (void)kill(getpid(), SIGABRT);
  (void)signal(SIGABRT, SIG_DFL);
  (void)sigprocmask(SIG_SETMASK, &mask, (sigset_t *)NULL);
  (void)kill(getpid(), SIGABRT);
  exit(1);
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1060 <sigfillset@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1080 <sigdelset@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%edi
mov    0x2e17(%rip),%rax
mov    (%rax),%esi
call   1070 <kill@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%edi
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
call   1070 <kill@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<abort>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sigfillset@plt>
mov    0x2e43(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   1080 <sigdelset@plt>
mov    0x2e49(%rip),%r15
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    (%r14),%esi
mov    %eax,%edi
call   1070 <kill@plt>
mov    (%r14),%edi
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    (%r14),%esi
mov    %eax,%edi
call   1070 <kill@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@SIGABRT = global i32 0
@SIG_SETMASK = global i32 0
@SIG_DFL = global i32 0
define void @abort() {
%1 = alloca i32
%2 = call i32 @sigfillset(i32* %1)
%3 = load i32, i32* @SIGABRT
%4 = call i32 @sigdelset(i32* %1, i32 %3)
%5 = load i32, i32* @SIG_SETMASK
%6 = call i32 @sigprocmask(i32 %5, i32* %1, i32* null)
%7 = call i32 (...) @getpid()
%8 = load i32, i32* @SIGABRT
%9 = call i32 @kill(i32 %7, i32 %8)
%10 = load i32, i32* @SIGABRT
%11 = load i32, i32* @SIG_DFL
%12 = call i32 @signal(i32 %10, i32 %11)
%13 = load i32, i32* @SIG_SETMASK
%14 = call i32 @sigprocmask(i32 %13, i32* %1, i32* null)
%15 = call i32 (...) @getpid()
%16 = load i32, i32* @SIGABRT
%17 = call i32 @kill(i32 %15, i32 %16)
%18 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@SIGABRT = global i32 0
@SIG_SETMASK = global i32 0
@SIG_DFL = global i32 0
define void @abort() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigfillset(i32* %1)
%4 = load i32, i32* @SIGABRT
%5 = call i32 @sigdelset(i32* %1, i32 %4)
%6 = load i32, i32* @SIG_SETMASK
%7 = call i32 @sigprocmask(i32 %6, i32* %1, i32* null)
%8 = call i32 (...) @getpid()
%9 = load i32, i32* @SIGABRT
%10 = call i32 @kill(i32 %8, i32 %9)
%11 = load i32, i32* @SIGABRT
%12 = load i32, i32* @SIG_DFL
%13 = call i32 @signal(i32 %11, i32 %12)
%14 = load i32, i32* @SIG_SETMASK
%15 = call i32 @sigprocmask(i32 %14, i32* %1, i32* null)
%16 = call i32 (...) @getpid()
%17 = load i32, i32* @SIGABRT
%18 = call i32 @kill(i32 %16, i32 %17)
%19 = call i32 @exit(i32 1)
unreachable
}