#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, *aa;
  aa = keyvals_get_val(comments, "albumartist");
  if (aa)
    return is_various_artists(aa);
  c = keyvals_get_val(comments, "compilation");
  return c && is_freeform_true(c);
}


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,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     116c <track_is_va_compilation+0x3c>
mov    -0x20(%rbp),%rdi
call   1040 <is_various_artists@plt>
mov    %eax,-0x4(%rbp)
jmp    11ae <track_is_va_compilation+0x7e>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1050 <keyvals_get_val@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x21(%rbp)
je     11a3 <track_is_va_compilation+0x73>
mov    -0x18(%rbp),%rdi
call   1030 <is_freeform_true@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-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    0xeb7(%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   1030 <is_freeform_true@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

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