#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 */

/* Variables and functions */
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIGQUIT;
int /*<<< orphan*/ SIGTERM;
scalar_t__ SIG_IGN;
scalar_t__ signal(int /*<<< orphan*/, int (*)());
init_signals() {
  int interrupt();
  if (signal(SIGINT, interrupt) == SIG_IGN) {
    signal(SIGINT, SIG_IGN);
    signal(SIGQUIT, SIG_IGN);
    signal(SIGHUP, SIG_IGN);
  } else {
    signal(SIGHUP, interrupt);
    signal(SIGQUIT, interrupt);
  }
  signal(SIGTERM, interrupt);
}


x86 assembly (clang, -O0):
<init_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
mov    0x2e90(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e94(%rip),%rcx
cmp    (%rcx),%rax
jne    118a <init_signals+0x7a>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
mov    0x2e7b(%rip),%rax
mov    (%rax),%rsi
call   1030 <signal@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
mov    0x2e63(%rip),%rax
mov    (%rax),%rsi
call   1030 <signal@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    0x2e4b(%rip),%rax
mov    (%rax),%rsi
call   1030 <signal@plt>
jmp    11b4 <init_signals+0xa4>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
mov    0x2e1e(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
mov    0x2e09(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
mov    0x2df4(%rip),%rsi
call   1030 <signal@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_signals>:
push   %r14
push   %rbx
push   %rax
mov    0x2ec5(%rip),%r14
mov    (%r14),%edi
mov    0x2e93(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e97(%rip),%rbx
cmp    (%rbx),%rax
jne    1160 <init_signals+0x50>
mov    (%r14),%edi
mov    %rax,%rsi
call   1030 <signal@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rsi
call   1030 <signal@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rsi
jmp    1184 <init_signals+0x74>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    0x2e48(%rip),%rbx
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1030 <signal@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
mov    0x2e1f(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <signal@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@SIG_IGN = global i64 0
@SIGQUIT = global i32 0
@SIGHUP = global i32 0
@SIGTERM = global i32 0
define i32 @init_signals() {
%1 = alloca i32
%2 = load i32, i32* @SIGINT
%3 = call i64 @signal(i32 %2, i32 (...)* @interrupt)
%4 = load i64, i64* @SIG_IGN
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %19
6: ; preds = %0
%7 = load i32, i32* @SIGINT
%8 = load i64, i64* @SIG_IGN
%9 = inttoptr i64 %8 to i32 (...)*
%10 = call i64 @signal(i32 %7, i32 (...)* %9)
%11 = load i32, i32* @SIGQUIT
%12 = load i64, i64* @SIG_IGN
%13 = inttoptr i64 %12 to i32 (...)*
%14 = call i64 @signal(i32 %11, i32 (...)* %13)
%15 = load i32, i32* @SIGHUP
%16 = load i64, i64* @SIG_IGN
%17 = inttoptr i64 %16 to i32 (...)*
%18 = call i64 @signal(i32 %15, i32 (...)* %17)
br label %24
19: ; preds = %0
%20 = load i32, i32* @SIGHUP
%21 = call i64 @signal(i32 %20, i32 (...)* @interrupt)
%22 = load i32, i32* @SIGQUIT
%23 = call i64 @signal(i32 %22, i32 (...)* @interrupt)
br label %24
24: ; preds = %19, %6
%25 = load i32, i32* @SIGTERM
%26 = call i64 @signal(i32 %25, i32 (...)* @interrupt)
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@SIGINT = global i32 0
@SIG_IGN = global i64 0
@SIGQUIT = global i32 0
@SIGHUP = global i32 0
@SIGTERM = global i32 0
define i32 @init_signals() {
%1 = load i32, i32* @SIGINT
%2 = tail call i64 @signal(i32 %1, i32 (...)* @interrupt)
%3 = load i64, i64* @SIG_IGN
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %17
5: ; preds = %0
%6 = load i32, i32* @SIGINT
%7 = inttoptr i64 %2 to i32 (...)*
%8 = tail call i64 @signal(i32 %6, i32 (...)* %7)
%9 = load i32, i32* @SIGQUIT
%10 = load i64, i64* @SIG_IGN
%11 = inttoptr i64 %10 to i32 (...)*
%12 = tail call i64 @signal(i32 %9, i32 (...)* %11)
%13 = load i32, i32* @SIGHUP
%14 = load i64, i64* @SIG_IGN
%15 = inttoptr i64 %14 to i32 (...)*
%16 = tail call i64 @signal(i32 %13, i32 (...)* %15)
br label %22
17: ; preds = %0
%18 = load i32, i32* @SIGHUP
%19 = tail call i64 @signal(i32 %18, i32 (...)* @interrupt)
%20 = load i32, i32* @SIGQUIT
%21 = tail call i64 @signal(i32 %20, i32 (...)* @interrupt)
br label %22
22: ; preds = %17, %5
%23 = load i32, i32* @SIGTERM
%24 = tail call i64 @signal(i32 %23, i32 (...)* @interrupt)
ret i32 undef
}