#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 */
struct sigaction {
  int /*<<< orphan*/ sa_handler;
  int /*<<< orphan*/ sa_mask;
};
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ sa;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGUSR2;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ memset(struct sigaction *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigfillset(int /*<<< orphan*/ *);
int main() {
  sigset_t mask, mask2;
  struct sigaction sa;
  pid_t pid;
  unsigned long old_mask;
  sigemptyset(&mask);
  sigaddset(&mask, SIGUSR2);
  memset(&sa, 0, sizeof(sa));
  sigfillset(&sa.sa_mask);
  sa.sa_handler = SIG_IGN;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rdi
call   1060 <sigaddset@plt>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
lea    -0x18(%rbp),%rdi
add    $0x4,%rdi
call   1050 <sigfillset@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sigemptyset@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1060 <sigaddset@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
lea    0x4(%rsp),%rdi
call   1050 <sigfillset@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigaction = type { i32, i32 }
@SIGUSR2 = global i32 0
@SIG_IGN = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sigaction
%5 = alloca i32
%6 = alloca i64
store i32 0, i32* %1
%7 = call i32 @sigemptyset(i32* %2)
%8 = load i32, i32* @SIGUSR2
%9 = call i32 @sigaddset(i32* %2, i32 %8)
%10 = call i32 @memset(%struct.sigaction* %4, i32 0, i32 8)
%11 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %4, i32 0, i32 1
%12 = call i32 @sigfillset(i32* %11)
%13 = load i32, i32* @SIG_IGN
%14 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %4, i32 0, i32 0
store i32 %13, i32* %14
ret i32 0
}

LLVM IR (-O2):
%struct.sigaction = type { i32, i32 }
@SIGUSR2 = global i32 0
@SIG_IGN = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sigaction
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.sigaction* %2 to i8*
%5 = call i32 @sigemptyset(i32* %1)
%6 = load i32, i32* @SIGUSR2
%7 = call i32 @sigaddset(i32* %1, i32 %6)
%8 = call i32 @memset(%struct.sigaction* %2, i32 0, i32 8)
%9 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 1
%10 = call i32 @sigfillset(i32* %9)
ret i32 0
}