// File: /workspace/github_c_makefile_star2_O1/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 0x2dee
movb $0x1, %r13b
xorl %r15d, %r15d
leaq 0x9741(%rip), %rax      # 0xf470
cmpl $0x0, (%rax,%r15,4)
jne 0x5dad
movb %r13b, 0x3(%rsp)
leaq 0x1(%r15), %r13
xorl %r12d, %r12d
movl %ebp, %edi
xorl %esi, %esi
callq *%r14
cltq
leaq 0x974e(%rip), %rcx      # 0xf4a0
movzwl 0x2(%rcx,%rax,4), %ecx
andl $0xf, %ecx
movb $0x1, %al
cmpq %rcx, %r13
je 0x5da0
xorl %r12d, %r12d
movl %r12d, %ebx
cmpl $0x8, %r12d
je 0x5d94
leal 0x1(%rbx), %r12d
movl %ebp, %edi
movl %r12d, %esi
callq *%r14
cltq
leaq 0x971e(%rip), %rcx      # 0xf4a0
movzwl 0x2(%rcx,%rax,4), %eax
andl $0xf, %eax
cmpq %rax, %r13
jne 0x5d64
xorl %r12d, %r12d
jmp 0x5d9a
movl $0x2, %r12d
cmpl $0x8, %ebx
setb %al
testb %al, %al
movb 0x3(%rsp), %r13b
je 0x5eaa
leaq 0x96bc(%rip), %rax      # 0xf470
cmpl $0x1, (%rax,%r15,4)
jne 0x5e1f
cmpl $0x50, 0x969e(%rip)     # 0xf460
jg 0x5e1f
movl $0x80, %ebx
movl %r15d, %ecx
shll %cl, %ebx
xorl %r12d, %r12d
movl %ebp, %edi
movl %r12d, %esi
callq *%r14
movslq %eax, %rcx
leaq 0x96bd(%rip), %rdx      # 0xf4a0
testl %ebx, (%rdx,%rcx,4)
je 0x5df3
incl %r12d
cmpl $0x9, %r12d
jne 0x5dd1
jmp 0x5e1f
movl %r15d, %ecx
shll $0x10, %ecx
addl $0x10000, %ecx          # imm = 0x10000
orl 0x4(%rsp), %eax
orl %ecx, %eax
movslq 0x9654(%rip), %rcx      # 0xf460
leal 0x1(%rcx), %edx
movl %edx, 0x964b(%rip)      # 0xf460
leaq 0x83e4(%rip), %rdx      # 0xe200
movl %eax, (%rdx,%rcx,4)
xorl %r12d, %r12d
leaq 0x97c7(%rip), %rax      # 0xf5f0
cmpl $0x8, (%rax,%r15,4)
jne 0x5eaa
cmpl $0x50, 0x9629(%rip)     # 0xf460
jg 0x5eaa
movl %ebp, %edi
movl %r15d, %esi
callq *%r14
movslq %eax, %rcx
leaq 0x9655(%rip), %rdx      # 0xf4a0
movl (%rdx,%rcx,4), %edx
movl %edx, %esi
shrl $0x7, %esi
movl $0x1ff, %edi            # imm = 0x1FF
andl %edi, %esi
xorl %ecx, %ecx
cmpl %edi, %esi
je 0x5e75
xorl $0x1ff, %esi            # imm = 0x1FF
xorl %ecx, %ecx
movl %esi, %edi
incl %ecx
shrl %edi
cmpl $0x1, %esi
movl %edi, %esi
ja 0x5e6a
leal -0x1(%rcx), %esi
cmpl $0x8, %esi
ja 0x5ee0
shrl %cl, %edx
testb $0x40, %dl
jne 0x5ee0
shll $0x10, %ecx
orl 0x4(%rsp), %eax
orl %ecx, %eax
movslq 0x95cc(%rip), %rcx      # 0xf460
leal 0x1(%rcx), %edx
movl %edx, 0x95c3(%rip)      # 0xf460
leaq 0x835c(%rip), %rdx      # 0xe200
movl %eax, (%rdx,%rcx,4)
xorl %r12d, %r12d
testl %r12d, %r12d
jne 0x5ec8
cmpq $0x8, %r15
leaq 0x1(%r15), %rax
setb %r13b
movq %rax, %r15
cmpq $0x9, %rax
jne 0x5d28
movzbl %r13b, %eax
andl $0x1, %eax
negl %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4d7e(%rip), %rdi      # 0xac65
leaq 0x4acc(%rip), %rsi      # 0xa9ba
leaq 0x4d97(%rip), %rcx      # 0xac8c
movl $0x411, %edx            # imm = 0x411
callq 0x2160