#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*/ free(char *);
int /*<<< orphan*/ is_url(char *);
char *strrchr(char *, char);
char *xstrdup(char const *);
char *make_menu_title(const char *plist_title, const int made_from_tags,
                      const int full_path) {
  char *title = xstrdup(plist_title);
  if (!made_from_tags) {
    if (!full_path && !is_url(title)) {
      char *slash = strrchr(title, '/');
      if (slash && slash != title) {
        char *old_title = title;
        title = xstrdup(slash + 1);
        free(old_title);
      }
    }
  }
  return title;
}


x86 assembly (clang, -O0):
<make_menu_title>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <xstrdup@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11dc <make_menu_title+0x9c>
cmpl   $0x0,-0x10(%rbp)
jne    11d7 <make_menu_title+0x97>
mov    -0x18(%rbp),%rdi
call   1030 <is_url@plt>
cmp    $0x0,%eax
jne    11d7 <make_menu_title+0x97>
mov    -0x18(%rbp),%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11d2 <make_menu_title+0x92>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     11d2 <make_menu_title+0x92>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
call   1060 <xstrdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
jmp    11d7 <make_menu_title+0x97>
jmp    11dc <make_menu_title+0x9c>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_menu_title>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
call   1060 <xstrdup@plt>
mov    %rax,%r14
or     %ebp,%ebx
jne    1160 <make_menu_title+0x20>
mov    %r14,%rdi
call   1030 <is_url@plt>
test   %eax,%eax
je     1168 <make_menu_title+0x28>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %r14,%rdi
mov    $0x2f,%esi
call   1050 <strrchr@plt>
test   %rax,%rax
je     1160 <make_menu_title+0x20>
cmp    %r14,%rax
je     1160 <make_menu_title+0x20>
add    $0x1,%rax
mov    %rax,%rdi
call   1060 <xstrdup@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <free@plt>
mov    %rbx,%rax
jmp    1163 <make_menu_title+0x23>

LLVM IR (-O0):
define i8* @make_menu_title(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = call i8* @xstrdup(i8* %10)
store i8* %11, i8** %7
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %39, label %14
14: ; preds = %3
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %38, label %17
17: ; preds = %14
%18 = load i8*, i8** %7
%19 = call i32 @is_url(i8* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %38, label %21
21: ; preds = %17
%22 = load i8*, i8** %7
%23 = call i8* @strrchr(i8* %22, i8 signext 47)
store i8* %23, i8** %8
%24 = load i8*, i8** %8
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %37
26: ; preds = %21
%27 = load i8*, i8** %8
%28 = load i8*, i8** %7
%29 = icmp ne i8* %27, %28
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i8*, i8** %7
store i8* %31, i8** %9
%32 = load i8*, i8** %8
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = call i8* @xstrdup(i8* %33)
store i8* %34, i8** %7
%35 = load i8*, i8** %9
%36 = call i32 @free(i8* %35)
br label %37
37: ; preds = %30, %26, %21
br label %38
38: ; preds = %37, %17, %14
br label %39
39: ; preds = %38, %3
%40 = load i8*, i8** %7
ret i8* %40
}

LLVM IR (-O2):
define i8* @make_menu_title(i8* %0, i32 %1, i32 %2) {
%4 = tail call i8* @xstrdup(i8* %0)
%5 = or i32 %2, %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = tail call i32 @is_url(i8* %4)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %7
%11 = tail call i8* @strrchr(i8* dereferenceable(1) %4, i8 signext 47)
%12 = icmp eq i8* %11, null
%13 = icmp eq i8* %11, %4
%14 = select i1 %12, i1 true, i1 %13
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = getelementptr inbounds i8, i8* %11, i64 1
%17 = tail call i8* @xstrdup(i8* %16)
%18 = tail call i32 @free(i8* %4)
br label %19
19: ; preds = %10, %15, %7, %3
%20 = phi i8* [ %4, %3 ], [ %4, %7 ], [ %17, %15 ], [ %4, %10 ]
ret i8* %20
}