#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*/ SIGINT;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ SIGUSR2;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ pthread_sigmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ *);
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
void set_signal_mask() {
  static sigset_t mask;
  sigemptyset(&mask);
  sigaddset(&mask, SIGUSR1);
  sigaddset(&mask, SIGUSR2);
  sigaddset(&mask, SIGTERM);
  sigaddset(&mask, SIGINT);
  pthread_sigmask(SIG_BLOCK, &mask, NULL);
}


x86 assembly (clang, -O0):
<set_signal_mask>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f01(%rip),%rdi
call   1030 <sigemptyset@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
lea    0x2eec(%rip),%rdi
call   1050 <sigaddset@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%esi
lea    0x2ed7(%rip),%rdi
call   1050 <sigaddset@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
lea    0x2ec2(%rip),%rdi
call   1050 <sigaddset@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%esi
lea    0x2ead(%rip),%rdi
call   1050 <sigaddset@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0x2e98(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <pthread_sigmask@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_signal_mask>:
push   %rbx
lea    0x2f04(%rip),%rbx
mov    %rbx,%rdi
call   1030 <sigemptyset@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <sigaddset@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
pop    %rbx
jmp    1040 <pthread_sigmask@plt>

LLVM IR (-O0):
@set_signal_mask.mask = internal global i32 0
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@SIGTERM = global i32 0
@SIGINT = global i32 0
@SIG_BLOCK = global i32 0
define void @set_signal_mask() {
%1 = call i32 @sigemptyset(i32* @set_signal_mask.mask)
%2 = load i32, i32* @SIGUSR1
%3 = call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %2)
%4 = load i32, i32* @SIGUSR2
%5 = call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %4)
%6 = load i32, i32* @SIGTERM
%7 = call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %6)
%8 = load i32, i32* @SIGINT
%9 = call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %8)
%10 = load i32, i32* @SIG_BLOCK
%11 = call i32 @pthread_sigmask(i32 %10, i32* @set_signal_mask.mask, i32* null)
ret void
}

LLVM IR (-O2):
@set_signal_mask.mask = internal global i32 0
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@SIGTERM = global i32 0
@SIGINT = global i32 0
@SIG_BLOCK = global i32 0
define void @set_signal_mask() {
%1 = tail call i32 @sigemptyset(i32* @set_signal_mask.mask)
%2 = load i32, i32* @SIGUSR1
%3 = tail call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %2)
%4 = load i32, i32* @SIGUSR2
%5 = tail call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %4)
%6 = load i32, i32* @SIGTERM
%7 = tail call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %6)
%8 = load i32, i32* @SIGINT
%9 = tail call i32 @sigaddset(i32* @set_signal_mask.mask, i32 %8)
%10 = load i32, i32* @SIG_BLOCK
%11 = tail call i32 @pthread_sigmask(i32 %10, i32* @set_signal_mask.mask, i32* null)
ret void
}