#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(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    %edi,-0x4(%rbp)
mov    $0x1e,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x6,%eax
ja     11f5 <CVDlsGetReturnFlagName+0xd5>
mov    -0x18(%rbp),%rax
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1205 <CVDlsGetReturnFlagName+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1205 <CVDlsGetReturnFlagName+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1205 <CVDlsGetReturnFlagName+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1205 <CVDlsGetReturnFlagName+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1205 <CVDlsGetReturnFlagName+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1205 <CVDlsGetReturnFlagName+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1205 <CVDlsGetReturnFlagName+0xe5>
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CVDlsGetReturnFlagName>:
push   %rbx
mov    %edi,%ebx
mov    $0x1e,%edi
call   1030 <malloc@plt>
add    $0x6,%ebx
cmp    $0x6,%ebx
ja     1148 <CVDlsGetReturnFlagName+0x38>
lea    0xed4(%rip),%rcx
movslq (%rcx,%rbx,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
movups 0xf42(%rip),%xmm0
movups %xmm0,(%rax)
movl   $0x525643,0x10(%rax)
pop    %rbx
ret
movb   $0x0,0x4(%rax)
movl   $0x454e4f4e,(%rax)
pop    %rbx
ret
movups 0xf0d(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x52564345524e55,%rcx
mov    %rcx,0xe(%rax)
pop    %rbx
ret
movabs $0x4c4941465f4d45,%rcx
jmp    1199 <CVDlsGetReturnFlagName+0x89>
movups 0xec8(%rip),%xmm0
jmp    118a <CVDlsGetReturnFlagName+0x7a>
movups 0xeaf(%rip),%xmm0
movups %xmm0,(%rax)
pop    %rbx
ret
movabs $0x4c4c554e5f4d45,%rcx
mov    %rcx,0x7(%rax)
movabs $0x454d5f534c445643,%rcx
5f 4d 45
jmp    11c1 <CVDlsGetReturnFlagName+0xb1>
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(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 %28 [
i32 0, label %7
i32 -1, label %10
i32 -2, label %13
i32 -3, label %16
i32 -4, label %19
i32 -5, label %22
i32 -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(i32 %0) {
%2 = tail call i64 @malloc(i32 30)
%3 = inttoptr i64 %2 to i8*
switch i32 %0, label %11 [
i32 0, label %4
i32 -1, label %5
i32 -2, label %6
i32 -3, label %7
i32 -4, label %8
i32 -5, label %9
i32 -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
}