#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 (*)());
void 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
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    0x2e94(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%rax
jne    1186 <init_signals+0x76>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2e7f(%rip),%rax
mov    (%rax),%rsi
call   1030 <signal@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    0x2e67(%rip),%rax
mov    (%rax),%rsi
call   1030 <signal@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    0x2e4f(%rip),%rax
mov    (%rax),%rsi
call   1030 <signal@plt>
jmp    11b0 <init_signals+0xa0>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    0x2e22(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
mov    0x2e0d(%rip),%rsi
call   1030 <signal@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
mov    0x2df8(%rip),%rsi
call   1030 <signal@plt>
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 void @init_signals() {
%1 = load i32, i32* @SIGINT
%2 = 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 %18
5: ; preds = %0
%6 = load i32, i32* @SIGINT
%7 = load i64, i64* @SIG_IGN
%8 = inttoptr i64 %7 to i32 (...)*
%9 = call i64 @signal(i32 %6, i32 (...)* %8)
%10 = load i32, i32* @SIGQUIT
%11 = load i64, i64* @SIG_IGN
%12 = inttoptr i64 %11 to i32 (...)*
%13 = call i64 @signal(i32 %10, i32 (...)* %12)
%14 = load i32, i32* @SIGHUP
%15 = load i64, i64* @SIG_IGN
%16 = inttoptr i64 %15 to i32 (...)*
%17 = call i64 @signal(i32 %14, i32 (...)* %16)
br label %23
18: ; preds = %0
%19 = load i32, i32* @SIGHUP
%20 = call i64 @signal(i32 %19, i32 (...)* @interrupt)
%21 = load i32, i32* @SIGQUIT
%22 = call i64 @signal(i32 %21, i32 (...)* @interrupt)
br label %23
23: ; preds = %18, %5
%24 = load i32, i32* @SIGTERM
%25 = call i64 @signal(i32 %24, i32 (...)* @interrupt)
ret void
}

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 void @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 void
}