#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 */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ EDOM;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ exit_error(int /*<<< orphan*/, unsigned int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void end_action(uint32_t action, unsigned int line) {
  uint32_t act = action & 0xffff0000U;
  uint32_t data = action & 0x0000ffffU;
  switch (act) {
  case 0x80000000U:
    fprintf(stdout, "KILL_PROCESS\n");
    break;
  case 0x00000000U:
    fprintf(stdout, "KILL\n");
    break;
  case 0x00030000U:
    fprintf(stdout, "TRAP\n");
    break;
  case 0x00050000U:
    fprintf(stdout, "ERRNO(%u)\n", data);
    break;
  case 0x7ff00000U:
    fprintf(stdout, "TRACE(%u)\n", data);
    break;
  case 0x7ffc0000U:
    fprintf(stdout, "LOG\n");
    break;
  case 0x7fff0000U:
    fprintf(stdout, "ALLOW\n");
    break;
  default:
    exit_error(EDOM, line);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<end_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0xc(%rbp)
movzwl -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x80000000,%eax
je     11d4 <end_action+0xa4>
jmp    1165 <end_action+0x35>
mov    -0x14(%rbp),%eax
test   %eax,%eax
je     11f0 <end_action+0xc0>
jmp    1175 <end_action+0x45>
mov    -0x14(%rbp),%eax
sub    $0x30000,%eax
je     120c <end_action+0xdc>
jmp    1188 <end_action+0x58>
mov    -0x14(%rbp),%eax
sub    $0x50000,%eax
je     1228 <end_action+0xf8>
jmp    119b <end_action+0x6b>
mov    -0x14(%rbp),%eax
sub    $0x7ff00000,%eax
je     1247 <end_action+0x117>
jmp    11ae <end_action+0x7e>
mov    -0x14(%rbp),%eax
sub    $0x7ffc0000,%eax
je     1266 <end_action+0x136>
jmp    11c1 <end_action+0x91>
mov    -0x14(%rbp),%eax
sub    $0x7fff0000,%eax
je     1282 <end_action+0x152>
jmp    129e <end_action+0x16e>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
lea    0xe1c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12af <end_action+0x17f>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12af <end_action+0x17f>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
lea    0xdf8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12af <end_action+0x17f>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xddf(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12af <end_action+0x17f>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xdcb(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12af <end_action+0x17f>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
lea    0xdba(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12af <end_action+0x17f>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
lea    0xda3(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12af <end_action+0x17f>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
call   1030 <exit_error@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<end_action>:
push   %rax
mov    %edi,%eax
and    $0xffff0000,%eax
cmp    $0x4ffff,%eax
jle    116d <end_action+0x3d>
cmp    $0x7ffbffff,%eax
jg     1198 <end_action+0x68>
movzwl %di,%edx
cmp    $0x50000,%eax
je     11b8 <end_action+0x88>
cmp    $0x7ff00000,%eax
jne    11fa <end_action+0xca>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
jmp    11c8 <end_action+0x98>
cmp    $0x80000000,%eax
je     11d6 <end_action+0xa6>
test   %eax,%eax
je     120f <end_action+0xdf>
cmp    $0x30000,%eax
jne    11fa <end_action+0xca>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
jmp    121f <end_action+0xef>
cmp    $0x7ffc0000,%eax
je     11e8 <end_action+0xb8>
cmp    $0x7fff0000,%eax
jne    11fa <end_action+0xca>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
jmp    121f <end_action+0xef>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
lea    0xe1a(%rip),%rsi
jmp    121f <end_action+0xef>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
lea    0xe38(%rip),%rsi
jmp    121f <end_action+0xef>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
call   1030 <exit_error@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xdef(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [14 x i8] c"KILL_PROCESS\0A\00"
@.str.1 = [6 x i8] c"KILL\0A\00"
@.str.2 = [6 x i8] c"TRAP\0A\00"
@.str.3 = [11 x i8] c"ERRNO(%u)\0A\00"
@.str.4 = [11 x i8] c"TRACE(%u)\0A\00"
@.str.5 = [5 x i8] c"LOG\0A\00"
@.str.6 = [7 x i8] c"ALLOW\0A\00"
@EDOM = global i32 0
define void @end_action(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = and i32 %7, -65536
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = and i32 %9, 65535
store i32 %10, i32* %6
%11 = load i32, i32* %5
switch i32 %11, label %35 [
i32 -2147483648, label %12
i32 0, label %15
i32 196608, label %18
i32 327680, label %21
i32 2146435072, label %25
i32 2147221504, label %29
i32 2147418112, label %32
]
12: ; preds = %2
%13 = load i32, i32* @stdout
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %39
15: ; preds = %2
%16 = load i32, i32* @stdout
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %39
18: ; preds = %2
%19 = load i32, i32* @stdout
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %39
21: ; preds = %2
%22 = load i32, i32* @stdout
%23 = load i32, i32* %6
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %23)
br label %39
25: ; preds = %2
%26 = load i32, i32* @stdout
%27 = load i32, i32* %6
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %27)
br label %39
29: ; preds = %2
%30 = load i32, i32* @stdout
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %39
32: ; preds = %2
%33 = load i32, i32* @stdout
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %39
35: ; preds = %2
%36 = load i32, i32* @EDOM
%37 = load i32, i32* %4
%38 = call i32 @exit_error(i32 %36, i32 %37)
br label %39
39: ; preds = %35, %32, %29, %25, %21, %18, %15, %12
%40 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [14 x i8] c"KILL_PROCESS\0A\00"
@.str.1 = [6 x i8] c"KILL\0A\00"
@.str.2 = [6 x i8] c"TRAP\0A\00"
@.str.3 = [11 x i8] c"ERRNO(%u)\0A\00"
@.str.4 = [11 x i8] c"TRACE(%u)\0A\00"
@.str.5 = [5 x i8] c"LOG\0A\00"
@.str.6 = [7 x i8] c"ALLOW\0A\00"
@EDOM = global i32 0
define void @end_action(i32 %0, i32 %1) {
%3 = and i32 %0, -65536
%4 = and i32 %0, 65535
switch i32 %3, label %26 [
i32 -2147483648, label %5
i32 0, label %8
i32 196608, label %11
i32 327680, label %14
i32 2146435072, label %17
i32 2147221504, label %20
i32 2147418112, label %23
]
5: ; preds = %2
%6 = load i32, i32* @stdout
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %29
8: ; preds = %2
%9 = load i32, i32* @stdout
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %29
11: ; preds = %2
%12 = load i32, i32* @stdout
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %29
14: ; preds = %2
%15 = load i32, i32* @stdout
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %4)
br label %29
17: ; preds = %2
%18 = load i32, i32* @stdout
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %4)
br label %29
20: ; preds = %2
%21 = load i32, i32* @stdout
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %29
23: ; preds = %2
%24 = load i32, i32* @stdout
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
br label %29
26: ; preds = %2
%27 = load i32, i32* @EDOM
%28 = tail call i32 @exit_error(i32 %27, i32 %1)
br label %29
29: ; preds = %26, %23, %20, %17, %14, %11, %8, %5
%30 = tail call i32 @exit(i32 0)
unreachable
}