#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*/ assert(int);
int /*<<< orphan*/ diatonic_interval(int /*<<< orphan*/, int /*<<< orphan*/,
                                     int);
int /*<<< orphan*/ end_test();
int /*<<< orphan*/ note_to_str(int /*<<< orphan*/, char *);
int /*<<< orphan*/ start_test(char *);
int /*<<< orphan*/ str_to_note(char *);
scalar_t__ strcmp(char *, char *);
void test_third() {
  char result[12];
  char *notes[] = {"C", "E", "F", "G", "A#"};
  char *answers[] = {"E", "G", "A", "B", "C"};
  int i;
  start_test("third");
  for (i = 0; i < 5; i++) {
    note_to_str(
        (diatonic_interval((str_to_note("C")), (str_to_note(notes[i])), 2)),
        result);
    assert(strcmp(result, answers[i]) == 0);
  }
  end_test();
}


x86 assembly (clang, -O0):
<test_third>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
lea    0xe5e(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe55(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe4c(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe43(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe3a(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
lea    0xe19(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe12(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xe0c(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe03(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xdeb(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xdef(%rip),%rdi
call   1040 <start_test@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    129e <test_third+0x11e>
lea    0xdc3(%rip),%rdi
call   1060 <str_to_note@plt>
mov    %eax,-0x78(%rbp)
movslq -0x74(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   1060 <str_to_note@plt>
mov    -0x78(%rbp),%edi
mov    %eax,%esi
mov    $0x2,%edx
call   10a0 <diatonic_interval@plt>
mov    %eax,%edi
lea    -0xc(%rbp),%rsi
call   1050 <note_to_str@plt>
lea    -0xc(%rbp),%rdi
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    122c <test_third+0xac>
mov    $0x0,%al
call   1030 <end_test@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_third>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe8c(%rip),%rdi
call   1040 <start_test@plt>
lea    0xe71(%rip),%r14
mov    %r14,%rdi
call   1060 <str_to_note@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1060 <str_to_note@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x2,%edx
call   1090 <diatonic_interval@plt>
lea    0x4(%rsp),%r12
mov    %eax,%edi
mov    %r12,%rsi
call   1050 <note_to_str@plt>
lea    0xe3d(%rip),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
call   1060 <str_to_note@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <str_to_note@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    $0x2,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1050 <note_to_str@plt>
lea    0xdf7(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
call   1060 <str_to_note@plt>
mov    %eax,%ebx
lea    0xdcb(%rip),%rdi
call   1060 <str_to_note@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x2,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1050 <note_to_str@plt>
lea    0xdae(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
call   1060 <str_to_note@plt>
mov    %eax,%ebx
mov    %r15,%rdi
call   1060 <str_to_note@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x2,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1050 <note_to_str@plt>
lea    0xd69(%rip),%rsi
mov    %r12,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
call   1060 <str_to_note@plt>
mov    %eax,%ebx
lea    0xd3d(%rip),%rdi
call   1060 <str_to_note@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x2,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r12,%rsi
call   1050 <note_to_str@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
xor    %eax,%eax
call   1030 <end_test@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"C\00"
@.str.1 = [2 x i8] c"E\00"
@.str.2 = [2 x i8] c"F\00"
@.str.3 = [2 x i8] c"G\00"
@.str.4 = [3 x i8] c"A#\00"
@.str.5 = [2 x i8] c"A\00"
@.str.6 = [2 x i8] c"B\00"
@.str.7 = [6 x i8] c"third\00"
define void @test_third() {
%1 = alloca [12 x i8]
%2 = alloca [5 x i8*]
%3 = alloca [5 x i8*]
%4 = alloca i32
%5 = bitcast [5 x i8*]* %2 to i8*
%6 = bitcast i8* %5 to [5 x i8*]*
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %6, i32 0, i32 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i8** %11
%12 = bitcast [5 x i8*]* %3 to i8*
%13 = bitcast i8* %12 to [5 x i8*]*
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8** %15
%16 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8** %16
%17 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8** %17
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8** %18
%19 = call i32 @start_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %4
br label %20
20: ; preds = %42, %0
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %45
23: ; preds = %20
%24 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @str_to_note(i8* %28)
%30 = call i32 @diatonic_interval(i32 %24, i32 %29, i32 2)
%31 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%32 = call i32 @note_to_str(i32 %30, i8* %31)
%33 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %35
%37 = load i8*, i8** %36
%38 = call i64 @strcmp(i8* %33, i8* %37)
%39 = icmp eq i64 %38, 0
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
br label %42
42: ; preds = %23
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %20
45: ; preds = %20
%46 = call i32 (...) @end_test()
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"C\00"
@.str.1 = [2 x i8] c"E\00"
@.str.2 = [2 x i8] c"F\00"
@.str.3 = [2 x i8] c"G\00"
@.str.4 = [3 x i8] c"A#\00"
@.str.5 = [2 x i8] c"A\00"
@.str.6 = [2 x i8] c"B\00"
@.str.7 = [6 x i8] c"third\00"
define void @test_third() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @start_test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%4 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @diatonic_interval(i32 %4, i32 %5, i32 2)
%7 = call i32 @note_to_str(i32 %6, i8* %2)
%8 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @diatonic_interval(i32 %12, i32 %13, i32 2)
%15 = call i32 @note_to_str(i32 %14, i8* %2)
%16 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 @diatonic_interval(i32 %20, i32 %21, i32 2)
%23 = call i32 @note_to_str(i32 %22, i8* %2)
%24 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @diatonic_interval(i32 %28, i32 %29, i32 2)
%31 = call i32 @note_to_str(i32 %30, i8* %2)
%32 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%37 = call i32 @str_to_note(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%38 = call i32 @diatonic_interval(i32 %36, i32 %37, i32 2)
%39 = call i32 @note_to_str(i32 %38, i8* %2)
%40 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = call i32 (...) @end_test()
ret void
}