// File: /workspace/github_cpp_makefile_star2_O1/Wombozo[P]harmony/src/Chord.cpp
// Function: Chord::Chord(Note*, std::vector<Interval, std::allocator<Interval>>)
Chord::Chord(Note *n, std::vector<Interval> ints) : root(n), bass(n), inversion(0)
{
    if (ints.size() != 2 && ints.size() != 3)
        throw E_CHORD_UNKNOWN;
    t = new Triad(n, ints);
    if (ints.size() == 2)
    {
        name = t->getName();
        notes = t->notes;
        intervals = t->getIntervals();
    }
    else
    {
        std::string str;
        Interval int4 = ints.at(2);
        intervals = ints;
        notes = t->notes;
        if (!int4.getName().compare("minor seventh"))
        {
            notes.push_back(int4.getNextSorted(root));
            if (!t->getTypeName().compare(""))
            {
                // 7
                str = chords[0];
            }
            else if (!t->getTypeName().compare("m"))
            {
                // m7
                str = chords[3];
            }
            else if (!t->getTypeName().compare("dim"))
            {
                // m7b5
                str = chords[6];
            }
            else
                throw E_CHORD_UNKNOWN;
        }
        else if (!int4.getName().compare("major seventh"))
        {
            notes.push_back(int4.getNextSorted(root));
            if (!t->getTypeName().compare(""))
            {
                // maj7
                str = chords[1];
            }
            else if (!t->getTypeName().compare("m"))
            {
                // minmaj7
                str = chords[4];
            }
            else if (!t->getTypeName().compare("dim"))
            {
                // 7b5
                str = chords[7];
            }
            else
                throw E_CHORD_UNKNOWN;
        }
        else if (!int4.getName().compare("major sixth"))
        {
            notes.push_back(int4.getNextSorted(root));
            if (!t->getTypeName().compare("m"))
            {
                // m6
                str = chords[5];
            }
            else if (!t->getTypeName().compare(""))
            {
                // 6
                str = chords[2];
            }
            else
                throw E_CHORD_UNKNOWN;
        }
        else if (!int4.getName().compare("diminished seventh"))
        {
            notes.push_back(int4.getNextSorted(root));
            if (!t->getTypeName().compare("dim"))
            {
                //dim7
                str = chords[8];
            }
            else
                throw E_CHORD_UNKNOWN;
        }
        else
            throw E_CHORD_UNKNOWN;
        name = n->display() + str;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %r14
movq %rsi, (%rdi)
movq %rsi, 0x10(%rdi)
movl $0x0, 0x18(%rdi)
leaq 0x20(%rdi), %rax
movq %rax, -0x58(%rbp)
leaq 0x30(%rdi), %rax
movq %rax, -0x88(%rbp)
movq %rax, 0x20(%rdi)
movq $0x0, 0x28(%rdi)
movb $0x0, 0x30(%rdi)
leaq 0x40(%rdi), %rax
movq %rax, -0x90(%rbp)
leaq 0x58(%rdi), %rax
movq %rax, -0x50(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x60(%rdi)
movq 0x8(%rdx), %rax
subq (%rdx), %rax
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r12 # imm = 0xCCCCCCCCCCCCCCCD
imulq %r12, %rax
andq $-0x2, %rax
cmpq $0x2, %rax
jne 0x8e2c
movq %rdx, %r15
movq %rsi, %r13
movl $0x88, %edi
callq 0x3180
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
movq %r15, %rsi
callq 0x911c
leaq -0xe8(%rbp), %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0xab08
movq %rbx, 0x8(%r14)
leaq -0xe8(%rbp), %rdi
callq 0x91c0
movq (%r15), %rbx
movq 0x8(%r15), %rdx
subq %rbx, %rdx
cmpq $0x50, %rdx
jne 0x890d
movq 0x8(%r14), %rsi
leaq -0x80(%rbp), %rdi
callq 0xb966
leaq -0x80(%rbp), %rbx
movq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x31d0
movq (%rbx), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x8884
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x3190
movq 0x8(%r14), %rsi
addq $0x70, %rsi
movq -0x50(%rbp), %rdi
callq 0x9210
movq 0x8(%r14), %rsi
leaq -0xb0(%rbp), %rdi
callq 0xb9a8
xorps %xmm0, %xmm0
leaq -0x80(%rbp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq 0x40(%r14), %rax
movups 0x48(%r14), %xmm0
leaq -0xb0(%rbp), %rbx
movq (%rbx), %rcx
movq %rcx, 0x40(%r14)
movq 0x8(%rbx), %rcx
movq %rcx, 0x48(%r14)
movq 0x10(%rbx), %rcx
movq %rcx, 0x50(%r14)
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq 0x10(%rdi), %rsi
movq %rax, (%rdi)
movups %xmm0, 0x8(%rdi)
movq %rcx, (%rbx)
movq %rdx, 0x8(%rbx)
movq %rsi, 0x10(%rbx)
callq 0x91c0
movq %rbx, %rdi
callq 0x91c0
jmp 0x8e1a
sarq $0x3, %rdx
imulq %r12, %rdx
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
cmpq $0x2, %rdx
jbe 0x8e4d
leaq -0x70(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x50(%rbx), %rsi
movq 0x58(%rbx), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %rdi
callq 0x669c
movq 0x70(%rbx), %rax
movq %rax, -0x60(%rbp)
movq -0x90(%rbp), %rdi
movq %r15, %rsi
callq 0x92f0
movq 0x8(%r14), %rsi
addq $0x70, %rsi
movq -0x50(%rbp), %rdi
callq 0x9210
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7890
leaq 0x590f(%rip), %rsi      # 0xe29c
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
leaq -0x38(%rbp), %r12
cmpq %r12, %rdi
je 0x89b3
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8acb
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7890
leaq 0x58db(%rip), %rsi      # 0xe2aa
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x89ed
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8ba1
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7890
leaq 0x5864(%rip), %rsi      # 0xe26d
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8a27
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8c77
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7890
leaq 0x5846(%rip), %rsi      # 0xe289
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8a61
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
jne 0x8e60
movq (%r14), %rsi
leaq -0x80(%rbp), %rdi
callq 0x7256
leaq -0x48(%rbp), %rsi
movq %rax, (%rsi)
movq -0x50(%rbp), %rdi
callq 0x971c
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x582d(%rip), %rsi      # 0xe2c6
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8ab7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
jne 0x8e60
leaq 0xa95a(%rip), %rsi      # 0x13420
jmp 0x8d37
movq (%r14), %rsi
leaq -0x80(%rbp), %rdi
callq 0x7256
leaq -0x48(%rbp), %rsi
movq %rax, (%rsi)
movq -0x50(%rbp), %rdi
callq 0x971c
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x5aaa(%rip), %rsi      # 0xe5a5
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8b19
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8d0c
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x5793(%rip), %rsi      # 0xe2c8
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8b53
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8d15
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x5757(%rip), %rsi      # 0xe2c6
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8b8d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
jne 0x8e60
leaq 0xa844(%rip), %rsi      # 0x133e0
jmp 0x8d37
movq (%r14), %rsi
leaq -0x80(%rbp), %rdi
callq 0x7256
leaq -0x48(%rbp), %rsi
movq %rax, (%rsi)
movq -0x50(%rbp), %rdi
callq 0x971c
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x59d4(%rip), %rsi      # 0xe5a5
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8bef
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8d1e
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x56bd(%rip), %rsi      # 0xe2c8
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8c29
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8d27
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x5681(%rip), %rsi      # 0xe2c6
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8c63
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
jne 0x8e60
leaq 0xa78e(%rip), %rsi      # 0x13400
jmp 0x8d37
movq (%r14), %rsi
leaq -0x80(%rbp), %rdi
callq 0x7256
leaq -0x48(%rbp), %rsi
movq %rax, (%rsi)
movq -0x50(%rbp), %rdi
callq 0x971c
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x5621(%rip), %rsi      # 0xe2c8
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8cc5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
je 0x8d30
movq 0x8(%r14), %rsi
leaq -0x48(%rbp), %rdi
callq 0xb9ce
leaq 0x58c8(%rip), %rsi      # 0xe5a5
movq %r15, %rdi
callq 0x3070
movl %eax, %ebx
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x8cfb
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
testl %ebx, %ebx
jne 0x8e60
leaq 0xa656(%rip), %rsi      # 0x13360
jmp 0x8d37
leaq 0xa60d(%rip), %rsi      # 0x13320
jmp 0x8d37
leaq 0xa664(%rip), %rsi      # 0x13380
jmp 0x8d37
leaq 0xa61b(%rip), %rsi      # 0x13340
jmp 0x8d37
leaq 0xa672(%rip), %rsi      # 0x133a0
jmp 0x8d37
leaq 0xa689(%rip), %rsi      # 0x133c0
leaq -0xb0(%rbp), %rdi
callq 0x30f0
movq (%r13), %rax
leaq -0xd0(%rbp), %rdi
movq %r13, %rsi
callq *(%rax)
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
leaq -0xd0(%rbp), %rdi
callq 0x3080
movq %r12, -0x48(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8d8d
movq %rdx, -0x48(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x38(%rbp)
jmp 0x8d95
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq -0x48(%rbp), %rbx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x58(%rbp), %rdi
movq %rbx, %rsi
callq 0x31d0
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x8dd0
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x3190
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8def
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x3190
leaq -0x80(%rbp), %rdi
callq 0x786e
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x8e1a
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x3190
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x4, %edi
callq 0x30d0
movl $0x1, (%rax)
leaq 0x9a35(%rip), %rsi      # 0x12878
movq %rax, %rdi
xorl %edx, %edx
callq 0x3290
leaq 0x549a(%rip), %rdi      # 0xe2ee
movl $0x2, %esi
xorl %eax, %eax
callq 0x3210
movl $0x4, %edi
callq 0x30d0
movl $0x1, (%rax)
leaq 0x9a01(%rip), %rsi      # 0x12878
movq %rax, %rdi
xorl %edx, %edx
callq 0x3290
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8ef0
movq %rax, %r13
leaq -0xc0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8ef3
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x3190
jmp 0x8ef3
jmp 0x8ef0
jmp 0x8ef0
jmp 0x8f20
jmp 0x8f20
movq %rax, %r13
jmp 0x8efc
movq %rax, %r13
leaq -0xe8(%rbp), %rdi
callq 0x91c0
jmp 0x8ee6
movq %rax, %r13
movl $0x88, %esi
movq %rbx, %rdi
jmp 0x8f19
movq %rax, %r13
leaq -0x80(%rbp), %rdi
callq 0x786e
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x8f23
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x3190
jmp 0x8f23
movq %rax, %r13
movq -0x50(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x8f3b
movq 0x68(%r14), %rsi
subq %rdi, %rsi
callq 0x3190
movq -0x90(%rbp), %rdi
callq 0x91c0
movq -0x58(%rbp), %rax
movq (%rax), %rdi
cmpq -0x88(%rbp), %rdi
je 0x8f69
movq -0x88(%rbp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x3190
movq %r13, %rdi
callq 0x32b0
nop