#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 */
struct plist {
  int dummy;
};

/* Variables and functions */
char *ext_pos(char const *);
int options_get_bool(char *);
int plist_load_m3u(struct plist *, char const *, char const *, int const);
int plist_load_pls(struct plist *, char const *, char const *);
int /*<<< orphan*/ strcasecmp(char const *, char *);
int /*<<< orphan*/ switch_titles_file(struct plist *);
int /*<<< orphan*/ switch_titles_tags(struct plist *);
int plist_load(struct plist *plist, const char *fname, const char *cwd,
               const int load_serial) {
  int num, read_tags;
  const char *ext;
  read_tags = options_get_bool("ReadTags");
  ext = ext_pos(fname);
  if (ext && !strcasecmp(ext, "pls"))
    num = plist_load_pls(plist, fname, cwd);
  else
    num = plist_load_m3u(plist, fname, cwd, load_serial);
  if (read_tags)
    switch_titles_tags(plist);
  else
    switch_titles_file(plist);
  return num;
}


x86 assembly (clang, -O0):
<plist_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xe72(%rip),%rdi
call   1080 <options_get_bool@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <ext_pos@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11e0 <plist_load+0x70>
mov    -0x30(%rbp),%rdi
lea    0xe50(%rip),%rsi
call   1040 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11e0 <plist_load+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1060 <plist_load_pls@plt>
mov    %eax,-0x20(%rbp)
jmp    11f7 <plist_load+0x87>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1090 <plist_load_m3u@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     120f <plist_load+0x9f>
mov    -0x8(%rbp),%rdi
call   1050 <switch_titles_tags@plt>
jmp    1218 <plist_load+0xa8>
mov    -0x8(%rbp),%rdi
call   1030 <switch_titles_file@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plist_load>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xe75(%rip),%rdi
call   1080 <options_get_bool@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1070 <ext_pos@plt>
test   %rax,%rax
je     11b3 <plist_load+0x43>
lea    0xe62(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcasecmp@plt>
test   %eax,%eax
je     11c6 <plist_load+0x56>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
call   1090 <plist_load_m3u@plt>
jmp    11d4 <plist_load+0x64>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1060 <plist_load_pls@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
test   %r14d,%r14d
je     11e5 <plist_load+0x75>
call   1050 <switch_titles_tags@plt>
jmp    11ea <plist_load+0x7a>
call   1030 <switch_titles_file@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.plist = type { i32 }
@.str = [9 x i8] c"ReadTags\00"
@.str.1 = [4 x i8] c"pls\00"
define i32 @plist_load(%struct.plist* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca %struct.plist*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
store %struct.plist* %0, %struct.plist** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%12 = call i32 @options_get_bool(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %10
%13 = load i8*, i8** %6
%14 = call i8* @ext_pos(i8* %13)
store i8* %14, i8** %11
%15 = load i8*, i8** %11
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %26
17: ; preds = %4
%18 = load i8*, i8** %11
%19 = call i32 @strcasecmp(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %17
%22 = load %struct.plist*, %struct.plist** %5
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = call i32 @plist_load_pls(%struct.plist* %22, i8* %23, i8* %24)
store i32 %25, i32* %9
br label %32
26: ; preds = %17, %4
%27 = load %struct.plist*, %struct.plist** %5
%28 = load i8*, i8** %6
%29 = load i8*, i8** %7
%30 = load i32, i32* %8
%31 = call i32 @plist_load_m3u(%struct.plist* %27, i8* %28, i8* %29, i32 %30)
store i32 %31, i32* %9
br label %32
32: ; preds = %26, %21
%33 = load i32, i32* %10
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load %struct.plist*, %struct.plist** %5
%37 = call i32 @switch_titles_tags(%struct.plist* %36)
br label %41
38: ; preds = %32
%39 = load %struct.plist*, %struct.plist** %5
%40 = call i32 @switch_titles_file(%struct.plist* %39)
br label %41
41: ; preds = %38, %35
%42 = load i32, i32* %9
ret i32 %42
}

LLVM IR (-O2):
%struct.plist = type { i32 }
@.str = [9 x i8] c"ReadTags\00"
@.str.1 = [4 x i8] c"pls\00"
define i32 @plist_load(%struct.plist* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @options_get_bool(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = tail call i8* @ext_pos(i8* %1)
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = tail call i32 @strcasecmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @plist_load_pls(%struct.plist* %0, i8* %1, i8* %2)
br label %15
13: ; preds = %8, %4
%14 = tail call i32 @plist_load_m3u(%struct.plist* %0, i8* %1, i8* %2, i32 %3)
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %14, %13 ], [ %12, %11 ]
%17 = icmp eq i32 %5, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 @switch_titles_tags(%struct.plist* %0)
br label %22
20: ; preds = %15
%21 = tail call i32 @switch_titles_file(%struct.plist* %0)
br label %22
22: ; preds = %20, %18
ret i32 %16
}