// File: /workspace/github_cpp_makefile_star2_O2/alex-courtis[P]xlayoutdisplay/main.cpp
// Function: parseCfgFile(std::basic_ifstream<char, std::char_traits<char>>&, Settings&)
void parseCfgFile(ifstream &ifs, Settings &settings) {
    string line;
    while (getline(ifs, line)) {

        // comments and empties
        if (regex_match(line, regex("\\s*#.*")) || regex_match(line, regex("\\s*"))) {
            continue;
        }

        // name=val
        smatch match;
        if (!regex_match(line, match, regex("\\s*(\\S+)\\s*=\\s*(\\S+)\\s*")) || match.size() != 3) {
            continue;
        }

        if (match[1] == "dpi") {
            settings.dpi = parseLong(match[1], match[2]);
        } else if (match[1] == "rate") {
            settings.rate = parseLong(match[1], match[2]);
        } else if (match[1] == "mirror") {
            settings.mirror = parseBool(match[2]);
        } else if (match[1] == "order") {
            settings.order.push_back(match[2]);
        } else if (match[1] == "primary") {
            settings.primary = match[2];
        } else if (match[1] == "quiet") {
            settings.quiet = parseBool(match[2]);
        } else if (match[1] == "wait") {
            settings.wait = parseLong(match[1], match[2]);
        } else {
            throw invalid_argument("unrecognised file option '" + match[0].str() + "'");
        }
    }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, 0x60(%rsp)
leaq 0x98(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x30(%rsi), %rax
movq %rax, 0x50(%rsp)
movq %rsi, 0x28(%rsp)
leaq 0x18(%rsi), %rax
movq %rax, 0x58(%rsp)
movq %rsp, %r15
leaq 0x30(%rsp), %rbp
leaq 0xe4e6(%rip), %r14      # 0x18d2a
leaq 0x68(%rsp), %r13
movq 0x60(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x60a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0xadf5
movq %r15, %rdi
leaq 0xe4ac(%rip), %rsi      # 0x18d23
pushq $0x10
popq %rdx
callq 0xb55e
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0xb546
testb %al, %al
je 0xa89f
movq %r15, %rdi
callq 0xb5c4
jmp 0xa849
movq %rbp, %rdi
leaq 0xe495(%rip), %rsi      # 0x18d3e
pushq $0x10
popq %rdx
callq 0xb55e
leaq 0x88(%rsp), %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xb546
movl %eax, %r12d
movq %rbp, %rdi
callq 0xb5c4
movq %r15, %rdi
callq 0xb5c4
testb %r12b, %r12b
jne 0xa849
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %rbp, %rdi
movq %r14, %rsi
pushq $0x10
popq %rdx
callq 0xb55e
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0xb619
testb %al, %al
je 0xa96c
movq 0x8(%rsp), %rax
subq (%rsp), %rax
movq %r14, %rbx
setne %r14b
cmpq $0x90, %rax
sete %r12b
movq %rbp, %rdi
callq 0xb5c4
testb %r12b, %r14b
movq %rbx, %r14
movq %rsp, %r15
je 0xab59
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0xa979
movq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xa979
addq $0x18, %rdi
jmp 0xa980
movq %rbp, %rdi
callq 0xb5c4
jmp 0xab59
addq %rcx, %rdi
addq $-0x48, %rdi
leaq 0xe3bb(%rip), %rsi      # 0x18d42
callq 0xb634
testb %al, %al
je 0xa9b9
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xa9e2
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xa9e2
addq $0x18, %rsi
jmp 0xa9e9
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0xaa1a
movq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xaa1a
addq $0x18, %rdi
jmp 0xaa21
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0xb642
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xaa5a
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xaa5a
addq $0x30, %rsi
jmp 0xaa61
addq %rcx, %rdi
addq $-0x48, %rdi
leaq 0xe31e(%rip), %rsi      # 0x18d46
callq 0xb634
testb %al, %al
je 0xaa81
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xaaaa
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xaaaa
addq $0x18, %rsi
jmp 0xaab1
addq %rcx, %rsi
addq $-0x48, %rsi
movq %r13, %rdi
callq 0xb642
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa6e5
movq 0x28(%rsp), %rcx
movq %rax, (%rcx)
jmp 0xab49
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0xaae2
movq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xaae2
addq $0x18, %rdi
jmp 0xaae9
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0xb642
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xab26
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xab26
addq $0x30, %rsi
jmp 0xab2d
addq %rcx, %rdi
addq $-0x48, %rdi
leaq 0xd853(%rip), %rsi      # 0x18343
callq 0xb634
testb %al, %al
je 0xab66
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xab8f
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xab8f
addq $0x30, %rsi
jmp 0xab96
addq %rcx, %rsi
addq $-0x48, %rsi
movq %r13, %rdi
callq 0xb642
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa6e5
movq 0x28(%rsp), %rcx
movq %rax, 0x8(%rcx)
movq %r13, %rdi
callq 0x61b0
movq %rbp, %rdi
callq 0x61b0
movq %r15, %rdi
callq 0xb7bc
jmp 0xa849
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0xabb0
movq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xabb0
addq $0x18, %rdi
jmp 0xabb7
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0xb642
movq %rbp, %rdi
callq 0xa68c
movq 0x28(%rsp), %rcx
movb %al, 0x12(%rcx)
jmp 0xab51
addq %rcx, %rdi
addq $-0x48, %rdi
leaq 0xe18d(%rip), %rsi      # 0x18d4b
callq 0xb634
testb %al, %al
je 0xabf0
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xac19
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xac19
addq $0x30, %rsi
jmp 0xac20
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0xac3a
movq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xac3a
addq $0x18, %rdi
jmp 0xac41
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0xb642
movq 0x58(%rsp), %rdi
movq %rbp, %rsi
callq 0x1707c
jmp 0xab51
addq %rcx, %rdi
addq $-0x48, %rdi
leaq 0xda54(%rip), %rsi      # 0x1869c
callq 0xb634
testb %al, %al
je 0xac7a
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xaca3
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xaca3
addq $0x30, %rsi
jmp 0xacaa
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0xacc4
movq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xacc4
addq $0x18, %rdi
jmp 0xaccb
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0xb642
movq 0x50(%rsp), %rdi
movq %rbp, %rsi
callq 0x64e0
jmp 0xab51
addq %rcx, %rdi
addq $-0x48, %rdi
leaq 0xe07f(%rip), %rsi      # 0x18d51
callq 0xb634
testb %al, %al
je 0xad04
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xad2d
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xad2d
addq $0x30, %rsi
jmp 0xad34
movq (%rsp), %rdi
movq 0x8(%rsp), %rcx
subq %rdi, %rcx
je 0xad51
movq %rcx, %rax
cqto
pushq $0x18
popq %rsi
idivq %rsi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xad51
addq $0x18, %rdi
jmp 0xad58
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0xb642
movq %rbp, %rdi
callq 0xa68c
movq 0x28(%rsp), %rcx
movb %al, 0x50(%rcx)
jmp 0xab51
addq %rcx, %rdi
addq $-0x48, %rdi
leaq 0xdff8(%rip), %rsi      # 0x18d57
callq 0xb634
testb %al, %al
je 0xae14
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xad95
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0xad95
addq $0x18, %rsi
jmp 0xad9c
addq %rcx, %rsi
addq $-0x48, %rsi
movq %rbp, %rdi
callq 0xb642
movq (%rsp), %rsi
movq 0x8(%rsp), %rcx
subq %rsi, %rcx
je 0xadcd
movq %rcx, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0xadcd
addq $0x30, %rsi
jmp 0xadd4
addq %rcx, %rsi
addq $-0x48, %rsi
movq %r13, %rdi
callq 0xb642
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa6e5
movq 0x28(%rsp), %rcx
movq %rax, 0x58(%rcx)
jmp 0xab49
leaq 0x88(%rsp), %rdi
callq 0x61b0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x61e0
movq (%rsp), %rcx
movq 0x8(%rsp), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
leaq -0x48(%rdx), %rdi
cmpq $0x48, %rsi
movq %rcx, %rsi
cmoveq %rdi, %rsi
movq %rax, %r14
cmpq %rcx, %rdx
cmoveq %rdi, %rsi
leaq 0xa8(%rsp), %rdi
callq 0xb642
leaq 0xdf04(%rip), %rsi      # 0x18d5c
leaq 0x68(%rsp), %rdi
leaq 0xa8(%rsp), %rdx
callq 0x9dc3
leaq 0xd897(%rip), %rdx      # 0x18708
leaq 0x30(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x6c6e
movb $0x1, %bpl
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x66f0
xorl %ebp, %ebp
movq 0x1b127(%rip), %rsi     # 0x25fc0
movq 0x1b108(%rip), %rdx     # 0x25fa8
movq %r14, %rdi
callq 0x66c0
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x61b0
jmp 0xaebd
movq %rax, %rbx
movb $0x1, %bpl
leaq 0x68(%rsp), %rdi
callq 0x61b0
jmp 0xaecf
movq %rax, %rbx
movb $0x1, %bpl
leaq 0xa8(%rsp), %rdi
callq 0x61b0
testb %bpl, %bpl
jne 0xaee6
jmp 0xaf3e
movq %rax, %rbx
movq %r14, %rdi
callq 0x62c0
jmp 0xaf3e
jmp 0xaf0a
jmp 0xaf19
jmp 0xaf3b
jmp 0xaf19
jmp 0xaf3b
jmp 0xaf3b
jmp 0xaf19
jmp 0xaf3b
jmp 0xaf3b
jmp 0xaf19
jmp 0xaf0a
jmp 0xaf19
jmp 0xaf3b
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x61b0
jmp 0xaf1c
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x61b0
jmp 0xaf3e
jmp 0xaf3b
jmp 0xaf3b
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xb5c4
jmp 0xaf3e
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb7bc
jmp 0xaf6b
jmp 0xaf59
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xb5c4
jmp 0xaf5c
movq %rax, %rbx
movq %rsp, %rdi
callq 0xb5c4
jmp 0xaf6b
jmp 0xaf68
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x61b0
movq %rbx, %rdi
callq 0x6710