#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 */
int /*<<< orphan*/ checked_free(char *);
int /*<<< orphan*/ getLevelArtworkDir(int);
char *getPath2(int /*<<< orphan*/, char *);
char *getCustomArtworkLevelConfigFilename(int type) {
  static char *filename = NULL;
  checked_free(filename);
  filename =
      getPath2(getLevelArtworkDir(type), ((type) == 0   ? "graphicsinfo.conf"
                                          : (type) == 1 ? "soundsinfo.conf"
                                          : (type) == 2 ? "musicinfo.conf"
                                                        : ""));
  return filename;
}


x86 assembly (clang, -O0):
<getCustomArtworkLevelConfigFilename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2efe(%rip),%rdi
call   1040 <checked_free@plt>
mov    -0x4(%rbp),%edi
call   1050 <getLevelArtworkDir@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    116c <getCustomArtworkLevelConfigFilename+0x3c>
lea    0xe9d(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11aa <getCustomArtworkLevelConfigFilename+0x7a>
cmpl   $0x1,-0x4(%rbp)
jne    1186 <getCustomArtworkLevelConfigFilename+0x56>
lea    0xe95(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11a2 <getCustomArtworkLevelConfigFilename+0x72>
mov    -0x4(%rbp),%edx
lea    0xea0(%rip),%rax
lea    0xe8b(%rip),%rcx
cmp    $0x2,%edx
cmove  %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <getPath2@plt>
mov    %rax,0x2e83(%rip)
mov    0x2e7c(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCustomArtworkLevelConfigFilename>:
push   %rbx
mov    %edi,%ebx
mov    0x2f06(%rip),%rdi
call   1040 <checked_free@plt>
mov    %ebx,%edi
call   1050 <getLevelArtworkDir@plt>
test   %ebx,%ebx
je     1158 <getCustomArtworkLevelConfigFilename+0x28>
cmp    $0x1,%ebx
jne    1161 <getCustomArtworkLevelConfigFilename+0x31>
lea    0xebc(%rip),%rsi
jmp    1176 <getCustomArtworkLevelConfigFilename+0x46>
lea    0xea1(%rip),%rsi
jmp    1176 <getCustomArtworkLevelConfigFilename+0x46>
cmp    $0x2,%ebx
lea    0xeb7(%rip),%rcx
lea    0xebe(%rip),%rsi
cmove  %rcx,%rsi
mov    %eax,%edi
call   1030 <getPath2@plt>
mov    %rax,0x2ebc(%rip)
pop    %rbx
ret

LLVM IR (-O0):
@getCustomArtworkLevelConfigFilename.filename = internal global i8* null
@.str = [18 x i8] c"graphicsinfo.conf\00"
@.str.1 = [16 x i8] c"soundsinfo.conf\00"
@.str.2 = [15 x i8] c"musicinfo.conf\00"
@.str.3 = [1 x i8] zeroinitializer
define i8* @getCustomArtworkLevelConfigFilename(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i8*, i8** @getCustomArtworkLevelConfigFilename.filename
%4 = call i32 @checked_free(i8* %3)
%5 = load i32, i32* %2
%6 = call i32 @getLevelArtworkDir(i32 %5)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
br label %21
10: ; preds = %1
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
br label %19
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 2
%17 = zext i1 %16 to i64
%18 = select i1 %16, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
br label %19
19: ; preds = %14, %13
%20 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %13 ], [ %18, %14 ]
br label %21
21: ; preds = %19, %9
%22 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %9 ], [ %20, %19 ]
%23 = call i8* @getPath2(i32 %6, i8* %22)
store i8* %23, i8** @getCustomArtworkLevelConfigFilename.filename
%24 = load i8*, i8** @getCustomArtworkLevelConfigFilename.filename
ret i8* %24
}

LLVM IR (-O2):
@getCustomArtworkLevelConfigFilename.filename = internal unnamed_addr global i8* null
@.str = [18 x i8] c"graphicsinfo.conf\00"
@.str.1 = [16 x i8] c"soundsinfo.conf\00"
@.str.2 = [15 x i8] c"musicinfo.conf\00"
@.str.3 = [1 x i8] zeroinitializer
define i8* @getCustomArtworkLevelConfigFilename(i32 %0) {
%2 = load i8*, i8** @getCustomArtworkLevelConfigFilename.filename
%3 = tail call i32 @checked_free(i8* %2)
%4 = tail call i32 @getLevelArtworkDir(i32 %0)
switch i32 %0, label %5 [
i32 0, label %9
i32 1, label %8
]
5: ; preds = %1
%6 = icmp eq i32 %0, 2
%7 = select i1 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %1, %8, %5
%10 = phi i8* [ getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %1 ], [ %7, %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), %8 ]
%11 = tail call i8* @getPath2(i32 %4, i8* %10)
store i8* %11, i8** @getCustomArtworkLevelConfigFilename.filename
ret i8* %11
}