#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *);
char *CVSpilsGetReturnFlagName(int flag) {
  char *name;
  name = (char *)malloc(30 * sizeof(char));
  switch (flag) {
  case 0:
    sprintf(name, "CVSPILS_SUCCESS");
    break;
  case -1:
    sprintf(name, "CVSPILS_MEM_NULL");
    break;
  case -2:
    sprintf(name, "CVSPILS_LMEM_NULL");
    break;
  case -3:
    sprintf(name, "CVSPILS_ILL_INPUT");
    break;
  case -4:
    sprintf(name, "CVSPILS_MEM_FAIL");
    break;
  case -5:
    sprintf(name, "CVSPILS_PMEM_NULL");
    break;
  default:
    sprintf(name, "NONE");
  }
  return (name);
}


x86 assembly (clang, -O0):
<CVSpilsGetReturnFlagName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1e,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     11e0 <CVSpilsGetReturnFlagName+0xc0>
mov    -0x18(%rbp),%rax
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f0 <CVSpilsGetReturnFlagName+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f0 <CVSpilsGetReturnFlagName+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f0 <CVSpilsGetReturnFlagName+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f0 <CVSpilsGetReturnFlagName+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f0 <CVSpilsGetReturnFlagName+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1040 <sprintf@plt>
jmp    11f0 <CVSpilsGetReturnFlagName+0xd0>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CVSpilsGetReturnFlagName>:
push   %rbx
mov    %edi,%ebx
mov    $0x1e,%edi
call   1030 <malloc@plt>
add    $0x5,%ebx
cmp    $0x5,%ebx
ja     113e <CVSpilsGetReturnFlagName+0x2e>
lea    0xed4(%rip),%rcx
movslq (%rcx,%rbx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
movups 0xf32(%rip),%xmm0
jmp    116c <CVSpilsGetReturnFlagName+0x5c>
movb   $0x0,0x4(%rax)
movl   $0x454e4f4e,(%rax)
pop    %rbx
ret
movups 0xf0c(%rip),%xmm0
jmp    117e <CVSpilsGetReturnFlagName+0x6e>
movups 0xef1(%rip),%xmm0
movups %xmm0,(%rax)
movw   $0x54,0x10(%rax)
pop    %rbx
ret
movups 0xecd(%rip),%xmm0
movups %xmm0,(%rax)
movw   $0x4c,0x10(%rax)
pop    %rbx
ret
movups 0xeaa(%rip),%xmm0
movups %xmm0,(%rax)
movb   $0x0,0x10(%rax)
pop    %rbx
ret
movups 0xe8a(%rip),%xmm0
movups %xmm0,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"CVSPILS_SUCCESS\00"
@.str.1 = [17 x i8] c"CVSPILS_MEM_NULL\00"
@.str.2 = [18 x i8] c"CVSPILS_LMEM_NULL\00"
@.str.3 = [18 x i8] c"CVSPILS_ILL_INPUT\00"
@.str.4 = [17 x i8] c"CVSPILS_MEM_FAIL\00"
@.str.5 = [18 x i8] c"CVSPILS_PMEM_NULL\00"
@.str.6 = [5 x i8] c"NONE\00"
define i8* @CVSpilsGetReturnFlagName(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i64 @malloc(i32 30)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i32, i32* %2
switch i32 %6, label %25 [
i32 0, label %7
i32 -1, label %10
i32 -2, label %13
i32 -3, label %16
i32 -4, label %19
i32 -5, label %22
]
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %28
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %28
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %28
16: ; preds = %1
%17 = load i8*, i8** %3
%18 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %28
19: ; preds = %1
%20 = load i8*, i8** %3
%21 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %28
22: ; preds = %1
%23 = load i8*, i8** %3
%24 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %28
25: ; preds = %1
%26 = load i8*, i8** %3
%27 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %28
28: ; preds = %25, %22, %19, %16, %13, %10, %7
%29 = load i8*, i8** %3
ret i8* %29
}

LLVM IR (-O2):
@.str = [16 x i8] c"CVSPILS_SUCCESS\00"
@.str.1 = [17 x i8] c"CVSPILS_MEM_NULL\00"
@.str.2 = [18 x i8] c"CVSPILS_LMEM_NULL\00"
@.str.3 = [18 x i8] c"CVSPILS_ILL_INPUT\00"
@.str.4 = [17 x i8] c"CVSPILS_MEM_FAIL\00"
@.str.5 = [18 x i8] c"CVSPILS_PMEM_NULL\00"
@.str.6 = [5 x i8] c"NONE\00"
define i8* @CVSpilsGetReturnFlagName(i32 %0) {
%2 = tail call i64 @malloc(i32 30)
%3 = inttoptr i64 %2 to i8*
switch i32 %0, label %10 [
i32 0, label %4
i32 -1, label %5
i32 -2, label %6
i32 -3, label %7
i32 -4, label %8
i32 -5, label %9
]
4: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(16) %3, i8* align 1 dereferenceable(16) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 16, i1 false)
br label %11
5: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %3, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i64 17, i1 false)
br label %11
6: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(18) %3, i8* align 1 dereferenceable(18) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 18, i1 false)
br label %11
7: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(18) %3, i8* align 1 dereferenceable(18) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i64 18, i1 false)
br label %11
8: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(17) %3, i8* align 1 dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i64 17, i1 false)
br label %11
9: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(18) %3, i8* align 1 dereferenceable(18) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i64 18, i1 false)
br label %11
10: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %3, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 5, i1 false)
br label %11
11: ; preds = %10, %9, %8, %7, %6, %5, %4
ret i8* %3
}