#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 SIGBUS 131
#define SIGFPE 130
#define SIGSEGV 129
#define SIGTRAP 128
int /*<<< orphan*/ int_fatal(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ setup_error(char *, int);
void signal_handler(int sig) {
  switch (sig) {
  case SIGTRAP:
    setup_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/tangentforks/zpl/refs/heads/"
                "master/comp/main/main.c",
                34);
    int_fatal(NULL, "Trace trap.");
  case SIGFPE:
    setup_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/tangentforks/zpl/refs/heads/"
                "master/comp/main/main.c",
                36);
    int_fatal(NULL, "Floating point exception.");
  case SIGBUS:
    setup_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/tangentforks/zpl/refs/heads/"
                "master/comp/main/main.c",
                38);
    int_fatal(NULL, "Bus error.");
  case SIGSEGV:
    setup_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/tangentforks/zpl/refs/heads/"
                "master/comp/main/main.c",
                40);
    int_fatal(NULL, "Segmentation violation.");
  default:
    setup_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/tangentforks/zpl/refs/heads/"
                "master/comp/main/main.c",
                42);
    int_fatal(NULL, "Unrecognized signal.");
  }
}


x86 assembly (clang, -O0):
<signal_handler>:
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    $0x3,%eax
ja     11d8 <signal_handler+0xb8>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb5(%rip),%rdi
mov    $0x22,%esi
call   1030 <setup_error@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xf2e(%rip),%rsi
call   1040 <int_fatal@plt>
lea    0xe94(%rip),%rdi
mov    $0x24,%esi
call   1030 <setup_error@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xf19(%rip),%rsi
call   1040 <int_fatal@plt>
lea    0xe73(%rip),%rdi
mov    $0x26,%esi
call   1030 <setup_error@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xf12(%rip),%rsi
call   1040 <int_fatal@plt>
lea    0xe52(%rip),%rdi
mov    $0x28,%esi
call   1030 <setup_error@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xefc(%rip),%rsi
call   1040 <int_fatal@plt>
lea    0xe31(%rip),%rdi
mov    $0x2a,%esi
call   1030 <setup_error@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xef3(%rip),%rsi
call   1040 <int_fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
add    $0xffffff80,%edi
cmp    $0x3,%edi
ja     11b9 <signal_handler+0x99>
lea    0xecc(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xecc(%rip),%rdi
mov    $0x22,%esi
call   1030 <setup_error@plt>
lea    0xf49(%rip),%rsi
xor    %edi,%edi
call   1040 <int_fatal@plt>
lea    0xead(%rip),%rdi
mov    $0x24,%esi
call   1030 <setup_error@plt>
lea    0xf36(%rip),%rsi
xor    %edi,%edi
call   1040 <int_fatal@plt>
lea    0xe8e(%rip),%rdi
mov    $0x26,%esi
call   1030 <setup_error@plt>
lea    0xf31(%rip),%rsi
xor    %edi,%edi
call   1040 <int_fatal@plt>
lea    0xe6f(%rip),%rdi
mov    $0x28,%esi
call   1030 <setup_error@plt>
lea    0xf1d(%rip),%rsi
xor    %edi,%edi
call   1040 <int_fatal@plt>
lea    0xe50(%rip),%rdi
mov    $0x2a,%esi
call   1030 <setup_error@plt>
lea    0xf16(%rip),%rsi
xor    %edi,%edi
pop    %rax
jmp    1040 <int_fatal@plt>

LLVM IR (-O0):
@.str = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tangentforks/zpl/refs/heads/master/comp/main/main.c\00"
@.str.1 = [12 x i8] c"Trace trap.\00"
@.str.2 = [26 x i8] c"Floating point exception.\00"
@.str.3 = [11 x i8] c"Bus error.\00"
@.str.4 = [24 x i8] c"Segmentation violation.\00"
@.str.5 = [21 x i8] c"Unrecognized signal.\00"
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 128, label %4
i32 130, label %7
i32 131, label %10
i32 129, label %13
]
4: ; preds = %1
%5 = call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 34)
%6 = call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %1, %4
%8 = call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 36)
%9 = call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %1, %7
%11 = call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 38)
%12 = call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %1, %10
%14 = call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 40)
%15 = call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %16
16: ; preds = %1, %13
%17 = call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 42)
%18 = call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tangentforks/zpl/refs/heads/master/comp/main/main.c\00"
@.str.1 = [12 x i8] c"Trace trap.\00"
@.str.2 = [26 x i8] c"Floating point exception.\00"
@.str.3 = [11 x i8] c"Bus error.\00"
@.str.4 = [24 x i8] c"Segmentation violation.\00"
@.str.5 = [21 x i8] c"Unrecognized signal.\00"
define void @signal_handler(i32 %0) {
switch i32 %0, label %14 [
i32 128, label %2
i32 130, label %5
i32 131, label %8
i32 129, label %11
]
2: ; preds = %1
%3 = tail call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 34)
%4 = tail call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %1, %2
%6 = tail call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 36)
%7 = tail call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %1, %5
%9 = tail call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 38)
%10 = tail call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %1, %8
%12 = tail call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 40)
%13 = tail call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %1, %11
%15 = tail call i32 @setup_error(i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str, i64 0, i64 0), i32 42)
%16 = tail call i32 @int_fatal(i32* null, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
ret void
}