#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*/ STDERR_FILENO;
int /*<<< orphan*/ _exit(int);
int strlen(char *);
char *strsignal(int);
int write(int /*<<< orphan*/, char *, int);
void fatal_handler(int signum) {
  int rc;
  char *str = strsignal(signum);
  rc = write(
      STDERR_FILENO,
      "\nUNEXPECTED FATAL ERROR in staprun. Please file a bug report.\n",
      sizeof(
          "\nUNEXPECTED FATAL ERROR in staprun. Please file a bug report.\n"));
  rc = write(STDERR_FILENO, str, strlen(str));
  rc = write(STDERR_FILENO, "\n", 1);
  (void)rc;
  _exit(1);
}


x86 assembly (clang, -O0):
<fatal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <strsignal@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xe99(%rip),%rsi
mov    $0x3f,%edx
call   1040 <write@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
lea    0xe8b(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<fatal_handler>:
push   %rbp
push   %r14
push   %rbx
call   1060 <strsignal@plt>
mov    %rax,%rbx
mov    0x2e8d(%rip),%r14
mov    (%r14),%edi
lea    0xea3(%rip),%rsi
mov    $0x3f,%edx
call   1040 <write@plt>
mov    (%r14),%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    (%r14),%edi
lea    0xeb5(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@STDERR_FILENO = global i32 0
@.str = [63 x i8] c"\0AUNEXPECTED FATAL ERROR in staprun. Please file a bug report.\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @fatal_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i8* @strsignal(i32 %5)
store i8* %6, i8** %4
%7 = load i32, i32* @STDERR_FILENO
%8 = call i32 @write(i32 %7, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i32 63)
store i32 %8, i32* %3
%9 = load i32, i32* @STDERR_FILENO
%10 = load i8*, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @write(i32 %9, i8* %10, i32 %12)
store i32 %13, i32* %3
%14 = load i32, i32* @STDERR_FILENO
%15 = call i32 @write(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
@STDERR_FILENO = global i32 0
@.str = [63 x i8] c"\0AUNEXPECTED FATAL ERROR in staprun. Please file a bug report.\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @fatal_handler(i32 %0) {
%2 = tail call i8* @strsignal(i32 %0)
%3 = load i32, i32* @STDERR_FILENO
%4 = tail call i32 @write(i32 %3, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i32 63)
%5 = load i32, i32* @STDERR_FILENO
%6 = tail call i32 @strlen(i8* %2)
%7 = tail call i32 @write(i32 %5, i8* %2, i32 %6)
%8 = load i32, i32* @STDERR_FILENO
%9 = tail call i32 @write(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = tail call i32 @_exit(i32 1)
unreachable
}