#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 __u8;

/* Variables and functions */
#define XFRM_SHARE_ANY 131
#define XFRM_SHARE_SESSION 130
#define XFRM_SHARE_UNIQUE 129
#define XFRM_SHARE_USER 128
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
const char *strxf_share(__u8 share) {
  static char str[32];
  switch (share) {
  case XFRM_SHARE_ANY:
    strcpy(str, "any");
    break;
  case XFRM_SHARE_SESSION:
    strcpy(str, "session");
    break;
  case XFRM_SHARE_USER:
    strcpy(str, "user");
    break;
  case XFRM_SHARE_UNIQUE:
    strcpy(str, "unique");
    break;
  default:
    sprintf(str, "%u", share);
    break;
  }
  return str;
}


x86 assembly (clang, -O0):
<strxf_share>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11b4 <strxf_share+0x94>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x2ee5(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ca <strxf_share+0xaa>
lea    0x2ecd(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ca <strxf_share+0xaa>
lea    0x2eb5(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ca <strxf_share+0xaa>
lea    0x2e9d(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1030 <strcpy@plt>
jmp    11ca <strxf_share+0xaa>
mov    -0x4(%rbp),%edx
lea    0x2e82(%rip),%rdi
lea    0xe63(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2e6f(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strxf_share>:
push   %rax
mov    %edi,%edx
lea    -0x80(%rdx),%eax
cmp    $0x3,%eax
ja     114b <strxf_share+0x2b>
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x2efe(%rip),%rdi
lea    0xed3(%rip),%rsi
jmp    118e <strxf_share+0x6e>
lea    0x2eee(%rip),%rdi
lea    0xecf(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1193 <strxf_share+0x73>
lea    0x2ed9(%rip),%rdi
lea    0xeb3(%rip),%rsi
jmp    118e <strxf_share+0x6e>
lea    0x2ec9(%rip),%rdi
lea    0xe96(%rip),%rsi
jmp    118e <strxf_share+0x6e>
lea    0x2eb9(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcpy@plt>
lea    0x2ea6(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@strxf_share.str = internal global [32 x i8] zeroinitializer
@.str = [4 x i8] c"any\00"
@.str.1 = [8 x i8] c"session\00"
@.str.2 = [5 x i8] c"user\00"
@.str.3 = [7 x i8] c"unique\00"
@.str.4 = [3 x i8] c"%u\00"
define i8* @strxf_share(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %12 [
i32 131, label %4
i32 130, label %6
i32 128, label %8
i32 129, label %10
]
4: ; preds = %1
%5 = call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %15
6: ; preds = %1
%7 = call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %15
8: ; preds = %1
%9 = call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %15
10: ; preds = %1
%11 = call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %15
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %10, %8, %6, %4
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0)
}

LLVM IR (-O2):
@strxf_share.str = internal global [32 x i8] zeroinitializer
@.str = [4 x i8] c"any\00"
@.str.1 = [8 x i8] c"session\00"
@.str.2 = [5 x i8] c"user\00"
@.str.3 = [7 x i8] c"unique\00"
@.str.4 = [3 x i8] c"%u\00"
define i8* @strxf_share(i32 %0) {
switch i32 %0, label %10 [
i32 131, label %2
i32 130, label %4
i32 128, label %6
i32 129, label %8
]
2: ; preds = %1
%3 = tail call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %12
4: ; preds = %1
%5 = tail call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %12
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %12
8: ; preds = %1
%9 = tail call i32 @strcpy(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %12
10: ; preds = %1
%11 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %0)
br label %12
12: ; preds = %10, %8, %6, %4, %2
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @strxf_share.str, i64 0, i64 0)
}