#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 _Unwind_Exception {
  int dummy;
};
struct _Unwind_Context {
  int dummy;
};
typedef int /*<<< orphan*/ _Unwind_Reason_Code;
typedef int /*<<< orphan*/ _Unwind_Exception_Class;
typedef int _Unwind_Action;

/* Variables and functions */
int _UA_END_OF_STACK;
int /*<<< orphan*/ _URC_NO_REASON;
int /*<<< orphan*/ abort();
__attribute__((__no__)) _Unwind_Reason_Code
stop_fn(int a __attribute__((__unused__)), _Unwind_Action action,
        _Unwind_Exception_Class b __attribute__((__unused__)),
        struct _Unwind_Exception *c __attribute__((__unused__)),
        struct _Unwind_Context *d __attribute__((__unused__)),
        void *e __attribute__((__unused__))) {
  if ((action & _UA_END_OF_STACK) != 0) {
    abort();
  }
  return _URC_NO_REASON;
}


x86 assembly (clang, -O0):
<stop_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ea1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1149 <stop_fn+0x39>
mov    $0x0,%al
call   1030 <abort@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stop_fn>:
push   %rax
mov    0x2ec0(%rip),%rax
test   %esi,(%rax)
jne    1127 <stop_fn+0x17>
mov    0x2ec5(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct._Unwind_Exception = type { i32 }
%struct._Unwind_Context = type { i32 }
@_UA_END_OF_STACK = global i32 0
@_URC_NO_REASON = global i32 0
define i32 @stop_fn(i32 %0, i32 %1, i32 %2, %struct._Unwind_Exception* %3, %struct._Unwind_Context* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct._Unwind_Exception*
%11 = alloca %struct._Unwind_Context*
%12 = alloca i8*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store %struct._Unwind_Exception* %3, %struct._Unwind_Exception** %10
store %struct._Unwind_Context* %4, %struct._Unwind_Context** %11
store i8* %5, i8** %12
%13 = load i32, i32* %8
%14 = load i32, i32* @_UA_END_OF_STACK
%15 = and i32 %13, %14
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %6
%18 = call i32 (...) @abort()
unreachable
19: ; preds = %6
%20 = load i32, i32* @_URC_NO_REASON
ret i32 %20
}

LLVM IR (-O2):
%struct._Unwind_Exception = type { i32 }
%struct._Unwind_Context = type { i32 }
@_UA_END_OF_STACK = global i32 0
@_URC_NO_REASON = global i32 0
define i32 @stop_fn(i32 %0, i32 %1, i32 %2, %struct._Unwind_Exception* nocapture readnone %3, %struct._Unwind_Context* nocapture readnone %4, i8* nocapture readnone %5) {
%7 = load i32, i32* @_UA_END_OF_STACK
%8 = and i32 %7, %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 (...) @abort()
unreachable
12: ; preds = %6
%13 = load i32, i32* @_URC_NO_REASON
ret i32 %13
}