// File: /workspace/github_cpp_makefile_star2_O1/alex-courtis[P]xlayoutdisplay/src/Output.cpp
// Function: Output::Output(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Output::State const&, std::__cxx11::list<std::shared_ptr<Mode const>, std::allocator<std::shared_ptr<Mode const>>> const&, std::shared_ptr<Mode const> const&, std::shared_ptr<Mode const> const&, std::shared_ptr<Pos const> const&, std::shared_ptr<Edid const> const&)
Output::Output(const string &name,
             const State &state,
             const list<shared_ptr<const Mode>> &modes,
             const shared_ptr<const Mode> &currentMode,
             const shared_ptr<const Mode> &preferredMode,
             const shared_ptr<const Pos> &currentPos,
             const shared_ptr<const Edid> &edid) :
        name(name),
        state(state),
        modes(modes),
        currentMode(currentMode),
        preferredMode(preferredMode),
        optimalMode(calculateOptimalMode(modes, preferredMode)),
        currentPos(currentPos),
        edid(edid) {
    switch (state) {
        case active:
            if (!currentMode) throw invalid_argument("active Output '" + name + "' has no currentMode");
            if (!currentPos) throw invalid_argument("active Output '" + name + "' has no currentPos");
            if (modes.empty()) throw invalid_argument("active Output '" + name + "' has no modes");
            break;
        case connected:
            if (modes.empty()) throw invalid_argument("connected Output '" + name + "' has no modes");
            break;
        default:
            break;
    }

    // active / connected must have NULL or valid preferred mode
    if (state == active || state == connected) {
        if (preferredMode && find(this->modes.begin(), this->modes.end(), preferredMode) == this->modes.end())
            throw invalid_argument("Output '" + name + "' has preferredMode not present in modes");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r9, %r15
movq %r8, %rbp
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x48(%rsp)
movq %rax, (%rdi)
movq (%rsi), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
callq 0x7aaa
movl (%r14), %eax
movl %eax, 0x20(%rbx)
leaq 0x28(%rbx), %rdi
movq %rdi, 0x50(%rsp)
movq %r13, %rsi
callq 0x793a
movq (%rbp), %rax
movq %rax, 0x40(%rbx)
movq 0x8(%rbp), %rax
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x73bd
movq 0x1dbe9(%rip), %rcx     # 0x24f98
cmpb $0x0, (%rcx)
je 0x73b9
incl 0x8(%rax)
jmp 0x73bd
lock
incl 0x8(%rax)
movq (%r15), %rax
movq %rax, 0x50(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x58(%rbx)
testq %rax, %rax
je 0x73e6
movq 0x1dbc0(%rip), %rcx     # 0x24f98
cmpb $0x0, (%rcx)
je 0x73e2
incl 0x8(%rax)
jmp 0x73e6
lock
incl 0x8(%rax)
leaq 0x60(%rbx), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x87e5
movq 0x98(%rsp), %rcx
movq 0x90(%rsp), %rax
movq (%rax), %rdx
movq %rdx, 0x70(%rbx)
movq 0x8(%rax), %rdx
movq %rdx, 0x78(%rbx)
testq %rdx, %rdx
je 0x742e
movq 0x1db78(%rip), %rsi     # 0x24f98
cmpb $0x0, (%rsi)
je 0x742a
incl 0x8(%rdx)
jmp 0x742e
lock
incl 0x8(%rdx)
movq (%rcx), %rdx
movq %rdx, 0x80(%rbx)
movq 0x8(%rcx), %rcx
movq %rcx, 0x88(%rbx)
testq %rcx, %rcx
je 0x745d
movq 0x1db49(%rip), %rdx     # 0x24f98
cmpb $0x0, (%rdx)
je 0x7459
incl 0x8(%rcx)
jmp 0x745d
lock
incl 0x8(%rcx)
movb $0x0, 0x90(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
movl (%r14), %ecx
testl %ecx, %ecx
je 0x74e1
cmpl $0x1, %ecx
jne 0x74fc
cmpq %r13, (%r13)
jne 0x74fc
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12dda(%rip), %rsi     # 0x1a275
leaq 0x28(%rsp), %rdi
movq %r12, %rdx
callq 0x7976
leaq 0x12db7(%rip), %rsi     # 0x1a266
leaq 0x28(%rsp), %rdi
callq 0x67c0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x76a1
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x76ae
cmpq $0x0, (%rbp)
je 0x7539
cmpq $0x0, (%rax)
je 0x7593
cmpq %r13, (%r13)
je 0x75ed
cmpl $0x1, %ecx
ja 0x752a
movq (%r15), %rcx
testq %rcx, %rcx
je 0x752a
movq 0x50(%rsp), %rdx
movq (%rdx), %rax
cmpq %rdx, %rax
je 0x7521
cmpq %rcx, 0x10(%rax)
je 0x7521
movq (%rax), %rax
jmp 0x7511
cmpq %rdx, %rax
je 0x7647
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12ce0(%rip), %rsi     # 0x1a22d
leaq 0x28(%rsp), %rdi
movq %r12, %rdx
callq 0x7976
leaq 0x12cdc(%rip), %rsi     # 0x1a23d
leaq 0x28(%rsp), %rdi
callq 0x67c0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x76f2
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x76ff
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12c86(%rip), %rsi     # 0x1a22d
leaq 0x28(%rsp), %rdi
movq %r12, %rdx
callq 0x7976
leaq 0x12c97(%rip), %rsi     # 0x1a252
leaq 0x28(%rsp), %rdi
callq 0x67c0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7743
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x7750
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12c2c(%rip), %rsi     # 0x1a22d
leaq 0x28(%rsp), %rdi
movq %r12, %rdx
callq 0x7976
leaq 0x12c51(%rip), %rsi     # 0x1a266
leaq 0x28(%rsp), %rdi
callq 0x67c0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7794
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x77a1
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12c24(%rip), %rsi     # 0x1a27f
leaq 0x28(%rsp), %rdi
movq %r12, %rdx
callq 0x7976
leaq 0x12c19(%rip), %rsi     # 0x1a288
leaq 0x28(%rsp), %rdi
callq 0x67c0
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x77e2
movups (%rcx), %xmm0
movups %xmm0, (%r14)
jmp 0x77ef
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r15, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1d8ea(%rip), %rsi     # 0x24fc8
movq 0x1d8cb(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x782e
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r15, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1d899(%rip), %rsi     # 0x24fc8
movq 0x1d87a(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x782e
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r15, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1d848(%rip), %rsi     # 0x24fc8
movq 0x1d829(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x782e
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r15, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1d7f7(%rip), %rsi     # 0x24fc8
movq 0x1d7d8(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x782e
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
leaq 0x8(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %r15, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1d7a9(%rip), %rsi     # 0x24fc8
movq 0x1d78a(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x783c
jmp 0x785a
jmp 0x783c
jmp 0x785a
jmp 0x783c
jmp 0x785a
jmp 0x783c
movq %rax, %r12
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x7860
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0x7860
jmp 0x785a
movq %rax, %r12
movb $0x1, %bpl
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x788b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0x788b
jmp 0x7885
jmp 0x7885
jmp 0x7885
jmp 0x7885
movq %rax, %r12
movb $0x1, %bpl
testb %bpl, %bpl
je 0x7898
movq %r15, %rdi
callq 0x62b0
movq 0xb0(%rbx), %rdi
testq %rdi, %rdi
je 0x78a9
callq 0x79fe
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x78ba
callq 0x79fe
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x78cb
callq 0x79fe
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x78d9
callq 0x79fe
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x78ec
callq 0x79fe
jmp 0x78ec
movq %rax, %r12
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x78fa
callq 0x79fe
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x7908
callq 0x79fe
movq 0x50(%rsp), %rdi
callq 0x7a6e
jmp 0x7917
movq %rax, %r12
movq (%rbx), %rdi
cmpq 0x48(%rsp), %rdi
je 0x7931
movq 0x48(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x63a0
movq %r12, %rdi
callq 0x6700
nop