#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*/ SFD_CLOEXEC;
int /*<<< orphan*/ _err_exit(char *, int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ errno;
int sigfillset(int /*<<< orphan*/ *);
int signalfd(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int init_signalfd(void) {
  sigset_t set;
  int fd;
  int rc;
  rc = sigfillset(&set);
  if (rc != 0)
    _err_exit("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Morgan-Stanley/treadmill-pid1/refs/"
              "heads/main/src/pid1.c",
              202, errno, "sigfillset");
  fd = signalfd(-1, &set, SFD_CLOEXEC);
  if (fd < 0)
    _err_exit("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Morgan-Stanley/treadmill-pid1/refs/"
              "heads/main/src/pid1.c",
              206, errno, "signalfd");
  return fd;
}


x86 assembly (clang, -O0):
<init_signalfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <sigfillset@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116f <init_signalfd+0x3f>
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
lea    0xea2(%rip),%rdi
mov    $0xca,%esi
lea    0xf29(%rip),%rcx
call   1040 <_err_exit@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x4(%rbp),%rsi
call   1030 <signalfd@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11b4 <init_signalfd+0x84>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edx
lea    0xe5d(%rip),%rdi
mov    $0xce,%esi
lea    0xeef(%rip),%rcx
call   1040 <_err_exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_signalfd>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1050 <sigfillset@plt>
test   %eax,%eax
je     1164 <init_signalfd+0x34>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edx
lea    0xead(%rip),%rdi
lea    0xf39(%rip),%rcx
mov    $0xca,%esi
call   1040 <_err_exit@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
lea    0xc(%rsp),%rsi
mov    $0xffffffff,%edi
call   1030 <signalfd@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    11a3 <init_signalfd+0x73>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edx
lea    0xe6e(%rip),%rdi
lea    0xf05(%rip),%rcx
mov    $0xce,%esi
call   1040 <_err_exit@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Morgan-Stanley/treadmill-pid1/refs/heads/main/src/pid1.c\00"
@errno = global i32 0
@.str.1 = [11 x i8] c"sigfillset\00"
@SFD_CLOEXEC = global i32 0
@.str.2 = [9 x i8] c"signalfd\00"
define i32 @init_signalfd() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @sigfillset(i32* %1)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @errno
%9 = call i32 @_err_exit(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 202, i32 %8, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* @SFD_CLOEXEC
%12 = call i32 @signalfd(i32 -1, i32* %1, i32 %11)
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* @errno
%17 = call i32 @_err_exit(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 206, i32 %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %15, %10
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Morgan-Stanley/treadmill-pid1/refs/heads/main/src/pid1.c\00"
@errno = global i32 0
@.str.1 = [11 x i8] c"sigfillset\00"
@SFD_CLOEXEC = global i32 0
@.str.2 = [9 x i8] c"signalfd\00"
define i32 @init_signalfd() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigfillset(i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i32, i32* @errno
%7 = call i32 @_err_exit(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 202, i32 %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %5, %0
%9 = load i32, i32* @SFD_CLOEXEC
%10 = call i32 @signalfd(i32 -1, i32* %1, i32 %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* @errno
%14 = call i32 @_err_exit(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 206, i32 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %12, %8
ret i32 %10
}