// File: /workspace/github_c_makefile_star2_O2/7402[P]randwords/main.c
// Function: main
int main(int argc, const char * argv[]) {
    int max_index = word_count() - 1;
    int from_index = 0;
    int to_index = max_index;
    bool error = false;
    bool silent = false;
    int words_per_row = 5;
    int word_count = 35;
    
    for (int index = 1; index < argc && !error; index++) {
        //  -f from
        if (strcmp(argv[index], "-f") == 0 && index + 1 < argc) {
            from_index = atoi(argv[++index]) - 1;
            error = from_index < 0 || from_index > max_index || from_index > to_index;
            
        //  -t to
        } else if (strcmp(argv[index], "-t") == 0 && index + 1 < argc) {
            to_index = atoi(argv[++index]) - 1;
            error = to_index < 0 || to_index > max_index || from_index > to_index;
            
        //  -c words_per_row
        } else if (strcmp(argv[index], "-c") == 0 && index + 1 < argc) {
            words_per_row = atoi(argv[++index]);
            error = words_per_row < 1 || words_per_row > 100;
            
        //  -n number_of_words
        } else if (strcmp(argv[index], "-n") == 0 && index + 1 < argc) {
            word_count = atoi(argv[++index]);
            error = word_count < 0 || word_count > 5000;
            
        //  -v --version       print version
        } else if ((strcmp(argv[index], "--version") == 0) ||
                   (strcmp(argv[index], "-v") == 0)) {
            printf("randwords 0.9.2\n");
            silent = true;

        //  -h --help       print help for randwords
        } else if ((strcmp(argv[index], "--help") == 0) ||
                   (strcmp(argv[index], "-h") == 0)) {
            printf("Generates a series of random words.\n"
                   "Usage:\n"
                   "  randwords [-c <words_per_row] [-n <number_of_words>]\n"
                   "            [-f <from_word_number>] [-t <to_word_number>]\n"
                   "  randwords -h | --help\n"
                   "  randwords -v | --version\n"
                   "  randwords --license\n"
                   "  randwords --man-page\n"
                   "\n"
                   "Options:\n"
                   "  -c <words_per_row>     Number of words per row [default: 5]\n"
                   "  -n <number_of_words>   Number of words to print [default: 35]\n"
                   "  -f <from_word_number>  Include words from list beginning at this number [default: 1]\n"
                   "  -t <to_word_number>    Include words from list up to this number [default: 5000]\n"
                   "  -h --help     Show this screen.\n"
                   "  --version     Show version.\n"
                   "  --license     Show software copyright and license\n"
                   "  --man_page    Show source for man page\n");
            silent = true;
            
        //  --man-page      print source for man page
        } else if (strcmp(argv[index], "--man-page") == 0) {
            man_page_source();
            silent = true;
            
        //  --licence       print copyright and license
        } else if (strcmp(argv[index], "--license") == 0) {
            license();
            silent = true;;
            
        } else {
            error = true;
        }
    }
    
    if (silent) {
        
    } else if (error) {
        fprintf(stderr, "Error: invalid options\n");
        
    } else {
        if (print_words(from_index, to_index, words_per_row, word_count)) {
            printf("error: unable to print\n");
        }
    }
    
    return error ? 1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x10(%rsp)
movl %edi, %ebp
callq 0x1e5bc
movq %rax, 0x20(%rsp)
decl %eax
movl %eax, 0xc(%rsp)
pushq $0x1
popq %r12
pushq $0x23
popq %rax
movl %eax, 0x18(%rsp)
pushq $0x5
popq %rax
movl %eax, 0x1c(%rsp)
movl $0x0, 0x8(%rsp)
xorl %r13d, %r13d
movl $0x0, 0x4(%rsp)
cmpl %ebp, %r12d
jge 0x1e419
testb $0x1, %r13b
jne 0x1e419
movslq %r12d, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %r14
movb (%r14), %r15b
cmpb $0x2d, %r15b
jne 0x1e36f
cmpb $0x66, 0x1(%r14)
jne 0x1e2b0
cmpb $0x0, 0x2(%r14)
jne 0x1e2b0
leal 0x1(%r12), %ebx
cmpl %ebp, %ebx
jge 0x1e2b0
movslq %ebx, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x1e0c0
leal -0x1(%rax), %edx
testl %eax, %eax
setle %cl
cmpl 0x20(%rsp), %eax
setg %r13b
movl %edx, 0x8(%rsp)
cmpl 0xc(%rsp), %edx
setg %al
orb %cl, %r13b
orb %al, %r13b
jmp 0x1e367
cmpb $0x74, 0x1(%r14)
jne 0x1e2fa
cmpb $0x0, 0x2(%r14)
jne 0x1e2fa
leal 0x1(%r12), %ebx
cmpl %ebp, %ebx
jge 0x1e2fa
movslq %ebx, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x1e0c0
leal -0x1(%rax), %ecx
movl %ecx, 0xc(%rsp)
testl %eax, %eax
setle %cl
cmpl 0x20(%rsp), %eax
setg %dl
orb %cl, %dl
cmpl %eax, 0x8(%rsp)
setge %r13b
orb %dl, %r13b
jmp 0x1e367
cmpb $0x63, 0x1(%r14)
jne 0x1e332
cmpb $0x0, 0x2(%r14)
jne 0x1e332
leal 0x1(%r12), %ebx
cmpl %ebp, %ebx
jge 0x1e332
movslq %ebx, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x1e0c0
movl %eax, 0x1c(%rsp)
addl $-0x65, %eax
cmpl $-0x64, %eax
setb %r13b
jmp 0x1e367
cmpb $0x6e, 0x1(%r14)
jne 0x1e36f
cmpb $0x0, 0x2(%r14)
jne 0x1e36f
leal 0x1(%r12), %ebx
cmpl %ebp, %ebx
jge 0x1e36f
movslq %ebx, %rax
movq 0x10(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
callq 0x1e0c0
movl %eax, 0x18(%rsp)
cmpl $0x1389, %eax           # imm = 0x1389
setae %r13b
movl %ebx, %r12d
jmp 0x1e403
movq %r14, %rdi
leaq 0xc8b(%rip), %rsi       # 0x1f004
callq 0x1e0a0
testl %eax, %eax
je 0x1e3e8
cmpb $0x2d, %r15b
jne 0x1e396
cmpb $0x76, 0x1(%r14)
jne 0x1e396
cmpb $0x0, 0x2(%r14)
je 0x1e3e8
movq %r14, %rdi
leaq 0xc6e(%rip), %rsi       # 0x1f00e
callq 0x1e0a0
testl %eax, %eax
je 0x1e3f1
cmpb $0x2d, %r15b
jne 0x1e3bd
cmpb $0x68, 0x1(%r14)
jne 0x1e3bd
cmpb $0x0, 0x2(%r14)
je 0x1e3f1
movq %r14, %rdi
leaq 0xc4e(%rip), %rsi       # 0x1f015
callq 0x1e0a0
testl %eax, %eax
je 0x1e40b
movq %r14, %rdi
leaq 0xc46(%rip), %rsi       # 0x1f020
callq 0x1e0a0
testl %eax, %eax
je 0x1e412
movb $0x1, %r13b
jmp 0x1e403
leaq 0xf21(%rip), %rdi       # 0x1f310
jmp 0x1e3f8
leaq 0xc4d(%rip), %rdi       # 0x1f045
callq 0x1e050
movb $0x1, %al
movl %eax, 0x4(%rsp)
incl %r12d
jmp 0x1e236
callq 0x1e470
jmp 0x1e3fd
callq 0x1e47c
jmp 0x1e3fd
testb $0x1, 0x4(%rsp)
jne 0x1e43b
testb $0x1, %r13b
jne 0x1e452
movl 0x8(%rsp), %edi
movl 0xc(%rsp), %esi
movl 0x1c(%rsp), %edx
movl 0x18(%rsp), %ecx
callq 0x1e488
andb $0x1, %r13b
movzbl %r13b, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xcb9f(%rip), %rax      # 0x2aff8
movq (%rax), %rcx
leaq 0xbc7(%rip), %rdi       # 0x1f02a
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
callq 0x1e0d0
jmp 0x1e43b