#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 /*<<< orphan*/ actname;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int);
const char *filter_Action2Nam(unsigned act) {
  static const char *const actname[] = {"  none ", "permit ", "  deny "};
  static char buf[8];
  if (act < 40) {
    snprintf(buf, sizeof buf, "%6d ", act);
    return buf;
  } else if (act >= (40) && act < (40) + sizeof(actname) / sizeof(char *))
    return actname[act - (40)];
  else
    return "?????? ";
}


x86 assembly (clang, -O0):
<filter_Action2Nam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x28,-0xc(%rbp)
jae    1150 <filter_Action2Nam+0x40>
mov    -0xc(%rbp),%ecx
lea    0x2efa(%rip),%rdi
mov    $0x8,%esi
lea    0xedd(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2ee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1190 <filter_Action2Nam+0x80>
cmpl   $0x28,-0xc(%rbp)
jb     1185 <filter_Action2Nam+0x75>
mov    -0xc(%rbp),%eax
cmp    $0x2b,%rax
jae    1185 <filter_Action2Nam+0x75>
mov    -0xc(%rbp),%eax
sub    $0x28,%eax
mov    %eax,%eax
mov    %eax,%ecx
lea    0x2c88(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1190 <filter_Action2Nam+0x80>
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter_Action2Nam>:
push   %rbx
mov    %edi,%ecx
cmp    $0x27,%edi
ja     1135 <filter_Action2Nam+0x25>
lea    0x2f0a(%rip),%rbx
lea    0xefe(%rip),%rdx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <snprintf@plt>
jmp    1154 <filter_Action2Nam+0x44>
cmp    $0x2a,%ecx
ja     114d <filter_Action2Nam+0x3d>
add    $0xffffffd8,%ecx
lea    0xebc(%rip),%rax
movslq (%rax,%rcx,4),%rbx
add    %rax,%rbx
jmp    1154 <filter_Action2Nam+0x44>
lea    0xed5(%rip),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@filter_Action2Nam.actname = internal constant [3 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0)]
@.str = [8 x i8] c" none \00"
@.str.1 = [8 x i8] c"permit \00"
@.str.2 = [8 x i8] c" deny \00"
@filter_Action2Nam.buf = internal global [8 x i8] zeroinitializer
@.str.3 = [5 x i8] c"%6d \00"
@.str.4 = [8 x i8] c"?????? \00"
define i8* @filter_Action2Nam(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 40
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = call i32 @snprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @filter_Action2Nam.buf, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %7)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @filter_Action2Nam.buf, i64 0, i64 0), i8** %2
br label %23
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp uge i32 %10, 40
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %3
%14 = zext i32 %13 to i64
%15 = icmp ult i64 %14, 43
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i32, i32* %3
%18 = sub i32 %17, 40
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [3 x i8*], [3 x i8*]* @filter_Action2Nam.actname, i64 0, i64 %19
%21 = load i8*, i8** %20
store i8* %21, i8** %2
br label %23
22: ; preds = %12, %9
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %23
23: ; preds = %22, %16, %6
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
@reltable.filter_Action2Nam = internal unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.filter_Action2Nam to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.filter_Action2Nam to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.filter_Action2Nam to i64)) to i32)]
@.str = [8 x i8] c" none \00"
@.str.1 = [8 x i8] c"permit \00"
@.str.2 = [8 x i8] c" deny \00"
@filter_Action2Nam.buf = internal global [8 x i8] zeroinitializer
@.str.3 = [5 x i8] c"%6d \00"
@.str.4 = [8 x i8] c"?????? \00"
define i8* @filter_Action2Nam(i32 %0) {
%2 = icmp ult i32 %0, 40
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @snprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @filter_Action2Nam.buf, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %0)
br label %12
5: ; preds = %1
%6 = icmp ult i32 %0, 43
br i1 %6, label %7, label %12
7: ; preds = %5
%8 = add nsw i32 %0, -40
%9 = zext i32 %8 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.filter_Action2Nam to i8*), i64 %10)
br label %12
12: ; preds = %5, %7, %3
%13 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @filter_Action2Nam.buf, i64 0, i64 0), %3 ], [ %11, %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %5 ]
ret i8* %13
}