#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 */
char *getCustomImageFilename(char *);
char *getCustomMusicFilename(char *);
char *getCustomSoundFilename(char *);
char *getCustomArtworkFilename(char *basename, int type) {
  if (type == 0)
    return getCustomImageFilename(basename);
  else if (type == 1)
    return getCustomSoundFilename(basename);
  else if (type == 2)
    return getCustomMusicFilename(basename);
  else
    return "[NONE]";
}


x86 assembly (clang, -O0):
<getCustomArtworkFilename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    115b <getCustomArtworkFilename+0x2b>
mov    -0x10(%rbp),%rdi
call   1050 <getCustomImageFilename@plt>
mov    %rax,-0x8(%rbp)
jmp    119e <getCustomArtworkFilename+0x6e>
cmpl   $0x1,-0x14(%rbp)
jne    1177 <getCustomArtworkFilename+0x47>
mov    -0x10(%rbp),%rdi
call   1040 <getCustomSoundFilename@plt>
mov    %rax,-0x8(%rbp)
jmp    119e <getCustomArtworkFilename+0x6e>
cmpl   $0x2,-0x14(%rbp)
jne    1193 <getCustomArtworkFilename+0x63>
mov    -0x10(%rbp),%rdi
call   1030 <getCustomMusicFilename@plt>
mov    %rax,-0x8(%rbp)
jmp    119e <getCustomArtworkFilename+0x6e>
lea    0xe66(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCustomArtworkFilename>:
cmp    $0x2,%esi
je     1143 <getCustomArtworkFilename+0x13>
cmp    $0x1,%esi
je     1148 <getCustomArtworkFilename+0x18>
test   %esi,%esi
jne    114d <getCustomArtworkFilename+0x1d>
jmp    1050 <getCustomImageFilename@plt>
jmp    1030 <getCustomMusicFilename@plt>
jmp    1040 <getCustomSoundFilename@plt>
lea    0xeac(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"[NONE]\00"
define i8* @getCustomArtworkFilename(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i8* @getCustomImageFilename(i8* %9)
store i8* %10, i8** %3
br label %24
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = call i8* @getCustomSoundFilename(i8* %15)
store i8* %16, i8** %3
br label %24
17: ; preds = %11
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i8*, i8** %4
%22 = call i8* @getCustomMusicFilename(i8* %21)
store i8* %22, i8** %3
br label %24
23: ; preds = %17
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %3
br label %24
24: ; preds = %23, %20, %14, %8
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
@.str = [7 x i8] c"[NONE]\00"
define i8* @getCustomArtworkFilename(i8* %0, i32 %1) {
switch i32 %1, label %9 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
]
3: ; preds = %2
%4 = tail call i8* @getCustomImageFilename(i8* %0)
br label %9
5: ; preds = %2
%6 = tail call i8* @getCustomSoundFilename(i8* %0)
br label %9
7: ; preds = %2
%8 = tail call i8* @getCustomMusicFilename(i8* %0)
br label %9
9: ; preds = %2, %7, %5, %3
%10 = phi i8* [ %4, %3 ], [ %6, %5 ], [ %8, %7 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %10
}