#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 */
#define SIGHUP 131
#define SIGINT 130
#define SIGUSR1 129
#define SIGUSR2 128
int errno;
int /*<<< orphan*/ set_cont(int /*<<< orphan*/);
int /*<<< orphan*/ set_dump(int);
int /*<<< orphan*/ set_dump_if_list(int);
int /*<<< orphan*/ set_reload_cfg(int);
void signal_handler(int signo) {
  int errno_save;
  errno_save = errno;
  switch (signo) {
  case SIGINT:
    set_cont(0);
    break;
  case SIGUSR1:
    set_dump(1);
    break;
  case SIGUSR2:
    set_dump_if_list(1);
    break;
  case SIGHUP:
    set_reload_cfg(1);
    break;
  }
  errno = errno_save;
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11b4 <signal_handler+0x74>
mov    -0x10(%rbp),%rax
lea    0xe89(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %edi,%edi
call   1060 <set_cont@plt>
jmp    11b4 <signal_handler+0x74>
mov    $0x1,%edi
call   1050 <set_dump@plt>
jmp    11b4 <signal_handler+0x74>
mov    $0x1,%edi
call   1040 <set_dump_if_list@plt>
jmp    11b4 <signal_handler+0x74>
mov    $0x1,%edi
call   1030 <set_reload_cfg@plt>
mov    -0x8(%rbp),%ecx
mov    0x2e22(%rip),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_handler>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e96(%rip),%rbx
mov    (%rbx),%ebp
add    $0xffffff80,%edi
cmp    $0x3,%edi
ja     118f <signal_handler+0x4f>
lea    0xea5(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    $0x1,%edi
call   1040 <set_dump_if_list@plt>
jmp    118f <signal_handler+0x4f>
mov    $0x1,%edi
call   1050 <set_dump@plt>
jmp    118f <signal_handler+0x4f>
xor    %edi,%edi
call   1060 <set_cont@plt>
jmp    118f <signal_handler+0x4f>
mov    $0x1,%edi
call   1030 <set_reload_cfg@plt>
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
define void @signal_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @errno
store i32 %4, i32* %3
%5 = load i32, i32* %2
switch i32 %5, label %14 [
i32 130, label %6
i32 129, label %8
i32 128, label %10
i32 131, label %12
]
6: ; preds = %1
%7 = call i32 @set_cont(i32 0)
br label %14
8: ; preds = %1
%9 = call i32 @set_dump(i32 1)
br label %14
10: ; preds = %1
%11 = call i32 @set_dump_if_list(i32 1)
br label %14
12: ; preds = %1
%13 = call i32 @set_reload_cfg(i32 1)
br label %14
14: ; preds = %1, %12, %10, %8, %6
%15 = load i32, i32* %3
store i32 %15, i32* @errno
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @signal_handler(i32 %0) {
%2 = load i32, i32* @errno
switch i32 %0, label %11 [
i32 130, label %3
i32 129, label %5
i32 128, label %7
i32 131, label %9
]
3: ; preds = %1
%4 = tail call i32 @set_cont(i32 0)
br label %11
5: ; preds = %1
%6 = tail call i32 @set_dump(i32 1)
br label %11
7: ; preds = %1
%8 = tail call i32 @set_dump_if_list(i32 1)
br label %11
9: ; preds = %1
%10 = tail call i32 @set_reload_cfg(i32 1)
br label %11
11: ; preds = %1, %9, %7, %5, %3
store i32 %2, i32* @errno
ret void
}