// File: /workspace/github_cpp_makefile_star2_O2/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, %r12
movq %r8, %rbp
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0x6570
movl (%r14), %eax
movl %eax, 0x20(%rbx)
leaq 0x28(%rbx), %rdi
movq %rdi, 0x50(%rsp)
movq %r13, %rsi
callq 0x740c
movq %r15, 0x8(%rsp)
leaq 0x40(%rbx), %rdi
movq %rbp, %rsi
callq 0x74bc
leaq 0x50(%rbx), %rdi
movq %r12, %rsi
callq 0x74bc
leaq 0x60(%rbx), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x806f
movq 0x98(%rsp), %r15
movq 0x90(%rsp), %rsi
leaq 0x70(%rbx), %rdi
callq 0x74f0
leaq 0x80(%rbx), %rdi
movq %r15, %rsi
callq 0x7504
movb $0x0, 0x90(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0xa8(%rbx)
movl (%r14), %eax
testl %eax, %eax
movq %rbx, %r14
je 0x7178
cmpl $0x1, %eax
jne 0x71be
cmpq %r13, (%r13)
jne 0x719f
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %r12
leaq 0x1114e(%rip), %rsi     # 0x18275
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
callq 0x7445
leaq 0x11129(%rip), %rdx     # 0x18266
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6c6e
movb $0x1, %bl
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x66f0
xorl %ebx, %ebx
movq 0x1ee5c(%rip), %rsi     # 0x25fc0
movq 0x1ee3d(%rip), %rdx     # 0x25fa8
movq %r12, %rdi
callq 0x66c0
jmp 0x7351
movq 0x90(%rsp), %rax
cmpq $0x0, (%rbp)
je 0x7230
cmpq $0x0, (%rax)
je 0x7293
cmpq %r13, (%r13)
je 0x72f3
cmpq $0x0, (%r12)
je 0x71be
movq 0x50(%rsp), %rbx
movq (%rbx), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x76d7
cmpq %rbx, %rax
je 0x71cd
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %r12
leaq 0x110a0(%rip), %rsi     # 0x1827f
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
callq 0x7445
leaq 0x11093(%rip), %rdx     # 0x18288
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6c6e
movb $0x1, %bl
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x66f0
xorl %ebx, %ebx
movq 0x1eda4(%rip), %rsi     # 0x25fc0
movq 0x1ed85(%rip), %rdx     # 0x25fa8
movq %r12, %rdi
callq 0x66c0
jmp 0x7351
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %r12
leaq 0x10feb(%rip), %rsi     # 0x1822d
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
callq 0x7445
leaq 0x10fe5(%rip), %rdx     # 0x1823d
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6c6e
movb $0x1, %bl
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x66f0
xorl %ebx, %ebx
movq 0x1ed41(%rip), %rsi     # 0x25fc0
movq 0x1ed22(%rip), %rdx     # 0x25fa8
movq %r12, %rdi
callq 0x66c0
jmp 0x7351
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %r12
leaq 0x10f88(%rip), %rsi     # 0x1822d
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
callq 0x7445
leaq 0x10f97(%rip), %rdx     # 0x18252
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6c6e
movb $0x1, %bl
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x66f0
xorl %ebx, %ebx
movq 0x1ecde(%rip), %rsi     # 0x25fc0
movq 0x1ecbf(%rip), %rdx     # 0x25fa8
movq %r12, %rdi
callq 0x66c0
jmp 0x7351
pushq $0x10
popq %rdi
callq 0x61e0
movq %rax, %r12
leaq 0x10f28(%rip), %rsi     # 0x1822d
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rdx
callq 0x7445
leaq 0x10f4b(%rip), %rdx     # 0x18266
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6c6e
movb $0x1, %bl
leaq 0x30(%rsp), %rsi
movq %r12, %rdi
callq 0x66f0
xorl %ebx, %ebx
movq 0x1ec7e(%rip), %rsi     # 0x25fc0
movq 0x1ec5f(%rip), %rdx     # 0x25fa8
movq %r12, %rdi
callq 0x66c0
jmp 0x7361
jmp 0x7370
jmp 0x7361
jmp 0x7370
jmp 0x7361
jmp 0x7370
jmp 0x7361
jmp 0x7370
movq %rax, %r15
leaq 0x30(%rsp), %rdi
callq 0x61b0
jmp 0x7375
movq %rax, %r15
movb $0x1, %bl
leaq 0x10(%rsp), %rdi
callq 0x61b0
testb %bl, %bl
jne 0x7390
jmp 0x739d
jmp 0x738d
jmp 0x738d
jmp 0x738d
jmp 0x738d
movq %rax, %r15
movq %r12, %rdi
callq 0x62c0
jmp 0x739d
movq %rax, %r15
leaq 0xb0(%r14), %rdi
callq 0x7518
leaq 0xa0(%r14), %rdi
callq 0x7518
leaq 0x88(%r14), %rdi
callq 0x7518
leaq 0x78(%r14), %rdi
callq 0x7518
movq %r14, %rbx
leaq 0x68(%r14), %rdi
callq 0x7518
jmp 0x73db
movq %rax, %r15
leaq 0x58(%rbx), %rdi
callq 0x7518
leaq 0x48(%rbx), %rdi
callq 0x7518
movq 0x50(%rsp), %rdi
callq 0x7594
jmp 0x73fc
movq %rax, %r15
movq %rbx, %rdi
callq 0x61b0
movq %r15, %rdi
callq 0x6710