#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 SIGALRM 134
#define SIGCHLD 133
#define SIGHUP 132
#define SIGTSTP 131
#define SIGTTIN 130
#define SIGTTOU 129
#define SIGUSR1 128
scalar_t__ SIG_DFL;
scalar_t__ SIG_IGN;
int /*<<< orphan*/ exit(long);
void sigchld_handler(int s) {
  switch (s) {
  case SIGTSTP:
    exit((long)SIG_IGN);
    break;
  case SIGTTOU:
    exit((long)SIG_IGN);
    break;
  case SIGTTIN:
    exit((long)SIG_IGN);
    break;
  case SIGHUP:
    exit((long)SIG_IGN);
    break;
  case SIGALRM:
    exit(1);
    break;
  case SIGUSR1:
    exit(0);
    break;
  case SIGCHLD:
    exit(2);
    break;
  default:
    exit((long)SIG_DFL);
    break;
  }
}


x86 assembly (clang, -O0):
<sigchld_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    $0x6,%eax
ja     119d <sigchld_handler+0x8d>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e9d(%rip),%rax
mov    (%rax),%rdi
call   1030 <exit@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%rdi
call   1030 <exit@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%rdi
call   1030 <exit@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%rdi
call   1030 <exit@plt>
mov    $0x1,%edi
call   1030 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <exit@plt>
mov    $0x2,%edi
call   1030 <exit@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%rdi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sigchld_handler>:
push   %rax
add    $0xffffff80,%edi
cmp    $0x6,%edi
ja     1138 <sigchld_handler+0x28>
lea    0xee0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    0x2eb8(%rip),%rax
mov    (%rax),%rdi
call   1030 <exit@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%rdi
call   1030 <exit@plt>
xor    %edi,%edi
call   1030 <exit@plt>
mov    $0x2,%edi
call   1030 <exit@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@SIG_IGN = global i64 0
@SIG_DFL = global i64 0
define void @sigchld_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %22 [
i32 131, label %4
i32 129, label %7
i32 130, label %10
i32 132, label %13
i32 134, label %16
i32 128, label %18
i32 133, label %20
]
4: ; preds = %1
%5 = load i64, i64* @SIG_IGN
%6 = call i32 @exit(i64 %5)
unreachable
7: ; preds = %1
%8 = load i64, i64* @SIG_IGN
%9 = call i32 @exit(i64 %8)
unreachable
10: ; preds = %1
%11 = load i64, i64* @SIG_IGN
%12 = call i32 @exit(i64 %11)
unreachable
13: ; preds = %1
%14 = load i64, i64* @SIG_IGN
%15 = call i32 @exit(i64 %14)
unreachable
16: ; preds = %1
%17 = call i32 @exit(i64 1)
unreachable
18: ; preds = %1
%19 = call i32 @exit(i64 0)
unreachable
20: ; preds = %1
%21 = call i32 @exit(i64 2)
unreachable
22: ; preds = %1
%23 = load i64, i64* @SIG_DFL
%24 = call i32 @exit(i64 %23)
unreachable
}

LLVM IR (-O2):
@SIG_IGN = global i64 0
@SIG_DFL = global i64 0
define void @sigchld_handler(i32 %0) {
switch i32 %0, label %20 [
i32 131, label %2
i32 129, label %5
i32 130, label %8
i32 132, label %11
i32 134, label %14
i32 128, label %16
i32 133, label %18
]
2: ; preds = %1
%3 = load i64, i64* @SIG_IGN
%4 = tail call i32 @exit(i64 %3)
unreachable
5: ; preds = %1
%6 = load i64, i64* @SIG_IGN
%7 = tail call i32 @exit(i64 %6)
unreachable
8: ; preds = %1
%9 = load i64, i64* @SIG_IGN
%10 = tail call i32 @exit(i64 %9)
unreachable
11: ; preds = %1
%12 = load i64, i64* @SIG_IGN
%13 = tail call i32 @exit(i64 %12)
unreachable
14: ; preds = %1
%15 = tail call i32 @exit(i64 1)
unreachable
16: ; preds = %1
%17 = tail call i32 @exit(i64 0)
unreachable
18: ; preds = %1
%19 = tail call i32 @exit(i64 2)
unreachable
20: ; preds = %1
%21 = load i64, i64* @SIG_DFL
%22 = tail call i32 @exit(i64 %21)
unreachable
}