#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 & 0x7fff0000U;
  uint32_t data = action & 0x0000ffffU;
  switch (act) {
  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 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)
mov    -0x4(%rbp),%eax
and    $0x7fff0000,%eax
mov    %eax,-0xc(%rbp)
movzwl -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     11af <end_action+0x7f>
jmp    1163 <end_action+0x33>
mov    -0x14(%rbp),%eax
sub    $0x30000,%eax
je     11cb <end_action+0x9b>
jmp    1176 <end_action+0x46>
mov    -0x14(%rbp),%eax
sub    $0x50000,%eax
je     11e7 <end_action+0xb7>
jmp    1189 <end_action+0x59>
mov    -0x14(%rbp),%eax
sub    $0x7ff00000,%eax
je     1206 <end_action+0xd6>
jmp    119c <end_action+0x6c>
mov    -0x14(%rbp),%eax
sub    $0x7fff0000,%eax
je     1225 <end_action+0xf5>
jmp    1241 <end_action+0x111>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe41(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1252 <end_action+0x122>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1252 <end_action+0x122>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xe12(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1252 <end_action+0x122>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%edx
lea    0xdfe(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1252 <end_action+0x122>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
lea    0xded(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1252 <end_action+0x122>
mov    0x2da0(%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    $0x7fff0000,%eax
cmp    $0x4ffff,%eax
jle    1169 <end_action+0x39>
movzwl %di,%edx
cmp    $0x50000,%eax
je     1186 <end_action+0x56>
cmp    $0x7ff00000,%eax
je     1198 <end_action+0x68>
cmp    $0x7fff0000,%eax
jne    11d4 <end_action+0xa4>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xebb(%rip),%rsi
jmp    11c6 <end_action+0x96>
test   %eax,%eax
je     11b6 <end_action+0x86>
cmp    $0x30000,%eax
jne    11d4 <end_action+0xa4>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
jmp    11c6 <end_action+0x96>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
jmp    11a8 <end_action+0x78>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x2e0d(%rip),%rax
mov    (%rax),%edi
call   1030 <exit_error@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [6 x i8] c"KILL\0A\00"
@.str.1 = [6 x i8] c"TRAP\0A\00"
@.str.2 = [11 x i8] c"ERRNO(%u)\0A\00"
@.str.3 = [11 x i8] c"TRACE(%u)\0A\00"
@.str.4 = [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, 2147418112
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 %29 [
i32 0, label %12
i32 196608, label %15
i32 327680, label %18
i32 2146435072, label %22
i32 2147418112, label %26
]
12: ; preds = %2
%13 = load i32, i32* @stdout
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %33
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 %33
18: ; preds = %2
%19 = load i32, i32* @stdout
%20 = load i32, i32* %6
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %33
22: ; preds = %2
%23 = load i32, i32* @stdout
%24 = load i32, i32* %6
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %33
26: ; preds = %2
%27 = load i32, i32* @stdout
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %33
29: ; preds = %2
%30 = load i32, i32* @EDOM
%31 = load i32, i32* %4
%32 = call i32 @exit_error(i32 %30, i32 %31)
br label %33
33: ; preds = %29, %26, %22, %18, %15, %12
%34 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [6 x i8] c"KILL\0A\00"
@.str.1 = [6 x i8] c"TRAP\0A\00"
@.str.2 = [11 x i8] c"ERRNO(%u)\0A\00"
@.str.3 = [11 x i8] c"TRACE(%u)\0A\00"
@.str.4 = [7 x i8] c"ALLOW\0A\00"
@EDOM = global i32 0
define void @end_action(i32 %0, i32 %1) {
%3 = and i32 %0, 2147418112
%4 = and i32 %0, 65535
switch i32 %3, label %20 [
i32 0, label %5
i32 196608, label %8
i32 327680, label %11
i32 2146435072, label %14
i32 2147418112, label %17
]
5: ; preds = %2
%6 = load i32, i32* @stdout
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %23
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 %23
11: ; preds = %2
%12 = load i32, i32* @stdout
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %4)
br label %23
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 %23
17: ; preds = %2
%18 = load i32, i32* @stdout
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %23
20: ; preds = %2
%21 = load i32, i32* @EDOM
%22 = tail call i32 @exit_error(i32 %21, i32 %1)
br label %23
23: ; preds = %20, %17, %14, %11, %8, %5
%24 = tail call i32 @exit(i32 0)
unreachable
}