#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_flags;
  int /*<<< orphan*/ sa_mask;
};

/* Variables and functions */
int /*<<< orphan*/ SA_RESTART;
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIGPIPE;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ perror(char *);
int sigaction(int /*<<< orphan*/, struct sigaction *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
scalar_t__ signal(int /*<<< orphan*/, int /*<<< orphan*/);
void initialiser_signaux(void) {
  struct sigaction sa;
  sigemptyset(&sa.sa_mask);
  sa.sa_flags = SA_RESTART;
  if (sigaction(SIGCHLD, &sa, NULL) == -1) {
    perror("sigaction(SIGCHLD)");
  }
  if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
    perror("Signal");
  }
}


x86 assembly (clang, -O0):
<initialiser_signaux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
add    $0x4,%rdi
call   1050 <sigemptyset@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
cmp    $0xffffffff,%eax
jne    118c <initialiser_signaux+0x4c>
lea    0xe79(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
mov    0x2e3c(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e1e(%rip),%rcx
cmp    (%rcx),%rax
jne    11bf <initialiser_signaux+0x7f>
lea    0xe59(%rip),%rdi
call   1060 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialiser_signaux>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <sigemptyset@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
cmp    $0xffffffff,%eax
je     1194 <initialiser_signaux+0x54>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e3b(%rip),%rcx
cmp    (%rcx),%rax
je     11a2 <initialiser_signaux+0x62>
pop    %rax
ret
lea    0xe65(%rip),%rdi
call   1060 <perror@plt>
jmp    116f <initialiser_signaux+0x2f>
lea    0xe6a(%rip),%rdi
call   1060 <perror@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.sigaction = type { i32, i32 }
@SA_RESTART = global i32 0
@SIGCHLD = global i32 0
@.str = [19 x i8] c"sigaction(SIGCHLD)\00"
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str.1 = [7 x i8] c"Signal\00"
define void @initialiser_signaux() {
%1 = alloca %struct.sigaction
%2 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i32 0, i32 1
%3 = call i32 @sigemptyset(i32* %2)
%4 = load i32, i32* @SA_RESTART
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i32 0, i32 0
store i32 %4, i32* %5
%6 = load i32, i32* @SIGCHLD
%7 = call i32 @sigaction(i32 %6, %struct.sigaction* %1, i32* null)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = load i32, i32* @SIGPIPE
%13 = load i32, i32* @SIG_IGN
%14 = call i64 @signal(i32 %12, i32 %13)
%15 = load i64, i64* @SIG_ERR
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %11
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { i32, i32 }
@SA_RESTART = global i32 0
@SIGCHLD = global i32 0
@.str = [19 x i8] c"sigaction(SIGCHLD)\00"
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@SIG_ERR = global i64 0
@.str.1 = [7 x i8] c"Signal\00"
define void @initialiser_signaux() {
%1 = alloca %struct.sigaction
%2 = bitcast %struct.sigaction* %1 to i8*
%3 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i64 0, i32 1
%4 = call i32 @sigemptyset(i32* %3)
%5 = load i32, i32* @SA_RESTART
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i64 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* @SIGCHLD
%8 = call i32 @sigaction(i32 %7, %struct.sigaction* %1, i32* null)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = load i32, i32* @SIGPIPE
%14 = load i32, i32* @SIG_IGN
%15 = call i64 @signal(i32 %13, i32 %14)
%16 = load i64, i64* @SIG_ERR
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
ret void
}