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


x86 assembly (clang, -O0):
<test_major_second>:
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    0xe22(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe19(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xe07(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xe06(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xdfd(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xdf5(%rip),%rdi
call   1040 <start_test@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    12a0 <test_major_second+0x120>
movslq -0x74(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%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    $0x1,%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_major_second+0xac>
mov    $0x0,%al
call   1030 <end_test@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_major_second>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe96(%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
mov    $0x1,%edx
call   1090 <diatonic_interval@plt>
lea    0x4(%rsp),%r14
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xe4a(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
lea    0xe24(%rip),%rbp
mov    %rbp,%rdi
call   1060 <str_to_note@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1060 <str_to_note@plt>
mov    %ebx,%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    0xdfe(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
lea    0xdd8(%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
mov    $0x1,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xda9(%rip),%rbx
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    0xd69(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
lea    0xd44(%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
mov    $0x1,%edx
call   1090 <diatonic_interval@plt>
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <note_to_str@plt>
lea    0xd1d(%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"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"D\00"
@.str.6 = [3 x i8] c"F#\00"
@.str.7 = [2 x i8] c"A\00"
@.str.8 = [3 x i8] c"B#\00"
@.str.9 = [13 x i8] c"major_second\00"
define void @test_major_second() {
%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.5, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, 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.3, 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.7, i32 0, i32 0), i8** %17
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i32 0, i32 4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0), i8** %18
%19 = call i32 @start_test(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %4
br label %20
20: ; preds = %46, %0
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %49
23: ; preds = %20
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 @str_to_note(i8* %27)
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @str_to_note(i8* %32)
%34 = call i32 @diatonic_interval(i32 %28, i32 %33, i32 1)
%35 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%36 = call i32 @note_to_str(i32 %34, i8* %35)
%37 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %39
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %37, i8* %41)
%43 = icmp eq i64 %42, 0
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
br label %46
46: ; preds = %23
%47 = load i32, i32* %4
%48 = add nsw i32 %47, 1
store i32 %48, i32* %4
br label %20
49: ; preds = %20
%50 = 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"D\00"
@.str.6 = [3 x i8] c"F#\00"
@.str.7 = [2 x i8] c"A\00"
@.str.8 = [3 x i8] c"B#\00"
@.str.9 = [13 x i8] c"major_second\00"
define void @test_major_second() {
%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 ([13 x i8], [13 x i8]* @.str.9, 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 1)
%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.5, 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.1, 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 1)
%15 = call i32 @note_to_str(i32 %14, i8* %2)
%16 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, 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.2, 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 1)
%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.3, 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.3, 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 1)
%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.7, 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 ([3 x i8], [3 x i8]* @.str.4, 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 1)
%39 = call i32 @note_to_str(i32 %38, i8* %2)
%40 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, 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
}