#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*/ sig_t;
typedef int /*<<< orphan*/ all_signals;

/* Variables and functions */
int SIGALRM;
int SIGCONT;
int SIGHUP;
int SIGINT;
int SIGPIPE;
int SIGQUIT;
int SIGTERM;
int SIGTSTP;
int SIGTTIN;
int SIGTTOU;
int SIGUSR1;
int SIGUSR2;
int SIGWINCH;
int /*<<< orphan*/ signal(int, int /*<<< orphan*/);
void signal_all(sig_t func) {
  int all_signals[] = {SIGHUP,  SIGINT,  SIGQUIT, SIGPIPE, SIGALRM,
                       SIGTERM, SIGUSR1, SIGUSR2, SIGCONT, SIGTSTP,
                       SIGTTIN, SIGTTOU, SIGWINCH};
  int i;
  for (i = 0; i < (sizeof(all_signals) / sizeof(all_signals[0])); i++)
    signal(all_signals[i], func);
}


x86 assembly (clang, -O0):
<signal_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ece(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
cmp    $0xd,%rax
jae    11ea <signal_all+0xda>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
mov    -0x4(%rbp),%esi
call   1030 <signal@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11be <signal_all+0xae>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_all>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%r15d
mov    0x2e76(%rip),%rax
mov    (%rax),%r14d
mov    0x2e3c(%rip),%rax
mov    (%rax),%ebp
mov    0x2e7b(%rip),%rax
mov    (%rax),%r13d
mov    0x2e61(%rip),%rax
mov    (%rax),%r12d
mov    0x2e77(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2e1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    0x2e03(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
mov    0x2e3e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
mov    %ebx,%esi
call   1030 <signal@plt>
mov    %r15d,%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    %r13d,%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    %r12d,%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    0xc(%rsp),%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    0x10(%rsp),%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    0x14(%rsp),%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    0x18(%rsp),%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    0x1c(%rsp),%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    0x20(%rsp),%edi
mov    %ebx,%esi
call   1030 <signal@plt>
mov    0x24(%rsp),%edi
mov    %ebx,%esi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <signal@plt>

LLVM IR (-O0):
@SIGHUP = global i32 0
@SIGINT = global i32 0
@SIGQUIT = global i32 0
@SIGPIPE = global i32 0
@SIGALRM = global i32 0
@SIGTERM = global i32 0
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@SIGCONT = global i32 0
@SIGTSTP = global i32 0
@SIGTTIN = global i32 0
@SIGTTOU = global i32 0
@SIGWINCH = global i32 0
define void @signal_all(i32 %0) {
%2 = alloca i32
%3 = alloca [13 x i32]
%4 = alloca i32
store i32 %0, i32* %2
%5 = getelementptr inbounds [13 x i32], [13 x i32]* %3, i64 0, i64 0
%6 = load i32, i32* @SIGHUP
store i32 %6, i32* %5
%7 = getelementptr inbounds i32, i32* %5, i64 1
%8 = load i32, i32* @SIGINT
store i32 %8, i32* %7
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = load i32, i32* @SIGQUIT
store i32 %10, i32* %9
%11 = getelementptr inbounds i32, i32* %9, i64 1
%12 = load i32, i32* @SIGPIPE
store i32 %12, i32* %11
%13 = getelementptr inbounds i32, i32* %11, i64 1
%14 = load i32, i32* @SIGALRM
store i32 %14, i32* %13
%15 = getelementptr inbounds i32, i32* %13, i64 1
%16 = load i32, i32* @SIGTERM
store i32 %16, i32* %15
%17 = getelementptr inbounds i32, i32* %15, i64 1
%18 = load i32, i32* @SIGUSR1
store i32 %18, i32* %17
%19 = getelementptr inbounds i32, i32* %17, i64 1
%20 = load i32, i32* @SIGUSR2
store i32 %20, i32* %19
%21 = getelementptr inbounds i32, i32* %19, i64 1
%22 = load i32, i32* @SIGCONT
store i32 %22, i32* %21
%23 = getelementptr inbounds i32, i32* %21, i64 1
%24 = load i32, i32* @SIGTSTP
store i32 %24, i32* %23
%25 = getelementptr inbounds i32, i32* %23, i64 1
%26 = load i32, i32* @SIGTTIN
store i32 %26, i32* %25
%27 = getelementptr inbounds i32, i32* %25, i64 1
%28 = load i32, i32* @SIGTTOU
store i32 %28, i32* %27
%29 = getelementptr inbounds i32, i32* %27, i64 1
%30 = load i32, i32* @SIGWINCH
store i32 %30, i32* %29
store i32 0, i32* %4
br label %31
31: ; preds = %42, %1
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = icmp ult i64 %33, 13
br i1 %34, label %35, label %45
35: ; preds = %31
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [13 x i32], [13 x i32]* %3, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = load i32, i32* %2
%41 = call i32 @signal(i32 %39, i32 %40)
br label %42
42: ; preds = %35
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %31
45: ; preds = %31
ret void
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@SIGINT = global i32 0
@SIGQUIT = global i32 0
@SIGPIPE = global i32 0
@SIGALRM = global i32 0
@SIGTERM = global i32 0
@SIGUSR1 = global i32 0
@SIGUSR2 = global i32 0
@SIGCONT = global i32 0
@SIGTSTP = global i32 0
@SIGTTIN = global i32 0
@SIGTTOU = global i32 0
@SIGWINCH = global i32 0
define void @signal_all(i32 %0) {
%2 = load i32, i32* @SIGHUP
%3 = load i32, i32* @SIGINT
%4 = load i32, i32* @SIGQUIT
%5 = load i32, i32* @SIGPIPE
%6 = load i32, i32* @SIGALRM
%7 = load i32, i32* @SIGTERM
%8 = load i32, i32* @SIGUSR1
%9 = load i32, i32* @SIGUSR2
%10 = load i32, i32* @SIGCONT
%11 = load i32, i32* @SIGTSTP
%12 = load i32, i32* @SIGTTIN
%13 = load i32, i32* @SIGTTOU
%14 = load i32, i32* @SIGWINCH
%15 = tail call i32 @signal(i32 %2, i32 %0)
%16 = tail call i32 @signal(i32 %3, i32 %0)
%17 = tail call i32 @signal(i32 %4, i32 %0)
%18 = tail call i32 @signal(i32 %5, i32 %0)
%19 = tail call i32 @signal(i32 %6, i32 %0)
%20 = tail call i32 @signal(i32 %7, i32 %0)
%21 = tail call i32 @signal(i32 %8, i32 %0)
%22 = tail call i32 @signal(i32 %9, i32 %0)
%23 = tail call i32 @signal(i32 %10, i32 %0)
%24 = tail call i32 @signal(i32 %11, i32 %0)
%25 = tail call i32 @signal(i32 %12, i32 %0)
%26 = tail call i32 @signal(i32 %13, i32 %0)
%27 = tail call i32 @signal(i32 %14, i32 %0)
ret void
}