// File: /workspace/github_c_makefile_star2_O3/7402[P]randwords/main.c
// Function: print_words
bool print_words(int from_index, int to_index, int words_per_row, int word_count)
{
    bool error = false;
    
    int key_index_size = to_index - from_index + 1;;
    KeyIndex *key_index = (KeyIndex *)calloc(key_index_size, sizeof(KeyIndex));
    
    if (key_index != NULL) {
        bool needs_shuffle = true;
        int next_key_index = 0;
        
        srand((unsigned int)time(NULL));
        for (int k = 0; k < key_index_size; k++) key_index[k].words_index = (short)(from_index + k);
        
        for (int word_num = 1; word_num <= word_count; word_num++) {
            if (needs_shuffle) {
                for (int k = 0; k < key_index_size; k++) key_index[k].rand_key = (short)rand();
                qsort(key_index, key_index_size, sizeof(KeyIndex), compare);
                next_key_index = 0;
                needs_shuffle = false;
            }
            
            printf("%s", word(key_index[next_key_index++].words_index));

            if (word_num % words_per_row == 0 || word_num == word_count) {
                printf("\n");
                
            } else {
                printf(" ");
            }

            if (next_key_index >= key_index_size) needs_shuffle = true;
        }

        free(key_index);
        key_index = NULL;
    }
    
    return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, (%rsp)
movl %edx, 0x4(%rsp)
movl %esi, %ebp
movl %edi, %r15d
subl %edi, %ebp
leal 0x1(%rbp), %r14d
movslq %r14d, %rdi
movl $0x4, %esi
movq %rdi, 0x10(%rsp)
callq 0x1e090
testq %rax, %rax
je 0x1e8ca
movq %rax, %r12
xorl %edi, %edi
callq 0x1e0b0
movl %eax, %edi
callq 0x1e080
testl %ebp, %ebp
js 0x1e80e
leaq 0x7(%r14), %rax
andq $-0x8, %rax
leaq -0x1(%r14), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movl %r15d, %ecx
movdqa 0xac0(%rip), %xmm1      # 0x1f010
movdqa 0xac8(%rip), %xmm2      # 0x1f020
movdqa 0xad0(%rip), %xmm3      # 0x1f030
movdqa 0xad8(%rip), %xmm4      # 0x1f040
xorl %edx, %edx
movdqa 0xade(%rip), %xmm5      # 0x1f050
pxor %xmm5, %xmm0
pcmpeqd %xmm6, %xmm6
movdqa 0xade(%rip), %xmm7      # 0x1f060
movdqa %xmm4, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
movd %xmm11, %esi
testb $0x1, %sil
je 0x1e5e7
leal (%rcx,%rdx), %esi
movw %si, 0x2(%r12,%rdx,4)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
movd %xmm8, %esi
shrl $0x10, %esi
testb $0x1, %sil
je 0x1e619
leal (%rcx,%rdx), %esi
incl %esi
movw %si, 0x6(%r12,%rdx,4)
movdqa %xmm3, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x2, %xmm11, %esi
testb $0x1, %sil
je 0x1e67a
leal (%rcx,%rdx), %esi
addl $0x2, %esi
movw %si, 0xa(%r12,%rdx,4)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x3, %xmm8, %esi
testb $0x1, %sil
je 0x1e6b8
leal (%rcx,%rdx), %esi
addl $0x3, %esi
movw %si, 0xe(%r12,%rdx,4)
movdqa %xmm2, %xmm8
pxor %xmm5, %xmm8
movdqa %xmm8, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm9    # xmm9 = xmm10[0,0,2,2]
pshuflw $0xe8, %xmm9, %xmm11    # xmm11 = xmm9[0,2,2,3,4,5,6,7]
pcmpeqd %xmm0, %xmm8
pshufd $0xf5, %xmm8, %xmm8     # xmm8 = xmm8[1,1,3,3]
pshuflw $0xe8, %xmm8, %xmm12    # xmm12 = xmm8[0,2,2,3,4,5,6,7]
pand %xmm11, %xmm12
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
por %xmm12, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x4, %xmm11, %esi
testb $0x1, %sil
je 0x1e721
leal (%rcx,%rdx), %esi
addl $0x4, %esi
movw %si, 0x12(%r12,%rdx,4)
pand %xmm9, %xmm8
por %xmm10, %xmm8
packssdw %xmm8, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x5, %xmm8, %esi
testb $0x1, %sil
je 0x1e752
leal (%rcx,%rdx), %esi
addl $0x5, %esi
movw %si, 0x16(%r12,%rdx,4)
movdqa %xmm1, %xmm9
pxor %xmm5, %xmm9
movdqa %xmm9, %xmm10
pcmpgtd %xmm0, %xmm10
pshufd $0xa0, %xmm10, %xmm8    # xmm8 = xmm10[0,0,2,2]
pcmpeqd %xmm0, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
movdqa %xmm9, %xmm11
pand %xmm8, %xmm11
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
por %xmm10, %xmm11
packssdw %xmm11, %xmm11
pxor %xmm6, %xmm11
packssdw %xmm11, %xmm11
pextrw $0x6, %xmm11, %esi
testb $0x1, %sil
je 0x1e7b3
leal (%rcx,%rdx), %esi
addl $0x6, %esi
movw %si, 0x1a(%r12,%rdx,4)
pshufhw $0x84, %xmm8, %xmm8     # xmm8 = xmm8[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pand %xmm8, %xmm9
pshufhw $0x84, %xmm10, %xmm8    # xmm8 = xmm10[0,1,2,3,4,5,4,6]
por %xmm9, %xmm8
pxor %xmm6, %xmm8
packssdw %xmm8, %xmm8
pextrw $0x7, %xmm8, %esi
testb $0x1, %sil
je 0x1e7f1
leal (%rcx,%rdx), %esi
addl $0x7, %esi
movw %si, 0x1e(%r12,%rdx,4)
addq $0x8, %rdx
paddq %xmm7, %xmm4
paddq %xmm7, %xmm3
paddq %xmm7, %xmm2
paddq %xmm7, %xmm1
cmpq %rdx, %rax
jne 0x1e582
movq %r14, 0x8(%rsp)
cmpl $0x0, (%rsp)
jle 0x1e8c2
movb $0x1, %al
movl $0x1, %r15d
xorl %r13d, %r13d
testb $0x1, %al
je 0x1e865
testl %ebp, %ebp
movq 0x8(%rsp), %r14
js 0x1e849
xorl %ebx, %ebx
callq 0x1e0e0
movw %ax, (%r12,%rbx,4)
incq %rbx
cmpq %rbx, %r14
jne 0x1e837
movl $0x4, %edx
movq %r12, %rdi
movq 0x10(%rsp), %rsi
leaq 0x7e(%rip), %rcx        # 0x1e8db
callq 0x1e060
xorl %r13d, %r13d
movslq %r13d, %rbx
incl %r13d
movswl 0x2(%r12,%rbx,4), %edi
callq 0x1e8ea
leaq 0x831(%rip), %rdi       # 0x1f0ae
movq %rax, %rsi
xorl %eax, %eax
callq 0x1e070
movl %r15d, %eax
cltd
idivl 0x4(%rsp)
testl %edx, %edx
movl $0x20, %edi
movl $0xa, %eax
cmovel %eax, %edi
movl (%rsp), %r14d
cmpl %r14d, %r15d
cmovel %eax, %edi
callq 0x1e040
cmpl %ebp, %ebx
setge %al
leal 0x1(%r15), %ecx
cmpl %r14d, %r15d
movl %ecx, %r15d
jne 0x1e828
movq %r12, %rdi
callq 0x1e030
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq