// File: /workspace/github_c_makefile_star2_O0/cinemast[P]sudoku/sudoku.c
// Function: main
int
main (int argc, char **argv)
{
    program = argv[0];

    /* Limited support for options */
    if (0 != evaluate_options(argc, argv)) {
        cleanup_curses_and_more();
        exit(1);
    }
    if (0 != opt_statistics && 0 != opt_generate) {
        fprintf(stderr, "Error: Cannot set both -g and -s options\n");
        cleanup_curses_and_more();
        return -1;
    }

    if (0 == precanned) {
        open_precanned(PRECANNED);

        /* Fallback - try current working directory */
        if (0 == precanned) {
            open_precanned(PRECANNED_FALLBACK);
        }
        /* Else, can continue happily without any precanned files... */
    }

    if (0 != opt_statistics || 0 != opt_solve) {
        int retval = gen_statistics();
        cleanup_curses_and_more();
        return retval;
    }

    srand((unsigned int)(time(0) ^ getpid()));

    if (0 == ftmplt) {
        open_template(TEMPLATE);

        /* Fallback - try current working directory */
        if (0 == ftmplt) {
            open_template(TEMPLATE_FALLBACK);
            if (0 == ftmplt) {
                fprintf(stderr, "Error: failed to open template file\n");
                exit(1);
            } else if (0 >= n_tmplt) {
                fprintf(stderr, "Error:"
                                " no valid template found"
                                " in the template file\n");
                cleanup_curses_and_more();
                exit(1);
            }
        }
    }

    if (0 != opt_generate) {
        /* -g0 generates many boards */
        if (0 == num_generate) {
            /* changed from --num_generate, to make it
             * independent from the actual size of int
             * 10000 seems to qualify for being 'many'
             */
            num_generate = 10000;
        }
        while (0 != num_generate--) {
            generate();
            print(stdout, title);
        }
        cleanup_curses_and_more();
        return 0;
    }

    if (0 == opt_random && 0 == precanned) {
        fprintf(stderr, "Error: option -n requires precanned boards\n");
        cleanup_curses_and_more();
        return 1;
    }

    if (!isatty(0) || !isatty(1)) {
        fprintf(stderr, "Error: stdin/out cannot be redirected\n");
        cleanup_curses_and_more();
        return 1;
    }

    /* Establish process environment */
    if (0 == initscr()) {
        fprintf(stderr,
                 "Error: failed to initialise curses screen library\n");
        cleanup_curses_and_more();
        return 1;
    }

    /* Any signal will now shutdown curses cleanly */
    signals();

    draw_screen();
    noecho();
    cbreak();
    load_board();
    play_the_game();
    cleanup_curses_and_more();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0xe574(%rip)      # 0x12408
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x3680
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0x3eb7
callq 0x4160
movl $0x1, %edi
callq 0x2310
xorl %eax, %eax
cmpl 0xe531(%rip), %eax      # 0x123f0
je 0x3ef4
xorl %eax, %eax
cmpl 0xe51f(%rip), %eax      # 0x123e8
je 0x3ef4
movq 0xd126(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8f7f(%rip), %rsi      # 0xce5b
movb $0x0, %al
callq 0x2200
callq 0x4160
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x414e
xorl %eax, %eax
cmpq 0xd4c3(%rip), %rax      # 0x113c0
jne 0x3f24
leaq 0x8f7f(%rip), %rdi      # 0xce85
callq 0x3c30
xorl %eax, %eax
cmpq 0xd4ac(%rip), %rax      # 0x113c0
jne 0x3f22
leaq 0x8f7a(%rip), %rdi      # 0xce97
callq 0x3c30
jmp 0x3f24
xorl %eax, %eax
cmpl 0xe4c4(%rip), %eax      # 0x123f0
jne 0x3f38
xorl %eax, %eax
cmpl 0xe4ca(%rip), %eax      # 0x12400
je 0x3f50
callq 0x41f0
movl %eax, -0x14(%rbp)
callq 0x4160
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x414e
xorl %eax, %eax
movl %eax, %edi
callq 0x2230
movq %rax, -0x20(%rbp)
callq 0x20b0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
xorq %rcx, %rax
movl %eax, %edi
callq 0x21c0
xorl %eax, %eax
cmpq 0xe47a(%rip), %rax      # 0x123f8
jne 0x400b
leaq 0x8f16(%rip), %rdi      # 0xcea1
callq 0x3cb0
xorl %eax, %eax
cmpq 0xe45f(%rip), %rax      # 0x123f8
jne 0x4009
leaq 0x9c70(%rip), %rdi      # 0xdc12
callq 0x3cb0
xorl %eax, %eax
cmpq 0xe448(%rip), %rax      # 0x123f8
jne 0x3fd4
movq 0xd03f(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8ef9(%rip), %rsi      # 0xcebc
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
callq 0x2310
xorl %eax, %eax
cmpl 0xe434(%rip), %eax      # 0x12410
jl 0x4005
movq 0xd013(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8ef2(%rip), %rsi      # 0xcee1
movb $0x0, %al
callq 0x2200
callq 0x4160
movl $0x1, %edi
callq 0x2310
jmp 0x4007
jmp 0x4009
jmp 0x400b
xorl %eax, %eax
cmpl 0xe3d5(%rip), %eax      # 0x123e8
je 0x4070
xorl %eax, %eax
cmpl 0xd1db(%rip), %eax      # 0x111f8
jne 0x4029
movl $0x2710, 0xd1cf(%rip)   # imm = 0x2710
jmp 0x402b
movl 0xd1c7(%rip), %ecx      # 0x111f8
movl %ecx, %eax
addl $-0x1, %eax
movl %eax, 0xd1bc(%rip)      # 0x111f8
xorl %eax, %eax
cmpl %ecx, %eax
je 0x405f
callq 0x43b0
movq 0xcf82(%rip), %rax      # 0x10fd0
movq (%rax), %rdi
leaq 0xe3c8(%rip), %rsi      # 0x12420
callq 0x4670
jmp 0x402b
callq 0x4160
movl $0x0, -0x4(%rbp)
jmp 0x414e
xorl %eax, %eax
cmpl 0xd184(%rip), %eax      # 0x111fc
jne 0x40ae
xorl %eax, %eax
cmpq 0xd33d(%rip), %rax      # 0x113c0
jne 0x40ae
movq 0xcf6c(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8e80(%rip), %rsi      # 0xcf16
movb $0x0, %al
callq 0x2200
callq 0x4160
movl $0x1, -0x4(%rbp)
jmp 0x414e
xorl %edi, %edi
callq 0x2070
cmpl $0x0, %eax
je 0x40c9
movl $0x1, %edi
callq 0x2070
cmpl $0x0, %eax
jne 0x40ef
movq 0xcf28(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8e68(%rip), %rsi      # 0xcf42
movb $0x0, %al
callq 0x2200
callq 0x4160
movl $0x1, -0x4(%rbp)
jmp 0x414e
callq 0x2160
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
jne 0x4124
movq 0xcef3(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8e5a(%rip), %rsi      # 0xcf69
movb $0x0, %al
callq 0x2200
callq 0x4160
movl $0x1, -0x4(%rbp)
jmp 0x414e
callq 0x46e0
callq 0x47f0
callq 0x2100
callq 0x2240
callq 0x4fa0
callq 0x5110
callq 0x4160
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)