// File: /workspace/github_c_makefile_star2_O3/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, %r13d
movq %rsi, %r14
movl %edi, %ebp
callq 0x2e47
movb $0x1, %bl
xorl %r15d, %r15d
leaq 0x96f5(%rip), %r12      # 0xf470
movl %r13d, 0x4(%rsp)
movl (%r12,%r15,4), %eax
testl %eax, %eax
jne 0x5dcb
leaq 0x1(%r15), %r13
xorl %r12d, %r12d
movl %ebp, %edi
movl %r12d, %esi
callq *%r14
cltq
leaq 0x9700(%rip), %rcx      # 0xf4a0
movzwl 0x2(%rcx,%rax,4), %eax
andl $0xf, %eax
cmpq %rax, %r13
je 0x5dbb
incl %r12d
cmpl $0x9, %r12d
jne 0x5d8f
jmp 0x5ef1
leaq 0x96ae(%rip), %r12      # 0xf470
movl (%r12,%r15,4), %eax
movl 0x4(%rsp), %r13d
cmpl $0x1, %eax
sete %al
movl 0x9689(%rip), %ecx      # 0xf460
cmpl $0x51, %ecx
setl %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x5e4b
movl $0x80, %ebx
movl %r15d, %ecx
shll %cl, %ebx
xorl %r12d, %r12d
movl %ebp, %edi
movl %r12d, %esi
callq *%r14
movslq %eax, %rcx
leaq 0x969d(%rip), %rdx      # 0xf4a0
testl %ebx, (%rdx,%rcx,4)
je 0x5e19
incl %r12d
cmpl $0x9, %r12d
jne 0x5df1
movl 0x9649(%rip), %ecx      # 0xf460
jmp 0x5e44
movl %r15d, %ecx
shll $0x10, %ecx
addl $0x10000, %ecx          # imm = 0x10000
orl %r13d, %eax
orl %ecx, %eax
movslq 0x962f(%rip), %rdx      # 0xf460
leal 0x1(%rdx), %ecx
movl %ecx, 0x9626(%rip)      # 0xf460
leaq 0x83bf(%rip), %rsi      # 0xe200
movl %eax, (%rsi,%rdx,4)
leaq 0x9625(%rip), %r12      # 0xf470
leaq 0x979e(%rip), %rax      # 0xf5f0
cmpl $0x8, (%rax,%r15,4)
jne 0x5ed5
cmpl $0x50, %ecx
jg 0x5ed5
movl %ebp, %edi
movl %r15d, %esi
callq *%r14
movslq %eax, %rcx
leaq 0x9630(%rip), %rdx      # 0xf4a0
movl (%rdx,%rcx,4), %esi
movl %esi, %edi
shrl $0x7, %edi
movl $0x1ff, %ecx            # imm = 0x1FF
andl %ecx, %edi
cmpl %ecx, %edi
je 0x5f08
xorl $0x1ff, %edi            # imm = 0x1FF
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %edx, %edx
movl %edi, %r8d
shrl %r8d
incl %ecx
addl $0x10000, %edx          # imm = 0x10000
cmpl $0x1, %edi
movl %r8d, %edi
ja 0x5e97
cmpl $0x8, %ecx
ja 0x5f08
shrl %cl, %esi
testb %sil, %sil
js 0x5f08
orl %r13d, %edx
orl %eax, %edx
movslq 0x959e(%rip), %rax      # 0xf460
leal 0x1(%rax), %ecx
movl %ecx, 0x9595(%rip)      # 0xf460
leaq 0x832e(%rip), %rcx      # 0xe200
movl %edx, (%rcx,%rax,4)
cmpq $0x8, %r15
leaq 0x1(%r15), %rax
setb %bl
movq %rax, %r15
cmpq $0x9, %rax
jne 0x5d80
xorl %eax, %eax
jmp 0x5ef9
movzbl %bl, %eax
andl $0x1, %eax
negl %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4d93(%rip), %rdi      # 0xaca2
leaq 0x4ae4(%rip), %rsi      # 0xa9fa
leaq 0x4dac(%rip), %rcx      # 0xacc9
movl $0x411, %edx            # imm = 0x411
callq 0x2160