// File: /workspace/github_cpp_makefile_star2_O2/Wombozo[P]harmony/src/Chord.cpp
// Function: Chord::Chord(Note*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Note*, int)
Chord::Chord(Note *n, const std::string &str, Note *b, int inv) : bass(b), inversion(inv)
{
    const std::string *ret = std::find(std::begin(triads), std::end(triads), str);
    if (ret != std::end(triads))
    {
        t = new Triad(n, str, b, inv);
        root = t->getRoot();
        bass = t->getBass();
        inversion = t->getInversion();
        name = t->getName();
        notes = t->notes;
    }
    else
    {
        if (!str.compare(chords[0]))
        {
            t = new Triad(n, "", b);
            notes = t->notes;
            notes.push_back(Interval("minor seventh").getNextSorted(n));
        }
        else if (!str.compare(chords[1]))
        {
            t = new Triad(n, "", b);
            notes = t->notes;
            notes.push_back(Interval("major seventh").getNextSorted(n));
        }
        else if (!str.compare(chords[2]))
        {
            t = new Triad(n, "", b);
            notes = t->notes;
            notes.push_back(Interval("major sixth").getNextSorted(n));
        }
        else if (!str.compare(chords[3]))
        {
            t = new Triad(n, "m", b);
            notes = t->notes;
            notes.push_back(Interval("minor seventh").getNextSorted(n));
        }
        else if (!str.compare(chords[4]))
        {
            t = new Triad(n, "m", b);
            notes = t->notes;
            notes.push_back(Interval("major seventh").getNextSorted(n));
        }
        else if (!str.compare(chords[5]))
        {
            t = new Triad(n, "m", b);
            notes = t->notes;
            notes.push_back(Interval("major sixth").getNextSorted(n));
        }
        else if (!str.compare(chords[6]))
        {
            t = new Triad(n, "dim", b);
            notes = t->notes;
            notes.push_back(Interval("minor seventh").getNextSorted(n));
        }
        else if (!str.compare(chords[7]))
        {
            t = new Triad(n, "b5", b);
            notes = t->notes;
            notes.push_back(Interval("minor seventh").getNextSorted(n));
        }
        else if (!str.compare(chords[8]))
        {
            t = new Triad(n, "dim", b);
            notes = t->notes;
            notes.push_back(Interval("diminished seventh").getNextSorted(n));
        }
        else
            throw E_CHORD_UNKNOWN;
        root = t->getRoot();
        if (inv > 3 | inv < 0)
            throw E_INVERSION;
        std::rotate(notes.begin(), notes.begin() + inversion, notes.end());

        name = n->display() + str;
        if (root != bass)
        {
            name += "/" + bass->display();
        }
        if (inversion)
        {
            name += "/" + notes.at(0)->display();
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %rbx
movq %rcx, 0x10(%rdi)
movl %r8d, -0x8c(%rbp)
movl %r8d, 0x18(%rdi)
leaq 0x30(%rdi), %rax
movq %rax, 0x20(%rdi)
andq $0x0, 0x28(%rdi)
movq %rsi, %r13
leaq 0x20(%rdi), %rax
movq %rax, -0x98(%rbp)
movb $0x0, 0x30(%rdi)
leaq 0x58(%rdi), %rax
movq %rax, -0x38(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x60(%rdi)
leaq 0xb8fa(%rip), %rdi      # 0x12450
leaq 0x100(%rdi), %rsi
callq 0x85da
movl $0x100, %ecx            # imm = 0x100
addq 0xb472(%rip), %rcx      # 0x11fe0
cmpq %rcx, %rax
je 0x6c02
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movl -0x8c(%rbp), %r8d
callq 0x88ac
movq %r14, 0x8(%rbx)
movq %r14, %rdi
callq 0x9d3a
movq %rax, (%rbx)
movq 0x8(%rbx), %rdi
callq 0x9d44
movq %rax, 0x10(%rbx)
movq 0x8(%rbx), %rdi
callq 0x9d6a
movl %eax, 0x18(%rbx)
movq 0x8(%rbx), %rsi
leaq -0x60(%rbp), %rdi
callq 0x9d1e
leaq -0x60(%rbp), %r14
movq -0x98(%rbp), %rdi
movq %r14, %rsi
callq 0x31c0
movq %r14, %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
jmp 0x7330
leaq 0xb717(%rip), %rsi      # 0x12320
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x6d67
leaq 0xb720(%rip), %rsi      # 0x12340
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x6dfd
leaq 0xb729(%rip), %rsi      # 0x12360
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x6e93
leaq 0xb732(%rip), %rsi      # 0x12380
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x6f29
leaq 0xb73b(%rip), %rsi      # 0x123a0
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x6fbf
leaq 0xb744(%rip), %rsi      # 0x123c0
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x7055
leaq 0xb74d(%rip), %rsi      # 0x123e0
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x70eb
leaq 0xb756(%rip), %rsi      # 0x12400
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
je 0x7181
leaq 0xb75f(%rip), %rsi      # 0x12420
movq %r12, %rdi
callq 0x3030
testl %eax, %eax
jne 0x735e
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x560b(%rip), %rsi      # 0xc2f0
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x558a(%rip), %rsi      # 0xc2b3
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x581a(%rip), %rsi      # 0xc595
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x5507(%rip), %rsi      # 0xc2c6
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x5784(%rip), %rsi      # 0xc595
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x547f(%rip), %rsi      # 0xc2d4
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x56ee(%rip), %rsi      # 0xc595
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x53ac(%rip), %rsi      # 0xc297
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x53b5(%rip), %rsi      # 0xc2f2
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x5345(%rip), %rsi      # 0xc2c6
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x531f(%rip), %rsi      # 0xc2f2
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x52bd(%rip), %rsi      # 0xc2d4
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x5289(%rip), %rsi      # 0xc2f2
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x51ea(%rip), %rsi      # 0xc297
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x51f1(%rip), %rsi      # 0xc2f0
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x5183(%rip), %rsi      # 0xc2c6
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
jmp 0x7212
movl $0x88, %edi
callq 0x31a0
movq %rax, %r14
leaq 0x5180(%rip), %rsi      # 0xc315
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdx
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rcx
callq 0x9406
movq %r14, 0x8(%rbx)
leaq -0x60(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rsi
addq $0x70, %rsi
movq -0x38(%rbp), %rdi
callq 0x7d2e
leaq 0x50ed(%rip), %rsi      # 0xc2c6
leaq -0x80(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0x4d30
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6840
leaq -0x60(%rbp), %rdi
movq %r13, %rsi
callq 0x6516
leaq -0x88(%rbp), %rsi
movq %rax, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x8486
leaq -0x60(%rbp), %rdi
callq 0x6ab4
leaq -0x80(%rbp), %rdi
callq 0x30d0
movq 0x8(%rbx), %rdi
callq 0x9d3a
movq %rax, (%rbx)
cmpl $0x4, -0x8c(%rbp)
jae 0x733f
movslq 0x18(%rbx), %rax
movq 0x58(%rbx), %rdi
movq 0x60(%rbx), %rdx
leaq (%rdi,%rax,8), %rsi
callq 0x8709
movq (%r13), %rax
leaq -0x80(%rbp), %rdi
movq %r13, %rsi
callq *(%rax)
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movq %r12, %rdx
movq -0x98(%rbp), %r15
callq 0x7f1e
leaq -0x60(%rbp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x31c0
movq %r14, %rdi
callq 0x30d0
leaq -0x80(%rbp), %rdi
callq 0x30d0
movq 0x10(%rbx), %rsi
cmpq %rsi, (%rbx)
je 0x72da
movq (%rsi), %rax
leaq -0x80(%rbp), %rdi
callq *(%rax)
leaq 0x5199(%rip), %rsi      # 0xc448
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x7f47
leaq -0x60(%rbp), %rsi
movq %r15, %rdi
callq 0x32f0
leaq -0x60(%rbp), %rdi
callq 0x30d0
leaq -0x80(%rbp), %rdi
callq 0x30d0
cmpl $0x0, 0x18(%rbx)
je 0x7330
movq -0x38(%rbp), %rdi
xorl %esi, %esi
callq 0x5be6
movq (%rax), %rsi
movq (%rsi), %rax
leaq -0x80(%rbp), %rdi
callq *(%rax)
leaq 0x514a(%rip), %rsi      # 0xc448
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rdx
movq -0x98(%rbp), %r14
callq 0x7f47
leaq -0x60(%rbp), %rsi
movq %r14, %rdi
callq 0x32f0
leaq -0x60(%rbp), %rdi
callq 0x30d0
leaq -0x80(%rbp), %rdi
callq 0x30d0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x4
popq %rdi
callq 0x30f0
movl $0x2, (%rax)
leaq 0xa524(%rip), %rsi      # 0x11878
movq %rax, %rdi
xorl %edx, %edx
callq 0x3290
pushq $0x4
popq %rdi
callq 0x30f0
movl $0x1, (%rax)
jmp 0x734d
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7409
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7409
jmp 0x7409
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7409
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7409
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7409
jmp 0x7417
jmp 0x743f
jmp 0x73e1
jmp 0x742d
jmp 0x7409
jmp 0x7417
jmp 0x743f
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x30d0
jmp 0x7430
jmp 0x742d
jmp 0x7409
jmp 0x73f7
jmp 0x7417
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x30d0
jmp 0x741a
jmp 0x7417
jmp 0x743f
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x6ab4
jmp 0x741a
movq %rax, %r15
leaq -0x80(%rbp), %rdi
callq 0x30d0
jmp 0x7442
jmp 0x743f
jmp 0x743f
jmp 0x743f
jmp 0x743f
movq %rax, %r15
movl $0x88, %esi
movq %r14, %rdi
callq 0x31b0
jmp 0x7442
movq %rax, %r15
addq $0x40, %rbx
movq -0x38(%rbp), %rdi
callq 0x4d7a
movq %rbx, %rdi
callq 0x7d02
movq -0x98(%rbp), %rdi
callq 0x30d0
movq %r15, %rdi
callq 0x32b0
nop