#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_diatonic_interval() {
  char *notes[] = {"C", "D", "E", "F", "G", "A", "B"};
  char result[12];
  int i;
  start_test("diatonic_interval");
  for (i = 0; i < 7; i++) {
    note_to_str(diatonic_interval((str_to_note("C")), (str_to_note("C")), i),
                result);
    assert(strcmp(result, notes[i]) == 0);
  }
  end_test();
}


x86 assembly (clang, -O0):
<test_diatonic_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x40(%rbp),%rdi
lea    0x2c4d(%rip),%rsi
mov    $0x38,%edx
call   1090 <memcpy@plt>
lea    0xe6a(%rip),%rdi
call   1040 <start_test@plt>
movl   $0x0,-0x50(%rbp)
cmpl   $0x7,-0x50(%rbp)
jge    121e <test_diatonic_interval+0x9e>
lea    0xe3f(%rip),%rdi
call   1060 <str_to_note@plt>
mov    %eax,-0x54(%rbp)
lea    0xe30(%rip),%rdi
call   1060 <str_to_note@plt>
mov    -0x54(%rbp),%edi
mov    %eax,%esi
mov    -0x50(%rbp),%edx
call   10a0 <diatonic_interval@plt>
mov    %eax,%edi
lea    -0x4c(%rbp),%rsi
call   1050 <note_to_str@plt>
lea    -0x4c(%rbp),%rdi
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    11b0 <test_diatonic_interval+0x30>
mov    $0x0,%al
call   1030 <end_test@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_diatonic_interval>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe8f(%rip),%rdi
call   1040 <start_test@plt>
lea    0xe75(%rip),%rbx
mov    %rbx,%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
xor    %edx,%edx
call   1090 <diatonic_interval@plt>
lea    0x4(%rsp),%r14
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%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    $0x1,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xe01(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%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    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xdbc(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%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    $0x3,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xd77(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%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    $0x4,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xd32(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%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    $0x5,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xced(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %rbx,%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    $0x6,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xca8(%rip),%rsi
mov    %r14,%rdi
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    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"C\00"
@.str.1 = [2 x i8] c"D\00"
@.str.2 = [2 x i8] c"E\00"
@.str.3 = [2 x i8] c"F\00"
@.str.4 = [2 x i8] c"G\00"
@.str.5 = [2 x i8] c"A\00"
@.str.6 = [2 x i8] c"B\00"
@__const.test_diatonic_interval.notes = [7 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [18 x i8] c"diatonic_interval\00"
define void @test_diatonic_interval() {
%1 = alloca [7 x i8*]
%2 = alloca [12 x i8]
%3 = alloca i32
%4 = bitcast [7 x i8*]* %1 to i8*
%5 = call i32 @start_test(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %3
br label %6
6: ; preds = %25, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 7
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = call i32 @diatonic_interval(i32 %10, i32 %11, i32 %12)
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%15 = call i32 @note_to_str(i32 %13, i8* %14)
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %16, i8* %20)
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
br label %25
25: ; preds = %9
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %6
28: ; preds = %6
%29 = call i32 (...) @end_test()
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"C\00"
@.str.1 = [2 x i8] c"D\00"
@.str.2 = [2 x i8] c"E\00"
@.str.3 = [2 x i8] c"F\00"
@.str.4 = [2 x i8] c"G\00"
@.str.5 = [2 x i8] c"A\00"
@.str.6 = [2 x i8] c"B\00"
@.str.7 = [18 x i8] c"diatonic_interval\00"
define void @test_diatonic_interval() {
%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 ([18 x i8], [18 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 0)
%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, 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, i64 0, i64 0))
%14 = call i32 @diatonic_interval(i32 %12, i32 %13, i32 1)
%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.1, 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, 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.2, 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, i64 0, i64 0))
%30 = call i32 @diatonic_interval(i32 %28, i32 %29, i32 3)
%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.3, 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 ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%38 = call i32 @diatonic_interval(i32 %36, i32 %37, i32 4)
%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.4, 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 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%45 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%46 = call i32 @diatonic_interval(i32 %44, i32 %45, i32 5)
%47 = call i32 @note_to_str(i32 %46, i8* %2)
%48 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%53 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%54 = call i32 @diatonic_interval(i32 %52, i32 %53, i32 6)
%55 = call i32 @note_to_str(i32 %54, i8* %2)
%56 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%57 = icmp eq i64 %56, 0
%58 = zext i1 %57 to i32
%59 = call i32 @assert(i32 %58)
%60 = call i32 (...) @end_test()
ret void
}