#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*/ EINVAL;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sigandset(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                int /*<<< orphan*/ const *);
int sigandset(sigset_t *dest, const sigset_t *left, const sigset_t *right) {
  if (dest == NULL || left == NULL || right == NULL) {
    __set_errno(EINVAL);
    return -1;
  }
  return __sigandset(dest, left, right);
}


x86 assembly (clang, -O0):
<sigandset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1155 <sigandset+0x35>
cmpq   $0x0,-0x18(%rbp)
je     1155 <sigandset+0x35>
cmpq   $0x0,-0x20(%rbp)
jne    116f <sigandset+0x4f>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1183 <sigandset+0x63>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <__sigandset@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigandset>:
test   %rdi,%rdi
je     1134 <sigandset+0x14>
test   %rsi,%rsi
je     1134 <sigandset+0x14>
test   %rdx,%rdx
je     1134 <sigandset+0x14>
jmp    1040 <__sigandset@plt>
push   %rax
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sigandset(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%8 = load i32*, i32** %5
%9 = icmp eq i32* %8, null
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i32*, i32** %6
%12 = icmp eq i32* %11, null
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i32*, i32** %7
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %13, %10, %3
%17 = load i32, i32* @EINVAL
%18 = call i32 @__set_errno(i32 %17)
store i32 -1, i32* %4
br label %24
19: ; preds = %13
%20 = load i32*, i32** %5
%21 = load i32*, i32** %6
%22 = load i32*, i32** %7
%23 = call i32 @__sigandset(i32* %20, i32* %21, i32* %22)
store i32 %23, i32* %4
br label %24
24: ; preds = %19, %16
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sigandset(i32* %0, i32* %1, i32* %2) {
%4 = icmp eq i32* %0, null
%5 = icmp eq i32* %1, null
%6 = or i1 %4, %5
%7 = icmp eq i32* %2, null
%8 = or i1 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i32, i32* @EINVAL
%11 = tail call i32 @__set_errno(i32 %10)
br label %14
12: ; preds = %3
%13 = tail call i32 @__sigandset(i32* %0, i32* %1, i32* %2)
br label %14
14: ; preds = %12, %9
%15 = phi i32 [ -1, %9 ], [ %13, %12 ]
ret i32 %15
}