#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*/ SIGBUS;
int /*<<< orphan*/ SIGHUP;
int /*<<< orphan*/ SIGSEGV;
int /*<<< orphan*/ SIGUSR1;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ install_handler(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ test(int, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  install_handler(SIGHUP, SIG_DFL);
  test(0, SIGSEGV, SIGBUS);
  test(0, SIGSEGV, SIGHUP);
  test(0, SIGUSR1, SIGBUS);
  test(0, SIGUSR1, SIGHUP);
  test(1, SIGSEGV, SIGBUS);
  test(1, SIGSEGV, SIGHUP);
  test(1, SIGUSR1, SIGBUS);
  test(1, SIGUSR1, SIGHUP);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
call   1030 <install_handler@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
mov    0x2e60(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%esi
mov    0x2e4f(%rip),%rax
mov    (%rax),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
mov    0x2e2e(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <test@plt>
mov    0x2e03(%rip),%rax
mov    (%rax),%esi
mov    0x2e1a(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <test@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%esi
mov    0x2df6(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <test@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
mov    0x2de2(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1040 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2ec1(%rip),%r14
mov    (%r14),%edi
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
call   1030 <install_handler@plt>
mov    0x2e89(%rip),%r12
mov    (%r12),%esi
mov    0x2e96(%rip),%r15
mov    (%r15),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    (%r12),%esi
mov    (%r14),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    0x2e67(%rip),%rbx
mov    (%rbx),%esi
mov    (%r15),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    (%rbx),%esi
mov    (%r14),%edx
xor    %edi,%edi
call   1040 <test@plt>
mov    (%r12),%esi
mov    (%r15),%edx
mov    $0x1,%edi
call   1040 <test@plt>
mov    (%r12),%esi
mov    (%r14),%edx
mov    $0x1,%edi
call   1040 <test@plt>
mov    (%rbx),%esi
mov    (%r15),%edx
mov    $0x1,%edi
call   1040 <test@plt>
mov    (%rbx),%esi
mov    (%r14),%edx
mov    $0x1,%edi
call   1040 <test@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SIGHUP = global i32 0
@SIG_DFL = global i32 0
@SIGSEGV = global i32 0
@SIGBUS = global i32 0
@SIGUSR1 = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @SIGHUP
%3 = load i32, i32* @SIG_DFL
%4 = call i32 @install_handler(i32 %2, i32 %3)
%5 = load i32, i32* @SIGSEGV
%6 = load i32, i32* @SIGBUS
%7 = call i32 @test(i32 0, i32 %5, i32 %6)
%8 = load i32, i32* @SIGSEGV
%9 = load i32, i32* @SIGHUP
%10 = call i32 @test(i32 0, i32 %8, i32 %9)
%11 = load i32, i32* @SIGUSR1
%12 = load i32, i32* @SIGBUS
%13 = call i32 @test(i32 0, i32 %11, i32 %12)
%14 = load i32, i32* @SIGUSR1
%15 = load i32, i32* @SIGHUP
%16 = call i32 @test(i32 0, i32 %14, i32 %15)
%17 = load i32, i32* @SIGSEGV
%18 = load i32, i32* @SIGBUS
%19 = call i32 @test(i32 1, i32 %17, i32 %18)
%20 = load i32, i32* @SIGSEGV
%21 = load i32, i32* @SIGHUP
%22 = call i32 @test(i32 1, i32 %20, i32 %21)
%23 = load i32, i32* @SIGUSR1
%24 = load i32, i32* @SIGBUS
%25 = call i32 @test(i32 1, i32 %23, i32 %24)
%26 = load i32, i32* @SIGUSR1
%27 = load i32, i32* @SIGHUP
%28 = call i32 @test(i32 1, i32 %26, i32 %27)
ret i32 0
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@SIG_DFL = global i32 0
@SIGSEGV = global i32 0
@SIGBUS = global i32 0
@SIGUSR1 = global i32 0
define i32 @main() {
%1 = load i32, i32* @SIGHUP
%2 = load i32, i32* @SIG_DFL
%3 = tail call i32 @install_handler(i32 %1, i32 %2)
%4 = load i32, i32* @SIGSEGV
%5 = load i32, i32* @SIGBUS
%6 = tail call i32 @test(i32 0, i32 %4, i32 %5)
%7 = load i32, i32* @SIGSEGV
%8 = load i32, i32* @SIGHUP
%9 = tail call i32 @test(i32 0, i32 %7, i32 %8)
%10 = load i32, i32* @SIGUSR1
%11 = load i32, i32* @SIGBUS
%12 = tail call i32 @test(i32 0, i32 %10, i32 %11)
%13 = load i32, i32* @SIGUSR1
%14 = load i32, i32* @SIGHUP
%15 = tail call i32 @test(i32 0, i32 %13, i32 %14)
%16 = load i32, i32* @SIGSEGV
%17 = load i32, i32* @SIGBUS
%18 = tail call i32 @test(i32 1, i32 %16, i32 %17)
%19 = load i32, i32* @SIGSEGV
%20 = load i32, i32* @SIGHUP
%21 = tail call i32 @test(i32 1, i32 %19, i32 %20)
%22 = load i32, i32* @SIGUSR1
%23 = load i32, i32* @SIGBUS
%24 = tail call i32 @test(i32 1, i32 %22, i32 %23)
%25 = load i32, i32* @SIGUSR1
%26 = load i32, i32* @SIGHUP
%27 = tail call i32 @test(i32 1, i32 %25, i32 %26)
ret i32 0
}