#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_INFO;
#define SIGALRM 130
#define SIGCHLD 129
#define SIGUSR1 128
scalar_t__ SIG_DFL;
int /*<<< orphan*/ exit(long);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
void child_handler(int signum) {
  switch (signum) {
  case SIGALRM:
    exit(1);
    break;
  case SIGUSR1:
    syslog(LOG_INFO, "child_handler: SIGUSR1");
    exit(0);
    break;
  case SIGCHLD:
    exit(1);
    break;
  default:
    exit((long)SIG_DFL);
    break;
  }
}


x86 assembly (clang, -O0):
<child_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x80,%eax
je     1171 <child_handler+0x51>
jmp    1141 <child_handler+0x21>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
je     118f <child_handler+0x6f>
jmp    1154 <child_handler+0x34>
mov    -0x8(%rbp),%eax
sub    $0x82,%eax
jne    1199 <child_handler+0x79>
jmp    1167 <child_handler+0x47>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1030 <syslog@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <exit@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%rdi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<child_handler>:
push   %rax
cmp    $0x80,%edi
je     1143 <child_handler+0x23>
cmp    $0x81,%edi
je     1139 <child_handler+0x19>
cmp    $0x82,%edi
jne    115f <child_handler+0x3f>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
call   1030 <syslog@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%rdi
call   1040 <exit@plt>

LLVM IR (-O0):
@LOG_INFO = global i32 0
@.str = [23 x i8] c"child_handler: SIGUSR1\00"
@SIG_DFL = global i64 0
define void @child_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 130, label %4
i32 128, label %6
i32 129, label %10
]
4: ; preds = %1
%5 = call i32 @exit(i64 1)
unreachable
6: ; preds = %1
%7 = load i32, i32* @LOG_INFO
%8 = call i32 @syslog(i32 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i64 0)
unreachable
10: ; preds = %1
%11 = call i32 @exit(i64 1)
unreachable
12: ; preds = %1
%13 = load i64, i64* @SIG_DFL
%14 = call i32 @exit(i64 %13)
unreachable
}

LLVM IR (-O2):
@LOG_INFO = global i32 0
@.str = [23 x i8] c"child_handler: SIGUSR1\00"
@SIG_DFL = global i64 0
define void @child_handler(i32 %0) {
switch i32 %0, label %10 [
i32 130, label %2
i32 128, label %4
i32 129, label %8
]
2: ; preds = %1
%3 = tail call i32 @exit(i64 1)
unreachable
4: ; preds = %1
%5 = load i32, i32* @LOG_INFO
%6 = tail call i32 @syslog(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i64 0)
unreachable
8: ; preds = %1
%9 = tail call i32 @exit(i64 1)
unreachable
10: ; preds = %1
%11 = load i64, i64* @SIG_DFL
%12 = tail call i32 @exit(i64 %11)
unreachable
}