// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
cmpl $0x9, -0x4(%rbp)
jge 0x43e4
movl -0x4(%rbp), %edx
addl $0x1, %edx
movslq -0x4(%rbp), %rcx
leaq 0xe8ea(%rip), %rax      # 0x12cc0
movl %edx, (%rax,%rcx,4)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x43bf
callq 0x2350
movl $0x8, %ecx
cltd
idivl %ecx
addl $0x1, %edx
leaq 0xe8c5(%rip), %rdi      # 0x12cc0
movl $0x9, %esi
callq 0x7280
leaq 0xe8b4(%rip), %rdi      # 0x12cc0
movl $0x9, %esi
callq 0x73b0
callq 0x7420
movl 0xe5e7(%rip), %eax      # 0x12a08
movl %eax, -0x14(%rbp)
callq 0x2350
movl -0x14(%rbp), %esi
movl 0xe5d6(%rip), %ecx      # 0x12a08
subl $0x1, %ecx
cltd
idivl %ecx
addl $0x1, %edx
leaq 0xe61e(%rip), %rdi      # 0x12a60
callq 0x7280
movl 0xe5bb(%rip), %esi      # 0x12a08
leaq 0xe60c(%rip), %rdi      # 0x12a60
callq 0x73b0
callq 0x62e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0xe59a(%rip), %eax      # 0x12a08
jge 0x44a6
movslq -0x4(%rbp), %rcx
leaq 0xe5e5(%rip), %rax      # 0x12a60
movl (%rax,%rcx,4), %edi
movl -0x4(%rbp), %eax
movl $0x9, %ecx
cltd
idivl %ecx
movslq %edx, %rcx
leaq 0xe82d(%rip), %rax      # 0x12cc0
movl (%rax,%rcx,4), %esi
callq 0x64b0
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x4465
callq 0x6860
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x44bc
cmpl $0x51, 0xe16a(%rip)     # 0x12624
jge 0x44c1
jmp 0x43b8
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0xe537(%rip), %eax      # 0x12a08
jge 0x4507
movslq -0x4(%rbp), %rcx
leaq 0xe582(%rip), %rax      # 0x12a60
movslq (%rax,%rcx,4), %rcx
leaq 0xdfc7(%rip), %rax      # 0x124b0
movl (%rax,%rcx,4), %edx
orl $0x100000, %edx         # imm = 0x100000
leaq 0xdfb7(%rip), %rax      # 0x124b0
movl %edx, (%rax,%rcx,4)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x44c8
movl $0x0, -0x4(%rbp)
movl $0x0, 0xe10c(%rip)      # 0x12624
cmpl $0x51, -0x4(%rbp)
jge 0x4585
movslq -0x4(%rbp), %rcx
leaq 0xdf87(%rip), %rax      # 0x124b0
movl (%rax,%rcx,4), %eax
andl $0x100000, %eax         # imm = 0x100000
cmpl $0x0, %eax
je 0x4578
movl -0x4(%rbp), %edx
movslq -0x4(%rbp), %rcx
leaq 0xdf6c(%rip), %rax      # 0x124b0
movl (%rax,%rcx,4), %eax
andl $0xf0000, %eax          # imm = 0xF0000
sarl $0x10, %eax
shll $0x10, %eax
orl %eax, %edx
orl $0x100000, %edx         # imm = 0x100000
movl 0xe0c4(%rip), %eax      # 0x12624
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0xe0b9(%rip)      # 0x12624
movslq %eax, %rcx
leaq 0xe0bb(%rip), %rax      # 0x12630
movl %edx, (%rax,%rcx,4)
jmp 0x457a
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x4518
callq 0x6ab0
callq 0x6860
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x45a0
cmpl $0x51, 0xe086(%rip)     # 0x12624
jge 0x45a5
jmp 0x43b8
callq 0x6900
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %eax
je 0x45c7
callq 0x6860
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x45c7
jmp 0x43b8
xorl %eax, %eax
cmpq 0xde08(%rip), %rax      # 0x123d8
je 0x462e
callq 0x69b0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdx
leaq 0xde3a(%rip), %rdi      # 0x12420
leaq 0x8f5b(%rip), %rsi      # 0xd548
movb $0x0, %al
callq 0x2300
leaq 0xde25(%rip), %rdi      # 0x12420
callq 0x74b0
movq 0xc9d1(%rip), %rax      # 0x10fd8
movq (%rax), %rdi
callq 0x2170
movq 0xddc2(%rip), %rdi      # 0x123d8
movq -0x10(%rbp), %rsi
callq 0x21f0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x462c
jmp 0x43b8
jmp 0x462e
jmp 0x4630
leaq 0xdde9(%rip), %rdi      # 0x12420
leaq 0x8f22(%rip), %rsi      # 0xd560
callq 0x2050
callq 0x69b0
movq %rax, %rsi
leaq 0xddce(%rip), %rdi      # 0x12420
callq 0x22f0
callq 0x6ab0
leaq 0xe685(%rip), %rdi      # 0x12ce8
callq 0x2230
addq $0x20, %rsp
popq %rbp
retq
nop