#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*/ end_test();
int /*<<< orphan*/ int_to_note(unsigned int);
unsigned int note_to_int(int /*<<< orphan*/);
int /*<<< orphan*/ note_to_str(int /*<<< orphan*/, char *);
int /*<<< orphan*/ start_test(char *);
scalar_t__ strcmp(char *, char *);
void test_int_to_note() {
  char result[2] = "";
  char *notes[] = {"C", "C#", "D", "D#", "E", "F"};
  unsigned int x;
  start_test("int_to_note");
  for (x = 0; x < 6; x++) {
    result[0] = '\0';
    note_to_str(int_to_note(x), result);
    assert(note_to_int(int_to_note(x)) == x);
    assert(strcmp(notes[x], result) == 0);
  }
  end_test();
}


x86 assembly (clang, -O0):
<test_int_to_note>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x2(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1060 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1060 <memset@plt>
lea    0xe51(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe48(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe40(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe37(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe2f(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe26(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xe1d(%rip),%rdi
call   1040 <start_test@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x6,-0x44(%rbp)
jae    126d <test_int_to_note+0xed>
movb   $0x0,-0x2(%rbp)
mov    -0x44(%rbp),%edi
call   1070 <int_to_note@plt>
mov    %eax,%edi
lea    -0x2(%rbp),%rsi
call   1050 <note_to_str@plt>
mov    -0x44(%rbp),%edi
call   1070 <int_to_note@plt>
mov    %eax,%edi
call   10a0 <note_to_int@plt>
cmp    -0x44(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x44(%rbp),%eax
mov    -0x40(%rbp,%rax,8),%rdi
lea    -0x2(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11fd <test_int_to_note+0x7d>
mov    $0x0,%al
call   1030 <end_test@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_int_to_note>:
push   %rbx
sub    $0x10,%rsp
movw   $0x0,0xe(%rsp)
lea    0xe8b(%rip),%rdi
call   1040 <start_test@plt>
xor    %edi,%edi
call   1060 <int_to_note@plt>
lea    0xe(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <note_to_str@plt>
xor    %edi,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
call   1090 <note_to_int@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xe40(%rip),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
movb   $0x0,0xe(%rsp)
mov    $0x1,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <note_to_str@plt>
mov    $0x1,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
call   1090 <note_to_int@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xded(%rip),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
movb   $0x0,0xe(%rsp)
mov    $0x2,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <note_to_str@plt>
mov    $0x2,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
call   1090 <note_to_int@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xd9b(%rip),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
movb   $0x0,0xe(%rsp)
mov    $0x3,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <note_to_str@plt>
mov    $0x3,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
call   1090 <note_to_int@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xd48(%rip),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
movb   $0x0,0xe(%rsp)
mov    $0x4,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <note_to_str@plt>
mov    $0x4,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
call   1090 <note_to_int@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xcf6(%rip),%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
movb   $0x0,0xe(%rsp)
mov    $0x5,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1050 <note_to_str@plt>
mov    $0x5,%edi
call   1060 <int_to_note@plt>
mov    %eax,%edi
call   1090 <note_to_int@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1080 <assert@plt>
lea    0xca3(%rip),%rdi
mov    %rbx,%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
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"C\00"
@.str.1 = [3 x i8] c"C#\00"
@.str.2 = [2 x i8] c"D\00"
@.str.3 = [3 x i8] c"D#\00"
@.str.4 = [2 x i8] c"E\00"
@.str.5 = [2 x i8] c"F\00"
@.str.6 = [12 x i8] c"int_to_note\00"
define void @test_int_to_note() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
store i16 0, i16* %1
%3 = tail call i32 @start_test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%4 = call i32 @int_to_note(i32 0)
%5 = call i32 @note_to_str(i32 %4, i8* %2)
%6 = call i32 @int_to_note(i32 0)
%7 = call i32 @note_to_int(i32 %6)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %2)
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
store i8 0, i8* %2
%15 = call i32 @int_to_note(i32 1)
%16 = call i32 @note_to_str(i32 %15, i8* %2)
%17 = call i32 @int_to_note(i32 1)
%18 = call i32 @note_to_int(i32 %17)
%19 = icmp eq i32 %18, 1
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
store i8 0, i8* %2
%26 = call i32 @int_to_note(i32 2)
%27 = call i32 @note_to_str(i32 %26, i8* %2)
%28 = call i32 @int_to_note(i32 2)
%29 = call i32 @note_to_int(i32 %28)
%30 = icmp eq i32 %29, 2
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%34 = icmp eq i64 %33, 0
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
store i8 0, i8* %2
%37 = call i32 @int_to_note(i32 3)
%38 = call i32 @note_to_str(i32 %37, i8* %2)
%39 = call i32 @int_to_note(i32 3)
%40 = call i32 @note_to_int(i32 %39)
%41 = icmp eq i32 %40, 3
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%45 = icmp eq i64 %44, 0
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
store i8 0, i8* %2
%48 = call i32 @int_to_note(i32 4)
%49 = call i32 @note_to_str(i32 %48, i8* %2)
%50 = call i32 @int_to_note(i32 4)
%51 = call i32 @note_to_int(i32 %50)
%52 = icmp eq i32 %51, 4
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%56 = icmp eq i64 %55, 0
%57 = zext i1 %56 to i32
%58 = call i32 @assert(i32 %57)
store i8 0, i8* %2
%59 = call i32 @int_to_note(i32 5)
%60 = call i32 @note_to_str(i32 %59, i8* %2)
%61 = call i32 @int_to_note(i32 5)
%62 = call i32 @note_to_int(i32 %61)
%63 = icmp eq i32 %62, 5
%64 = zext i1 %63 to i32
%65 = call i32 @assert(i32 %64)
%66 = call i64 @strcmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%67 = icmp eq i64 %66, 0
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
%70 = call i32 (...) @end_test()
ret void
}