#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
long UINT_MAX;
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ init_constraints();
int /*<<< orphan*/ init_unknowns();
int /*<<< orphan*/ print_board();
int /*<<< orphan*/ read_board();
int /*<<< orphan*/ solve_board();
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ *strstr(char *, char *);
long strtol(char *, char **, int);
long time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  long seed = time(NULL);
  if (argc > 1) {
    char *prog = *argv;
    argv++;
    if (strstr(*argv, "-h") != NULL) {
      fprintf(stderr, "usage: %s [-s seed]\n", prog);
      return 1;
    }
    if (strcmp(*argv, "-s") != 0) {
      fprintf(stderr, "%s: unknown option %s\n", prog, *argv);
      return 1;
    }
    if (argc == 2) {
      fprintf(stderr, "%s: option %s requires an argument\n", prog, *argv);
      return 1;
    }
    errno = 0;
    seed = strtol(argv[1], argv, 10);
    if (errno != 0 || seed > UINT_MAX) {
      fprintf(stderr, "%s: invalid seed -- %s\n", prog, *argv);
      return 1;
    }
  }
  srand((unsigned int)seed);
  read_board();
  init_unknowns();
  init_constraints();
  solve_board();
  print_board();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    133b <main+0x18b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdfe(%rip),%rsi
call   10d0 <strstr@plt>
cmp    $0x0,%rax
je     1238 <main+0x88>
mov    0x2dc0(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xdde(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1370 <main+0x1c0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdd2(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     1283 <main+0xd3>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xdab(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1370 <main+0x1c0>
cmpl   $0x2,-0x8(%rbp)
jne    12bb <main+0x10b>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd8a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1370 <main+0x1c0>
mov    0x2d0e(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   10a0 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    0x2ce6(%rip),%rax
cmpq   $0x0,(%rax)
jne    1308 <main+0x158>
mov    -0x18(%rbp),%rax
mov    0x2ce9(%rip),%rcx
cmp    (%rcx),%rax
jle    1336 <main+0x186>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xd33(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1370 <main+0x1c0>
jmp    133b <main+0x18b>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1070 <srand@plt>
mov    $0x0,%al
call   1040 <read_board@plt>
mov    $0x0,%al
call   1060 <init_unknowns@plt>
mov    $0x0,%al
call   1030 <init_constraints@plt>
mov    $0x0,%al
call   10c0 <solve_board@plt>
mov    $0x0,%al
call   1050 <print_board@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r12d,%r12d
xor    %edi,%edi
call   10b0 <time@plt>
cmp    $0x2,%ebp
jl     128a <main+0xda>
mov    (%rbx),%r14
mov    0x8(%rbx),%r13
lea    0xe1f(%rip),%rsi
mov    %r13,%rdi
call   10d0 <strstr@plt>
test   %rax,%rax
je     120d <main+0x5d>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
lea    0xe05(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    12d3 <main+0x123>
lea    0x8(%rbx),%r15
lea    0xe00(%rip),%rsi
mov    %r13,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     123d <main+0x8d>
mov    0x2dac(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rcx
lea    0xde3(%rip),%rsi
jmp    12c9 <main+0x119>
cmp    $0x2,%ebp
jne    1257 <main+0xa7>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rcx
lea    0xddd(%rip),%rsi
jmp    12c9 <main+0x119>
mov    0x2d72(%rip),%rbp
movq   $0x0,0x0(%rbp)
mov    0x10(%rbx),%rdi
mov    %r15,%rsi
mov    $0xa,%edx
call   10a0 <strtol@plt>
cmpq   $0x0,0x0(%rbp)
jne    12b6 <main+0x106>
mov    0x2d63(%rip),%rcx
cmp    (%rcx),%rax
jg     12b6 <main+0x106>
mov    %eax,%edi
call   1070 <srand@plt>
xor    %eax,%eax
call   1040 <read_board@plt>
xor    %eax,%eax
call   1060 <init_unknowns@plt>
xor    %eax,%eax
call   1030 <init_constraints@plt>
xor    %eax,%eax
call   10c0 <solve_board@plt>
xor    %eax,%eax
call   1050 <print_board@plt>
jmp    12d9 <main+0x129>
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rcx
lea    0xd8d(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [21 x i8] c"usage: %s [-s seed]\0A\00"
@.str.2 = [3 x i8] c"-s\00"
@.str.3 = [23 x i8] c"%s: unknown option %s\0A\00"
@.str.4 = [36 x i8] c"%s: option %s requires an argument\0A\00"
@errno = global i64 0
@UINT_MAX = global i64 0
@.str.5 = [24 x i8] c"%s: invalid seed -- %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 @time(i32* null)
store i64 %8, i64* %6
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, label %63
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
store i8* %13, i8** %7
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i32 1
store i8** %15, i8*** %5
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = call i32* @strstr(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %24
20: ; preds = %11
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %7
%23 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %22)
store i32 1, i32* %3
br label %72
24: ; preds = %11
%25 = load i8**, i8*** %5
%26 = load i8*, i8** %25
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %24
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %7
%32 = load i8**, i8*** %5
%33 = load i8*, i8** %32
%34 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %31, i8* %33)
store i32 1, i32* %3
br label %72
35: ; preds = %24
%36 = load i32, i32* %4
%37 = icmp eq i32 %36, 2
br i1 %37, label %38, label %44
38: ; preds = %35
%39 = load i32, i32* @stderr
%40 = load i8*, i8** %7
%41 = load i8**, i8*** %5
%42 = load i8*, i8** %41
%43 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %40, i8* %42)
store i32 1, i32* %3
br label %72
44: ; preds = %35
store i64 0, i64* @errno
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = load i8**, i8*** %5
%49 = call i64 @strtol(i8* %47, i8** %48, i32 10)
store i64 %49, i64* %6
%50 = load i64, i64* @errno
%51 = icmp ne i64 %50, 0
br i1 %51, label %56, label %52
52: ; preds = %44
%53 = load i64, i64* %6
%54 = load i64, i64* @UINT_MAX
%55 = icmp sgt i64 %53, %54
br i1 %55, label %56, label %62
56: ; preds = %52, %44
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %7
%59 = load i8**, i8*** %5
%60 = load i8*, i8** %59
%61 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %58, i8* %60)
store i32 1, i32* %3
br label %72
62: ; preds = %52
br label %63
63: ; preds = %62, %2
%64 = load i64, i64* %6
%65 = trunc i64 %64 to i32
%66 = call i32 @srand(i32 %65)
%67 = call i32 (...) @read_board()
%68 = call i32 (...) @init_unknowns()
%69 = call i32 (...) @init_constraints()
%70 = call i32 (...) @solve_board()
%71 = call i32 (...) @print_board()
store i32 0, i32* %3
br label %72
72: ; preds = %63, %56, %38, %29, %20
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [21 x i8] c"usage: %s [-s seed]\0A\00"
@.str.2 = [3 x i8] c"-s\00"
@.str.3 = [23 x i8] c"%s: unknown option %s\0A\00"
@.str.4 = [36 x i8] c"%s: option %s requires an argument\0A\00"
@errno = global i64 0
@UINT_MAX = global i64 0
@.str.5 = [24 x i8] c"%s: invalid seed -- %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @time(i32* null)
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %40
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @strstr(i8* dereferenceable(1) %8, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %49
14: ; preds = %5
%15 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %7
%20 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %6, i8* %19)
br label %49
21: ; preds = %14
%22 = icmp eq i32 %0, 2
br i1 %22, label %23, label %27
23: ; preds = %21
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %7
%26 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* %6, i8* %25)
br label %49
27: ; preds = %21
store i64 0, i64* @errno
%28 = getelementptr inbounds i8*, i8** %1, i64 2
%29 = load i8*, i8** %28
%30 = tail call i64 @strtol(i8* %29, i8** %7, i32 10)
%31 = load i64, i64* @errno
%32 = icmp ne i64 %31, 0
%33 = load i64, i64* @UINT_MAX
%34 = icmp sgt i64 %30, %33
%35 = select i1 %32, i1 true, i1 %34
br i1 %35, label %36, label %40
36: ; preds = %27
%37 = load i32, i32* @stderr
%38 = load i8*, i8** %7
%39 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %6, i8* %38)
br label %49
40: ; preds = %27, %2
%41 = phi i64 [ %3, %2 ], [ %30, %27 ]
%42 = trunc i64 %41 to i32
%43 = tail call i32 @srand(i32 %42)
%44 = tail call i32 (...) @read_board()
%45 = tail call i32 (...) @init_unknowns()
%46 = tail call i32 (...) @init_constraints()
%47 = tail call i32 (...) @solve_board()
%48 = tail call i32 (...) @print_board()
br label %49
49: ; preds = %36, %23, %17, %11, %40
%50 = phi i32 [ 0, %40 ], [ 1, %11 ], [ 1, %17 ], [ 1, %23 ], [ 1, %36 ]
ret i32 %50
}