#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*/ SIG_SETMASK;
scalar_t__ __sigdelset(int /*<<< orphan*/ *, int);
int sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int sigrelse(int sig) {
  sigset_t set;
  if (sigprocmask(SIG_SETMASK, NULL, &set) < 0)
    return -1;
  if (__sigdelset(&set, sig) < 0)
    return -1;
  return sigprocmask(SIG_SETMASK, &set, NULL);
}


x86 assembly (clang, -O0):
<sigrelse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
lea    -0xc(%rbp),%rdx
call   1030 <sigprocmask@plt>
cmp    $0x0,%eax
jge    1156 <sigrelse+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1191 <sigrelse+0x71>
mov    -0x8(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   1040 <__sigdelset@plt>
cmp    $0x0,%rax
jge    1178 <sigrelse+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    1191 <sigrelse+0x71>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    -0xc(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigrelse>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebp
mov    0x2eb7(%rip),%r14
mov    (%r14),%edi
lea    0xc(%rsp),%rdx
xor    %esi,%esi
call   1030 <sigprocmask@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
js     116b <sigrelse+0x4b>
lea    0xc(%rsp),%rdi
mov    %ebp,%esi
call   1040 <__sigdelset@plt>
test   %rax,%rax
js     116b <sigrelse+0x4b>
mov    (%r14),%edi
lea    0xc(%rsp),%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SIG_SETMASK = global i32 0
define i32 @sigrelse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* @SIG_SETMASK
%6 = call i32 @sigprocmask(i32 %5, i32* null, i32* %4)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %17
9: ; preds = %1
%10 = load i32, i32* %3
%11 = call i64 @__sigdelset(i32* %4, i32 %10)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 -1, i32* %2
br label %17
14: ; preds = %9
%15 = load i32, i32* @SIG_SETMASK
%16 = call i32 @sigprocmask(i32 %15, i32* %4, i32* null)
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %13, %8
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
define i32 @sigrelse(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @SIG_SETMASK
%5 = call i32 @sigprocmask(i32 %4, i32* null, i32* %2)
%6 = icmp slt i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1
%8 = call i64 @__sigdelset(i32* %2, i32 %0)
%9 = icmp slt i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* @SIG_SETMASK
%12 = call i32 @sigprocmask(i32 %11, i32* %2, i32* null)
br label %13
13: ; preds = %7, %1, %10
%14 = phi i32 [ %12, %10 ], [ -1, %1 ], [ -1, %7 ]
ret i32 %14
}