#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 *);
int is_various_artists(char const *);
char *keyvals_get_val(struct keyval const *, char *);
int track_is_va_compilation(const struct keyval *comments) {
  const char *c, *a, *aa;
  aa = keyvals_get_val(comments, "albumartist");
  if (aa)
    return is_various_artists(aa);
  a = keyvals_get_val(comments, "artist");
  if (a && is_various_artists(a))
    return 1;
  c = keyvals_get_val(comments, "compilation");
  if (c && is_freeform_true(c))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<track_is_va_compilation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <keyvals_get_val@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     116c <track_is_va_compilation+0x3c>
mov    -0x28(%rbp),%rdi
call   1040 <is_various_artists@plt>
mov    %eax,-0x4(%rbp)
jmp    11ee <track_is_va_compilation+0xbe>
mov    -0x10(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1050 <keyvals_get_val@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11a9 <track_is_va_compilation+0x79>
mov    -0x20(%rbp),%rdi
call   1040 <is_various_artists@plt>
cmp    $0x0,%eax
je     11a9 <track_is_va_compilation+0x79>
movl   $0x1,-0x4(%rbp)
jmp    11ee <track_is_va_compilation+0xbe>
mov    -0x10(%rbp),%rdi
lea    0xe58(%rip),%rsi
call   1050 <keyvals_get_val@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11e7 <track_is_va_compilation+0xb7>
mov    -0x18(%rbp),%rdi
call   1030 <is_freeform_true@plt>
cmp    $0x0,%rax
je     11e7 <track_is_va_compilation+0xb7>
movl   $0x1,-0x4(%rbp)
jmp    11ee <track_is_va_compilation+0xbe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<track_is_va_compilation>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1050 <keyvals_get_val@plt>
test   %rax,%rax
je     114e <track_is_va_compilation+0x1e>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <is_various_artists@plt>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1050 <keyvals_get_val@plt>
test   %rax,%rax
je     1177 <track_is_va_compilation+0x47>
mov    %rax,%rdi
call   1040 <is_various_artists@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
je     1177 <track_is_va_compilation+0x47>
pop    %rbx
ret
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1050 <keyvals_get_val@plt>
test   %rax,%rax
je     11a0 <track_is_va_compilation+0x70>
mov    %rax,%rdi
call   1030 <is_freeform_true@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1175 <track_is_va_compilation+0x45>
xor    %eax,%eax
pop    %rbx
ret

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

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