// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x18(%rdx), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rdx), %rax
cmpq 0x20(%rdx), %rax
setne %al
movl %eax, 0x10(%rsp)
leaq 0x30(%rdx), %rax
movq %rax, 0x20(%rsp)
leaq 0xd85e(%rip), %r15      # 0x1881c
leaq 0x28(%rsp), %r13
leaq 0x48(%rsp), %r12
andl $0x0, 0x14(%rsp)
movl %ebp, %edi
movq %rbx, %rsi
leaq 0xddb5(%rip), %rdx      # 0x18d8e
leaq 0x1b440(%rip), %rcx     # 0x26420
leaq 0x14(%rsp), %r8
callq 0x66a0
leal -0x64(%rax), %ecx
cmpl $0x13, %ecx
ja 0xb14e
movslq (%r15,%rcx,4), %rax
addq %r15, %rax
jmpq *%rax
movq %r13, %rdi
leaq 0xdd39(%rip), %rsi      # 0x18d42
leaq 0xf(%rsp), %rdx
callq 0x6c8e
movq 0x1af3e(%rip), %rax     # 0x25f58
movq (%rax), %rsi
movq %r12, %rdi
leaq 0xe(%rsp), %rdx
callq 0x6c8e
movq %r13, %rdi
movq %r12, %rsi
callq 0xa6e5
movq %rax, (%r14)
jmp 0xb116
movb $0x1, 0x50(%r14)
jmp 0xafc8
movb $0x1, 0x12(%r14)
jmp 0xafc8
testb $0x1, 0x10(%rsp)
je 0xb05f
movq 0x18(%rsp), %rdi
callq 0xb67c
movq 0x1aef2(%rip), %rax     # 0x25f58
movq (%rax), %rsi
movq %r13, %rdi
movq %r12, %rdx
callq 0x6c8e
movq 0x18(%rsp), %rdi
movq %r13, %rsi
callq 0x1707c
movq %r13, %rdi
callq 0x61b0
movl $0x0, 0x10(%rsp)
jmp 0xafc8
movb $0x1, 0x10(%r14)
jmp 0xafc8
movq %r13, %rdi
leaq 0xdc9c(%rip), %rsi      # 0x18d46
leaq 0xf(%rsp), %rdx
callq 0x6c8e
movq 0x1ae9d(%rip), %rax     # 0x25f58
movq (%rax), %rsi
movq %r12, %rdi
leaq 0xe(%rsp), %rdx
callq 0x6c8e
movq %r13, %rdi
movq %r12, %rsi
callq 0xa6e5
movq %rax, 0x8(%r14)
jmp 0xb116
movq %r13, %rdi
leaq 0xdc71(%rip), %rsi      # 0x18d57
leaq 0xf(%rsp), %rdx
callq 0x6c8e
movq 0x1ae61(%rip), %rax     # 0x25f58
movq (%rax), %rsi
movq %r12, %rdi
leaq 0xe(%rsp), %rdx
callq 0x6c8e
movq %r13, %rdi
movq %r12, %rsi
callq 0xa6e5
movq %rax, 0x58(%r14)
movq %r12, %rdi
callq 0x61b0
movq %r13, %rdi
callq 0x61b0
jmp 0xafc8
movq 0x1ae26(%rip), %rax     # 0x25f58
movq (%rax), %rsi
movq 0x20(%rsp), %rdi
callq 0x67c0
jmp 0xafc8
movb $0x1, 0x11(%r14)
jmp 0xafc8
cmpl $-0x1, %eax
jne 0xb162
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1ae77(%rip), %rdi     # 0x25fe0
callq 0xa7e8
pushq $0x1
popq %rdi
callq 0x64c0
movq 0x1ae13(%rip), %rdi     # 0x25f90
callq 0xa7e8
jmp 0xb1b9
movq (%rbx), %rsi
movq 0x1ae02(%rip), %rdi     # 0x25f90
callq 0x6370
leaq 0xd665(%rip), %rsi      # 0x187ff
movq %rax, %rdi
callq 0x6370
leaq 0xdbf6(%rip), %rsi      # 0x18d9f
movq %rax, %rdi
callq 0x6370
movq %rax, %rdi
callq 0x61d0
xorl %edi, %edi
callq 0x64c0
jmp 0xb1df
jmp 0xb1ee
jmp 0xb1ce
jmp 0xb1df
jmp 0xb1ce
jmp 0xb1ee
jmp 0xb1df
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x61b0
jmp 0xb1e2
jmp 0xb1ee
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x61b0
jmp 0xb1f1
movq %rax, %rbx
movq %rbx, %rdi
callq 0x6710