#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 sa_flags;
  int /*<<< orphan*/ sa_mask;
  int /*<<< orphan*/ sa_handler;
};
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int SA_NOCLDSTOP;
int SA_NOCLDWAIT;
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ memset(struct sigaction *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sigaction(int /*<<< orphan*/, struct sigaction *,
                             int /*<<< orphan*/ *);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
void signal_handler_initialize() {
  sigset_t sigset;
  sigemptyset(&sigset);
  struct sigaction action;
  memset(&action, 0, sizeof(struct sigaction));
  action.sa_handler = SIG_IGN;
  action.sa_mask = sigset;
  action.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT;
  sigaction(SIGCHLD, &action, NULL);
}


x86 assembly (clang, -O0):
<signal_handler_initialize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <sigemptyset@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    0x2e75(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_handler_initialize>:
push   %rbx
sub    $0x20,%rsp
lea    0xc(%rsp),%rdi
call   1050 <sigemptyset@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2e69(%rip),%rax
mov    0x2e7a(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0xc(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    %ecx,0x10(%rsp)
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigaction = type { i32, i32, i32 }
@SIG_IGN = global i32 0
@SA_NOCLDSTOP = global i32 0
@SA_NOCLDWAIT = global i32 0
@SIGCHLD = global i32 0
define void @signal_handler_initialize() {
%1 = alloca i32
%2 = alloca %struct.sigaction
%3 = call i32 @sigemptyset(i32* %1)
%4 = call i32 @memset(%struct.sigaction* %2, i32 0, i32 12)
%5 = load i32, i32* @SIG_IGN
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 2
store i32 %5, i32* %6
%7 = load i32, i32* %1
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 1
store i32 %7, i32* %8
%9 = load i32, i32* @SA_NOCLDSTOP
%10 = load i32, i32* @SA_NOCLDWAIT
%11 = or i32 %9, %10
%12 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i32 0, i32 0
store i32 %11, i32* %12
%13 = load i32, i32* @SIGCHLD
%14 = call i32 @sigaction(i32 %13, %struct.sigaction* %2, i32* null)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i32, i32, i32 }
@SIG_IGN = global i32 0
@SA_NOCLDSTOP = global i32 0
@SA_NOCLDWAIT = global i32 0
@SIGCHLD = global i32 0
define void @signal_handler_initialize() {
%1 = alloca i32
%2 = alloca %struct.sigaction
%3 = bitcast i32* %1 to i8*
%4 = call i32 @sigemptyset(i32* %1)
%5 = bitcast %struct.sigaction* %2 to i8*
%6 = call i32 @memset(%struct.sigaction* %2, i32 0, i32 12)
%7 = load i32, i32* @SIG_IGN
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 2
store i32 %7, i32* %8
%9 = load i32, i32* %1
%10 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 1
store i32 %9, i32* %10
%11 = load i32, i32* @SA_NOCLDSTOP
%12 = load i32, i32* @SA_NOCLDWAIT
%13 = or i32 %12, %11
%14 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 0
store i32 %13, i32* %14
%15 = load i32, i32* @SIGCHLD
%16 = call i32 @sigaction(i32 %15, %struct.sigaction* %2, i32* null)
ret void
}