#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*/ sprintf(char *, char *);
void scale_type_to_name(char *str, unsigned char scale) {
  switch (scale) {
  case 0:
    sprintf(str, "Chromatic");
    break;
  case 1:
    sprintf(str, "Major");
    break;
  case 2:
    sprintf(str, "Nat Minor");
    break;
  case 3:
    sprintf(str, "Har Minor");
    break;
  case 4:
    sprintf(str, "Dorian");
    break;
  case 5:
    sprintf(str, "Whole");
    break;
  case 6:
    sprintf(str, "Pentatonic");
    break;
  case 7:
    sprintf(str, "Diminished");
    break;
  case 8:
    sprintf(str, "Phrygian");
    break;
  case 9:
    sprintf(str, "Lydian");
    break;
  case 10:
    sprintf(str, "Mixolydian");
    break;
  case 11:
    sprintf(str, "Locrian");
    break;
  case 12:
    sprintf(str, "Min Pent");
    break;
  case 13:
    sprintf(str, "Blues");
    break;
  case 14:
    sprintf(str, "Half Dim");
    break;
  case 15:
    sprintf(str, "Seven Chord");
    break;
  }
}


x86 assembly (clang, -O0):
<scale_type_to_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0xf,%rax
ja     1293 <scale_type_to_name+0x183>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
lea    0xeed(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xee2(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xed3(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xec8(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe5b(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1030 <sprintf@plt>
jmp    1293 <scale_type_to_name+0x183>
mov    -0x8(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_type_to_name>:
cmp    $0xf,%sil
ja     121e <scale_type_to_name+0x11e>
mov    %esi,%eax
lea    0xeed(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movabs $0x6974616d6f726843,%rax
61 74 69
mov    %rax,(%rdi)
movw   $0x63,0x8(%rdi)
ret
movw   $0x72,0x4(%rdi)
movl   $0x6f6a614d,(%rdi)
ret
movabs $0x6f6e694d2074614e,%rax
69 6e 6f
jmp    1153 <scale_type_to_name+0x53>
movabs $0x6f6e694d20726148,%rax
69 6e 6f
mov    %rax,(%rdi)
movw   $0x72,0x8(%rdi)
ret
movl   $0x6e6169,0x3(%rdi)
movl   $0x69726f44,(%rdi)
ret
movw   $0x65,0x4(%rdi)
movl   $0x6c6f6857,(%rdi)
ret
movabs $0x6e6f7461746e6550,%rax
74 6f 6e
mov    %rax,(%rdi)
movl   $0x63696e,0x7(%rdi)
ret
movabs $0x6873696e696d6944,%rax
69 73 68
mov    %rax,(%rdi)
movl   $0x646568,0x7(%rdi)
ret
movabs $0x6e61696779726850,%rax
69 61 6e
jmp    1202 <scale_type_to_name+0x102>
movl   $0x6e6169,0x3(%rdi)
movl   $0x6964794c,(%rdi)
ret
movabs $0x6964796c6f78694d,%rax
79 64 69
mov    %rax,(%rdi)
movl   $0x6e6169,0x7(%rdi)
ret
movabs $0x6e616972636f4c,%rax
mov    %rax,(%rdi)
ret
movabs $0x746e6550206e694d,%rax
65 6e 74
jmp    1202 <scale_type_to_name+0x102>
movw   $0x73,0x4(%rdi)
movl   $0x65756c42,(%rdi)
ret
movabs $0x6d694420666c6148,%rax
44 69 6d
mov    %rax,(%rdi)
movb   $0x0,0x8(%rdi)
ret
movabs $0x6843206e65766553,%rax
20 43 68
mov    %rax,(%rdi)
movl   $0x64726f,0x8(%rdi)
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Chromatic\00"
@.str.1 = [6 x i8] c"Major\00"
@.str.2 = [10 x i8] c"Nat Minor\00"
@.str.3 = [10 x i8] c"Har Minor\00"
@.str.4 = [7 x i8] c"Dorian\00"
@.str.5 = [6 x i8] c"Whole\00"
@.str.6 = [11 x i8] c"Pentatonic\00"
@.str.7 = [11 x i8] c"Diminished\00"
@.str.8 = [9 x i8] c"Phrygian\00"
@.str.9 = [7 x i8] c"Lydian\00"
@.str.10 = [11 x i8] c"Mixolydian\00"
@.str.11 = [8 x i8] c"Locrian\00"
@.str.12 = [9 x i8] c"Min Pent\00"
@.str.13 = [6 x i8] c"Blues\00"
@.str.14 = [9 x i8] c"Half Dim\00"
@.str.15 = [12 x i8] c"Seven Chord\00"
define void @scale_type_to_name(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
switch i32 %6, label %55 [
i32 0, label %7
i32 1, label %10
i32 2, label %13
i32 3, label %16
i32 4, label %19
i32 5, label %22
i32 6, label %25
i32 7, label %28
i32 8, label %31
i32 9, label %34
i32 10, label %37
i32 11, label %40
i32 12, label %43
i32 13, label %46
i32 14, label %49
i32 15, label %52
]
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %55
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %55
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %55
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %55
19: ; preds = %2
%20 = load i8*, i8** %3
%21 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %55
22: ; preds = %2
%23 = load i8*, i8** %3
%24 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %55
25: ; preds = %2
%26 = load i8*, i8** %3
%27 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %55
28: ; preds = %2
%29 = load i8*, i8** %3
%30 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
br label %55
31: ; preds = %2
%32 = load i8*, i8** %3
%33 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
br label %55
34: ; preds = %2
%35 = load i8*, i8** %3
%36 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %55
37: ; preds = %2
%38 = load i8*, i8** %3
%39 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %55
40: ; preds = %2
%41 = load i8*, i8** %3
%42 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %55
43: ; preds = %2
%44 = load i8*, i8** %3
%45 = call i32 @sprintf(i8* %44, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
br label %55
46: ; preds = %2
%47 = load i8*, i8** %3
%48 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
br label %55
49: ; preds = %2
%50 = load i8*, i8** %3
%51 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0))
br label %55
52: ; preds = %2
%53 = load i8*, i8** %3
%54 = call i32 @sprintf(i8* %53, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0))
br label %55
55: ; preds = %2, %52, %49, %46, %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %13, %10, %7
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Chromatic\00"
@.str.1 = [6 x i8] c"Major\00"
@.str.2 = [10 x i8] c"Nat Minor\00"
@.str.3 = [10 x i8] c"Har Minor\00"
@.str.4 = [7 x i8] c"Dorian\00"
@.str.5 = [6 x i8] c"Whole\00"
@.str.6 = [11 x i8] c"Pentatonic\00"
@.str.7 = [11 x i8] c"Diminished\00"
@.str.8 = [9 x i8] c"Phrygian\00"
@.str.9 = [7 x i8] c"Lydian\00"
@.str.10 = [11 x i8] c"Mixolydian\00"
@.str.12 = [9 x i8] c"Min Pent\00"
@.str.13 = [6 x i8] c"Blues\00"
@.str.14 = [9 x i8] c"Half Dim\00"
@.str.15 = [12 x i8] c"Seven Chord\00"
define void @scale_type_to_name(i8* nocapture writeonly %0, i8 zeroext %1) {
switch i8 %1, label %20 [
i8 0, label %3
i8 1, label %4
i8 2, label %5
i8 3, label %6
i8 4, label %7
i8 5, label %8
i8 6, label %9
i8 7, label %10
i8 8, label %11
i8 9, label %12
i8 10, label %13
i8 11, label %14
i8 12, label %16
i8 13, label %17
i8 14, label %18
i8 15, label %19
]
3: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %0, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 10, i1 false)
br label %20
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %0, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 6, i1 false)
br label %20
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %0, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i64 10, i1 false)
br label %20
6: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %0, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i64 10, i1 false)
br label %20
7: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %0, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i64 7, i1 false)
br label %20
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %0, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 6, i1 false)
br label %20
9: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(11) %0, i8* align 1 dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i64 11, i1 false)
br label %20
10: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(11) %0, i8* align 1 dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i64 11, i1 false)
br label %20
11: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %0, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i64 9, i1 false)
br label %20
12: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(7) %0, i8* align 1 dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i64 7, i1 false)
br label %20
13: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(11) %0, i8* align 1 dereferenceable(11) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i64 11, i1 false)
br label %20
14: ; preds = %2
%15 = bitcast i8* %0 to i64*
store i64 31069352956751692, i64* %15
br label %20
16: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %0, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i64 9, i1 false)
br label %20
17: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %0, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0), i64 6, i1 false)
br label %20
18: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(9) %0, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i64 9, i1 false)
br label %20
19: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(12) %0, i8* align 1 dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i64 12, i1 false)
br label %20
20: ; preds = %2, %19, %18, %17, %16, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
ret void
}