#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*/ SIGQUIT;
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
scalar_t__ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *);
void block_signals(void) {
  sigset_t mask;
  sigemptyset(&mask);
  sigaddset(&mask, SIGTERM);
  sigaddset(&mask, SIGINT);
  sigaddset(&mask, SIGQUIT);
  if (sigprocmask(SIG_BLOCK, &mask, NULL) != 0) {
    assert(0);
    abort();
  }
}


x86 assembly (clang, -O0):
<block_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1060 <sigemptyset@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1070 <sigaddset@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1070 <sigaddset@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1070 <sigaddset@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
cmp    $0x0,%rax
je     11c5 <block_signals+0x75>
xor    %edi,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1040 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_signals>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sigemptyset@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <sigaddset@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <sigaddset@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1070 <sigaddset@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
test   %rax,%rax
jne    11b3 <block_signals+0x63>
add    $0x10,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   1050 <assert@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
@SIGINT = global i32 0
@SIGQUIT = global i32 0
@SIG_BLOCK = global i32 0
define void @block_signals() {
%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* @SIGINT
%6 = call i32 @sigaddset(i32* %1, i32 %5)
%7 = load i32, i32* @SIGQUIT
%8 = call i32 @sigaddset(i32* %1, i32 %7)
%9 = load i32, i32* @SIG_BLOCK
%10 = call i64 @sigprocmask(i32 %9, i32* %1, i32* null)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 @assert(i32 0)
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %0
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@SIGINT = global i32 0
@SIGQUIT = global i32 0
@SIG_BLOCK = global i32 0
define void @block_signals() {
%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* @SIGINT
%7 = call i32 @sigaddset(i32* %1, i32 %6)
%8 = load i32, i32* @SIGQUIT
%9 = call i32 @sigaddset(i32* %1, i32 %8)
%10 = load i32, i32* @SIG_BLOCK
%11 = call i64 @sigprocmask(i32 %10, i32* %1, i32* null)
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %0
%14 = call i32 @assert(i32 0)
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %0
ret void
}