#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*/ SIGABRT;
int /*<<< orphan*/ SIGALRM;
int /*<<< orphan*/ SIGBUS;
int /*<<< orphan*/ SIGFPE;
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIGILL;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ SIGSEGV;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
void CatchSignals(void (*SigHandler)(int)) {
  signal(SIGHUP, SigHandler);
  signal(SIGINT, SigHandler);
  signal(SIGQUIT, SigHandler);
  signal(SIGILL, SigHandler);
  signal(SIGABRT, SigHandler);
  signal(SIGFPE, SigHandler);
  signal(SIGSEGV, SigHandler);
  signal(SIGPIPE, SigHandler);
  signal(SIGALRM, SigHandler);
  signal(SIGTERM, SigHandler);
  signal(SIGBUS, SigHandler);
}


x86 assembly (clang, -O0):
<CatchSignals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
call   1030 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CatchSignals>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ed5(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <signal@plt>

LLVM IR (-O0):
@SIGHUP = global i32 0
@SIGINT = global i32 0
@SIGQUIT = global i32 0
@SIGILL = global i32 0
@SIGABRT = global i32 0
@SIGFPE = global i32 0
@SIGSEGV = global i32 0
@SIGPIPE = global i32 0
@SIGALRM = global i32 0
@SIGTERM = global i32 0
@SIGBUS = global i32 0
define void @CatchSignals(void (i32)* %0) {
%2 = alloca void (i32)*
store void (i32)* %0, void (i32)** %2
%3 = load i32, i32* @SIGHUP
%4 = load void (i32)*, void (i32)** %2
%5 = call i32 @signal(i32 %3, void (i32)* %4)
%6 = load i32, i32* @SIGINT
%7 = load void (i32)*, void (i32)** %2
%8 = call i32 @signal(i32 %6, void (i32)* %7)
%9 = load i32, i32* @SIGQUIT
%10 = load void (i32)*, void (i32)** %2
%11 = call i32 @signal(i32 %9, void (i32)* %10)
%12 = load i32, i32* @SIGILL
%13 = load void (i32)*, void (i32)** %2
%14 = call i32 @signal(i32 %12, void (i32)* %13)
%15 = load i32, i32* @SIGABRT
%16 = load void (i32)*, void (i32)** %2
%17 = call i32 @signal(i32 %15, void (i32)* %16)
%18 = load i32, i32* @SIGFPE
%19 = load void (i32)*, void (i32)** %2
%20 = call i32 @signal(i32 %18, void (i32)* %19)
%21 = load i32, i32* @SIGSEGV
%22 = load void (i32)*, void (i32)** %2
%23 = call i32 @signal(i32 %21, void (i32)* %22)
%24 = load i32, i32* @SIGPIPE
%25 = load void (i32)*, void (i32)** %2
%26 = call i32 @signal(i32 %24, void (i32)* %25)
%27 = load i32, i32* @SIGALRM
%28 = load void (i32)*, void (i32)** %2
%29 = call i32 @signal(i32 %27, void (i32)* %28)
%30 = load i32, i32* @SIGTERM
%31 = load void (i32)*, void (i32)** %2
%32 = call i32 @signal(i32 %30, void (i32)* %31)
%33 = load i32, i32* @SIGBUS
%34 = load void (i32)*, void (i32)** %2
%35 = call i32 @signal(i32 %33, void (i32)* %34)
ret void
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@SIGINT = global i32 0
@SIGQUIT = global i32 0
@SIGILL = global i32 0
@SIGABRT = global i32 0
@SIGFPE = global i32 0
@SIGSEGV = global i32 0
@SIGPIPE = global i32 0
@SIGALRM = global i32 0
@SIGTERM = global i32 0
@SIGBUS = global i32 0
define void @CatchSignals(void (i32)* %0) {
%2 = load i32, i32* @SIGHUP
%3 = tail call i32 @signal(i32 %2, void (i32)* %0)
%4 = load i32, i32* @SIGINT
%5 = tail call i32 @signal(i32 %4, void (i32)* %0)
%6 = load i32, i32* @SIGQUIT
%7 = tail call i32 @signal(i32 %6, void (i32)* %0)
%8 = load i32, i32* @SIGILL
%9 = tail call i32 @signal(i32 %8, void (i32)* %0)
%10 = load i32, i32* @SIGABRT
%11 = tail call i32 @signal(i32 %10, void (i32)* %0)
%12 = load i32, i32* @SIGFPE
%13 = tail call i32 @signal(i32 %12, void (i32)* %0)
%14 = load i32, i32* @SIGSEGV
%15 = tail call i32 @signal(i32 %14, void (i32)* %0)
%16 = load i32, i32* @SIGPIPE
%17 = tail call i32 @signal(i32 %16, void (i32)* %0)
%18 = load i32, i32* @SIGALRM
%19 = tail call i32 @signal(i32 %18, void (i32)* %0)
%20 = load i32, i32* @SIGTERM
%21 = tail call i32 @signal(i32 %20, void (i32)* %0)
%22 = load i32, i32* @SIGBUS
%23 = tail call i32 @signal(i32 %22, void (i32)* %0)
ret void
}