// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %rsi, %rcx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, 0x50(%rsp)
movq %rax, (%rdi)
movq (%rsi), %rsi
movq %rcx, 0x48(%rsp)
movq 0x8(%rcx), %rdx
addq %rsi, %rdx
callq 0x7ab0
movl (%r12), %eax
movl %eax, 0x20(%rbx)
leaq 0x28(%rbx), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x7940
movq (%rbp), %rax
movq %rax, 0x40(%rbx)
movq 0x8(%rbp), %rax
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x73a8
movq 0x1dbfe(%rip), %rcx     # 0x24f98
cmpb $0x0, (%rcx)
je 0x73a4
incl 0x8(%rax)
jmp 0x73a8
lock
incl 0x8(%rax)
movq (%r15), %rax
movq %rax, 0x50(%rbx)
movq 0x8(%r15), %rax
movq %rax, 0x58(%rbx)
testq %rax, %rax
je 0x73d1
movq 0x1dbd5(%rip), %rcx     # 0x24f98
cmpb $0x0, (%rcx)
je 0x73cd
incl 0x8(%rax)
jmp 0x73d1
lock
incl 0x8(%rax)
leaq 0x60(%rbx), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x87f3
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 0x7419
movq 0x1db8d(%rip), %rsi     # 0x24f98
cmpb $0x0, (%rsi)
je 0x7415
incl 0x8(%rdx)
jmp 0x7419
lock
incl 0x8(%rdx)
movq (%rcx), %rdx
movq %rdx, 0x80(%rbx)
movq 0x8(%rcx), %rcx
movq %rcx, 0x88(%rbx)
testq %rcx, %rcx
je 0x7448
movq 0x1db5e(%rip), %rdx     # 0x24f98
cmpb $0x0, (%rdx)
je 0x7444
incl 0x8(%rcx)
jmp 0x7448
lock
incl 0x8(%rcx)
movb $0x0, 0x90(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
movl (%r12), %ecx
testl %ecx, %ecx
je 0x74d4
cmpl $0x1, %ecx
jne 0x7513
cmpq %r13, (%r13)
jne 0x74f3
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12dea(%rip), %rsi     # 0x1a275
leaq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0x797c
leaq 0x12dc5(%rip), %rsi     # 0x1a266
leaq 0x8(%rsp), %rdi
callq 0x67c0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x76e0
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x76ed
cmpq $0x0, (%rbp)
je 0x75c9
cmpq $0x0, (%rax)
je 0x7626
cmpq %r13, (%r13)
je 0x7683
movq (%r15), %rax
testq %rax, %rax
je 0x7513
movq (%r14), %rcx
cmpq %r14, %rcx
je 0x7522
cmpq %rax, 0x10(%rcx)
je 0x750e
movq (%rcx), %rcx
jmp 0x74fe
cmpq %r14, %rcx
je 0x7522
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 0x12d49(%rip), %rsi     # 0x1a27f
leaq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0x797c
leaq 0x12d3c(%rip), %rsi     # 0x1a288
leaq 0x8(%rsp), %rdi
callq 0x67c0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7578
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x7585
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%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 0x1da13(%rip), %rsi     # 0x24fc8
movq 0x1d9f4(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x781c
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12c50(%rip), %rsi     # 0x1a22d
leaq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0x797c
leaq 0x12c4a(%rip), %rsi     # 0x1a23d
leaq 0x8(%rsp), %rdi
callq 0x67c0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7731
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x773e
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12bf3(%rip), %rsi     # 0x1a22d
leaq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0x797c
leaq 0x12c02(%rip), %rsi     # 0x1a252
leaq 0x8(%rsp), %rdi
callq 0x67c0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7782
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x778f
movl $0x10, %edi
callq 0x61c0
movq %rax, %r15
leaq 0x12b96(%rip), %rsi     # 0x1a22d
leaq 0x8(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0x797c
leaq 0x12bb9(%rip), %rsi     # 0x1a266
leaq 0x8(%rsp), %rdi
callq 0x67c0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x77d0
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x77dd
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%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 0x1d8ab(%rip), %rsi     # 0x24fc8
movq 0x1d88c(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x781c
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%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 0x1d85a(%rip), %rsi     # 0x24fc8
movq 0x1d83b(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x781c
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%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 0x1d809(%rip), %rsi     # 0x24fc8
movq 0x1d7ea(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x781c
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%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 0x1d7bb(%rip), %rsi     # 0x24fc8
movq 0x1d79c(%rip), %rdx     # 0x24fb0
movq %r15, %rdi
callq 0x66c0
jmp 0x7844
jmp 0x7880
jmp 0x7844
jmp 0x7880
jmp 0x7844
jmp 0x7844
jmp 0x7880
jmp 0x7880
jmp 0x78a0
jmp 0x78a0
jmp 0x78a0
jmp 0x78a0
movq %rax, %r12
jmp 0x78fa
movq %rax, %r12
jmp 0x791e
movq %rax, %r12
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x785e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x63a0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7879
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x63a0
testb %bpl, %bpl
jne 0x78a3
jmp 0x78ab
movq %rax, %r12
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x78a3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0x78a3
movq %rax, %r12
movq %r15, %rdi
callq 0x62b0
movq 0xb0(%rbx), %rdi
testq %rdi, %rdi
je 0x78bc
callq 0x7a04
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x78cd
callq 0x7a04
movq 0x88(%rbx), %rdi
testq %rdi, %rdi
je 0x78de
callq 0x7a04
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x78ec
callq 0x7a04
movq 0x68(%rbx), %rdi
testq %rdi, %rdi
je 0x78fa
callq 0x7a04
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x7908
callq 0x7a04
movq 0x48(%rbx), %rdi
testq %rdi, %rdi
je 0x7916
callq 0x7a04
movq %r14, %rdi
callq 0x7a74
movq (%rbx), %rdi
cmpq 0x50(%rsp), %rdi
je 0x7938
movq 0x50(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x63a0
movq %r12, %rdi
callq 0x6700