#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 SIGINT 133
#define SIGKILL 132
#define SIGPIPE 131
#define SIGSEGV 130
#define SIGTERM 129
#define SIGUSR1 128
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void exit_log(int signo) {
  switch (signo) {
  case SIGPIPE:
    return;
    break;
  case SIGTERM:
    exit(0);
    break;
  case SIGKILL:
    exit(0);
    break;
  case SIGINT:
    exit(0);
    break;
  case SIGUSR1:
    break;
  case SIGSEGV:
    printf("segmentation fault\n");
    exit(0);
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<exit_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     1186 <exit_log+0x66>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    118b <exit_log+0x6b>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %edi,%edi
call   1040 <exit@plt>
jmp    1186 <exit_log+0x66>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
jmp    118b <exit_log+0x6b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exit_log>:
push   %rax
add    $0xffffff7f,%edi
cmp    $0x4,%edi
ja     113c <exit_log+0x1c>
lea    0xecd(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
pop    %rax
ret
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"segmentation fault\0A\00"
define void @exit_log(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %15 [
i32 131, label %4
i32 129, label %5
i32 132, label %7
i32 133, label %9
i32 128, label %11
i32 130, label %12
]
4: ; preds = %1
br label %16
5: ; preds = %1
%6 = call i32 @exit(i32 0)
unreachable
7: ; preds = %1
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %1
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %1
br label %15
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %1, %11
br label %16
16: ; preds = %15, %4
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"segmentation fault\00"
define void @exit_log(i32 %0) {
switch i32 %0, label %11 [
i32 130, label %8
i32 129, label %2
i32 132, label %4
i32 133, label %6
]
2: ; preds = %1
%3 = tail call i32 @exit(i32 0)
unreachable
4: ; preds = %1
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %1
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 0)
unreachable
11: ; preds = %1
ret void
}