#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*/ SIGABRT;
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ SIGTERM;
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 sig_shield(void) {
  sigset_t ss;
  sigemptyset(&ss);
  sigaddset(&ss, SIGTERM);
  sigaddset(&ss, SIGQUIT);
  sigaddset(&ss, SIGABRT);
  sigaddset(&ss, SIGINT);
  sigaddset(&ss, SIGPIPE);
  sigaddset(&ss, SIGHUP);
  sigprocmask(SIG_BLOCK, &ss, 0);
}


x86 assembly (clang, -O0):
<sig_shield>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_shield>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sigemptyset@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIGTERM = global i32 0
@SIGQUIT = global i32 0
@SIGABRT = global i32 0
@SIGINT = global i32 0
@SIGPIPE = global i32 0
@SIGHUP = global i32 0
@SIG_BLOCK = global i32 0
define void @sig_shield() {
%1 = alloca i32
%2 = call i32 @sigemptyset(i32* %1)
%3 = load i32, i32* @SIGTERM
%4 = call i32 @sigaddset(i32* %1, i32 %3)
%5 = load i32, i32* @SIGQUIT
%6 = call i32 @sigaddset(i32* %1, i32 %5)
%7 = load i32, i32* @SIGABRT
%8 = call i32 @sigaddset(i32* %1, i32 %7)
%9 = load i32, i32* @SIGINT
%10 = call i32 @sigaddset(i32* %1, i32 %9)
%11 = load i32, i32* @SIGPIPE
%12 = call i32 @sigaddset(i32* %1, i32 %11)
%13 = load i32, i32* @SIGHUP
%14 = call i32 @sigaddset(i32* %1, i32 %13)
%15 = load i32, i32* @SIG_BLOCK
%16 = call i32 @sigprocmask(i32 %15, i32* %1, i32 0)
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@SIGQUIT = global i32 0
@SIGABRT = global i32 0
@SIGINT = global i32 0
@SIGPIPE = global i32 0
@SIGHUP = global i32 0
@SIG_BLOCK = global i32 0
define void @sig_shield() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigemptyset(i32* %1)
%4 = load i32, i32* @SIGTERM
%5 = call i32 @sigaddset(i32* %1, i32 %4)
%6 = load i32, i32* @SIGQUIT
%7 = call i32 @sigaddset(i32* %1, i32 %6)
%8 = load i32, i32* @SIGABRT
%9 = call i32 @sigaddset(i32* %1, i32 %8)
%10 = load i32, i32* @SIGINT
%11 = call i32 @sigaddset(i32* %1, i32 %10)
%12 = load i32, i32* @SIGPIPE
%13 = call i32 @sigaddset(i32* %1, i32 %12)
%14 = load i32, i32* @SIGHUP
%15 = call i32 @sigaddset(i32* %1, i32 %14)
%16 = load i32, i32* @SIG_BLOCK
%17 = call i32 @sigprocmask(i32 %16, i32* %1, i32 0)
ret void
}