#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 */
int /*<<< orphan*/ print_sudoku(int **, int);
int /*<<< orphan*/ printf(char *);
int **read_sudoku(char *, int *);
scalar_t__ solve(int **, int **, int);
int main(int argc, char *argv[]) {
  int **sudoku;
  int **sudoku_o;
  int n;
  if (argc != 2) {
    printf("Usage: ./sudoku {filename}\n");
    return 1;
  }
  sudoku = read_sudoku(argv[1], &n);
  sudoku_o = read_sudoku(argv[1], &n);
  if (solve(sudoku, sudoku_o, n) == 0) {
    printf("Puzzle cannot be solved!\n");
    return 1;
  }
  print_sudoku(sudoku, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e7 <main+0xa7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <read_sudoku@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <read_sudoku@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <solve@plt>
cmp    $0x0,%rax
jne    11d4 <main+0x94>
lea    0xe59(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e7 <main+0xa7>
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <print_sudoku@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    1195 <main+0x55>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xc(%rsp),%r15
mov    %r15,%rsi
call   1060 <read_sudoku@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
mov    %r15,%rsi
call   1060 <read_sudoku@plt>
mov    0xc(%rsp),%edx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <solve@plt>
test   %rax,%rax
je     119e <main+0x5e>
mov    0xc(%rsp),%esi
mov    %r14,%rdi
call   1050 <print_sudoku@plt>
xor    %eax,%eax
jmp    11af <main+0x6f>
lea    0xe7d(%rip),%rdi
jmp    11a5 <main+0x65>
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Usage: ./sudoku {filename}\0A\00"
@.str.1 = [26 x i8] c"Puzzle cannot be solved!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32**
%7 = alloca i32**
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %33
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32** @read_sudoku(i8* %16, i32* %8)
store i32** %17, i32*** %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32** @read_sudoku(i8* %20, i32* %8)
store i32** %21, i32*** %7
%22 = load i32**, i32*** %6
%23 = load i32**, i32*** %7
%24 = load i32, i32* %8
%25 = call i64 @solve(i32** %22, i32** %23, i32 %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %13
%28 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %33
29: ; preds = %13
%30 = load i32**, i32*** %6
%31 = load i32, i32* %8
%32 = call i32 @print_sudoku(i32** %30, i32 %31)
store i32 0, i32* %3
br label %33
33: ; preds = %29, %27, %11
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@str = [25 x i8] c"Puzzle cannot be solved!\00"
@str.2 = [27 x i8] c"Usage: ./sudoku {filename}\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.2, i64 0, i64 0))
br label %22
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32** @read_sudoku(i8* %10, i32* %3)
%12 = load i8*, i8** %9
%13 = call i32** @read_sudoku(i8* %12, i32* %3)
%14 = load i32, i32* %3
%15 = call i64 @solve(i32** %11, i32** %13, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %8
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
br label %22
19: ; preds = %8
%20 = load i32, i32* %3
%21 = call i32 @print_sudoku(i32** %11, i32 %20)
br label %22
22: ; preds = %19, %17, %6
%23 = phi i32 [ 1, %6 ], [ 1, %17 ], [ 0, %19 ]
ret i32 %23
}