// File: /workspace/github_cpp_makefile_star2_O1/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 $0x78, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x18(%rdx), %rax
movq %rax, 0x60(%rsp)
movq 0x18(%rdx), %rax
cmpq 0x20(%rdx), %rax
setne %al
movl %eax, 0x34(%rsp)
leaq 0x30(%rdx), %rax
movq %rax, 0x70(%rsp)
leaq 0xf054(%rip), %r13      # 0x1ad8e
leaq 0x10(%rsp), %r15
movq %rsi, 0x68(%rsp)
movq %r15, %r12
movl $0x0, 0x5c(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
movq %r13, %rdx
leaq 0x196c2(%rip), %rcx     # 0x25420
leaq 0x5c(%rsp), %r8
callq 0x66a0
leal -0x64(%rax), %ecx
cmpl $0x13, %ecx
ja 0xbdd2
leaq 0xeaa5(%rip), %rdx      # 0x1a81c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
movq %r12, %r15
jmpq *%rax
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
leaq 0xefab(%rip), %rsi      # 0x1ad42
leaq 0xefa7(%rip), %rdx      # 0x1ad45
callq 0x715e
movq 0x191b6(%rip), %rax     # 0x24f60
movq (%rax), %rsi
leaq 0x38(%rsp), %r15
movq %r15, %rdi
leaq 0xf(%rsp), %rdx
callq 0x6f06
movq %r12, %rdi
movq %r15, %rsi
callq 0xae50
movq %rax, (%r14)
jmp 0xbf22
cmpl $-0x1, %eax
jne 0xbf7f
movq %r12, %r15
xorl %eax, %eax
jmp 0xbf68
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
leaq 0xef4d(%rip), %rsi      # 0x1ad46
leaq 0xef4a(%rip), %rdx      # 0x1ad4a
callq 0x715e
movq 0x19154(%rip), %rax     # 0x24f60
movq (%rax), %rsi
leaq 0x38(%rsp), %r15
movq %r15, %rdi
leaq 0xf(%rsp), %rdx
callq 0x6f06
movq %r12, %rdi
movq %r15, %rsi
callq 0xae50
movq %rax, 0x8(%r14)
jmp 0xbf22
movb $0x1, 0x50(%r14)
jmp 0xbf66
movb $0x1, 0x12(%r14)
jmp 0xbf66
movq 0x19110(%rip), %rax     # 0x24f60
movq (%rax), %r13
movq 0x38(%r14), %r15
movq %r13, %rdi
callq 0x6190
movq 0x70(%rsp), %rdi
xorl %esi, %esi
movq %r15, %rdx
movq 0x68(%rsp), %rbx
movq %r13, %rcx
leaq 0xef16(%rip), %r13      # 0x1ad8e
movq %rax, %r8
callq 0x65f0
movq %r12, %r15
jmp 0xbf66
testb $0x1, 0x34(%rsp)
je 0xbea7
movq 0x60(%rsp), %rdi
movq (%rdi), %rsi
callq 0x19b20
movq %r12, %r15
movl $0x0, 0x34(%rsp)
movq 0x190b2(%rip), %rax     # 0x24f60
movq (%rax), %rsi
movq %r15, %rdi
leaq 0x38(%rsp), %rdx
callq 0x6f06
movq 0x60(%rsp), %rdi
movq %r15, %rsi
callq 0x198a4
jmp 0xbf3e
movb $0x1, 0x10(%r14)
jmp 0xbf66
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r15, %rdi
leaq 0xee6c(%rip), %rsi      # 0x1ad57
leaq 0xee69(%rip), %rdx      # 0x1ad5b
callq 0x715e
movq 0x19062(%rip), %rax     # 0x24f60
movq (%rax), %rsi
leaq 0x38(%rsp), %r15
movq %r15, %rdi
leaq 0xf(%rsp), %rdx
callq 0x6f06
movq %r12, %rdi
movq %r15, %rsi
callq 0xae50
movq %rax, 0x58(%r14)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xbf3e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x63a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0xbf5a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x63a0
movb $0x1, %al
movq %r12, %r15
jmp 0xbf68
movb $0x1, 0x11(%r14)
movb $0x1, %al
testb %al, %al
jne 0xbd44
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x19062(%rip), %rdi     # 0x24fe8
callq 0xb028
movl $0x1, %edi
callq 0x64c0
movq 0x19004(%rip), %rdi     # 0x24fa0
callq 0xb028
jmp 0xbfd8
movq (%rbx), %rsi
movq 0x18ff3(%rip), %rdi     # 0x24fa0
callq 0x6360
leaq 0xe846(%rip), %rsi      # 0x1a7ff
movq %rax, %rdi
callq 0x6360
leaq 0xedd7(%rip), %rsi      # 0x1ad9f
movq %rax, %rdi
callq 0x6360
movq %rax, %rdi
callq 0x61b0
xorl %edi, %edi
callq 0x64c0
jmp 0xc001
jmp 0xc027
jmp 0xc048
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
jne 0xc039
jmp 0xc04b
jmp 0xc048
jmp 0xc001
jmp 0xc027
jmp 0xc048
leaq 0x20(%rsp), %r12
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0xc02f
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0xc02f
leaq 0x20(%rsp), %r12
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
je 0xc04b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x63a0
jmp 0xc04b
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6700