#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*/ SIGALRM;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
void registerSignal(sigset_t *sigsToCatch) {
  sigemptyset(sigsToCatch);
  sigaddset(sigsToCatch, SIGINT);
  sigaddset(sigsToCatch, SIGUSR1);
  sigaddset(sigsToCatch, SIGALRM);
  sigaddset(sigsToCatch, SIGTERM);
  sigprocmask(SIG_BLOCK, sigsToCatch, NULL);
}


x86 assembly (clang, -O0):
<registerSignal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
call   1050 <sigaddset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
call   1050 <sigaddset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e6c(%rip),%rax
mov    (%rax),%esi
call   1050 <sigaddset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e4a(%rip),%rax
mov    (%rax),%esi
call   1050 <sigaddset@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<registerSignal>:
push   %rbx
mov    %rdi,%rbx
call   1040 <sigemptyset@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
pop    %rbx
jmp    1030 <sigprocmask@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@SIGUSR1 = global i32 0
@SIGALRM = global i32 0
@SIGTERM = global i32 0
@SIG_BLOCK = global i32 0
define void @registerSignal(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @sigemptyset(i32* %3)
%5 = load i32*, i32** %2
%6 = load i32, i32* @SIGINT
%7 = call i32 @sigaddset(i32* %5, i32 %6)
%8 = load i32*, i32** %2
%9 = load i32, i32* @SIGUSR1
%10 = call i32 @sigaddset(i32* %8, i32 %9)
%11 = load i32*, i32** %2
%12 = load i32, i32* @SIGALRM
%13 = call i32 @sigaddset(i32* %11, i32 %12)
%14 = load i32*, i32** %2
%15 = load i32, i32* @SIGTERM
%16 = call i32 @sigaddset(i32* %14, i32 %15)
%17 = load i32, i32* @SIG_BLOCK
%18 = load i32*, i32** %2
%19 = call i32 @sigprocmask(i32 %17, i32* %18, i32* null)
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@SIGUSR1 = global i32 0
@SIGALRM = global i32 0
@SIGTERM = global i32 0
@SIG_BLOCK = global i32 0
define void @registerSignal(i32* %0) {
%2 = tail call i32 @sigemptyset(i32* %0)
%3 = load i32, i32* @SIGINT
%4 = tail call i32 @sigaddset(i32* %0, i32 %3)
%5 = load i32, i32* @SIGUSR1
%6 = tail call i32 @sigaddset(i32* %0, i32 %5)
%7 = load i32, i32* @SIGALRM
%8 = tail call i32 @sigaddset(i32* %0, i32 %7)
%9 = load i32, i32* @SIGTERM
%10 = tail call i32 @sigaddset(i32* %0, i32 %9)
%11 = load i32, i32* @SIG_BLOCK
%12 = tail call i32 @sigprocmask(i32 %11, i32* %0, i32* null)
ret void
}