#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*/ SIGALRM;
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ SIG_UNBLOCK;
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
scalar_t__ sigismember(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
void sigalarm_unblock() {
  sigset_t ens;
  sigset_t old;
  sigemptyset(&ens);
  sigprocmask(SIG_BLOCK, &ens, &old);
  if (sigismember(&old, SIGALRM)) {
    sigaddset(&ens, SIGALRM);
    sigprocmask(SIG_UNBLOCK, &ens, NULL);
  }
}


x86 assembly (clang, -O0):
<sigalarm_unblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigismember@plt>
cmp    $0x0,%rax
je     11ab <sigalarm_unblock+0x6b>
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdi
call   1060 <sigaddset@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigalarm_unblock>:
push   %r14
push   %rbx
push   %rax
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sigemptyset@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0x4(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <sigprocmask@plt>
mov    0x2e71(%rip),%rbx
mov    (%rbx),%esi
mov    %r14,%rdi
call   1050 <sigismember@plt>
test   %rax,%rax
je     119e <sigalarm_unblock+0x5e>
mov    (%rbx),%esi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <sigaddset@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIG_BLOCK = global i32 0
@SIGALRM = global i32 0
@SIG_UNBLOCK = global i32 0
define void @sigalarm_unblock() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @sigemptyset(i32* %1)
%4 = load i32, i32* @SIG_BLOCK
%5 = call i32 @sigprocmask(i32 %4, i32* %1, i32* %2)
%6 = load i32, i32* @SIGALRM
%7 = call i64 @sigismember(i32* %2, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* @SIGALRM
%11 = call i32 @sigaddset(i32* %1, i32 %10)
%12 = load i32, i32* @SIG_UNBLOCK
%13 = call i32 @sigprocmask(i32 %12, i32* %1, i32* null)
br label %14
14: ; preds = %9, %0
ret void
}

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