#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_BLOCK;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigismember(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigpending(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  sigset_t ss;
  (void)sigemptyset(&ss);
  (void)sigaddset(&ss, SIGINT);
  (void)sigprocmask(SIG_BLOCK, &ss, NULL);
  do {
    (void)getpid();
    (void)sigpending(&ss);
  } while (!sigismember(&ss, SIGINT));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <sigemptyset@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdi
call   1080 <sigaddset@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    -0x14(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
lea    -0x14(%rbp),%rdi
call   1060 <sigpending@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%esi
lea    -0x14(%rbp),%rdi
call   1070 <sigismember@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a7 <main+0x47>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <sigemptyset@plt>
mov    0x2e70(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   1080 <sigaddset@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rbx,%rdi
call   1060 <sigpending@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1070 <sigismember@plt>
test   %eax,%eax
je     11a0 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIGINT = global i32 0
@SIG_BLOCK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @sigemptyset(i32* %6)
%8 = load i32, i32* @SIGINT
%9 = call i32 @sigaddset(i32* %6, i32 %8)
%10 = load i32, i32* @SIG_BLOCK
%11 = call i32 @sigprocmask(i32 %10, i32* %6, i32* null)
br label %12
12: ; preds = %15, %2
%13 = call i32 (...) @getpid()
%14 = call i32 @sigpending(i32* %6)
br label %15
15: ; preds = %12
%16 = load i32, i32* @SIGINT
%17 = call i32 @sigismember(i32* %6, i32 %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
br i1 %19, label %12, label %20
20: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@SIGINT = global i32 0
@SIG_BLOCK = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @sigemptyset(i32* %3)
%6 = load i32, i32* @SIGINT
%7 = call i32 @sigaddset(i32* %3, i32 %6)
%8 = load i32, i32* @SIG_BLOCK
%9 = call i32 @sigprocmask(i32 %8, i32* %3, i32* null)
br label %10
10: ; preds = %10, %2
%11 = call i32 (...) @getpid()
%12 = call i32 @sigpending(i32* %3)
%13 = load i32, i32* @SIGINT
%14 = call i32 @sigismember(i32* %3, i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %10, label %16
16: ; preds = %10
ret i32 0
}