#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*/ SIG_SETMASK;
int /*<<< orphan*/ print_pend(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigpending(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int main() {
  sigset_t block, out, pending;
  sigemptyset(&block);
  sigemptyset(&out);
  sigemptyset(&pending);
  sigaddset(&block, SIGINT);
  sigprocmask(SIG_SETMASK, &block, &out);
  while (1) {
    sigpending(&pending);
    print_pend(&pending);
    sleep(1);
  }
  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    -0xc(%rbp),%rdi
call   1050 <sigemptyset@plt>
lea    -0x10(%rbp),%rdi
call   1050 <sigemptyset@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1080 <sigaddset@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <sigprocmask@plt>
lea    -0x10(%rbp),%rdi
call   1060 <sigpending@plt>
lea    -0x10(%rbp),%rdi
call   1030 <print_pend@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    11b2 <main+0x52>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1050 <sigemptyset@plt>
lea    0x8(%rsp),%r15
mov    %r15,%rdi
call   1050 <sigemptyset@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <sigemptyset@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   1080 <sigaddset@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <sigprocmask@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1060 <sigpending@plt>
mov    %rbx,%rdi
call   1030 <print_pend@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    11c0 <main+0x60>

LLVM IR (-O0):
@SIGINT = global i32 0
@SIG_SETMASK = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @sigemptyset(i32* %2)
%6 = call i32 @sigemptyset(i32* %3)
%7 = call i32 @sigemptyset(i32* %4)
%8 = load i32, i32* @SIGINT
%9 = call i32 @sigaddset(i32* %2, i32 %8)
%10 = load i32, i32* @SIG_SETMASK
%11 = call i32 @sigprocmask(i32 %10, i32* %2, i32* %3)
br label %12
12: ; preds = %0, %12
%13 = call i32 @sigpending(i32* %4)
%14 = call i32 @print_pend(i32* %4)
%15 = call i32 @sleep(i32 1)
br label %12
}

LLVM IR (-O2):
@SIGINT = global i32 0
@SIG_SETMASK = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @sigemptyset(i32* %1)
%8 = call i32 @sigemptyset(i32* %2)
%9 = call i32 @sigemptyset(i32* %3)
%10 = load i32, i32* @SIGINT
%11 = call i32 @sigaddset(i32* %1, i32 %10)
%12 = load i32, i32* @SIG_SETMASK
%13 = call i32 @sigprocmask(i32 %12, i32* %1, i32* %2)
br label %14
14: ; preds = %14, %0
%15 = call i32 @sigpending(i32* %3)
%16 = call i32 @print_pend(i32* %3)
%17 = call i32 @sleep(i32 1)
br label %14
}