// File: /workspace/github_c_makefile_star2_O0/robertdavidgraham[P]wc2/wc2.c
// Function: read_command_line
static struct config
read_command_line(int argc, char *argv[])
{
    struct config cfg;
    int i;

    memset(&cfg, 0, sizeof(cfg));

    /* We set this as the errno so that 'perror()' will print a localized
     * error message, whatever "Invalid argument" is in the user's local
     * language */
    errno = EINVAL;

    for (i=1; i<argc; i++) {
        size_t j;
        size_t maxj;
        if (argv[i][0] != '-') {
            /* Assume anything not an -option is a filename */
            cfg.file_count++;
            continue;
        }
        if (argv[i][1] == '\0') {
            /* A bare dash '-' on the command-line means we should
             * also handle <stdin> */
            cfg.is_stdin = 1;
            continue;
        }
        if (argv[i][1] == '-') {
            if (argv[i][2] == '\0') {
                cfg.file_count += argc - i - 1;
                break;
            } else if (strcmp(argv[i], "--version") == 0) {
                fprintf(stderr, "--- wc-fast-ut8 1.0 by Robert Graham ---\n");
                exit(0);
            } else if (strcmp(argv[i], "--help") == 0) {
                print_help();
                exit(0);
            } else {
                perror(argv[i]);
                exit(1);
            }
        }

        maxj = strlen(argv[i]);
        for (j=1; j<maxj; j++) {
            char c = argv[i][j];
            const char *parm = NULL;
            switch (c) {
                case 'l': cfg.is_counting_lines++; break;
                case 'w': cfg.is_counting_words++; break;
                case 'c':
                    if (cfg.is_counting_chars) {
                        perror("-c");
                        exit(1);
                    }
                    cfg.is_counting_bytes++;
                    break;
                case 'm':
                    if (cfg.is_counting_bytes) {
                        perror("-m");
                        exit(1);
                    }
                    cfg.is_counting_chars++;
                    break;
                case 'W':
                    if (argv[i][j+1] == '\0') {
                        if (i+1 < argc)
                            parm = argv[++i];
                    } else {
                        parm = argv[i] + j + 1;
                    }
                    if (parm == NULL || !isdigit(*parm)) {
                        perror("-W");
                        exit(1);
                    } else
                        cfg.column_width = atoi(parm);
                    j = maxj;
                    break;
                case 'P':
                    cfg.is_pointer_arithmetic++;
                    break;
                default:
                    {
                        char foo[3];
                        foo[0] = '-';
                        foo[1] = c;
                        foo[2] = '\0';
                        perror(foo);
                        exit(1);
                    }
                    break;
            }
        }
    }

    /* If no files specified, then we do <stdin> instead */
    if (cfg.file_count == 0)
        cfg.is_stdin = 1;

    /* Default is -lwc if no options are given */
    if (cfg.is_counting_lines == 0
        && cfg.is_counting_words == 0
        && cfg.is_counting_bytes == 0
        && cfg.is_counting_chars == 0) {
        cfg.is_counting_lines = 1;
        cfg.is_counting_words = 1;
        cfg.is_counting_bytes = 1;
    }

    /* Calculate the width for the columns */
    if (cfg.column_width == 0) {
        if (cfg.file_count > 0) {
            cfg.column_width = get_column_width(argc, argv, cfg.is_stdin);
        } else
            cfg.column_width = 1;
    }

    /* If there are more than one files, or if there are both files and
     * <stdin>, then we need to print totals at the end. Otherwise, if only
     * a single result is to be printed, then printing an additional result
     * would be redundant */
    if (cfg.file_count > 1 || (cfg.file_count && cfg.is_stdin))
        cfg.is_printing_totals = 1;

    return cfg;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x50(%rbp)
movq %rdi, %rax
movq %rax, -0x48(%rbp)
movl %esi, -0x4(%rbp)
movq %rdx, -0x10(%rbp)
xorl %esi, %esi
movl $0x28, %edx
callq 0x10c0
callq 0x1050
movl $0x16, (%rax)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x2287
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x1f9b
movq -0x50(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x2279
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x1fc0
movq -0x50(%rbp), %rax
movl $0x1, 0x8(%rax)
jmp 0x2279
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
cmpl $0x2d, %eax
jne 0x2089
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x2009
movq -0x50(%rbp), %rax
movl -0x4(%rbp), %ecx
subl -0x14(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addq (%rax), %rcx
movq %rcx, (%rax)
jmp 0x2287
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x10d3(%rip), %rsi      # 0x30ef
callq 0x10d0
cmpl $0x0, %eax
jne 0x2045
movq 0x2fcb(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x10c2(%rip), %rsi      # 0x30f9
movb $0x0, %al
callq 0x10e0
xorl %edi, %edi
callq 0x1180
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x10cb(%rip), %rsi      # 0x3123
callq 0x10d0
cmpl $0x0, %eax
jne 0x206e
callq 0x2950
xorl %edi, %edi
callq 0x1180
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1160
movl $0x1, %edi
callq 0x1180
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x1080
movq %rax, -0x28(%rbp)
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x2277
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x20(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
movq $0x0, -0x38(%rbp)
movsbl -0x29(%rbp), %eax
addl $-0x50, %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x27, %eax
ja 0x2243
movq -0x58(%rbp), %rax
leaq 0xf4d(%rip), %rcx       # 0x3040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x50(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0x2264
movq -0x50(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x10(%rax)
jmp 0x2264
movq -0x50(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x2140
leaq 0xff9(%rip), %rdi       # 0x312a
callq 0x1160
movl $0x1, %edi
callq 0x1180
movq -0x50(%rbp), %rax
movl 0x14(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x14(%rax)
jmp 0x2264
movq -0x50(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x2172
leaq 0xfca(%rip), %rdi       # 0x312d
callq 0x1160
movl $0x1, %edi
callq 0x1180
movq -0x50(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
jmp 0x2264
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x20(%rbp), %rcx
movsbl 0x1(%rax,%rcx), %eax
cmpl $0x0, %eax
jne 0x21c3
movl -0x14(%rbp), %eax
addl $0x1, %eax
cmpl -0x4(%rbp), %eax
jge 0x21c1
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
jmp 0x21db
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x2202
callq 0x1190
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x2218
leaq 0xf27(%rip), %rdi       # 0x3130
callq 0x1160
movl $0x1, %edi
callq 0x1180
movq -0x38(%rbp), %rdi
callq 0x1170
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x2264
movq -0x50(%rbp), %rax
movl 0x24(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x24(%rax)
jmp 0x2264
movb $0x2d, -0x3b(%rbp)
movb -0x29(%rbp), %al
movb %al, -0x3a(%rbp)
movb $0x0, -0x39(%rbp)
leaq -0x3b(%rbp), %rdi
callq 0x1160
movl $0x1, %edi
callq 0x1180
jmp 0x2266
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x20a6
jmp 0x2279
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1f68
movq -0x50(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x229c
movq -0x50(%rbp), %rax
movl $0x1, 0x8(%rax)
movq -0x50(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jne 0x22dd
movq -0x50(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x22dd
movq -0x50(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0x22dd
movq -0x50(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x22dd
movq -0x50(%rbp), %rax
movl $0x1, 0xc(%rax)
movl $0x1, 0x10(%rax)
movl $0x1, 0x14(%rax)
movq -0x50(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x231c
movq -0x50(%rbp), %rax
cmpq $0x0, (%rax)
jbe 0x230f
movq -0x50(%rbp), %rax
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movl 0x8(%rax), %edx
callq 0x29e0
movl %eax, %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x20(%rax)
jmp 0x231a
movq -0x50(%rbp), %rax
movl $0x1, 0x20(%rax)
jmp 0x231c
movq -0x50(%rbp), %rax
cmpq $0x1, (%rax)
ja 0x233a
movq -0x50(%rbp), %rax
cmpq $0x0, (%rax)
je 0x2345
movq -0x50(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x2345
movq -0x50(%rbp), %rax
movl $0x1, 0x1c(%rax)
movq -0x48(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nop