#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 keyval {
  int dummy;
};

/* Variables and functions */
scalar_t__ is_freeform_true(char const *);
scalar_t__ is_various_artists(char const *);
char *keyvals_get_val(struct keyval const *, char *);
int /*<<< orphan*/ u_strcase_equal(char const *, char const *);
int track_is_compilation(const struct keyval *comments) {
  const char *c, *a, *aa;
  c = keyvals_get_val(comments, "compilation");
  if (c && is_freeform_true(c))
    return 1;
  aa = keyvals_get_val(comments, "albumartist");
  if (aa && is_various_artists(aa))
    return 1;
  a = keyvals_get_val(comments, "artist");
  if (aa && a && !u_strcase_equal(aa, a))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<track_is_compilation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1050 <keyvals_get_val@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118a <track_is_compilation+0x4a>
mov    -0x18(%rbp),%rdi
call   1030 <is_freeform_true@plt>
cmp    $0x0,%rax
je     118a <track_is_compilation+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    121b <track_is_compilation+0xdb>
mov    -0x10(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1050 <keyvals_get_val@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11c8 <track_is_compilation+0x88>
mov    -0x28(%rbp),%rdi
call   1040 <is_various_artists@plt>
cmp    $0x0,%rax
je     11c8 <track_is_compilation+0x88>
movl   $0x1,-0x4(%rbp)
jmp    121b <track_is_compilation+0xdb>
mov    -0x10(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1050 <keyvals_get_val@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1214 <track_is_compilation+0xd4>
cmpq   $0x0,-0x20(%rbp)
je     1214 <track_is_compilation+0xd4>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <u_strcase_equal@plt>
cmp    $0x0,%eax
jne    1214 <track_is_compilation+0xd4>
movl   $0x1,-0x4(%rbp)
jmp    121b <track_is_compilation+0xdb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<track_is_compilation>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xeb2(%rip),%rsi
call   1050 <keyvals_get_val@plt>
test   %rax,%rax
je     116a <track_is_compilation+0x2a>
mov    %rax,%rdi
call   1030 <is_freeform_true@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    11c9 <track_is_compilation+0x89>
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <keyvals_get_val@plt>
test   %rax,%rax
je     11b8 <track_is_compilation+0x78>
mov    %rax,%r14
mov    %rax,%rdi
call   1040 <is_various_artists@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    11c9 <track_is_compilation+0x89>
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
call   1050 <keyvals_get_val@plt>
test   %rax,%rax
je     11c7 <track_is_compilation+0x87>
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <u_strcase_equal@plt>
test   %eax,%eax
jne    11c7 <track_is_compilation+0x87>
jmp    11c9 <track_is_compilation+0x89>
lea    0xe52(%rip),%rsi
mov    %rbx,%rdi
call   1050 <keyvals_get_val@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.keyval = type { i32 }
@.str = [12 x i8] c"compilation\00"
@.str.1 = [12 x i8] c"albumartist\00"
@.str.2 = [7 x i8] c"artist\00"
define i32 @track_is_compilation(%struct.keyval* %0) {
%2 = tail call i8* @keyvals_get_val(%struct.keyval* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i64 @is_freeform_true(i8* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %22
7: ; preds = %4, %1
%8 = tail call i8* @keyvals_get_val(%struct.keyval* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i8* @keyvals_get_val(%struct.keyval* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %21
12: ; preds = %7
%13 = tail call i64 @is_various_artists(i8* %8)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = tail call i8* @keyvals_get_val(%struct.keyval* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i8* %16, null
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = tail call i32 @u_strcase_equal(i8* %8, i8* %16)
%20 = icmp eq i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %10, %18, %15
br label %22
22: ; preds = %18, %12, %4, %21
%23 = phi i32 [ 0, %21 ], [ 1, %4 ], [ 1, %12 ], [ 1, %18 ]
ret i32 %23
}