#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 SIG_BLOCK;
int SIG_SETMASK;
int SIG_UNBLOCK;
int /*<<< orphan*/ check_blocked_sigs();
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int main() {
  sigset_t s_set;
  sigemptyset(&s_set);
  sigaddset(&s_set, 1);
  sigaddset(&s_set, 4);
  sigprocmask(SIG_BLOCK | SIG_SETMASK, &s_set, NULL);
  check_blocked_sigs();
  sigprocmask(SIG_UNBLOCK, &s_set, NULL);
  check_blocked_sigs();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <sigemptyset@plt>
lea    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1060 <sigaddset@plt>
lea    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1060 <sigaddset@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
mov    0x2e5c(%rip),%rax
or     (%rax),%edi
lea    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    $0x0,%al
call   1040 <check_blocked_sigs@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    $0x0,%al
call   1040 <check_blocked_sigs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <sigemptyset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <sigaddset@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <sigaddset@plt>
mov    0x2e5d(%rip),%rax
mov    0x2e66(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
xor    %eax,%eax
call   1040 <check_blocked_sigs@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
xor    %eax,%eax
call   1040 <check_blocked_sigs@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIG_BLOCK = global i32 0
@SIG_SETMASK = global i32 0
@SIG_UNBLOCK = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @sigemptyset(i32* %2)
%4 = call i32 @sigaddset(i32* %2, i32 1)
%5 = call i32 @sigaddset(i32* %2, i32 4)
%6 = load i32, i32* @SIG_BLOCK
%7 = load i32, i32* @SIG_SETMASK
%8 = or i32 %6, %7
%9 = call i32 @sigprocmask(i32 %8, i32* %2, i32* null)
%10 = call i32 (...) @check_blocked_sigs()
%11 = load i32, i32* @SIG_UNBLOCK
%12 = call i32 @sigprocmask(i32 %11, i32* %2, i32* null)
%13 = call i32 (...) @check_blocked_sigs()
ret i32 0
}

LLVM IR (-O2):
@SIG_BLOCK = global i32 0
@SIG_SETMASK = global i32 0
@SIG_UNBLOCK = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigemptyset(i32* %1)
%4 = call i32 @sigaddset(i32* %1, i32 1)
%5 = call i32 @sigaddset(i32* %1, i32 4)
%6 = load i32, i32* @SIG_BLOCK
%7 = load i32, i32* @SIG_SETMASK
%8 = or i32 %7, %6
%9 = call i32 @sigprocmask(i32 %8, i32* %1, i32* null)
%10 = call i32 (...) @check_blocked_sigs()
%11 = load i32, i32* @SIG_UNBLOCK
%12 = call i32 @sigprocmask(i32 %11, i32* %1, i32* null)
%13 = call i32 (...) @check_blocked_sigs()
ret i32 0
}