#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 */
scalar_t__ can_solve(int **);
int /*<<< orphan*/ print_sudoku(int **);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int sudoku[9][9];
  int i, j;
  printf("Provide the sudoku \n\'0\' represents blank space \n");
  for (i = 0; i < 9; i++) {
    for (j = 0; j < 9; j++) {
      scanf("%d", &sudoku[i][j]);
    }
  }
  if (can_solve(sudoku))
    print_sudoku(sudoku);
  else
    printf("Can't solve this sudoku \n");
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
lea    0xeae(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x154(%rbp)
cmpl   $0x9,-0x154(%rbp)
jge    11e1 <main+0xa1>
movl   $0x0,-0x158(%rbp)
cmpl   $0x9,-0x158(%rbp)
jge    11c8 <main+0x88>
movslq -0x154(%rbp),%rax
lea    -0x150(%rbp),%rsi
imul   $0x24,%rax,%rax
add    %rax,%rsi
movslq -0x158(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe82(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    1178 <main+0x38>
jmp    11cd <main+0x8d>
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    1161 <main+0x21>
lea    -0x150(%rbp),%rdi
call   1030 <can_solve@plt>
cmp    $0x0,%rax
je     1208 <main+0xc8>
lea    -0x150(%rbp),%rdi
call   1040 <print_sudoku@plt>
jmp    1214 <main+0xd4>
lea    0xe25(%rip),%rdi
call   1050 <printf@plt>
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x148,%rsp
lea    0xeb2(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
lea    0xea1(%rip),%r14
nop
lea    (%rsp,%rbx,1),%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x4,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x8,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0xc,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x14,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x18,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x1c,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    %r14,%rdi
call   1060 <scanf@plt>
add    $0x24,%rbx
cmp    $0x144,%rbx
jne    1160 <main+0x20>
mov    %rsp,%rdi
call   1030 <can_solve@plt>
test   %rax,%rax
je     1214 <main+0xd4>
mov    %rsp,%rdi
call   1050 <print_sudoku@plt>
jmp    1220 <main+0xe0>
lea    0xe18(%rip),%rdi
call   1040 <puts@plt>
add    $0x148,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Provide the sudoku \0A'0' represents blank space \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"Can't solve this sudoku \0A\00"
define void @main() {
%1 = alloca [9 x [9 x i32]]
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %5
5: ; preds = %24, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 9
br i1 %7, label %8, label %27
8: ; preds = %5
store i32 0, i32* %3
br label %9
9: ; preds = %20, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 9
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %14
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [9 x i32], [9 x i32]* %15, i64 0, i64 %17
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
br label %20
20: ; preds = %12
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %9
23: ; preds = %9
br label %24
24: ; preds = %23
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %5
27: ; preds = %5
%28 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 0
%29 = bitcast [9 x i32]* %28 to i32**
%30 = call i64 @can_solve(i32** %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %27
%33 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 0
%34 = bitcast [9 x i32]* %33 to i32**
%35 = call i32 @print_sudoku(i32** %34)
br label %38
36: ; preds = %27
%37 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %38
38: ; preds = %36, %32
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [48 x i8] c"Provide the sudoku \0A'0' represents blank space \00"
@str.3 = [25 x i8] c"Can't solve this sudoku \00"
define void @main() {
%1 = alloca [9 x [9 x i32]]
%2 = bitcast [9 x [9 x i32]]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %24, %4 ]
%6 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 3
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 4
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 5
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 6
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 7
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %1, i64 0, i64 %5, i64 8
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = add nuw nsw i64 %5, 1
%25 = icmp eq i64 %24, 9
br i1 %25, label %26, label %4
26: ; preds = %4
%27 = bitcast [9 x [9 x i32]]* %1 to i32**
%28 = call i64 @can_solve(i32** %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %26
%31 = call i32 @print_sudoku(i32** %27)
br label %34
32: ; preds = %26
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
br label %34
34: ; preds = %32, %30
ret void
}