LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: reapply
static
int
reapply (void)
{
    int digit, idx, j;
    int allok = 0;
    memset(board, 0x00, sizeof(board));
    for (j = 0; j < idx_history; ++j) {
        if (!(history[j] & IGNORED) && 0 != GET_DIGIT(history[j])) {
            idx = GET_INDEX(history[j]);
            digit = GET_DIGIT(history[j]);
            if (!IS_EMPTY(idx) || DISALLOWED(idx, digit)) {
                allok = -1;
            }
            board[idx] = SET_DIGIT(digit);
            if (history[j] & FIXED) {
                board[idx] |= FIXED;
            }
            update(idx);
        }
    }
    return allok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0xc1b0(%rip), %rbx      # 0xf4a0
xorl %ebp, %ebp
movl $0x144, %edx            # imm = 0x144
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2190
cmpl $0x0, 0xc30c(%rip)      # 0xf614
jle 0x336c
xorl %r14d, %r14d
leaq 0xc30c(%rip), %r15      # 0xf620
xorl %ebp, %ebp
movl (%r15), %eax
btl $0x16, %eax
jb 0x3359
movl %eax, %ecx
shrl $0x10, %ecx
andl $0xf, %ecx
je 0x3359
movl %eax, %edi
andl $0x7f, %edi
movl %edi, %edx
movl (%rbx,%rdx,4), %edx
testl $0xf0000, %edx          # imm = 0xF0000
jne 0x3342
shrl %cl, %edx
testb $0x40, %dl
je 0x3347
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
shll $0x10, %ecx
andl $0x100000, %eax         # imm = 0x100000
orl %ecx, %eax
movl %eax, (%rbx,%rdi,4)
callq 0x6031
incq %r14
movslq 0xc2b1(%rip), %rax      # 0xf614
addq $0x4, %r15
cmpq %rax, %r14
jl 0x3316
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: clear_hints
static
void
clear_hints (void)
{
    int i;
    for (i = 0; i < 9; ++i) {
        mvaddch(TOP + 1 + i + i / 3, LEFT - 2, ' ');
        mvaddch(TOP + 1 + i + i / 3, RIGHT + 2, ' ');
        mvaddch(TOP - 1, LEFT + 2 + 2 * (i + i / 3), ' ');
        mvaddch(BOTTOM + 1, LEFT + 2 + 2 * (i + i / 3), ' ');
    }
    have_hint = 0;
    move_to(curx, cury);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %r14d, %r14d
movl $0x9, %ebp
movl $0xaaaaaaab, %r15d      # imm = 0xAAAAAAAB
movq 0xa822(%rip), %r12      # 0xdfd8
movl %r14d, %r13d
imulq %r15, %r13
shrq $0x21, %r13
movq (%r12), %rdi
leal (%r14,%r13), %ebx
addl $0x7, %ebx
movl %ebx, %esi
movl $0x19, %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x37eb
movq (%r12), %rdi
movl $0x20, %esi
callq 0x2300
movq (%r12), %rdi
movl %ebx, %esi
movl $0x35, %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x380e
movq (%r12), %rdi
movl $0x20, %esi
callq 0x2300
addl %r14d, %r13d
movq (%r12), %rdi
leal 0x1d(,%r13,2), %ebx
movl $0x5, %esi
movl %ebx, %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x383c
movq (%r12), %rdi
movl $0x20, %esi
callq 0x2300
movq (%r12), %rdi
movl $0x13, %esi
movl %ebx, %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x385f
movq (%r12), %rdi
movl $0x20, %esi
callq 0x2300
incl %r14d
decl %ebp
jne 0x37b6
movb $0x0, 0xaad7(%rip)      # 0xe348
movl 0xc175(%rip), %edi      # 0xf9ec
movl 0xc173(%rip), %esi      # 0xf9f0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6134
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: set_status
static
void
set_status (const char * txt)
{
    mvaddstr(STATUS_LINE,
             (int)((LINE_SIZE - strlen(txt)) / 2),
             (char *)txt);

    move_to(curx, cury);
    wrefresh(stdscr);
    have_status = 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0xa739(%rip), %r15      # 0xdfd8
movq (%r15), %r14
callq 0x2100
movl $0x50, %edx
subq %rax, %rdx
shrq %rdx
movq %r14, %rdi
movl $0x14, %esi
callq 0x22d0
cmpl $-0x1, %eax
je 0x38d4
movq (%r15), %rdi
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2360
movl 0xc112(%rip), %edi      # 0xf9ec
movl 0xc110(%rip), %esi      # 0xf9f0
callq 0x6134
movq (%r15), %rdi
callq 0x2180
movb $0x1, 0xc100(%rip)      # 0xf9f4
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: open_precanned
static
int
open_precanned (const char * filename)
{
    n_precanned = 0;
    precanned = fopen(filename, "r");
    if (0 != precanned) {
        while (0 == read_board(precanned, 0)) {
            ++n_precanned;
        }
    }
    /* return 0 on success, -1 on failure. */
    return (n_precanned > 0) - 1;
}

// Assembly:
pushq %rax
movl $0x0, 0xb6ce(%rip)      # 0xf3c0
leaq 0x79f2(%rip), %rsi      # 0xb6eb
callq 0x22c0
movq %rax, 0xa6ab(%rip)      # 0xe3b0
testq %rax, %rax
jne 0x3d12
jmp 0x3d24
incl 0xb6ae(%rip)            # 0xf3c0
movq 0xa697(%rip), %rdi      # 0xe3b0
xorl %esi, %esi
callq 0x6183
testl %eax, %eax
je 0x3d0c
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: open_template
static
void
open_template (const char * filename)
{
    n_tmplt = 0;
    ftmplt = topen(filename, "r");
    if (0 != ftmplt) {
        while (0 == read_board(ftmplt, 1)) {
            ++n_tmplt;
        }
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x0, 0xb6cc(%rip)      # 0xf400
leaq 0x79b0(%rip), %rsi      # 0xb6eb
callq 0x22c0
testq %rax, %rax
jne 0x3d74
leaq 0x7b67(%rip), %rdi      # 0xb8b3
movq %rbx, %rsi
callq 0x2210
testl %eax, %eax
je 0x3d5c
xorl %eax, %eax
jmp 0x3d74
movb $0x1, 0xbf0d(%rip)      # 0xfc70
movl $0x0, 0xbf07(%rip)      # 0xfc74
leaq 0xbe24(%rip), %rax      # 0xfb98
movq %rax, 0xb66d(%rip)      # 0xf3e8
testq %rax, %rax
jne 0x3d88
jmp 0x3d9d
incl 0xb678(%rip)            # 0xf400
movq 0xb659(%rip), %rdi      # 0xf3e8
movl $0x1, %esi
callq 0x6183
testl %eax, %eax
je 0x3d82
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: write_default_template
static
int
write_default_template(const char *     template_path)
{
    int     ret = -1;
    FILE *  f   = fopen(template_path, "r");
    if (0 == f) {
        f = fopen(template_path, "w");
        if (0 != f) {
            size_t i;
            for (i = 0; i < sizeof(default_template); ++i) {
                unsigned char ch = default_template[i];
                int j;
                for (j = 0; j < 4; ++j) {
                    fprintf(f, "%c", dtct[ch & 3]);
                    ch >>= 2;
                }
            }
            ret = fclose(f);
        }
    } else {
        fclose(f);
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x7937(%rip), %rsi      # 0xb6eb
callq 0x22c0
testq %rax, %rax
je 0x3dda
movq %rax, %rdi
callq 0x20e0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6f3a(%rip), %rsi      # 0xad1b
movq %rbx, %rdi
callq 0x22c0
testq %rax, %rax
je 0x3dc6
movq %rax, %rbx
xorl %r14d, %r14d
leaq 0x53c5(%rip), %r15      # 0x91c0
leaq 0x7df3(%rip), %r12      # 0xbbf5
movb (%r14,%r15), %r13b
movl $0x4, %ebp
movzbl %r13b, %r13d
movl %r13d, %eax
andl $0x3, %eax
movsbl (%rax,%r12), %edi
movq %rbx, %rsi
callq 0x21c0
shrb $0x2, %r13b
decl %ebp
jne 0x3e0b
incq %r14
cmpq $0x1773, %r14           # imm = 0x1773
jne 0x3e02
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20e0
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: cleanup_curses_and_more
static
void
cleanup_curses_and_more (void)
{
    if (opened != NULL) {
        fclose(opened);
        opened = NULL;
    }
    if (precanned != NULL) {
        fclose(precanned);
        precanned = NULL;
    }
    tclose(ftmplt);
    ftmplt = NULL;
    move(LAST_LINE, 0);
    wrefresh(stdscr);
    endwin();
}

// Assembly:
pushq %rbx
movq 0xa99c(%rip), %rdi      # 0xfc78
testq %rdi, %rdi
je 0x52f1
callq 0x20e0
movq $0x0, 0xa987(%rip) # 0xfc78
movq 0x90b8(%rip), %rdi      # 0xe3b0
testq %rdi, %rdi
je 0x530d
callq 0x20e0
movq $0x0, 0x90a3(%rip) # 0xe3b0
movq 0xa0d4(%rip), %rdi      # 0xf3e8
leaq 0xa87d(%rip), %rax      # 0xfb98
cmpq %rax, %rdi
je 0x532c
testq %rdi, %rdi
je 0x533d
callq 0x20e0
jmp 0x533d
movb $0x0, 0xa93d(%rip)      # 0xfc70
movl $0x0, 0xa937(%rip)      # 0xfc74
movq $0x0, 0xa0a0(%rip) # 0xf3e8
movq 0x8c89(%rip), %rbx      # 0xdfd8
movq (%rbx), %rdi
movl $0x17, %esi
xorl %edx, %edx
callq 0x22d0
movq (%rbx), %rdi
callq 0x2180
popq %rbx
jmp 0x2350
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: load_board
static
void
load_board (void)
{
    int i = 0;
    if (opened) {
        /* Select next board */
        i = read_board(opened, 0);
        if (i--) {
            fclose(opened);
            opened = NULL;
        }
    } else if (precanned &&
               (0 == opt_random ||
                (0 == rand() % 3 && 0 < n_precanned))) {
        /* Select random board */
        i = rand() % n_precanned;
        fseek(precanned, 0, SEEK_SET);
        while (0 <= i && 0 == read_board(precanned, 0)) {
            --i;
        }
    }
    if (i != -1) {
        set_status("generating a random board... (please wait)");
        generate();
        clear_status();
    }

    /* Shameless plug... */
    set_status("Su-Do-Ku by Michael Kennett");

    render();
    write_title(title);

    curx = cury = 8;    /* move_next() takes care of this... */
    move_next();
    completed = is_complete();
    num_hints = -1;
    time(&start_time);
}

// Assembly:
pushq %rbx
movq 0xa0af(%rip), %rdi      # 0xfc78
testq %rdi, %rdi
je 0x5bf9
xorl %esi, %esi
callq 0x6183
movl %eax, %ebx
subl $0x1, %ebx
jb 0x5c70
movq 0xa091(%rip), %rdi      # 0xfc78
callq 0x20e0
movq $0x0, 0xa081(%rip) # 0xfc78
jmp 0x5c70
xorl %ebx, %ebx
cmpq $0x0, 0x87ad(%rip)      # 0xe3b0
je 0x5c70
cmpb $0x0, 0x97d0(%rip)      # 0xf3dc
jne 0x5c2e
callq 0x2380
imull $0xaaaaaaab, %eax, %eax # imm = 0xAAAAAAAB
addl $0x2aaaaaaa, %eax       # imm = 0x2AAAAAAA
cmpl $0x55555554, %eax       # imm = 0x55555554
ja 0x5c70
cmpl $0x0, 0x9794(%rip)      # 0xf3c0
jle 0x5c70
callq 0x2380
cltd
idivl 0x9786(%rip)            # 0xf3c0
movl %edx, %ebx
movq 0x876d(%rip), %rdi      # 0xe3b0
xorl %esi, %esi
xorl %edx, %edx
callq 0x2270
testl %ebx, %ebx
js 0x5c70
movq 0x8759(%rip), %rdi      # 0xe3b0
xorl %esi, %esi
callq 0x6183
testl %eax, %eax
jne 0x5c70
leal -0x1(%rbx), %eax
testl %ebx, %ebx
movl %eax, %ebx
jg 0x5c50
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %ebx
je 0x5c8b
leaq 0x5b20(%rip), %rdi      # 0xb79c
callq 0x3890
callq 0x536c
callq 0x7416
leaq 0x5b35(%rip), %rdi      # 0xb7c7
callq 0x3890
callq 0x744f
leaq 0x976d(%rip), %rdi      # 0xf410
callq 0x7398
movl $0x8, %eax
movl %eax, 0x9d3d(%rip)      # 0xf9f0
movl %eax, 0x9d33(%rip)      # 0xf9ec
callq 0x756a
xorl %eax, %eax
leaq 0x97d9(%rip), %rcx      # 0xf4a0
testb $0xf, 0x2(%rax,%rcx)
je 0x5ce1
addq $0x4, %rax
cmpq $0x144, %rax            # imm = 0x144
jne 0x5cc7
movl $0x1, %ecx
jmp 0x5cec
xorl %ecx, %ecx
cmpq $0x144, %rax            # imm = 0x144
sete %cl
movl %ecx, 0x9fee(%rip)      # 0xfce0
movl $0xffffffff, 0x8650(%rip) # imm = 0xFFFFFFFF
leaq 0x9fd5(%rip), %rdi      # 0xfcd8
popq %rbx
jmp 0x2250
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: exblock
static
void
exblock (int block, int el, int (*idx_fn)(int, int))
{
    int i, idx, mask;

    /* By assumption, all unknown squares in the block appear in the
     * same row/column, so to construct a mask for these squares, it
     * is sufficient to invert the mask for the known squares in the
     * block.
     */
    mask = 0;
    for (i = 0; i < 9; ++i) {
        idx = idx_block(block, i);
        if (!IS_EMPTY(idx)) {
            mask |= DIGIT_STATE(DIGIT(idx));
        }
    }
    exmask(mask ^ STATE_MASK, block, el, idx_fn);
}

// Assembly:
pushq %rbx
movq %rdx, %rax
movl %esi, %edx
movl %edi, %esi
movslq %edi, %rcx
imulq $0x55555556, %rcx, %rdi # imm = 0x55555556
movq %rdi, %r8
shrq $0x3f, %r8
shrq $0x20, %rdi
addl %r8d, %edi
leal (%rdi,%rdi,2), %edi
leal (%rcx,%rcx,8), %r8d
subl %edi, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %r8d
xorl %edi, %edi
movl $0xaaaaaaab, %r9d       # imm = 0xAAAAAAAB
leaq 0x9561(%rip), %r10      # 0xf4a0
xorl %r11d, %r11d
movl %r11d, %ecx
imulq %r9, %rcx
shrq $0x21, %rcx
leal (%rcx,%rcx,2), %ecx
leal (%r8,%rcx,2), %ecx
addl %r11d, %ecx
movslq %ecx, %rcx
movzwl 0x2(%r10,%rcx,4), %ecx
andl $0xf, %ecx
movl $0x40, %ebx
shll %cl, %ebx
testl %ecx, %ecx
cmovel %ecx, %ebx
orl %ebx, %edi
incl %r11d
cmpl $0x9, %r11d
jne 0x5f42
xorl $0xff80, %edi           # imm = 0xFF80
movq %rax, %rcx
popq %rbx
jmp 0x5f86
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: exmask
static
void
exmask (int mask, int block, int el, int (*idx_fn)(int, int))
{
    int i, idx;

    for (i = 0; i < 9; ++i) {
        idx = (*idx_fn)(el, i);
        if (block != BLOCK(idx) && IS_EMPTY(idx)) {
            board[idx] |= mask;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
xorl %r12d, %r12d
leaq 0x94fa(%rip), %r13      # 0xf4a0
movl %ebp, %edi
movl %r12d, %esi
callq *%rbx
cltq
imulq $0x4bda12f7, %rax, %rcx # imm = 0x4BDA12F7
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
sarl $0x3, %ecx
addl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
imulq $0x38e38e39, %rax, %rdx # imm = 0x38E38E39
movq %rdx, %rsi
shrq $0x3f, %rsi
shrq $0x20, %rdx
sarl %edx
addl %esi, %edx
leal (%rdx,%rdx,8), %edx
movl %eax, %esi
subl %edx, %esi
movslq %esi, %rdx
imulq $0x55555556, %rdx, %rdx # imm = 0x55555556
movq %rdx, %rsi
shrq $0x3f, %rsi
shrq $0x20, %rdx
addl %esi, %edx
addl %ecx, %edx
cmpl %r14d, %edx
je 0x6019
movl (%r13,%rax,4), %ecx
testl $0xf0000, %ecx          # imm = 0xF0000
jne 0x6019
orl %r15d, %ecx
movl %ecx, (%r13,%rax,4)
incl %r12d
cmpl $0x9, %r12d
jne 0x5fa6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: update
static
void
update (int idx)
{
    const int row = ROW(idx);
    const int col = COLUMN(idx);
    const int block = IDX_BLOCK(row, col);
    const int mask = DIGIT_STATE(DIGIT(idx));
    int i;

    board[idx] |= STATE_MASK;  /* filled - no choice possible */

    /* Digit cannot appear in row, column or block */
    for (i = 0; i < 9; ++i) {
        board[idx_row(row, i)] |= mask;
        board[idx_column(col, i)] |= mask;
        board[idx_block(block, i)] |= mask;
    }
}

// Assembly:
movslq %edi, %rax
imulq $0x38e38e39, %rax, %rcx # imm = 0x38E38E39
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x20, %rcx
sarl %ecx
addl %edx, %ecx
leal (%rcx,%rcx,8), %ecx
movl %eax, %edx
subl %ecx, %edx
imulq $0x4bda12f7, %rax, %rdi # imm = 0x4BDA12F7
movq %rdi, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rdi
sarl $0x3, %edi
addl %ecx, %edi
leal (%rdi,%rdi,2), %r10d
movslq %edx, %r9
imulq $0x55555556, %r9, %r8   # imm = 0x55555556
movq %r8, %rcx
shrq $0x3f, %rcx
shrq $0x20, %r8
addl %ecx, %r8d
leaq 0x9415(%rip), %rdx      # 0xf4a0
movl (%rdx,%rax,4), %r11d
movl %r11d, %ecx
shrl $0x10, %ecx
andb $0xf, %cl
movl $0x40, %esi
shll %cl, %esi
addl %r8d, %r10d
orl $0xff80, %r11d          # imm = 0xFF80
movl %r11d, (%rdx,%rax,4)
movslq %r10d, %r10
imulq $0x55555556, %r10, %rcx # imm = 0x55555556
movq %rcx, %r11
shrq $0x3f, %r11
shrq $0x20, %rcx
addl %r11d, %ecx
leal (%rcx,%rcx,2), %ecx
subl %ecx, %r10d
shlq $0x2, %rax
leaq (,%r9,4), %rcx
subq %rcx, %rax
leaq (%rdx,%r9,4), %rcx
leal (%rdi,%rdi,8), %edi
leal (%rdi,%rdi,2), %r9d
leal (%r8,%r8,8), %edi
addl %r9d, %edi
addl %r10d, %r10d
leal (%r10,%r10,2), %r8d
subl %r8d, %edi
xorl %r8d, %r8d
movl $0xaaaaaaab, %r9d       # imm = 0xAAAAAAAB
movl %r8d, %r10d
imulq %r9, %r10
shrq $0x21, %r10
leal (%r10,%r10,2), %r10d
leal (%rdi,%r10,2), %r10d
leaq (%rax,%r8,4), %r11
orl %esi, (%rdx,%r11)
orl %esi, (%rcx)
addl %r8d, %r10d
movslq %r10d, %r10
orl %esi, (%rdx,%r10,4)
incq %r8
addq $0x24, %rcx
cmpq $0x9, %r8
jne 0x60ff
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: move_to
static
void
move_to (int x, int y)
{
    curx = x;
    cury = y;

    move(TOP + 1 + y + y / 3,
         LEFT + 2 + 2 * (x + x / 3));

    wrefresh(stdscr);
}

// Assembly:
pushq %rbx
movl %edi, 0x98b1(%rip)      # 0xf9ec
movl %esi, 0x98af(%rip)      # 0xf9f0
movq 0x7e90(%rip), %rbx      # 0xdfd8
movq (%rbx), %rax
movl %esi, %ecx
movl $0xaaaaaaab, %edx       # imm = 0xAAAAAAAB
imulq %rdx, %rcx
shrq $0x21, %rcx
addl %ecx, %esi
addl $0x7, %esi
movl %edi, %ecx
imulq %rdx, %rcx
shrq $0x21, %rcx
addl %edi, %ecx
leal 0x1d(,%rcx,2), %edx
movq %rax, %rdi
callq 0x22d0
movq (%rbx), %rdi
popq %rbx
jmp 0x2180
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: tgets
static
char *
tgets (char *   str,
       int      n,
       FILE *    stream)
{
    char * ret = 0;
    if (stream == &default_template_file) {
        int i = 0;
        if (str != 0
            && n > 0
            && default_template_siz > default_template_pos
            && default_template_pos >= 0) {
            char ch = 0;
            while (default_template_pos < default_template_siz
                   && n > i) {
                unsigned char ci = default_template[default_template_pos >> 2];
                int j = (default_template_pos++ & 3);
                if (j > 0) {
                    ci >>= 2 * j;
                }
                ch = dtct[ci & 3];
                str[i++] = ch;
                if (ch == '\n') {
                    break;
                }
            }
            if (i < n) {
                str[i++] = 0;
                ret = str;
            } else if (i == n && 0 < n) {
                str[n - 1] = 0;
                ret = str;
            }
        }
    } else {
        ret = fgets (str,
                     n,
                     stream);
    }
    return ret;
}

// Assembly:
pushq %rbx
leaq 0x96a5(%rip), %rax      # 0xfb98
cmpq %rax, %rdi
je 0x650d
movq %rdi, %rdx
leaq 0x94fe(%rip), %rdi      # 0xfa00
movl $0x50, %esi
popq %rbx
jmp 0x21f0
movb 0x975d(%rip), %cl       # 0xfc70
xorl %eax, %eax
cmpb $0x1, %cl
jne 0x65c9
cmpl $0x5dcb, 0x974c(%rip)   # imm = 0x5DCB
ja 0x65c9
xorl %edx, %edx
testb %cl, %cl
movl $0x5dcc, %esi           # imm = 0x5DCC
cmovel %edx, %esi
movl 0x9734(%rip), %edi      # 0xfc74
leaq 0x2c79(%rip), %r8       # 0x91c0
leaq 0x56a7(%rip), %r9       # 0xbbf5
leaq 0x94ab(%rip), %rax      # 0xfa00
leaq (%rdi,%rdx), %r10
cmpl %esi, %r10d
jge 0x65a4
cmpq $0x4f, %rdx
ja 0x65a4
movl %r10d, %ecx
sarl $0x2, %ecx
movslq %ecx, %rcx
movzbl (%rcx,%r8), %r11d
leal (%rdi,%rdx), %ecx
incl %ecx
movl %ecx, 0x96f7(%rip)      # 0xfc74
andl $0x3, %r10d
leal (%r10,%r10), %ecx
movl %r11d, %ebx
shrl %cl, %ebx
testl %r10d, %r10d
cmovel %r11d, %ebx
andl $0x3, %ebx
movb (%rbx,%r9), %cl
movb %cl, (%rdx,%rax)
incq %rdx
cmpq $0x2, %rbx
jne 0x6555
cmpl $0x4f, %edx
jg 0x65b9
movslq %edx, %rcx
leaq 0x944d(%rip), %rax      # 0xfa00
movb $0x0, (%rcx,%rax)
jmp 0x65c9
cmpl $0x50, %edx
jne 0x65c7
movb $0x0, 0x948a(%rip)      # 0xfa4f
jmp 0x65c9
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: fill
static
int
fill (int idx, int digit)
{
    assert(0 != digit);

    if (!IS_EMPTY(idx)) {
        return (DIGIT(idx) == digit) ? 0 : -1;
    }
    if (DISALLOWED(idx, digit)) {
        return -1;
    }

    board[idx] = SET_DIGIT(digit);
    update(idx);
    add_move(idx, digit, 0);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testl %esi, %esi
je 0x662f
movl %esi, %ebx
movslq %edi, %r14
leaq 0x8ec1(%rip), %rax      # 0xf4a0
movl (%rax,%r14,4), %ecx
movl %ecx, %edx
shrl $0x10, %edx
andl $0xf, %edx
je 0x65f9
xorl %ebp, %ebp
cmpl %ebx, %edx
setne %bpl
negl %ebp
jmp 0x6628
leal 0x6(%rbx), %edx
movzbl %dl, %edx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
btl %edx, %ecx
jb 0x6628
movl %ebx, %ecx
shll $0x10, %ecx
movl %ecx, (%rax,%r14,4)
movl %r14d, %edi
callq 0x6031
xorl %ebp, %ebp
movl %r14d, %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0x664e
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x46a8(%rip), %rdi      # 0xacde
leaq 0x437d(%rip), %rsi      # 0xa9ba
leaq 0x46a5(%rip), %rcx      # 0xace9
movl $0x3a8, %edx            # imm = 0x3A8
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: add_move
static
void
add_move (int idx, int digit, int choice)
{
    int i;

    if (sizeof(history) / sizeof(int) - 1 <= idx_history) {
        compress(81);
    }
    /* Never ignore the last move */
    history[idx_history++] = SET_INDEX(idx) | SET_DIGIT(digit) | choice;

    /* Ignore all previous references to idx */
    for (i = idx_history - 2; 0 <= i; --i) {
        if (GET_INDEX(history[i]) == idx) {
            history[i] |= IGNORED;
            break;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %ebx
cmpl $0xf2, 0x8fb1(%rip)     # 0xf614
jb 0x666f
movl $0x51, %edi
callq 0x66b6
shll $0x10, %r14d
orl %ebx, %ebp
orl %r14d, %ebp
movl 0x8f96(%rip), %eax      # 0xf614
leal 0x1(%rax), %ecx
movl %ecx, 0x8f8d(%rip)      # 0xf614
movslq %eax, %rdx
leaq 0x8f8f(%rip), %rcx      # 0xf620
movl %ebp, (%rcx,%rdx,4)
testl %eax, %eax
jle 0x66b1
movl -0x4(%rcx,%rax,4), %edx
decq %rax
movl %edx, %esi
andl $0x7f, %esi
cmpl %ebx, %esi
jne 0x6694
orl $0x400000, %edx         # imm = 0x400000
movl %edx, (%rcx,%rax,4)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: compress
static
void
compress(int limit)
{
    int i, j, k;
    /* Find the first ignored history item, if there is any. */
    for (k = 0; k < idx_history; ++k) {
        if (0 != (history[k] & IGNORED)) {
            break;
        }
    }
    /* Move the rest to compress the history */
    for (i = j = k; i < idx_history && j < limit; ++i) {
        if (!(history[i] & IGNORED)) {
            history[j++] = history[i];
        }
    }
    for (; i < idx_history; ++i) {
        history[j++] = history[i];
    }
    idx_history = j;
}

// Assembly:
movl 0x8f58(%rip), %eax      # 0xf614
leaq 0x8f5d(%rip), %rcx      # 0xf620
xorl %edx, %edx
testl %eax, %eax
jle 0x66e0
movq %rcx, %rsi
testb $0x40, 0x2(%rsi)
jne 0x66e0
incq %rdx
addq $0x4, %rsi
cmpq %rdx, %rax
jne 0x66cc
movl %eax, %edx
cmpl %eax, %edx
setge %sil
cmpl %edi, %edx
setge %r8b
orb %sil, %r8b
jne 0x671c
movl %edx, %esi
leaq (%rcx,%rsi,4), %r8
movl %edx, %esi
movl (%r8), %r9d
btl $0x16, %r9d
jb 0x670c
movslq %esi, %r10
incl %esi
movl %r9d, (%rcx,%r10,4)
incl %edx
cmpl %edx, %eax
jle 0x671e
addq $0x4, %r8
cmpl %edi, %esi
jl 0x66f9
jmp 0x671e
movl %edx, %esi
cmpl %eax, %edx
jge 0x6755
movslq %esi, %rdi
movl %edx, %edx
leaq (,%rdx,4), %r9
shlq $0x2, %rdi
xorl %r8d, %r8d
leaq (%r9,%r8,4), %r10
movl (%rcx,%r10), %r10d
leaq (%rdi,%r8,4), %r11
movl %r10d, (%rcx,%r11)
incq %r8
leal (%rdx,%r8), %r10d
cmpl %r10d, %eax
jg 0x6736
addl %r8d, %esi
movl %esi, 0x8eb9(%rip)      # 0xf614
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: solve
static
int
solve (void)
{
    int idx;

    for (;;) {
        if (0 == deterministic()) {
            /* Solved, make a new choice, or rewind a previous choice */
            idx = choice();
            if (-1 == idx) {
                idx = 0;
                break;
            } else if ((idx < 0 || -1 == choose(idx, 1))
                       && -1 == backtrack()) {
                idx = -1;
                break;
            }
        } else {
            /* rewind to a previous choice */
            if (-1 == backtrack()) {
                idx = -1;
                break;
            }
        }
    }
    return idx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x7a92(%rip), %rbx      # 0xe200
leaq 0x8d2b(%rip), %r12      # 0xf4a0
leaq 0x8cf4(%rip), %r13      # 0xf470
leaq 0xaec(%rip), %r14       # 0x726f
callq 0x6a76
movl %eax, %r15d
testl %eax, %eax
jle 0x67cd
incl 0x93ff(%rip)            # 0xfb94
cmpl $0x1, %r15d
adcl $0x0, %r15d
shlq $0x2, %r15
xorl %ebp, %ebp
movl (%rbp,%rbx), %esi
movl %esi, %edi
andl $0x7f, %edi
shrl $0x10, %esi
andl $0xf, %esi
callq 0x65cb
cmpl $-0x1, %eax
je 0x67c7
addq $0x4, %rbp
cmpq %rbp, %r15
jne 0x67a3
jmp 0x6783
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testl %r15d, %r15d
je 0x67e1
callq 0x68a1
cmpl $-0x1, %eax
jne 0x6783
jmp 0x6889
xorl %ecx, %ecx
xorl %eax, %eax
movl (%r12,%rcx,4), %esi
testl $0xf0000, %esi          # imm = 0xF0000
jne 0x682d
xorl %edi, %edi
movl $0x7, %r8d
xorl %edx, %edx
btl %r8d, %esi
jae 0x6805
incl %edx
jmp 0x6809
incl (%rdi,%r13)
addq $0x4, %rdi
incl %r8d
cmpq $0x24, %rdi
jne 0x67fb
movl %edx, %esi
shll $0x10, %esi
addl %ecx, %esi
movslq %eax, %rdi
movl %esi, (%rbx,%rdi,4)
andl $0xf, %edx
cmpl $0x9, %edx
je 0x6858
incl %eax
incq %rcx
cmpq $0x51, %rcx
jne 0x67e5
testl %eax, %eax
je 0x685f
movslq %eax, %rsi
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x2070
movl 0x79ad(%rip), %edi      # 0xe200
andl $0x7f, %edi
jmp 0x6864
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
jmp 0x6864
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
cmpl $-0x1, %edi
je 0x6890
testl %edi, %edi
js 0x67d2
movl $0x1, %esi
callq 0x6a18
cmpl $-0x1, %eax
jne 0x6783
jmp 0x67d2
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x6892
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: backtrack
static
int
backtrack (void)
{
    int digit, idx;

    for (; 0 < --idx_history;) {
        if (history[idx_history] & CHOICE) {
            /* Remember the last choice, and advance */
            idx = GET_INDEX(history[idx_history]);
            digit = GET_DIGIT(history[idx_history]) + 1;
            reapply();
            if (-1 != choose(idx, digit)) {
                return idx;
            }
        }
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl 0x8d69(%rip), %ecx      # 0xf614
leal -0x1(%rcx), %eax
movl %eax, 0x8d60(%rip)      # 0xf614
cmpl $0x2, %ecx
jl 0x6900
leaq 0x8d60(%rip), %r14      # 0xf620
movl %eax, %eax
movl (%r14,%rax,4), %ebp
btl $0x15, %ebp
jae 0x68ec
movl %ebp, %ebx
andl $0x7f, %ebx
shrl $0x10, %ebp
andl $0xf, %ebp
incl %ebp
callq 0x32e2
movl %ebx, %edi
movl %ebp, %esi
callq 0x6a18
cmpl $-0x1, %eax
jne 0x6905
movl 0x8d22(%rip), %ecx      # 0xf614
leal -0x1(%rcx), %eax
movl %eax, 0x8d19(%rip)      # 0xf614
cmpl $0x1, %ecx
jg 0x68c0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: classify
static
const char *
classify (void)
{
    int i, score;

    pass = 0;
    clear_moves();
    if (-1 == solve()) {
        return 0;
    }

    score = 81;
    for (i = 0; i < 81; ++i) {
        if (IS_FIXED(i)) {
            --score;
        }
    }
    assert(81 == idx_history);

    for (i = 0; i < 81; ++i) {
        if (history[i] & CHOICE) {
            score -= 5;
        }
    }
    return  class_name_by_score(score);
}

// Assembly:
pushq %rax
movl $0x0, 0x927d(%rip)      # 0xfb94
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x8cfd(%rip), %rcx      # 0xf620
incl %eax
testb $0x10, 0x2(%rcx)
leaq 0x4(%rcx), %rcx
jne 0x6923
movl %eax, 0x8cdf(%rip)      # 0xf614
callq 0x32e2
callq 0x675c
cmpl $-0x1, %eax
je 0x69b3
movl $0x51, %eax
xorl %ecx, %ecx
leaq 0x8b4e(%rip), %rdx      # 0xf4a0
movl (%rcx,%rdx), %esi
shll $0xb, %esi
sarl $0x1f, %esi
addl %esi, %eax
addq $0x4, %rcx
cmpq $0x144, %rcx            # imm = 0x144
jne 0x6952
cmpl $0x51, 0x8ca3(%rip)     # 0xf614
jne 0x69f9
xorl %ecx, %ecx
leaq 0x8ca0(%rip), %rdx      # 0xf620
movl %eax, %esi
leal -0x5(%rsi), %eax
testb $0x20, 0x2(%rcx,%rdx)
cmovel %esi, %eax
addq $0x4, %rcx
cmpq $0x144, %rcx            # imm = 0x144
jne 0x6980
movl 0x91f4(%rip), %ecx      # 0xfb94
leal (%rcx,%rcx,4), %edx
leal (%rdx,%rdx,2), %edx
cmpl %eax, %edx
jge 0x69b7
leaq 0x434b(%rip), %rax      # 0xacfc
jmp 0x69f7
xorl %eax, %eax
jmp 0x69f7
leal (%rcx,%rcx,4), %edx
leal (%rcx,%rdx,2), %edx
cmpl %eax, %edx
jge 0x69ca
leaq 0x4339(%rip), %rax      # 0xad01
jmp 0x69f7
leal (,%rcx,8), %edx
subl %ecx, %edx
cmpl %eax, %edx
jge 0x69e0
leaq 0x4328(%rip), %rax      # 0xad06
jmp 0x69f7
shll $0x2, %ecx
cmpl %eax, %ecx
leaq 0x4321(%rip), %rcx      # 0xad0d
leaq 0x431f(%rip), %rax      # 0xad12
cmovlq %rcx, %rax
popq %rcx
retq
leaq 0x47bc(%rip), %rdi      # 0xb1bc
leaq 0x3fb3(%rip), %rsi      # 0xa9ba
leaq 0x47c0(%rip), %rcx      # 0xb1ce
movl $0x7df, %edx            # imm = 0x7DF
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: choose
static
int
choose (int idx, int digit)
{
    for (; digit <= 9; ++digit) {
        if (!DISALLOWED(idx, digit)) {
            board[idx] = SET_DIGIT(digit);
            update(idx);
            add_move(idx, digit, CHOICE);
            return digit;
        }
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0x9, %esi
jg 0x6a4e
movl %esi, %ebx
movl %edi, %ebp
movl %edi, %eax
leaq 0x8a73(%rip), %rdx      # 0xf4a0
movl (%rdx,%rax,4), %edi
shll $0x10, %esi
movl %edi, %r8d
movl %ebx, %ecx
shrl %cl, %r8d
testb $0x40, %r8b
je 0x6a55
incl %ebx
addl $0x10000, %esi          # imm = 0x10000
cmpl $0xa, %ebx
jne 0x6a33
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x6a6d
movl %esi, (%rdx,%rax,4)
movl %ebp, %edi
callq 0x6031
movl %ebp, %edi
movl %ebx, %esi
movl $0x200000, %edx         # imm = 0x200000
callq 0x664e
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: rotate
static
void
rotate (int * a, int len, int idx)
{
    int xdi = len - idx;
    int delta = idx - xdi;

    while (0 != delta && 0 != idx) {
        if (delta < 0) {
            if (1 == idx) {
                rotate1_left(a, len);
                idx = 0;
            } else {
                exchange(a, a + xdi, idx);
                len = xdi;
            }
        } else {
            /* 0 < delta */
            if (1 == xdi) {
                rotate1_right(a, len);
                idx = 0;
            } else {
                exchange(a, a + idx, xdi);
                a += xdi;
                len = idx;
                idx -= xdi;
            }
        }
        xdi = len - idx;
        delta = idx - xdi;
    }
    if (0 < idx) {
        exchange(a, a + idx, idx);
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, %eax
subl %edx, %eax
movl %edx, %ecx
subl %eax, %ecx
sete %sil
testl %edx, %edx
sete %dil
orb %sil, %dil
jne 0x7373
testl %ecx, %ecx
js 0x72d9
cmpl $0x1, %eax
jne 0x7305
movslq %r14d, %rax
movl -0x4(%rbx,%rax,4), %eax
cmpl $0x2, %r14d
jl 0x72d5
leal -0x1(%r14), %ecx
movl %ecx, %ecx
incq %rcx
movl -0x8(%rbx,%rcx,4), %edx
movl %edx, -0x4(%rbx,%rcx,4)
decq %rcx
cmpq $0x1, %rcx
jg 0x72c4
movl %eax, (%rbx)
jmp 0x7301
cmpl $0x1, %edx
jne 0x7338
movl (%rbx), %ebp
cmpl $0x2, %r14d
jl 0x72fa
leaq 0x4(%rbx), %rsi
leal -0x1(%r14), %edx
shlq $0x2, %rdx
movq %rbx, %rdi
callq 0x2280
movslq %r14d, %rax
movl %ebp, -0x4(%rbx,%rax,4)
xorl %edx, %edx
jmp 0x7360
jl 0x732a
movslq %edx, %rcx
leaq (%rbx,%rcx,4), %rcx
movl %eax, %esi
xorl %edi, %edi
movl (%rbx,%rdi,4), %r8d
movl (%rcx,%rdi,4), %r9d
movl %r9d, (%rbx,%rdi,4)
movl %r8d, (%rcx,%rdi,4)
incq %rdi
cmpq %rdi, %rsi
jne 0x7312
movslq %eax, %rcx
leaq (%rbx,%rcx,4), %rbx
movl %edx, %r14d
subl %eax, %edx
jmp 0x7360
jl 0x735d
movslq %eax, %rcx
leaq (%rbx,%rcx,4), %rcx
movl %edx, %esi
xorl %edi, %edi
movl (%rbx,%rdi,4), %r8d
movl (%rcx,%rdi,4), %r9d
movl %r9d, (%rbx,%rdi,4)
movl %r8d, (%rcx,%rdi,4)
incq %rdi
cmpq %rdi, %rsi
jne 0x7345
movl %eax, %r14d
movl %r14d, %eax
subl %edx, %eax
movl %edx, %ecx
subl %eax, %ecx
je 0x7373
testl %edx, %edx
jne 0x72a5
testl %edx, %edx
jle 0x7393
movl %edx, %eax
leaq (%rbx,%rax,4), %rcx
xorl %edx, %edx
movl (%rbx,%rdx,4), %esi
movl (%rcx,%rdx,4), %edi
movl %edi, (%rbx,%rdx,4)
movl %esi, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x737f
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: write_title
static
void
write_title(const char * title)
{
    move(TITLE_LINE, LEFT_LEFT);
    wclrtoeol(stdscr);
    if (0 != title) {
        mvaddstr(TITLE_LINE,
                 (int)((LINE_SIZE - strlen(title)) / 2),
                 title);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x6c31(%rip), %r15      # 0xdfd8
movq (%r15), %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x22d0
movq (%r15), %rdi
callq 0x22e0
testq %rbx, %rbx
je 0x7400
movq (%r15), %r14
movq %rbx, %rdi
callq 0x2100
movl $0x50, %edx
subq %rax, %rdx
shrq %rdx
movq %r14, %rdi
movl $0x4, %esi
callq 0x22d0
cmpl $-0x1, %eax
je 0x7400
movq (%r15), %rdi
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %r15
jmp 0x2360
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: clear_status
static
void
clear_status (void)
{
    move(STATUS_LINE, LEFT_LEFT);
    wclrtoeol(stdscr);
    move_to(curx, cury);
    have_status = 0;
}

// Assembly:
pushq %rbx
movq 0x6bba(%rip), %rbx      # 0xdfd8
movq (%rbx), %rdi
movl $0x14, %esi
xorl %edx, %edx
callq 0x22d0
movq (%rbx), %rdi
callq 0x22e0
movl 0x85b1(%rip), %edi      # 0xf9ec
movl 0x85af(%rip), %esi      # 0xf9f0
callq 0x6134
movb $0x0, 0x85a7(%rip)      # 0xf9f4
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: render
static
void
render (void)
{
    int i, x, y;

    for (i = 0; i < 81; ++i) {
        x = LEFT + 2 + 2 * (COLUMN(i) + COLUMN(i) / 3);
        y = TOP + 1 + ROW(i) + ROW(i) / 3;
        assert(0 <= DIGIT(i));
        assert(DIGIT(i) <= 9); /* XXX FAILING */
        if (IS_FIXED(i)) {
            attron(A_BOLD);
        }
        if (IS_EMPTY(i)) {
            mvaddch(y, x, '.');
        } else {
            mvaddch(y, x, '0' + DIGIT(i));
        }
        if (IS_FIXED(i)) {
            attroff(A_BOLD);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x8042(%rip), %rbx      # 0xf4a0
xorl %r14d, %r14d
movl $0xaaaaaaab, %r15d      # imm = 0xAAAAAAAB
movq 0x6b6a(%rip), %r12      # 0xdfd8
movl (%rbx), %eax
movl %eax, %ecx
andl $0xe0000, %ecx          # imm = 0xE0000
cmpl $0xa0000, %ecx          # imm = 0xA0000
jae 0x754b
btl $0x14, %eax
jae 0x749a
movq (%r12), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x21d0
movl %r14d, %ecx
imulq $0x38e38e39, %rcx, %rax # imm = 0x38E38E39
shrq $0x21, %rax
leal (%rax,%rax,8), %edx
movl %r14d, %esi
subl %edx, %esi
movq %rsi, %rdx
imulq %r15, %rdx
shrq $0x21, %rdx
addl %esi, %edx
leal 0x1d(,%rdx,2), %edx
imulq $0x2f684bdb, %rcx, %rcx # imm = 0x2F684BDB
shrq $0x20, %rcx
movl %r14d, %esi
subl %ecx, %esi
shrl %esi
addl %ecx, %esi
shrl $0x4, %esi
addl %eax, %esi
addl $0x7, %esi
movl (%rbx), %ebp
movq (%r12), %rdi
callq 0x22d0
testl $0xf0000, %ebp          # imm = 0xF0000
je 0x7508
cmpl $-0x1, %eax
je 0x751b
movq (%r12), %rdi
movzwl 0x2(%rbx), %esi
andl $0xf, %esi
orl $0x30, %esi
jmp 0x7516
cmpl $-0x1, %eax
je 0x751b
movq (%r12), %rdi
movl $0x2e, %esi
callq 0x2300
testb $0x10, 0x2(%rbx)
je 0x7531
movq (%r12), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x2370
incq %r14
addq $0x4, %rbx
cmpq $0x51, %r14
jne 0x746e
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x42a3(%rip), %rdi      # 0xb7f5
leaq 0x3461(%rip), %rsi      # 0xa9ba
leaq 0x4283(%rip), %rcx      # 0xb7e3
movl $0x73c, %edx            # imm = 0x73C
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: move_next
void
static
move_next (void)
{
    int is_loop = 0;
    do {
        if (curx < 8) {
            move_to(curx + 1, cury);
        } else if (cury < 8) {
            move_to(0, cury + 1);
        } else {
            move_to(0, 0);
            if (is_loop++ > 0) {
                /* We can get here if the user attempts to load a fully
                 * populated board. In that case it's better to break.  */
                break;
            }
        }
     } while (IS_FIXED(INDEX(cury, curx)));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
leaq 0x7f26(%rip), %r14      # 0xf4a0
movq 0x6a57(%rip), %r15      # 0xdfd8
xorl %ebp, %ebp
movl 0x8463(%rip), %edi      # 0xf9ec
cmpl $0x7, %edi
jg 0x7598
incl %edi
movl 0x845a(%rip), %esi      # 0xf9f0
jmp 0x75a7
movl 0x8452(%rip), %esi      # 0xf9f0
cmpl $0x7, %esi
jg 0x75ae
incl %esi
xorl %edi, %edi
callq 0x6134
jmp 0x75da
movl %ebx, 0x8438(%rip)      # 0xf9ec
movl %ebx, 0x8436(%rip)      # 0xf9f0
movq (%r15), %rdi
movl $0x7, %esi
movl $0x1d, %edx
callq 0x22d0
movq (%r15), %rdi
callq 0x2180
testl %ebp, %ebp
jg 0x75f1
incl %ebp
movl 0x8410(%rip), %eax      # 0xf9f0
leal (%rax,%rax,8), %eax
addl 0x8403(%rip), %eax      # 0xf9ec
testb $0x10, 0x2(%r14,%rax,4)
jne 0x7583
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: getkey
static
int
getkey (void)
{
    int ch = wgetch(stdscr);
    if (0x1b == ch) {
        ch = wgetch(stdscr);
        if ('[' == ch) {
            ch = wgetch(stdscr);
            switch (ch) {
                case 'A': ch = VKEY_UP;     break;
                case 'B': ch = VKEY_DOWN;   break;
                case 'C': ch = VKEY_RIGHT;  break;
                case 'D': ch = VKEY_LEFT;   break;
                case 'H': ch = VKEY_HOME;   break;
                case '2': ch = VKEY_INSERT; break;
                case '3': ch = VKEY_DELETE; break;
                case '4': ch = VKEY_END;    break;
                case '5': ch = VKEY_PGUP;   break;
                case '6': ch = VKEY_PGDOWN; break;
                default:  ch = VKEY_IGNORE;
            }
            if (ch == VKEY_HOME ||
                ch == VKEY_DELETE ||
                ch == VKEY_INSERT ||
                ch == VKEY_END ||
                ch == VKEY_PGUP ||
                ch == VKEY_PGDOWN) {
                int ch4 = wgetch(stdscr);
                if (ch4 != '~') {
                    ch = VKEY_IGNORE;
                }
            }
        } else {
            /* Enabling the Esc Esc sequence to produce one Esc character */
            if (0x1b != ch) {
                ch = VKEY_IGNORE;
            }
        }
    }
    return ch;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x69d1(%rip), %r14      # 0xdfd8
movq (%r14), %rdi
callq 0x20a0
movl %eax, %ebx
cmpl $0x1b, %eax
jne 0x76c4
movq (%r14), %rdi
callq 0x20a0
cmpl $0x5b, %eax
jne 0x7650
movq (%r14), %rdi
callq 0x20a0
addl $-0x32, %eax
cmpl $0x16, %eax
ja 0x7684
leaq 0x1b1e(%rip), %rcx      # 0x915c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb $0x1, %al
movl $0x132, %ebx            # imm = 0x132
jmp 0x76ad
cmpl $0x1b, %eax
movl $0x100, %ebx            # imm = 0x100
cmovel %eax, %ebx
jmp 0x76c4
movb $0x1, %al
movl $0x134, %ebx            # imm = 0x134
jmp 0x76ad
movl $0x141, %ebx            # imm = 0x141
jmp 0x76ab
movb $0x1, %al
movl $0x133, %ebx            # imm = 0x133
jmp 0x76ad
movl $0x142, %ebx            # imm = 0x142
jmp 0x76ab
movl $0x143, %ebx            # imm = 0x143
jmp 0x76ab
movl $0x100, %ebx            # imm = 0x100
jmp 0x76ab
movb $0x1, %al
movl $0x135, %ebx            # imm = 0x135
jmp 0x76ad
movb $0x1, %al
movl $0x136, %ebx            # imm = 0x136
jmp 0x76ad
movb $0x1, %al
movl $0x148, %ebx            # imm = 0x148
jmp 0x76ad
movl $0x144, %ebx            # imm = 0x144
xorl %eax, %eax
testb %al, %al
je 0x76c4
movq (%r14), %rdi
callq 0x20a0
cmpl $0x7e, %eax
movl $0x100, %eax            # imm = 0x100
cmovnel %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: fix
static
int
fix (void)
{
    int i;

    if (0 == reapply()) {
        compress(idx_history);
        for (i = 0; i < idx_history; ++i) {
            history[i] |= FIXED;
        }
        reapply();
        render();
        if (idx_history < 81 && IS_FIXED(INDEX(cury, curx))) {
            move_next();
        } else {
            move_to(curx, cury);
        }
        return 0;
    } else {
        return -1;
    }
}

// Assembly:
pushq %rax
callq 0x32e2
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x775b
movl 0x7f2f(%rip), %edi      # 0xf614
callq 0x66b6
movslq 0x7f23(%rip), %rax      # 0xf614
testq %rax, %rax
jle 0x7711
shlq $0x2, %rax
xorl %ecx, %ecx
leaq 0x7f1d(%rip), %rdx      # 0xf620
orb $0x10, 0x2(%rcx,%rdx)
addq $0x4, %rcx
cmpq %rcx, %rax
jne 0x7703
callq 0x32e2
callq 0x744f
cmpl $0x50, 0x7ef2(%rip)     # 0xf614
jg 0x7741
movl 0x82c6(%rip), %eax      # 0xf9f0
leal (%rax,%rax,8), %eax
addl 0x82b9(%rip), %eax      # 0xf9ec
leaq 0x7d66(%rip), %rcx      # 0xf4a0
testb $0x10, 0x2(%rcx,%rax,4)
jne 0x7754
movl 0x82a5(%rip), %edi      # 0xf9ec
movl 0x82a3(%rip), %esi      # 0xf9f0
callq 0x6134
jmp 0x7759
callq 0x756a
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: status_message
static
void
status_message (const char * txt)
{
    beep();
    set_status(txt);
    usleep(2000000);
    clear_status();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x20d0
movq %rbx, %rdi
callq 0x3890
movl $0x1e8480, %edi         # imm = 0x1E8480
callq 0x23a0
popq %rbx
jmp 0x7416
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: get_filepath
static
void
get_filepath (char *            working_buffer,
              size_t            working_buffsize,
              const char *      default_name)
{
    char *          wbp = working_buffer;
    size_t          wbs = working_buffsize;
    const char *    dn  = default_name;
    /* Just for the sake of having shorter names. */
    assert (wbp != NULL && wbs > 0);
    if (wbp != NULL && wbs > 0) {

        if ('\0' == *wbp) {
            wbp[0] = '>';
            assert(dn != NULL && strlen(dn) < 6 + 3);
            if (0 == getcwd(wbp + 1,
                            (int)wbs - 1 - 1 - 6 - 3)) {
                /* The path is probably too long, use the filename alone. */
                strcpy(wbp + 1, dn);
            } else {
                if (dn != NULL) {
                    /* If the path would make it longer than the line length
                     * we can use just the filename. If the file name itself
                     * is too long, than we cannot avoid the wrap around, so
                     * it's better to be prepared for handling that.
                     */
                    if (strlen(wbp) + strlen(dn) > wbs) {
                        wbp[1] = '\0';
                    } else {
                        strcat(wbp, "/");
                    }
                    strcat(wbp, dn);
                }
            }
            wbp[wbs - 1] = '\0';
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x84a8
movq %rsi, %rbx
testq %rsi, %rsi
je 0x84a8
movq %rdi, %r14
cmpb $0x0, (%rdi)
jne 0x849e
movq %rdx, %r15
movb $0x3e, (%r14)
testq %rdx, %rdx
je 0x84c7
movq %r15, %rdi
callq 0x2100
cmpq $0x9, %rax
jae 0x84c7
leaq 0x1(%r14), %r12
leal -0xb(%rbx), %eax
movslq %eax, %rsi
movq %r12, %rdi
callq 0x21a0
testq %rax, %rax
je 0x8471
movq %r14, %rdi
callq 0x2100
movq %rax, %r13
movq %r15, %rdi
callq 0x2100
addq %r13, %rax
cmpq %rbx, %rax
jbe 0x847e
movb $0x0, (%r12)
jmp 0x848d
movq %r12, %rdi
movq %r15, %rsi
callq 0x2050
jmp 0x8498
movq %r14, %rdi
callq 0x2100
movw $0x2f, (%r14,%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2310
movb $0x0, -0x1(%r14,%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x35da(%rip), %rdi      # 0xba89
leaq 0x2504(%rip), %rsi      # 0xa9ba
leaq 0x35e3(%rip), %rcx      # 0xbaa0
movl $0xc5c, %edx            # imm = 0xC5C
callq 0x2160
leaq 0x3602(%rip), %rdi      # 0xbad0
leaq 0x24e5(%rip), %rsi      # 0xa9ba
leaq 0x35c4(%rip), %rcx      # 0xbaa0
movl $0xc61, %edx            # imm = 0xC61
callq 0x2160
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: el_show_actual_char
static
void
el_show_actual_char (edit_t *  ep)
{
    if (ep->m_0 <= ep->m_1 &&
        ep->m_1 <= ep->ecp &&
        ep->ecp <= ep->ecn) {

        int first_invisible = ep->m_1 + ep->x_mv;

        if (ep->ecp < first_invisible) {
            /* Display the character */
            mvaddch(ep->efy,
                    ep->ecp - ep->m_1 + ep->x_1,
                    ep->eb[ep->ecp]);
        } else {
            if (ep->ecp != first_invisible ||
                ep->eb[ep->ecp] != '\0') {
                /* This should never happen. */
                beep();
            }
        }
    } else {
        /* This should never happen. */
        beep();
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x40(%rdi), %eax
cmpl %eax, 0x3c(%rdi)
jg 0x8502
movq %rdi, %rbx
movslq 0x24(%rdi), %rdx
cmpl %eax, %edx
jl 0x8502
cmpl 0x20(%rbx), %edx
jle 0x850e
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x20d0
movl 0x38(%rbx), %ecx
addl %eax, %ecx
cmpl %ecx, %edx
jge 0x854d
movq 0x5aba(%rip), %r14      # 0xdfd8
movq (%r14), %rdi
movl 0x1c(%rbx), %esi
subl %eax, %edx
addl 0x2c(%rbx), %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x855a
movq (%r14), %rdi
movq (%rbx), %rax
movslq 0x24(%rbx), %rcx
movsbl (%rax,%rcx), %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2300
cmpl %ecx, %edx
jne 0x8502
movq (%rbx), %rax
cmpb $0x0, (%rax,%rdx)
jne 0x8502
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: el_highlight_in_overwrite_mode
static
void
el_highlight_in_overwrite_mode (edit_t *    ep)
{
    if (!ep->ins_mode) {
        /* Overwrite mode, highlight the character at the current position. */
        attron(A_BOLD);
        el_show_actual_char(ep);
        attroff(A_BOLD);
    }
}

// Assembly:
cmpl $0x0, 0x50(%rdi)
je 0x8569
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x5a61(%rip), %r14      # 0xdfd8
movq (%r14), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x21d0
movq %rbx, %rdi
callq 0x84e6
movq (%r14), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2370
// File: /workspace/github_c_makefile_star2_O1/cinemast[P]sudoku/sudoku.c
// Function: el_adjust_markers
static
void
el_adjust_markers (edit_t *   ep)
{
    int first_invisible = ep->m_1 + ep->x_mv;
    if (ep->m_0 == ep->m_1) {
        /* The first visible is the first editable character. */
        if (ep->prompt != ep->dprompt) {
            /* Show the default prompt if it is not shown yet. */
            ep->prompt = ep->dprompt;
            mvaddch(ep->efy, ep->x_0, ep->prompt);
        }
    } else {
        /* The first visible is not the first editable character. */
        if (ep->prompt != '<') {
            ep->prompt = '<';
            /* Show the '<' prompt. */
            mvaddch(ep->efy, ep->x_0, ep->prompt);
        }
    }
    if (ep->ecn > first_invisible) {
        /* The last visible is not the last editable character. */
        if (ep->eol_mark != '<') {
            ep->eol_mark = '<';
            mvaddch(ep->efy, ep->x_3, ep->eol_mark);
        }
    } else {
        if (ep->eol_mark != ' ') {
            ep->eol_mark = ' ';
            mvaddch(ep->efy, ep->x_3, ep->eol_mark);
        }
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x40(%rdi), %ecx
movl 0x38(%rdi), %ebp
addl %ecx, %ebp
movl 0x44(%rdi), %eax
cmpl %ecx, 0x3c(%rdi)
jne 0x85c6
movl 0x48(%rbx), %ecx
cmpl %ecx, %eax
je 0x85fe
movl %ecx, 0x44(%rbx)
jmp 0x85d2
cmpl $0x3c, %eax
je 0x85fe
movl $0x3c, 0x44(%rbx)
movq 0x59ff(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
movl 0x1c(%rbx), %esi
movl 0x28(%rbx), %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x85fe
movq 0x59e5(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
movl 0x44(%rbx), %esi
callq 0x2300
movl 0x4c(%rbx), %eax
cmpl %ebp, 0x20(%rbx)
jle 0x8614
cmpl $0x3c, %eax
je 0x8652
movl $0x3c, 0x4c(%rbx)
jmp 0x8620
cmpl $0x20, %eax
je 0x8652
movl $0x20, 0x4c(%rbx)
movq 0x59b1(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
movl 0x1c(%rbx), %esi
movl 0x34(%rbx), %edx
callq 0x22d0
cmpl $-0x1, %eax
je 0x8652
movq 0x5997(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
movl 0x4c(%rbx), %esi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2300
addq $0x8, %rsp
popq %rbx
popq %rbp
retq