// File: /workspace/github_c_makefile_star2_O0/kobolt[P]curses-collection/sudoku/sudoku.c
// Function: apply_next_guess
static int apply_next_guess(void)
{
  /* Restore to initial state, always. */
  memcpy(sudoku, sudoku_copy, sizeof(sudoku));

  if (guess_number == 0) {
    /* Possibly find inital empty spot. */
    while (1) {
      if (sudoku[guess_y][guess_x] > 0) {
        guess_x++;
        if (guess_x == 9) {
          guess_x = 0;
          guess_y++;
          if (guess_y == 9)
            return 0; /* Exhausted. */
        }
      } else {
        break;
      }
    }
  }

  /* Find next untried number. */
  do {
    guess_number++;
    if (guess_number == 10) {
      guess_number = 1;
      do {
        guess_x++;
        if (guess_x == 9) {
          guess_x = 0;
          guess_y++;
        }
      } while (sudoku[guess_y][guess_x] > 0 && guess_y < 9);
      if (guess_y == 9)
        return 0; /* Exhausted. */
    }
  } while (guess_is_not_possible());

  sudoku[guess_y][guess_x] = guess_number;
  display_update("Guessing...");
  usleep(10000);
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x32b1(%rip), %rdi      # 0x50e0
leaq 0x33fa(%rip), %rsi      # 0x5230
movl $0x144, %edx            # imm = 0x144
callq 0x10b0
cmpl $0x0, 0x33dd(%rip)      # 0x5224
jne 0x1ebd
jmp 0x1e4b
movslq 0x33da(%rip), %rcx      # 0x522c
leaq 0x3287(%rip), %rax      # 0x50e0
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movslq 0x33c1(%rip), %rcx      # 0x5228
cmpl $0x0, (%rax,%rcx,4)
jle 0x1eb7
movl 0x33b5(%rip), %eax      # 0x5228
addl $0x1, %eax
movl %eax, 0x33ac(%rip)      # 0x5228
cmpl $0x9, 0x33a5(%rip)      # 0x5228
jne 0x1eb5
movl $0x0, 0x3399(%rip)      # 0x5228
movl 0x3397(%rip), %eax      # 0x522c
addl $0x1, %eax
movl %eax, 0x338e(%rip)      # 0x522c
cmpl $0x9, 0x3387(%rip)      # 0x522c
jne 0x1eb3
movl $0x0, -0x4(%rbp)
jmp 0x1fb9
jmp 0x1eb5
jmp 0x1eb9
jmp 0x1ebb
jmp 0x1e4b
jmp 0x1ebd
jmp 0x1ebf
movl 0x335f(%rip), %eax      # 0x5224
addl $0x1, %eax
movl %eax, 0x3356(%rip)      # 0x5224
cmpl $0xa, 0x334f(%rip)      # 0x5224
jne 0x1f67
movl $0x1, 0x333f(%rip)      # 0x5224
movl 0x333d(%rip), %eax      # 0x5228
addl $0x1, %eax
movl %eax, 0x3334(%rip)      # 0x5228
cmpl $0x9, 0x332d(%rip)      # 0x5228
jne 0x1f16
movl $0x0, 0x3321(%rip)      # 0x5228
movl 0x331f(%rip), %eax      # 0x522c
addl $0x1, %eax
movl %eax, 0x3316(%rip)      # 0x522c
jmp 0x1f18
movslq 0x330d(%rip), %rax      # 0x522c
leaq 0x31ba(%rip), %rcx      # 0x50e0
imulq $0x24, %rax, %rax
addq %rax, %rcx
movslq 0x32f4(%rip), %rdx      # 0x5228
xorl %eax, %eax
cmpl $0x0, (%rcx,%rdx,4)
movb %al, -0x5(%rbp)
jle 0x1f4c
cmpl $0x9, 0x32e6(%rip)      # 0x522c
setl %al
movb %al, -0x5(%rbp)
movb -0x5(%rbp), %al
testb $0x1, %al
jne 0x1ee5
cmpl $0x9, 0x32d2(%rip)      # 0x522c
jne 0x1f65
movl $0x0, -0x4(%rbp)
jmp 0x1fb9
jmp 0x1f67
jmp 0x1f69
callq 0x2510
cmpl $0x0, %eax
jne 0x1ebf
movl 0x32a7(%rip), %edx      # 0x5224
movslq 0x32a8(%rip), %rcx      # 0x522c
leaq 0x3155(%rip), %rax      # 0x50e0
imulq $0x24, %rcx, %rcx
addq %rcx, %rax
movslq 0x328f(%rip), %rcx      # 0x5228
movl %edx, (%rax,%rcx,4)
leaq 0x119a(%rip), %rdi      # 0x313d
callq 0x17d0
movl $0x2710, %edi           # imm = 0x2710
callq 0x1140
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)