// File: /workspace/github_c_makefile_star2_O3/cinemast[P]sudoku/sudoku.c
// Function: generate
static
void
generate (void)
{
    static int digits[9];

    int i;

    for (;;) {
        for (i = 0; i < 9; ++i) {
            digits[i] = i + 1;
        }

        rotate(digits, 9, 1 + rand() % 8);
        shuffle(digits, 9);
        select_template();

        rotate(tmplt, len_tmplt, 1 + rand() % (len_tmplt - 1));
        shuffle(tmplt, len_tmplt);

        reset();  /* construct a new board */

        for (i = 0; i < len_tmplt; ++i) {
            fill(tmplt[i], digits[i % 9]);
        }
        if (0 != solve() || idx_history < 81) {
            continue;
        }
        for (i = 0; i < len_tmplt; ++i) {
            board[tmplt[i]] |= FIXED;
        }
        /* Construct fixed squares */
        for (idx_history = i = 0; i < 81; ++i) {
            if (IS_FIXED(i)) {
                history[idx_history++] = SET_INDEX(i)
                                         | SET_DIGIT(DIGIT(i))
                                         | FIXED;
            }
        }
        clear_moves();

        if (0 != solve() || idx_history < 81) {
            continue;
        }
        if (-1 != backtrack() && 0 == solve()) {
            continue;
        }
        if (NULL != requested_class) {
            const char * generated_class = classify();
            sprintf(title, "randomly generated - %s", generated_class);
            write_title(title);
            wrefresh(stdscr);
            if (0 != strcmp(requested_class, generated_class)) {
                continue;
            }
        }

        break;
    }

    strcpy(title, "randomly generated - ");
    strcat(title, classify());

    clear_moves();
    time(&start_time);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movdqa 0x5641(%rip), %xmm0     # 0xa980
pshufd $0xf5, 0x5658(%rip), %xmm1 # xmm1 = mem[1,1,3,3]
movdqa %xmm1, (%rsp)
leaq 0xa95c(%rip), %r12      # 0xfcb0
leaq 0xa6f5(%rip), %r15      # 0xfa50
leaq 0xa13e(%rip), %r14      # 0xf4a0
movabsq $-0x1c71c71c71c71c71, %r13 # imm = 0xE38E38E38E38E38F
xorl %ecx, %ecx
movdqa %xmm0, %xmm1
pxor 0x5616(%rip), %xmm1     # 0xa990
movdqa 0x561e(%rip), %xmm3     # 0xa9a0
pcmpgtd %xmm1, %xmm3
pshufd $0xf5, %xmm1, %xmm2     # xmm2 = xmm1[1,1,3,3]
pcmpeqd (%rsp), %xmm2
pand %xmm3, %xmm2
movdqa %xmm0, %xmm1
psubq 0x5620(%rip), %xmm1     # 0xa9c0
movd %xmm2, %eax
testb $0x1, %al
je 0x53ae
movd %xmm1, (%r12,%rcx,4)
pextrw $0x4, %xmm2, %eax
testb $0x1, %al
je 0x53c3
pshufd $0xee, %xmm1, %xmm1     # xmm1 = xmm1[2,3,2,3]
movd %xmm1, 0x4(%r12,%rcx,4)
addq $0x2, %rcx
paddq 0x55e1(%rip), %xmm0     # 0xa9b0
cmpq $0xa, %rcx
jne 0x536e
callq 0x2380
leal 0x7(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
andl $-0x8, %ecx
negl %ecx
leal (%rax,%rcx), %edx
incl %edx
movq %r12, %rdi
movl $0x9, %esi
callq 0x725e
movl $0xa, %ebx
callq 0x2380
leaq -0x1(%rbx), %rcx
cltd
idivl %ecx
movl -0x8(%r12,%rbx,4), %eax
movslq %edx, %rdx
movl (%r12,%rdx,4), %esi
movl %esi, -0x8(%r12,%rbx,4)
movl %eax, (%r12,%rdx,4)
movq %rcx, %rbx
cmpq $0x1, %rcx
ja 0x53fe
cmpl $0x0, 0x9fd1(%rip)      # 0xf400
jle 0x5441
callq 0x2380
cltd
idivl 0x9fc3(%rip)            # 0xf400
movl %edx, %ebp
jmp 0x5443
xorl %ebp, %ebp
movq 0x9f9e(%rip), %rdi      # 0xf3e8
leaq 0xa747(%rip), %rax      # 0xfb98
cmpq %rax, %rdi
je 0x5461
xorl %esi, %esi
xorl %edx, %edx
callq 0x2270
jmp 0x5474
cmpb $0x1, 0xa808(%rip)      # 0xfc70
jne 0x5474
movl $0x0, 0xa800(%rip)      # 0xfc74
testl %ebp, %ebp
js 0x5497
movq 0x9f69(%rip), %rdi      # 0xf3e8
movl $0x1, %esi
callq 0x61aa
addl $-0x1, %ebp
setb %cl
testl %eax, %eax
jne 0x5497
testb %cl, %cl
jne 0x5478
movl 0xa55b(%rip), %ebp      # 0xf9f8
callq 0x2380
movl 0xa550(%rip), %ecx      # 0xf9f8
decl %ecx
cltd
idivl %ecx
incl %edx
movq %r15, %rdi
movl %ebp, %esi
callq 0x725e
movslq 0xa538(%rip), %rbx      # 0xf9f8
testq %rbx, %rbx
jle 0x556d
callq 0x2380
cltd
idivl %ebx
movl -0x4(%r15,%rbx,4), %eax
movslq %edx, %rcx
movl (%r15,%rcx,4), %edx
movl %edx, -0x4(%r15,%rbx,4)
leaq -0x1(%rbx), %rdx
movl %eax, (%r15,%rcx,4)
cmpq $0x1, %rbx
movq %rdx, %rbx
ja 0x54c9
movl 0xa4ff(%rip), %ebx      # 0xf9f8
movl $0x144, %edx            # imm = 0x144
movq %r14, %rdi
xorl %esi, %esi
callq 0x2190
movl $0x3cc, %edx            # imm = 0x3CC
leaq 0xa10c(%rip), %rdi      # 0xf620
xorl %esi, %esi
callq 0x2190
xorl %eax, %eax
movl %eax, 0xa0f1(%rip)      # 0xf614
movl %eax, 0xa66b(%rip)      # 0xfb94
cmpl %eax, %ebx
jle 0x559d
movq %r12, %rbx
movq %r15, %r14
xorl %ebp, %ebp
movq %rbp, %rax
mulq %r13
shrq %rdx
andq $-0x4, %rdx
leaq (%rdx,%rdx,8), %rax
negq %rax
movl (%r14), %edi
movl (%rbx,%rax), %esi
callq 0x65c2
incq %rbp
movslq 0xa49a(%rip), %rax      # 0xf9f8
addq $0x4, %r14
addq $0x4, %rbx
cmpq %rax, %rbp
jl 0x5535
jmp 0x559d
movl $0x144, %edx            # imm = 0x144
movq %r14, %rdi
xorl %esi, %esi
callq 0x2190
movl $0x3cc, %edx            # imm = 0x3CC
leaq 0xa098(%rip), %rdi      # 0xf620
xorl %esi, %esi
callq 0x2190
xorl %eax, %eax
movl %eax, 0xa07d(%rip)      # 0xf614
movl %eax, 0xa5f7(%rip)      # 0xfb94
callq 0x6758
movl $0x0, %ecx
movdqa 0x53d1(%rip), %xmm0     # 0xa980
testl %eax, %eax
leaq 0x9ee8(%rip), %r14      # 0xf4a0
leaq 0xa061(%rip), %r8       # 0xf620
jne 0x536e
cmpl $0x51, 0xa048(%rip)     # 0xf614
movl $0x0, %ecx
movdqa 0x53a7(%rip), %xmm0     # 0xa980
jl 0x536e
movslq 0xa412(%rip), %rax      # 0xf9f8
testq %rax, %rax
jle 0x5604
shlq $0x2, %rax
xorl %ecx, %ecx
movslq (%rcx,%r15), %rdx
orb $0x10, 0x2(%r14,%rdx,4)
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0x55f1
xorl %eax, %eax
movq %r14, %rcx
xorl %edx, %edx
movl (%rcx), %esi
btl $0x14, %esi
jae 0x562c
andl $0xf0000, %esi          # imm = 0xF0000
movl %eax, %edi
orl %esi, %edi
orl $0x100000, %edi         # imm = 0x100000
movslq %edx, %rsi
incl %edx
movl %edi, (%r8,%rsi,4)
incq %rax
addq $0x4, %rcx
cmpq $0x51, %rax
jne 0x560b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %r8, %rcx
incl %eax
testb $0x10, 0x2(%rcx)
leaq 0x4(%rcx), %rcx
jne 0x5641
movl %eax, 0x9fc1(%rip)      # 0xf614
callq 0x32c0
callq 0x6758
movl $0x0, %ecx
movdqa 0x5316(%rip), %xmm0     # 0xa980
testl %eax, %eax
jne 0x536e
cmpl $0x51, 0x9f9b(%rip)     # 0xf614
movl $0x0, %ecx
movdqa 0x52fa(%rip), %xmm0     # 0xa980
jl 0x536e
callq 0x686f
cmpl $-0x1, %eax
je 0x56b0
callq 0x6758
movl $0x0, %ecx
movdqa 0x52d8(%rip), %xmm0     # 0xa980
testl %eax, %eax
je 0x536e
cmpq $0x0, 0x9d10(%rip)      # 0xf3c8
je 0x5718
callq 0x68dc
movq %rax, %rbp
leaq 0x9d47(%rip), %rbx      # 0xf410
movq %rbx, %rdi
leaq 0x5b47(%rip), %rsi      # 0xb21a
movq %rax, %rdx
xorl %eax, %eax
callq 0x2320
movq %rbx, %rdi
callq 0x7378
movq 0x88ec(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
callq 0x2180
movq 0x9ccd(%rip), %rdi      # 0xf3c8
movq %rbp, %rsi
callq 0x2210
movl $0x0, %ecx
movdqa 0x5270(%rip), %xmm0     # 0xa980
testl %eax, %eax
jne 0x536e
movups 0x5b13(%rip), %xmm0     # 0xb232
movaps %xmm0, 0x9cea(%rip)     # 0xf410
movabsq $0x202d2064657461, %rax # imm = 0x202D2064657461
movq %rax, 0x9ce7(%rip)      # 0xf41e
leaq 0x9cd2(%rip), %rbx      # 0xf410
callq 0x68dc
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2310
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x9ec6(%rip), %rcx      # 0xf620
incl %eax
testb $0x10, 0x2(%rcx)
leaq 0x4(%rcx), %rcx
jne 0x575a
movl %eax, 0x9ea8(%rip)      # 0xf614
callq 0x32c0
leaq 0xa560(%rip), %rdi      # 0xfcd8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2250