#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*/ diminish_note(int /*<<< orphan*/);
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_minor_seventh() {
  char result[12];
  char *notes[] = {"C", "E", "F", "G", "A#"};
  char *answers[] = {"Bb", "D", "Eb", "F", "G#"};
  int i;
  start_test("minor_seventh");
  for (i = 0; i < 5; i++) {
    note_to_str((diminish_note((diatonic_interval(
                    (str_to_note(notes[i])), (str_to_note(notes[i])), 6)))),
                result);
    assert(strcmp(result, answers[i]) == 0);
  }
  end_test();
}


x86 assembly (clang, -O0):
<test_minor_seventh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1080 <memset@plt>
lea    0xe4e(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe45(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe3c(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe33(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe2a(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1080 <memset@plt>
lea    0xe12(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    0xe0a(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xe01(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xdea(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xdee(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xde6(%rip),%rdi
call   1050 <start_test@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x5,-0x74(%rbp)
jge    12b7 <test_minor_seventh+0x127>
movslq -0x74(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   1070 <str_to_note@plt>
mov    %eax,-0x78(%rbp)
movslq -0x74(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
call   1070 <str_to_note@plt>
mov    -0x78(%rbp),%edi
mov    %eax,%esi
mov    $0x6,%edx
call   10b0 <diatonic_interval@plt>
mov    %eax,%edi
call   1040 <diminish_note@plt>
mov    %eax,%edi
lea    -0xc(%rbp),%rsi
call   1060 <note_to_str@plt>
lea    -0xc(%rbp),%rdi
movslq -0x74(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10a0 <assert@plt>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    123c <test_minor_seventh+0xac>
mov    $0x0,%al
call   1030 <end_test@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_minor_seventh>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe85(%rip),%rdi
call   1050 <start_test@plt>
lea    0xe63(%rip),%rbx
mov    %rbx,%rdi
call   1070 <str_to_note@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1070 <str_to_note@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    $0x6,%edx
call   10a0 <diatonic_interval@plt>
mov    %eax,%edi
call   1040 <diminish_note@plt>
lea    0xc(%rsp),%r15
mov    %eax,%edi
mov    %r15,%rsi
call   1060 <note_to_str@plt>
lea    0xe31(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
lea    0xe0b(%rip),%rbp
mov    %rbp,%rdi
call   1070 <str_to_note@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1070 <str_to_note@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x6,%edx
call   10a0 <diatonic_interval@plt>
mov    %eax,%edi
call   1040 <diminish_note@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1060 <note_to_str@plt>
lea    0xddf(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
lea    0xdb8(%rip),%r14
mov    %r14,%rdi
call   1070 <str_to_note@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1070 <str_to_note@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    $0x6,%edx
call   10a0 <diatonic_interval@plt>
mov    %eax,%edi
call   1040 <diminish_note@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1060 <note_to_str@plt>
lea    0xd8c(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
lea    0xd65(%rip),%rbx
mov    %rbx,%rdi
call   1070 <str_to_note@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1070 <str_to_note@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    $0x6,%edx
call   10a0 <diatonic_interval@plt>
mov    %eax,%edi
call   1040 <diminish_note@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1060 <note_to_str@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1080 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
lea    0xd16(%rip),%rbx
mov    %rbx,%rdi
call   1070 <str_to_note@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1070 <str_to_note@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    $0x6,%edx
call   10a0 <diatonic_interval@plt>
mov    %eax,%edi
call   1040 <diminish_note@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   1060 <note_to_str@plt>
lea    0xce9(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1090 <assert@plt>
xor    %eax,%eax
call   1030 <end_test@plt>
add    $0x18,%rsp
pop    %rbx
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 = [3 x i8] c"Bb\00"
@.str.6 = [2 x i8] c"D\00"
@.str.7 = [3 x i8] c"Eb\00"
@.str.8 = [3 x i8] c"G#\00"
@.str.9 = [14 x i8] c"minor_seventh\00"
define void @test_minor_seventh() {
%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 ([3 x i8], [3 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 ([2 x i8], [2 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 ([3 x i8], [3 x i8]* @.str.7, 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.2, 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 ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %4
br label %20
20: ; preds = %47, %0
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 5
br i1 %22, label %23, label %50
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 6)
%35 = call i32 @diminish_note(i32 %34)
%36 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%37 = call i32 @note_to_str(i32 %35, i8* %36)
%38 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [5 x i8*], [5 x i8*]* %3, i64 0, i64 %40
%42 = load i8*, i8** %41
%43 = call i64 @strcmp(i8* %38, i8* %42)
%44 = icmp eq i64 %43, 0
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
br label %47
47: ; preds = %23
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
br label %20
50: ; preds = %20
%51 = 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 = [3 x i8] c"Bb\00"
@.str.6 = [2 x i8] c"D\00"
@.str.7 = [3 x i8] c"Eb\00"
@.str.8 = [3 x i8] c"G#\00"
@.str.9 = [14 x i8] c"minor_seventh\00"
define void @test_minor_seventh() {
%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 ([14 x i8], [14 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 6)
%7 = call i32 @diminish_note(i32 %6)
%8 = call i32 @note_to_str(i32 %7, i8* %2)
%9 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @diatonic_interval(i32 %13, i32 %14, i32 6)
%16 = call i32 @diminish_note(i32 %15)
%17 = call i32 @note_to_str(i32 %16, i8* %2)
%18 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @diatonic_interval(i32 %22, i32 %23, i32 6)
%25 = call i32 @diminish_note(i32 %24)
%26 = call i32 @note_to_str(i32 %25, i8* %2)
%27 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @str_to_note(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @diatonic_interval(i32 %31, i32 %32, i32 6)
%34 = call i32 @diminish_note(i32 %33)
%35 = call i32 @note_to_str(i32 %34, i8* %2)
%36 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = call i32 @str_to_note(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = call i32 @str_to_note(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%42 = call i32 @diatonic_interval(i32 %40, i32 %41, i32 6)
%43 = call i32 @diminish_note(i32 %42)
%44 = call i32 @note_to_str(i32 %43, i8* %2)
%45 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = call i32 (...) @end_test()
ret void
}