// File: /workspace/github_cpp_makefile_star2_O3/alex-courtis[P]xlayoutdisplay/main.cpp
// Function: parseArgs(int, char**, Settings&)
void parseArgs(int argc, char **argv, Settings &settings) {
    static struct option long_options[] = {
        { "help",          no_argument,       0, 'h' },
        { "info",          no_argument,       0, 'i' },
        { "noop",          no_argument,       0, 'n' },
        { "version",       no_argument,       0, 'v' },
        { "dpi",           required_argument, 0, 'd' },
        { "rate",          required_argument, 0, 'r' },
        { "mirror",        no_argument,       0, 'm' },
        { "order",         required_argument, 0, 'o' },
        { "primary",       required_argument, 0, 'p' },
        { "quiet",         no_argument,       0, 'q' },
        { "wait",          required_argument, 0, 'w' },
        { 0,               0,                 0,  0  }
    };
    static const char *short_options = "hinvd:r:mo:p:qw:";

    bool orderFromFile = !settings.order.empty();

    int c;
    while (1) {
        int long_index = 0;
        c = getopt_long(argc, argv, short_options, long_options, &long_index);
        if (c == -1)
            break;
        switch (c) {
            case 'h':
                usage(cout);
                exit(EXIT_SUCCESS);
            case 'i':
                settings.info = true;
                break;
            case 'n':
                settings.noop = true;
                break;
            case 'v':
                cout << argv[0] << " " << VERSION << endl;
                exit(EXIT_SUCCESS);
            case 'd':
                settings.dpi = parseLong("dpi", optarg);
                break;
            case 'r':
                settings.rate = parseLong("rate", optarg);
                break;
            case 'm':
                settings.mirror = true;
                break;
            case 'o':
                if (orderFromFile) {
                    settings.order.clear();
                    orderFromFile = false;
                }
                settings.order.push_back(optarg);
                break;
            case 'p':
                settings.primary = optarg;
                break;
            case 'q':
                settings.quiet = true;
                break;
            case 'w':
                settings.wait = parseLong("wait", optarg);;
                break;
            case '?':
            default:
                usage(cerr);
                exit(EXIT_FAILURE);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r13
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x18(%rdx), %rax
movq %rax, 0x58(%rsp)
movq 0x18(%rdx), %rax
cmpq 0x20(%rdx), %rax
setne %al
movl %eax, 0x2c(%rsp)
leaq 0x18(%rsp), %r12
leaq 0x30(%rdx), %rax
movq %rax, 0x60(%rsp)
leaq 0xf08e(%rip), %r15      # 0x1ad9e
movl %edi, 0x50(%rsp)
movl $0x0, 0x54(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
leaq 0x196f5(%rip), %rcx     # 0x25420
leaq 0x54(%rsp), %r8
callq 0x66a0
leal -0x64(%rax), %ecx
cmpl $0x13, %ecx
ja 0xbf42
leaq 0xeae4(%rip), %rdx      # 0x1a82c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq %r12, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0xeff0(%rip), %rsi      # 0x1ad52
leaq 0xefec(%rip), %rdx      # 0x1ad55
callq 0x7172
movq 0x191eb(%rip), %rax     # 0x24f60
movq (%rax), %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0x7(%rsp), %rdx
callq 0x6f1a
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xae3c
movq %rax, (%r13)
jmp 0xbeb5
movb $0x1, 0x50(%r13)
jmp 0xbd14
movb $0x1, 0x12(%r13)
jmp 0xbd14
testb $0x1, 0x2c(%rsp)
je 0xbdc8
movq 0x58(%rsp), %rdi
movq (%rdi), %rsi
callq 0x19b0a
movq 0x19191(%rip), %rax     # 0x24f60
movq (%rax), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
leaq 0x30(%rsp), %rdx
callq 0x6f1a
movq 0x58(%rsp), %rdi
movq %r14, %rsi
callq 0x19880
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbe08
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x63a0
movl $0x0, 0x2c(%rsp)
jmp 0xbd14
movb $0x1, 0x10(%r13)
jmp 0xbd14
movq %r12, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0xef26(%rip), %rsi      # 0x1ad56
leaq 0xef23(%rip), %rdx      # 0x1ad5a
callq 0x7172
movq 0x1911d(%rip), %rax     # 0x24f60
movq (%rax), %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0x7(%rsp), %rdx
callq 0x6f1a
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xae3c
movq %rax, 0x8(%r13)
jmp 0xbeb5
movq %r12, 0x8(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0xeeeb(%rip), %rsi      # 0x1ad67
leaq 0xeee8(%rip), %rdx      # 0x1ad6b
callq 0x7172
movq 0x190d1(%rip), %rax     # 0x24f60
movq (%rax), %rsi
leaq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0x7(%rsp), %rdx
callq 0x6f1a
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0xae3c
movq %rax, 0x58(%r13)
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xbed1
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x63a0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xbd14
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0xbd14
movq %r13, %r15
movq 0x19065(%rip), %rax     # 0x24f60
movq (%rax), %r13
movq %r12, %r14
movq 0x38(%r15), %r12
movq %r13, %rdi
callq 0x6190
movq 0x60(%rsp), %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %r14, %r12
movl 0x50(%rsp), %ebp
movq %r13, %rcx
movq %r15, %r13
leaq 0xee73(%rip), %r15      # 0x1ad9e
movq %rax, %r8
callq 0x65f0
jmp 0xbd14
movb $0x1, 0x11(%r13)
jmp 0xbd14
cmpl $-0x1, %eax
jne 0xbf56
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1908b(%rip), %rdi     # 0x24fe8
callq 0xb027
movl $0x1, %edi
callq 0x64c0
movq 0x1902d(%rip), %rdi     # 0x24fa0
callq 0xb027
jmp 0xbfaf
movq (%rbx), %rsi
movq 0x1901c(%rip), %rdi     # 0x24fa0
callq 0x6360
leaq 0xe87f(%rip), %rsi      # 0x1a80f
movq %rax, %rdi
callq 0x6360
leaq 0xee10(%rip), %rsi      # 0x1adaf
movq %rax, %rdi
callq 0x6360
movq %rax, %rdi
callq 0x61b0
xorl %edi, %edi
callq 0x64c0
jmp 0xbfe7
jmp 0xc003
jmp 0xbfc4
jmp 0xbfe7
jmp 0xbfc4
jmp 0xc003
jmp 0xbfe7
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0xbfea
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0xbfea
jmp 0xc003
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0xc006
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0xc006
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6700