// File: /workspace/github_c_makefile_star2_O2/cinemast[P]sudoku/sudoku.c
// Function: singles
static
int
singles (int el, int (*idx_fn)(int, int), int hintcode)
{
    int i;

    count_set_digits(el, idx_fn);

    for (i = 0; i < 9; ++i) {
        int c = i;
        if (0 == counts[c]) {
            /* No allowed position left for digit 'c+1' in the element. */
            int nd = 0;
            int j;
            for (j = 0; j < 9; ++j) {
                if (DIGIT((*idx_fn)(el, j)) == c + 1) {
                    /* The element already contains this digit */
                    ++nd;
                    break;
                }
            }
            if (nd == 0) {
                /* Contradiction found, this element can't have this  digit. */
                break;
            }
        }
        if (1 == counts[c] &&
            idx_possible < 81) {
            /* One allowed position left for digit 'c+1' in the element. */
            int j;
            for (j = 0; j < 9; ++j) {
                /* Let's find the place. */
                int idx = (*idx_fn)(el, j);
                if (!DISALLOWED(idx, c + 1)) {
                    possible[idx_possible++] = SET_INDEX(idx)
                                               | SET_DIGIT(c + 1)
                                               | hintcode;
                    /* We have found that single position, safe to break. */
                    break;
                }
            }
        }
        if (8 == digits[i] &&
            idx_possible < 81) {
            /* 8 digits are masked at this position - just one remaining */
            int idx = (*idx_fn)(el, i);
            int sta = (STATE_MASK & ~STATE(idx));
            int d = 0;
            /* Let's find the appropriate digit */
            for (sta >>= STATE_SHIFT + 1; 0 != sta; sta >>= 1) {
                ++d;
            }
            assert (0 < d && d < 10 && !DISALLOWED(idx, d));
            if (0 < d && d < 10) {
                /* It seems to be an appropriate digit */
                possible[idx_possible++] = SET_INDEX(idx)
                                            | SET_DIGIT(d)
                                            | hintcode;
            }
        }
    }
    return -(i < 9);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, 0x4(%rsp)
movq %rsi, %r14
movl %edi, %ebp
callq 0x2640
xorl %r15d, %r15d
leaq 0xa36f(%rip), %r13      # 0xf4a0
cmpq $0x9, %r15
je 0x5272
leaq 0xa32e(%rip), %rax      # 0xf470
movl (%rax,%r15,4), %eax
testl %eax, %eax
jne 0x5181
leaq 0x1(%r15), %rbx
xorl %r12d, %r12d
cmpl $0x9, %r12d
je 0x5272
movl %ebp, %edi
movl %r12d, %esi
callq *%r14
cltq
movzwl 0x2(%r13,%rax,4), %eax
andl $0xf, %eax
incl %r12d
cmpq %rax, %rbx
jne 0x5151
leaq 0xa2f3(%rip), %rax      # 0xf470
movl (%rax,%r15,4), %eax
cmpl $0x1, %eax
sete %al
movl 0xa2d3(%rip), %ecx      # 0xf460
cmpl $0x51, %ecx
setl %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x51f6
movl $0x80, %ebx
movl %r15d, %ecx
shll %cl, %ebx
xorl %r12d, %r12d
cmpl $0x9, %r12d
je 0x51f0
movl %ebp, %edi
movl %r12d, %esi
callq *%r14
movslq %eax, %rcx
incl %r12d
testl %ebx, (%r13,%rcx,4)
jne 0x51a7
movl %r15d, %ecx
shll $0x10, %ecx
addl $0x10000, %ecx          # imm = 0x10000
orl 0x4(%rsp), %eax
orl %ecx, %eax
movslq 0xa285(%rip), %rdx      # 0xf460
leal 0x1(%rdx), %ecx
movl %ecx, 0xa27c(%rip)      # 0xf460
leaq 0x9015(%rip), %rsi      # 0xe200
movl %eax, (%rsi,%rdx,4)
jmp 0x51f6
movl 0xa26a(%rip), %ecx      # 0xf460
leaq 0xa3f3(%rip), %rax      # 0xf5f0
cmpl $0x8, (%rax,%r15,4)
jne 0x526a
cmpl $0x50, %ecx
jg 0x526a
movl %ebp, %edi
movl %r15d, %esi
callq *%r14
movslq %eax, %rcx
movl (%r13,%rcx,4), %esi
movl %esi, %edi
notl %edi
shrl $0x7, %edi
andl $0x1ff, %edi            # imm = 0x1FF
xorl %edx, %edx
xorl %ecx, %ecx
testl %edi, %edi
je 0x523a
incl %ecx
shrl %edi
addl $0x10000, %edx          # imm = 0x10000
jmp 0x522a
leal -0x1(%rcx), %edi
cmpl $0x8, %edi
ja 0x5289
shrl %cl, %esi
testb $0x40, %sil
jne 0x5289
orl 0x4(%rsp), %edx
orl %eax, %edx
movslq 0xa209(%rip), %rax      # 0xf460
leal 0x1(%rax), %ecx
movl %ecx, 0xa200(%rip)      # 0xf460
leaq 0x8f99(%rip), %rcx      # 0xe200
movl %edx, (%rcx,%rax,4)
incq %r15
jmp 0x5131
xorl %eax, %eax
cmpq $0x9, %r15
sbbl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x49c2(%rip), %rdi      # 0x9c52
leaq 0x4713(%rip), %rsi      # 0x99aa
leaq 0x49db(%rip), %rcx      # 0x9c79
movl $0x411, %edx            # imm = 0x411
callq 0x2160