#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 *CVDlsGetReturnFlagName(long int flag) {
  char *name;
  name = (char *)malloc(30 * sizeof(char));
  switch (flag) {
  case 0:
    sprintf(name, "CVDLS_SUCCESS");
    break;
  case -1:
    sprintf(name, "CVDLS_MEM_NULL");
    break;
  case -2:
    sprintf(name, "CVDLS_LMEM_NULL");
    break;
  case -3:
    sprintf(name, "CVDLS_ILL_INPUT");
    break;
  case -4:
    sprintf(name, "CVDLS_MEM_FAIL");
    break;
  case -5:
    sprintf(name, "CVDLS_JACFUNC_UNRECVR");
    break;
  case -6:
    sprintf(name, "CVDLS_JACFUNC_RECVR");
    break;
  default:
    sprintf(name, "NONE");
  }
  return (name);
}


x86 assembly (clang, -O0):
<CVDlsGetReturnFlagName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1e,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x18(%rbp)
sub    $0x6,%rax
ja     11f7 <CVDlsGetReturnFlagName+0xd7>
mov    -0x18(%rbp),%rax
lea    0xea5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1207 <CVDlsGetReturnFlagName+0xe7>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1207 <CVDlsGetReturnFlagName+0xe7>
mov    -0x10(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1207 <CVDlsGetReturnFlagName+0xe7>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1207 <CVDlsGetReturnFlagName+0xe7>
mov    -0x10(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1207 <CVDlsGetReturnFlagName+0xe7>
mov    -0x10(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1207 <CVDlsGetReturnFlagName+0xe7>
mov    -0x10(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1207 <CVDlsGetReturnFlagName+0xe7>
mov    -0x10(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CVDlsGetReturnFlagName>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1e,%edi
call   1030 <malloc@plt>
add    $0x6,%rbx
cmp    $0x6,%rbx
ja     114b <CVDlsGetReturnFlagName+0x3b>
lea    0xed1(%rip),%rcx
movslq (%rcx,%rbx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
movups 0xf3f(%rip),%xmm0
movups %xmm0,(%rax)
movl   $0x525643,0x10(%rax)
pop    %rbx
ret
movb   $0x0,0x4(%rax)
movl   $0x454e4f4e,(%rax)
pop    %rbx
ret
movups 0xf0a(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x52564345524e55,%rcx
mov    %rcx,0xe(%rax)
pop    %rbx
ret
movabs $0x4c4941465f4d45,%rcx
jmp    119c <CVDlsGetReturnFlagName+0x8c>
movups 0xec5(%rip),%xmm0
jmp    118d <CVDlsGetReturnFlagName+0x7d>
movups 0xeac(%rip),%xmm0
movups %xmm0,(%rax)
pop    %rbx
ret
movabs $0x4c4c554e5f4d45,%rcx
mov    %rcx,0x7(%rax)
movabs $0x454d5f534c445643,%rcx
5f 4d 45
jmp    11c4 <CVDlsGetReturnFlagName+0xb4>
movabs $0x53534543435553,%rcx
mov    %rcx,0x6(%rax)
movabs $0x55535f534c445643,%rcx
5f 53 55
mov    %rcx,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"CVDLS_SUCCESS\00"
@.str.1 = [15 x i8] c"CVDLS_MEM_NULL\00"
@.str.2 = [16 x i8] c"CVDLS_LMEM_NULL\00"
@.str.3 = [16 x i8] c"CVDLS_ILL_INPUT\00"
@.str.4 = [15 x i8] c"CVDLS_MEM_FAIL\00"
@.str.5 = [22 x i8] c"CVDLS_JACFUNC_UNRECVR\00"
@.str.6 = [20 x i8] c"CVDLS_JACFUNC_RECVR\00"
@.str.7 = [5 x i8] c"NONE\00"
define i8* @CVDlsGetReturnFlagName(i64 %0) {
%2 = tail call i64 @malloc(i32 30)
%3 = inttoptr i64 %2 to i8*
switch i64 %0, label %11 [
i64 0, label %4
i64 -1, label %5
i64 -2, label %6
i64 -3, label %7
i64 -4, label %8
i64 -5, label %9
i64 -6, label %10
]
4: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(14) %3, i8* align 1 dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 14, i1 false)
br label %12
5: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(15) %3, i8* align 1 dereferenceable(15) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i64 15, i1 false)
br label %12
6: ; 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.2, i64 0, i64 0), i64 16, i1 false)
br label %12
7: ; 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.3, i64 0, i64 0), i64 16, i1 false)
br label %12
8: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(15) %3, i8* align 1 dereferenceable(15) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i64 15, i1 false)
br label %12
9: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(22) %3, i8* align 1 dereferenceable(22) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i64 22, i1 false)
br label %12
10: ; preds = %1
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(20) %3, i8* align 1 dereferenceable(20) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i64 20, i1 false)
br label %12
11: ; 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.7, i64 0, i64 0), i64 5, i1 false)
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6, %5, %4
ret i8* %3
}