#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*/ LOG_NOTICE;
#define SIGALRM 135
#define SIGCHLD 134
#define SIGPWR 133
#define SIGQUIT 132
#define SIGSTOP 131
#define SIGTERM 130
#define SIGUSR1 129
#define SIGXCPU 128
int /*<<< orphan*/ end_ffcycle();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int);
void EXIT_Handler(int sig) {
  syslog(LOG_NOTICE, "EXIT_handler processing signal code=%d", sig);
  switch (sig) {
  case SIGALRM:
    exit(1);
    break;
  case SIGUSR1:
    exit(0);
    break;
  case SIGCHLD:
    exit(1);
    break;
  case SIGQUIT:
  case SIGPWR:
  case SIGSTOP:
  case SIGXCPU:
  case SIGTERM:
  default:
    end_ffcycle();
    exit(0);
  }
}


x86 assembly (clang, -O0):
<EXIT_Handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xed2(%rip),%rsi
call   1040 <syslog@plt>
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     119c <EXIT_Handler+0x6c>
mov    -0x10(%rbp),%rax
lea    0xe8d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    119c <EXIT_Handler+0x6c>
mov    $0x0,%al
call   1030 <end_ffcycle@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<EXIT_Handler>:
push   %rbx
mov    %edi,%ebx
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
mov    %ebx,%edx
call   1040 <syslog@plt>
cmp    $0x81,%ebx
je     116c <EXIT_Handler+0x3c>
cmp    $0x86,%ebx
je     1162 <EXIT_Handler+0x32>
cmp    $0x87,%ebx
jne    1173 <EXIT_Handler+0x43>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <end_ffcycle@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@LOG_NOTICE = global i32 0
@.str = [39 x i8] c"EXIT_handler processing signal code=%d\00"
define void @EXIT_Handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @LOG_NOTICE
%4 = load i32, i32* %2
%5 = call i32 @syslog(i32 %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
switch i32 %6, label %14 [
i32 135, label %7
i32 129, label %9
i32 134, label %11
i32 132, label %13
i32 133, label %13
i32 131, label %13
i32 128, label %13
i32 130, label %13
]
7: ; preds = %1
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %1
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %1
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1, %1, %1, %1, %1
br label %14
14: ; preds = %1, %13
%15 = call i32 (...) @end_ffcycle()
%16 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@LOG_NOTICE = global i32 0
@.str = [39 x i8] c"EXIT_handler processing signal code=%d\00"
define void @EXIT_Handler(i32 %0) {
%2 = load i32, i32* @LOG_NOTICE
%3 = tail call i32 @syslog(i32 %2, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %0)
switch i32 %0, label %10 [
i32 135, label %4
i32 129, label %6
i32 134, label %8
]
4: ; preds = %1
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %1
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %1
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %1
%11 = tail call i32 (...) @end_ffcycle()
%12 = tail call i32 @exit(i32 0)
unreachable
}