#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 */
unsigned int NUD_NOARP;
unsigned int NUD_PERMANENT;
unsigned int NUD_REACHABLE;
unsigned int NUD_STALE;
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
const char *state_n2a(unsigned s) {
  static char buf[32];
  if (s & NUD_PERMANENT)
    return "permanent";
  if (s & NUD_NOARP)
    return "static";
  if (s & NUD_STALE)
    return "stale";
  if (s & NUD_REACHABLE)
    return "";
  sprintf(buf, "state=%#x", s);
  return buf;
}


x86 assembly (clang, -O0):
<state_n2a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ec3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1140 <state_n2a+0x30>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d0 <state_n2a+0xc0>
mov    -0xc(%rbp),%eax
mov    0x2e8e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1165 <state_n2a+0x55>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d0 <state_n2a+0xc0>
mov    -0xc(%rbp),%eax
mov    0x2e59(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     118a <state_n2a+0x7a>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d0 <state_n2a+0xc0>
mov    -0xc(%rbp),%eax
mov    0x2e3c(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     11af <state_n2a+0x9f>
lea    0xe6a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11d0 <state_n2a+0xc0>
mov    -0xc(%rbp),%edx
lea    0x2e87(%rip),%rdi
lea    0xe57(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2e74(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<state_n2a>:
push   %rbx
mov    0x2ed0(%rip),%rax
test   %edi,(%rax)
je     1125 <state_n2a+0x15>
lea    0xedd(%rip),%rbx
jmp    1179 <state_n2a+0x69>
mov    %edi,%edx
mov    0x2eaa(%rip),%rax
test   %edi,(%rax)
je     113b <state_n2a+0x2b>
lea    0xed1(%rip),%rbx
jmp    1179 <state_n2a+0x69>
mov    0x2e86(%rip),%rax
test   %edx,(%rax)
je     114f <state_n2a+0x3f>
lea    0xec4(%rip),%rbx
jmp    1179 <state_n2a+0x69>
mov    0x2e7a(%rip),%rax
test   %edx,(%rax)
je     1163 <state_n2a+0x53>
lea    0xeaf(%rip),%rbx
jmp    1179 <state_n2a+0x69>
lea    0x2ed6(%rip),%rbx
lea    0xea6(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@state_n2a.buf = internal global [32 x i8] zeroinitializer
@NUD_PERMANENT = global i32 0
@.str = [10 x i8] c"permanent\00"
@NUD_NOARP = global i32 0
@.str.1 = [7 x i8] c"static\00"
@NUD_STALE = global i32 0
@.str.2 = [6 x i8] c"stale\00"
@NUD_REACHABLE = global i32 0
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [10 x i8] c"state=%#x\00"
define i8* @state_n2a(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @NUD_PERMANENT
%6 = and i32 %4, %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %30
9: ; preds = %1
%10 = load i32, i32* %3
%11 = load i32, i32* @NUD_NOARP
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %30
15: ; preds = %9
%16 = load i32, i32* %3
%17 = load i32, i32* @NUD_STALE
%18 = and i32 %16, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %30
21: ; preds = %15
%22 = load i32, i32* %3
%23 = load i32, i32* @NUD_REACHABLE
%24 = and i32 %22, %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %30
27: ; preds = %21
%28 = load i32, i32* %3
%29 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @state_n2a.buf, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %28)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @state_n2a.buf, i64 0, i64 0), i8** %2
br label %30
30: ; preds = %27, %26, %20, %14, %8
%31 = load i8*, i8** %2
ret i8* %31
}

LLVM IR (-O2):
@state_n2a.buf = internal global [32 x i8] zeroinitializer
@NUD_PERMANENT = global i32 0
@.str = [10 x i8] c"permanent\00"
@NUD_NOARP = global i32 0
@.str.1 = [7 x i8] c"static\00"
@NUD_STALE = global i32 0
@.str.2 = [6 x i8] c"stale\00"
@NUD_REACHABLE = global i32 0
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [10 x i8] c"state=%#x\00"
define i8* @state_n2a(i32 %0) {
%2 = load i32, i32* @NUD_PERMANENT
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %19
5: ; preds = %1
%6 = load i32, i32* @NUD_NOARP
%7 = and i32 %6, %0
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = load i32, i32* @NUD_STALE
%11 = and i32 %10, %0
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i32, i32* @NUD_REACHABLE
%15 = and i32 %14, %0
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @state_n2a.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %0)
br label %19
19: ; preds = %13, %9, %5, %1, %17
%20 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @state_n2a.buf, i64 0, i64 0), %17 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %13 ]
ret i8* %20
}