// File: /workspace/github_c_makefile_star2_O2/kobolt[P]curses-collection/sudoku/sudoku.c
// Function: main
int main(int argc, char *argv[])
{
  int done;
  char *current_status;

  if (argc == 2)
    read_from_file(argv[1]);

  initscr();
  noecho();
  keypad(stdscr, TRUE);

  current_status = NULL;
  done = 0;
  while (! done) {
    display_update(current_status);

    switch (getch()) {
    case KEY_LEFT:
      current_x--;
      if (current_x < 0)
        current_x = 0;
      break;

    case KEY_RIGHT:
      current_x++;
      if (current_x >= 9)
        current_x = 8;
      break;

    case KEY_UP:
      current_y--;
      if (current_y < 0)
        current_y = 0;
      break;

    case KEY_DOWN:
      current_y++;
      if (current_y >= 9)
        current_y = 8;
      break;

    case '1':
      sudoku[current_y][current_x] = 1;
      break;

    case '2':
      sudoku[current_y][current_x] = 2;
      break;

    case '3':
      sudoku[current_y][current_x] = 3;
      break;

    case '4':
      sudoku[current_y][current_x] = 4;
      break;

    case '5':
      sudoku[current_y][current_x] = 5;
      break;

    case '6':
      sudoku[current_y][current_x] = 6;
      break;

    case '7':
      sudoku[current_y][current_x] = 7;
      break;

    case '8':
      sudoku[current_y][current_x] = 8;
      break;

    case '9':
      sudoku[current_y][current_x] = 9;
      break;

    case '0':
    case ' ':
      sudoku[current_y][current_x] = 0;
      break;

    case KEY_ENTER:
    case '\n':
      if (solve_sudoku())
        current_status = "Unable to solve, enter more numbers.";
      else
        current_status = "Solved!";
      break;

    case 'q':
    case 'Q':
    case '\e':
      done = 1;
      break;

    default:
      break;
    }
  }

  endwin();
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
cmpl $0x2, %edi
jne 0x1352
movq 0x8(%rsi), %rdi
leaq 0xe4f(%rip), %rsi       # 0x20bd
callq 0x10e0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0x1352
leaq 0x30(%rsp), %rbp
movslq 0x4(%rsp), %rax
imulq $0x24, %rax, %rax
leaq 0x2e4a(%rip), %rcx      # 0x40e0
leaq (%rcx,%rax), %rdx
movq %rdx, 0x8(%rsp)
leaq (%rax,%rcx), %rdx
addq $0x4, %rdx
movq %rdx, 0x28(%rsp)
leaq 0x8(%rax,%rcx), %rdx
movq %rdx, 0x20(%rsp)
leaq 0xc(%rax,%rcx), %rdx
movq %rdx, 0x18(%rsp)
leaq 0x10(%rax,%rcx), %r14
leaq (%rax,%rcx), %rbx
addq $0x14, %rbx
leaq (%rax,%rcx), %r12
addq $0x18, %r12
leaq (%rax,%rcx), %r13
addq $0x1c, %r13
leaq (%rax,%rcx), %r15
addq $0x20, %r15
movq %rbp, %rdi
pushq $0x20
popq %rsi
movq 0x10(%rsp), %rdx
callq 0x10a0
testq %rax, %rax
je 0x1348
subq $0x8, %rsp
movq %rbp, %rdi
leaq 0xdb7(%rip), %rsi       # 0x20bf
movq 0x10(%rsp), %rdx
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x20(%rsp), %r9
xorl %eax, %eax
pushq %r15
pushq %r13
pushq %r12
pushq %rbx
pushq %r14
callq 0x10d0
addq $0x30, %rsp
cmpl $0x9, %eax
jne 0x12e5
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl $0x9, %eax
jne 0x1286
movq 0x10(%rsp), %rdi
callq 0x1050
callq 0x1070
callq 0x1060
movq 0x2c7d(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
pushq $0x1
popq %rsi
callq 0x1090
movb $0x1, %cl
xorl %ebp, %ebp
testb $0x1, %cl
je 0x1c71
movq %rbp, %rdi
callq 0x1c87
movq 0x2c56(%rip), %rax      # 0x3fe0
movq (%rax), %rdi
callq 0x1040
leal -0x20(%rax), %ecx
cmpl $0x19, %ecx
ja 0x13d0
leaq 0xc63(%rip), %rdx       # 0x2004
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
movb $0x1, %cl
leaq 0x2d2f(%rip), %rdx      # 0x40e0
jmpq *%rax
movslq 0x2d1a(%rip), %rax      # 0x40d4
movslq 0x2d0f(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
andl $0x0, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
leal -0x102(%rax), %ecx
cmpl $0x3, %ecx
leaq 0x2d00(%rip), %rsi      # 0x40e0
pushq $0x3
popq %rdi
jbe 0x1a72
cmpl $0xa, %eax
je 0x1416
cmpl $0x1b, %eax
je 0x1a98
cmpl $0x51, %eax
je 0x1a98
cmpl $0x71, %eax
je 0x1a98
movb $0x1, %cl
cmpl $0x157, %eax            # imm = 0x157
jne 0x1372
andl $0x0, 0x2e07(%rip)      # 0x4224
andl $0x0, 0x2e04(%rip)      # 0x4228
andl $0x0, 0x2e01(%rip)      # 0x422c
movl $0x0, 0x4(%rsp)
xorl %r12d, %r12d
cmpl $0x4, %r12d
ja 0x1bda
movl %r12d, %eax
leaq 0xc32(%rip), %rcx       # 0x207c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %r8d, %r8d
cmpq $0x9, %r8
jne 0x148b
movq %rsi, %rax
xorl %ecx, %ecx
cmpq $0x9, %rcx
je 0x19c1
xorl %edx, %edx
cmpq $0x9, %rdx
je 0x1482
cmpl $0x0, (%rax,%rdx,4)
leaq 0x1(%rdx), %rdx
jne 0x146d
jmp 0x1615
incq %rcx
addq $0x24, %rax
jmp 0x1461
movl %r8d, %eax
xorl %edx, %edx
divl %edi
movq %r8, %r14
subq %rdx, %r14
imulq $0x24, %rdx, %rax
movl %edx, %ecx
negl %ecx
addq $0x3, %r14
movslq %ecx, %rcx
addq %r8, %rcx
movq %rcx, 0x10(%rsp)
movq %r8, 0x8(%rsp)
imulq $0x24, %r8, %rbx
movq %rbx, %r15
subq %rax, %r15
addq %rsi, %r15
movq %rsi, %rbp
xorl %r13d, %r13d
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
cmpq $0x9, %r13
je 0x1608
leaq (%rsi,%rbx), %rax
cmpl $0x0, (%rax,%r13,4)
jg 0x15fc
movq %rcx, 0x30(%rsp)
movb $0x1, 0x38(%rsp)
jne 0x15fc
leaq (%rax,%r13,4), %rcx
xorl %eax, %eax
cmpq $0x9, %rax
je 0x1523
leaq (%rbx,%rax,4), %rdx
movslq (%rsi,%rdx), %rdx
testq %rdx, %rdx
je 0x151e
leaq 0x30(%rsp), %r8
movb $0x0, -0x1(%rdx,%r8)
incq %rax
jmp 0x1500
movq $-0x144, %rax           # imm = 0xFEBC
testq %rax, %rax
je 0x154c
movslq 0x144(%rbp,%rax), %rdx
testq %rdx, %rdx
je 0x1546
leaq 0x30(%rsp), %rsi
movb $0x0, -0x1(%rdx,%rsi)
addq $0x24, %rax
jmp 0x152a
movl %r13d, %eax
xorl %edx, %edx
divl %edi
movl %r13d, %eax
subl %edx, %eax
negl %edx
addl %r13d, %edx
addl $0x3, %edx
cltq
movslq %edx, %rdx
movq %r15, %rsi
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
jge 0x159c
movq %rax, %r8
cmpq %rdx, %r8
jge 0x1593
movslq (%rsi,%r8,4), %r9
testq %r9, %r9
je 0x158e
leaq 0x30(%rsp), %r10
movb $0x0, -0x1(%r9,%r10)
incq %r8
jmp 0x1575
incq %rdi
addq $0x24, %rsi
jmp 0x156d
pushq $-0x9
popq %rdx
pushq $-0x1
popq %rax
testq %rdx, %rdx
je 0x15c0
cmpl $-0x1, %eax
je 0x15b0
xorl %esi, %esi
jmp 0x15b3
leal 0xa(%rdx), %esi
cmpb $0x0, 0x39(%rsp,%rdx)
cmovnel %esi, %eax
incq %rdx
jmp 0x15a2
cmpl $-0x2, %eax
pushq $-0x2
popq %rdx
cmovael %edx, %eax
testl %eax, %eax
jle 0x15e8
movl %eax, (%rcx)
leaq 0xbc7(%rip), %rdi       # 0x219d
callq 0x1c87
movl $0x2710, %edi           # imm = 0x2710
callq 0x1140
incl %r12d
leaq 0x2af1(%rip), %rsi      # 0x40e0
pushq $0x3
popq %rdi
movabsq $0x101010101010101, %rcx # imm = 0x101010101010101
incq %r13
addq $0x4, %rbp
jmp 0x14d1
movq 0x8(%rsp), %r8
incq %r8
jmp 0x1456
xorl %r8d, %r8d
testl %r12d, %r12d
movl $0x0, %r12d
jg 0x1456
pushq $0x1
popq %r12
jmp 0x1436
movl $0x144, %edx            # imm = 0x144
movq %rsi, %rbx
movq %rsi, %rdi
leaq 0x2bee(%rip), %rsi      # 0x4230
callq 0x10b0
movl 0x2bd7(%rip), %edi      # 0x4224
testl %edi, %edi
je 0x1a1f
movl 0x2bcd(%rip), %esi      # 0x4228
movl 0x2bcb(%rip), %ecx      # 0x422c
incl %edi
cmpl $0xa, %edi
jne 0x16aa
leaq 0x2a71(%rip), %rdi      # 0x40e0
incl %esi
cmpl $0x9, %esi
jne 0x1680
incl %ecx
movl %ecx, 0x2bae(%rip)      # 0x422c
xorl %esi, %esi
cmpl $0x8, %ecx
jg 0x1698
movslq %ecx, %rax
movslq %esi, %rdx
imulq $0x24, %rax, %rax
addq %rdi, %rax
cmpl $0x0, (%rax,%rdx,4)
jg 0x166f
movl %esi, 0x2b8a(%rip)      # 0x4228
pushq $0x1
popq %rdi
cmpl $0x9, %ecx
je 0x19ca
movl %ecx, %eax
cltd
pushq $0x3
popq %r10
idivl %r10d
movl %ecx, %r8d
subl %edx, %r8d
movslq %edx, %r12
movl %edx, %r9d
negl %r9d
addl $0x3, %r8d
movl %esi, %eax
cltd
idivl %r10d
movslq %esi, %rax
movl %esi, %r11d
subl %edx, %r11d
movslq %r11d, %r10
addl $0x3, %r11d
movslq %r11d, %r11
movslq %ecx, %r15
movslq %r9d, %rbx
addq %r15, %rbx
movslq %r8d, %r14
imulq $0x24, %r15, %r8
leaq (,%rax,4), %r9
leaq (%r8,%rax,4), %r15
movslq %edx, %rdx
shlq $0x2, %rdx
subq %rdx, %r15
imulq $0x24, %r12, %rdx
subq %rdx, %r15
leaq 0x29cc(%rip), %rdx      # 0x40e0
addq %rdx, %r15
cmpq %r14, %rbx
jge 0x1743
movq %r15, %rdx
movq %r10, %r13
cmpq %r11, %r13
jge 0x173a
incq %r13
leaq 0x4(%rdx), %r12
cmpl %edi, (%rdx)
movq %r12, %rdx
jne 0x1722
jmp 0x1661
incq %rbx
addq $0x24, %r15
jmp 0x1717
xorl %edx, %edx
cmpq $0x9, %rdx
je 0x1764
leaq (%r8,%rdx,4), %r10
incq %rdx
leaq 0x2987(%rip), %r11      # 0x40e0
cmpl %edi, (%r11,%r10)
jne 0x1745
jmp 0x1661
leaq 0x2975(%rip), %rdx      # 0x40e0
addq %rdx, %r9
movq $-0x168, %rdx           # imm = 0xFE98
movq $-0x168, %r10           # imm = 0xFE98
addq $0x24, %r10
je 0x19e7
cmpl %edi, 0x168(%r9,%rdx)
movq %r10, %rdx
jne 0x177c
jmp 0x1661
movl $0x144, %edx            # imm = 0x144
leaq 0x2a8c(%rip), %rdi      # 0x4230
leaq 0x2935(%rip), %rsi      # 0x40e0
callq 0x10b0
pushq $0x3
popq %rdi
leaq 0x2926(%rip), %rsi      # 0x40e0
pushq $0x1
popq %rax
movl %eax, 0x4(%rsp)
pushq $0x2
popq %r12
jmp 0x1436
xorl %r15d, %r15d
movq %rsi, %rcx
movl $0x0, 0x18(%rsp)
movl %r15d, %eax
xorl %edx, %edx
divl %edi
cmpq $0x9, %r15
je 0x1999
imulq $-0x24, %rdx, %rbx
movq %rcx, 0x20(%rsp)
addq %rcx, %rbx
movl %r15d, %eax
xorl %edx, %edx
divl %edi
movq %r15, %rbp
subq %rdx, %rbp
movl %edx, %eax
negl %eax
addq $0x3, %rbp
movslq %eax, %r14
addq %r15, %r14
movq %rsi, %rcx
xorl %r13d, %r13d
movl %r13d, %eax
xorl %edx, %edx
divl %edi
cmpq $0x9, %r13
je 0x1988
imulq $0x24, %r15, %rax
addq %rsi, %rax
cmpl $0x0, (%rax,%r13,4)
jg 0x197c
shll $0x2, %edx
movq %rcx, 0x8(%rsp)
subq %rdx, %rcx
movq %rcx, 0x10(%rsp)
leaq (%rax,%r13,4), %rax
movq %rax, 0x28(%rsp)
movl %r13d, %eax
xorl %edx, %edx
divl %edi
movl %r13d, %eax
subl %edx, %eax
negl %edx
leal (%rdx,%r13), %ecx
addl $0x3, %ecx
movslq %eax, %rsi
movslq %ecx, %rdi
pushq $0x1
popq %rdx
cmpl $0xa, %edx
je 0x196d
movq %rbx, %rax
movq %r14, %r8
cmpq %rbp, %r8
jge 0x18a6
movq %rsi, %rcx
cmpq %rdi, %rcx
jge 0x189d
leaq 0x1(%rcx), %r9
cmpl %edx, (%rax,%rcx,4)
movq %r9, %rcx
jne 0x1887
jmp 0x1945
incq %r8
addq $0x24, %rax
jmp 0x187f
xorl %r8d, %r8d
movq %rbx, %r9
movq %r14, %r10
cmpq %rbp, %r10
jge 0x193f
movq 0x10(%rsp), %r11
movq %rsi, %rax
cmpq %rdi, %rax
jge 0x1933
imulq $0x24, %r10, %rcx
leaq 0x2810(%rip), %r12      # 0x40e0
addq %r12, %rcx
cmpl $0x0, (%rcx,%rax,4)
jg 0x18e3
cmpq %r15, %r10
jne 0x18ef
cmpq %r13, %rax
jne 0x18ef
incl %r8d
incq %rax
addq $0x4, %r11
jmp 0x18c0
cmpq %r15, %r10
jne 0x191c
cmpq %r13, %rax
je 0x1945
movq $-0x168, %r12           # imm = 0xFE98
movq $-0x168, %rcx           # imm = 0xFE98
addq $0x24, %rcx
je 0x1945
cmpl %edx, 0x168(%r11,%r12)
movq %rcx, %r12
jne 0x1907
jmp 0x18e6
xorl %ecx, %ecx
cmpq $0x9, %rcx
je 0x18f4
leaq 0x1(%rcx), %r12
cmpl %edx, (%r9,%rcx,4)
movq %r12, %rcx
jne 0x191e
jmp 0x18e6
incq %r10
addq $0x24, %r9
jmp 0x18af
cmpl $0x9, %r8d
jne 0x194c
incl %edx
jmp 0x1870
movq 0x28(%rsp), %rax
movl %edx, (%rax)
leaq 0x843(%rip), %rdi       # 0x219d
callq 0x1c87
movl $0x2710, %edi           # imm = 0x2710
callq 0x1140
incl 0x18(%rsp)
leaq 0x276c(%rip), %rsi      # 0x40e0
pushq $0x3
popq %rdi
movq 0x8(%rsp), %rcx
incq %r13
addq $0x4, %rcx
jmp 0x1816
incq %r15
movq 0x20(%rsp), %rcx
addq $0x24, %rcx
jmp 0x17d8
xorl %r12d, %r12d
cmpl $0x0, 0x18(%rsp)
jg 0x1436
xorl %r12d, %r12d
cmpl $0x0, 0x4(%rsp)
setne %r12b
movl %r12d, 0x4(%rsp)
xorl $0x3, %r12d
jmp 0x1436
pushq $0x4
popq %r12
jmp 0x1436
movl $0x1, 0x2850(%rip)      # 0x4224
pushq $0x5
popq %r12
leaq 0x2701(%rip), %rsi      # 0x40e0
pushq $0x3
popq %rdi
jmp 0x1436
movl %edi, 0x2837(%rip)      # 0x4224
leaq 0x26ec(%rip), %rbx      # 0x40e0
addq %rbx, %r8
movl %edi, (%r8,%rax,4)
leaq 0x7a6(%rip), %rdi       # 0x21a8
callq 0x1c87
movl $0x2710, %edi           # imm = 0x2710
callq 0x1140
movq %rbx, %rsi
xorl %r12d, %r12d
pushq $0x3
popq %rdi
jmp 0x1436
movslq 0x2806(%rip), %rcx      # 0x422c
movl 0x27fc(%rip), %edx      # 0x4228
imulq $0x24, %rcx, %rax
addq %rbx, %rax
movslq %edx, %rsi
leal 0x1(%rsi), %edx
cmpl $0x0, (%rax,%rsi,4)
jle 0x1661
movl %edx, 0x27df(%rip)      # 0x4228
incq %rsi
incl %edx
cmpl $0xa, %edx
jne 0x1a39
andl $0x0, 0x27ce(%rip)      # 0x4228
incl %ecx
movl %ecx, 0x27ca(%rip)      # 0x422c
addq $0x24, %rax
xorl %edx, %edx
cmpl $0x9, %ecx
jne 0x1a33
jmp 0x19d4
leaq 0x5f3(%rip), %rdx       # 0x206c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x264c(%rip), %eax      # 0x40d4
cmpl $0x7, %eax
pushq $0x7
popq %rcx
cmovgel %ecx, %eax
incl %eax
jmp 0x1c56
xorl %ecx, %ecx
jmp 0x1372
movslq 0x262e(%rip), %rax      # 0x40d4
movslq 0x2623(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x3, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x260b(%rip), %rax      # 0x40d4
movslq 0x2600(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x8, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x25e8(%rip), %rax      # 0x40d4
movslq 0x25dd(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x1, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x25c5(%rip), %rax      # 0x40d4
movslq 0x25ba(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x2, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x25a2(%rip), %rax      # 0x40d4
movslq 0x2597(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x6, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x257f(%rip), %rax      # 0x40d4
movslq 0x2574(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x4, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x255c(%rip), %rax      # 0x40d4
movslq 0x2551(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x5, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x2539(%rip), %rax      # 0x40d4
movslq 0x252e(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x7, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movslq 0x2516(%rip), %rax      # 0x40d4
movslq 0x250b(%rip), %rcx      # 0x40d0
imulq $0x24, %rax, %rax
addq %rdx, %rax
movl $0x9, (%rax,%rcx,4)
movb $0x1, %cl
jmp 0x1372
movb $0x1, %cl
leaq 0x4ad(%rip), %rbp       # 0x2090
cmpl $0x0, 0x4(%rsp)
je 0x1372
movl $0x144, %edx            # imm = 0x144
leaq 0x24e6(%rip), %rdi      # 0x40e0
leaq 0x262f(%rip), %rsi      # 0x4230
callq 0x10b0
movb $0x1, %cl
leaq 0x481(%rip), %rbp       # 0x2090
jmp 0x1372
movl 0x24b6(%rip), %eax      # 0x40d0
cmpl $0x2, %eax
pushq $0x1
popq %rcx
cmovll %ecx, %eax
decl %eax
jmp 0x1c38
movl 0x24a3(%rip), %eax      # 0x40d0
cmpl $0x7, %eax
pushq $0x7
popq %rcx
cmovgel %ecx, %eax
incl %eax
movl %eax, 0x2492(%rip)      # 0x40d0
movb $0x1, %cl
jmp 0x1372
movl 0x2489(%rip), %eax      # 0x40d4
cmpl $0x2, %eax
pushq $0x1
popq %rcx
cmovll %ecx, %eax
decl %eax
movl %eax, 0x2478(%rip)      # 0x40d4
movb $0x1, %cl
jmp 0x1372
movb $0x1, %cl
leaq 0x449(%rip), %rbp       # 0x20b5
jmp 0x1372
callq 0x1120
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq