#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;
size_t backtrace(void **, int);
int /*<<< orphan*/ backtrace_symbols_fd(void **, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void sigsegv_watchdog(int signo) {
  size_t size;
  void *array[50];
  printf("\nhvm info: hvm execution aborted.\n\n");
  printf("*** SIGSEV PANIC ***\n\n");
  printf("%s\n\n", "hefesto-"
                   "0.1.1.5");
  size = backtrace(array, 50);
  backtrace_symbols_fd(array, size, STDERR_FILENO);
  printf("\n\n");
  exit(1);
}


x86 assembly (clang, -O0):
<sigsegv_watchdog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xeca(%rip),%rdi
lea    0xec8(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x32,%esi
call   1040 <backtrace@plt>
mov    %rax,-0x10(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e3a(%rip),%rax
mov    (%rax),%edx
call   1030 <backtrace_symbols_fd@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<sigsegv_watchdog>:
push   %rbx
sub    $0x190,%rsp
lea    0xeb6(%rip),%rdi
call   1040 <puts@plt>
lea    0xecd(%rip),%rdi
call   1040 <puts@plt>
lea    0xe89(%rip),%rdi
lea    0xe87(%rip),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
call   1050 <backtrace@plt>
mov    0x2e44(%rip),%rcx
mov    (%rcx),%edx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <backtrace_symbols_fd@plt>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"\0Ahvm info: hvm execution aborted.\0A\0A\00"
@.str.1 = [23 x i8] c"*** SIGSEV PANIC ***\0A\0A\00"
@.str.2 = [5 x i8] c"%s\0A\0A\00"
@.str.3 = [16 x i8] c"hefesto-0.1.1.5\00"
@STDERR_FILENO = global i32 0
@.str.4 = [3 x i8] c"\0A\0A\00"
define void @sigsegv_watchdog(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca [50 x i8*]
store i32 %0, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%8 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 0
%9 = call i64 @backtrace(i8** %8, i32 50)
store i64 %9, i64* %3
%10 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 0
%11 = load i64, i64* %3
%12 = load i32, i32* @STDERR_FILENO
%13 = call i32 @backtrace_symbols_fd(i8** %10, i64 %11, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str.2 = [5 x i8] c"%s\0A\0A\00"
@.str.3 = [16 x i8] c"hefesto-0.1.1.5\00"
@STDERR_FILENO = global i32 0
@str = [35 x i8] c"\0Ahvm info: hvm execution aborted.\0A\00"
@str.5 = [22 x i8] c"*** SIGSEV PANIC ***\0A\00"
@str.6 = [2 x i8] c"\0A\00"
define void @sigsegv_watchdog(i32 %0) {
%2 = alloca [50 x i8*]
%3 = bitcast [50 x i8*]* %2 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%7 = getelementptr inbounds [50 x i8*], [50 x i8*]* %2, i64 0, i64 0
%8 = call i64 @backtrace(i8** %7, i32 50)
%9 = load i32, i32* @STDERR_FILENO
%10 = call i32 @backtrace_symbols_fd(i8** %7, i64 %8, i32 %9)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
}