// File: /workspace/github_c_makefile_star2_O1/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, %r15
movl %edi, %r12d
callq 0x1e5fc
movq %rax, 0x20(%rsp)
decl %eax
movl %eax, 0x14(%rsp)
cmpl $0x2, %r12d
jge 0x1e254
movl $0x23, %ecx
movl $0x5, %edx
movl $0x0, 0x10(%rsp)
xorl %ebx, %ebx
xorl %eax, %eax
xorl %r13d, %r13d
jmp 0x1e45d
movl $0x0, 0xc(%rsp)
movl $0x5, 0x1c(%rsp)
movl $0x23, 0x18(%rsp)
movl $0x1, %r14d
xorl %r13d, %r13d
movl $0x0, 0x10(%rsp)
movslq %r14d, %rax
movq (%r15,%rax,8), %rbx
movq %rbx, %rdi
leaq 0xd76(%rip), %rsi       # 0x1f004
callq 0x1e0a0
testl %eax, %eax
jne 0x1e2d2
leal 0x1(%r14), %ebp
cmpl %r12d, %ebp
jge 0x1e2d2
movslq %ebp, %rax
movq (%r15,%rax,8), %rdi
callq 0x1e0c0
leal -0x1(%rax), %edx
testl %eax, %eax
setle %cl
cmpl 0x20(%rsp), %eax
setg %r13b
movl %edx, 0x10(%rsp)
cmpl 0x14(%rsp), %edx
setg %al
orb %cl, %r13b
orb %al, %r13b
jmp 0x1e389
movq %rbx, %rdi
leaq 0xd2b(%rip), %rsi       # 0x1f007
callq 0x1e0a0
testl %eax, %eax
jne 0x1e31c
leal 0x1(%r14), %ebp
cmpl %r12d, %ebp
jge 0x1e31c
movslq %ebp, %rax
movq (%r15,%rax,8), %rdi
callq 0x1e0c0
leal -0x1(%rax), %ecx
movl %ecx, 0x14(%rsp)
testl %eax, %eax
setle %cl
cmpl 0x20(%rsp), %eax
setg %dl
orb %cl, %dl
cmpl %eax, 0x10(%rsp)
setge %r13b
orb %dl, %r13b
jmp 0x1e389
movq %rbx, %rdi
leaq 0xce4(%rip), %rsi       # 0x1f00a
callq 0x1e0a0
testl %eax, %eax
jne 0x1e354
leal 0x1(%r14), %ebp
cmpl %r12d, %ebp
jge 0x1e354
movslq %ebp, %rax
movq (%r15,%rax,8), %rdi
callq 0x1e0c0
movl %eax, 0x1c(%rsp)
addl $-0x65, %eax
cmpl $-0x64, %eax
setb %r13b
jmp 0x1e389
movq %rbx, %rdi
leaq 0xcaf(%rip), %rsi       # 0x1f00d
callq 0x1e0a0
testl %eax, %eax
jne 0x1e391
leal 0x1(%r14), %ebp
cmpl %r12d, %ebp
jge 0x1e391
movslq %ebp, %rax
movq (%r15,%rax,8), %rdi
callq 0x1e0c0
movl %eax, 0x18(%rsp)
cmpl $0x1389, %eax           # imm = 0x1389
setae %r13b
movl %ebp, %r14d
jmp 0x1e423
movq %rbx, %rdi
leaq 0xc75(%rip), %rsi       # 0x1f010
callq 0x1e0a0
testl %eax, %eax
je 0x1e408
movq %rbx, %rdi
leaq 0xc6c(%rip), %rsi       # 0x1f01a
callq 0x1e0a0
testl %eax, %eax
je 0x1e408
movq %rbx, %rdi
leaq 0xc5c(%rip), %rsi       # 0x1f01d
callq 0x1e0a0
testl %eax, %eax
je 0x1e411
movq %rbx, %rdi
leaq 0xc50(%rip), %rsi       # 0x1f024
callq 0x1e0a0
testl %eax, %eax
je 0x1e411
movq %rbx, %rdi
leaq 0xc40(%rip), %rsi       # 0x1f027
callq 0x1e0a0
testl %eax, %eax
je 0x1e437
movq %rbx, %rdi
leaq 0xc38(%rip), %rsi       # 0x1f032
callq 0x1e0a0
testl %eax, %eax
je 0x1e440
movb $0x1, %r13b
jmp 0x1e423
leaq 0xf13(%rip), %rdi       # 0x1f322
jmp 0x1e418
leaq 0xc3f(%rip), %rdi       # 0x1f057
callq 0x1e050
movb $0x1, %al
movl %eax, 0xc(%rsp)
incl %r14d
cmpl %r12d, %r14d
jge 0x1e449
testb $0x1, %r13b
je 0x1e27d
jmp 0x1e449
leaq 0xef4(%rip), %rdi       # 0x1f332
jmp 0x1e418
leaq 0x1538(%rip), %rdi      # 0x1f97f
jmp 0x1e418
movl %r13d, %eax
andb $0x1, %al
movzbl %al, %ebx
movl 0x18(%rsp), %ecx
movl 0x1c(%rsp), %edx
movl 0xc(%rsp), %eax
testb $0x1, %al
jne 0x1e474
testb $0x1, %r13b
jne 0x1e485
movl 0x10(%rsp), %edi
movl 0x14(%rsp), %esi
callq 0x1e4a4
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1e100
jmp 0x1e474