#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 */
typedef int /*<<< orphan*/ row;
typedef int /*<<< orphan*/ known;
typedef int /*<<< orphan*/ col;
typedef int /*<<< orphan*/ block;

/* Variables and functions */
int /*<<< orphan*/ memset(int **, int /*<<< orphan*/, int);
int /*<<< orphan*/ readSudoku(char **, int **, int **, int **, int **);
scalar_t__ setCell(char **, int **, int **, int **, int, int);
void solveSudoku(char **board, int boardRowSize, int boardColSize) {
  int col[9][9];
  int row[9][9];
  int block[9][9];
  int pos = 0;
  int known[9][9];
  memset(row, 0, sizeof(row));
  memset(col, 0, sizeof(col));
  memset(block, 0, sizeof(block));
  memset(known, 0, sizeof(known));
  readSudoku(board, known, row, col, block);
  while (1) {
    while (pos < 81 && known[pos / 9][pos % 9]) {
      pos++;
    }
    if (pos >= 81) {
      break;
    }
    if (setCell(board, row, col, block, pos / 9, pos % 9)) {
      pos++;
    } else {
      do {
        pos--;
      } while (pos >= 0 && known[pos / 9][pos % 9]);
      if (pos < 0) {
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<solveSudoku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x580,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x404(%rbp)
lea    -0x2b0(%rbp),%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
lea    -0x550(%rbp),%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
lea    -0x550(%rbp),%rsi
lea    -0x2b0(%rbp),%rdx
lea    -0x160(%rbp),%rcx
lea    -0x400(%rbp),%r8
call   1050 <readSudoku@plt>
jmp    11c5 <solveSudoku+0x95>
xor    %eax,%eax
cmpl   $0x51,-0x404(%rbp)
mov    %al,-0x551(%rbp)
jge    1225 <solveSudoku+0xf5>
mov    -0x404(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    -0x550(%rbp),%rax
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x560(%rbp)
mov    -0x404(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    -0x560(%rbp),%rax
movslq %edx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
setne  %al
mov    %al,-0x551(%rbp)
mov    -0x551(%rbp),%al
test   $0x1,%al
jne    1238 <solveSudoku+0x108>
jmp    124c <solveSudoku+0x11c>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    11c5 <solveSudoku+0x95>
cmpl   $0x51,-0x404(%rbp)
jl     125e <solveSudoku+0x12e>
jmp    136c <solveSudoku+0x23c>
mov    -0x8(%rbp),%rdi
lea    -0x2b0(%rbp),%rsi
lea    -0x160(%rbp),%rax
mov    %rax,-0x568(%rbp)
lea    -0x400(%rbp),%rcx
mov    -0x404(%rbp),%eax
mov    $0x9,%r8d
cltd
idiv   %r8d
mov    %eax,%r8d
mov    -0x404(%rbp),%eax
mov    $0x9,%r9d
cltd
idiv   %r9d
mov    %edx,%r9d
mov    -0x568(%rbp),%rdx
call   1040 <setCell@plt>
cmp    $0x0,%rax
je     12ce <solveSudoku+0x19e>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    1367 <solveSudoku+0x237>
jmp    12d3 <solveSudoku+0x1a3>
mov    -0x404(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x404(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x404(%rbp)
mov    %al,-0x569(%rbp)
jl     1342 <solveSudoku+0x212>
mov    -0x404(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
lea    -0x550(%rbp),%rax
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x578(%rbp)
mov    -0x404(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    -0x578(%rbp),%rax
movslq %edx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
setne  %al
mov    %al,-0x569(%rbp)
mov    -0x569(%rbp),%al
test   $0x1,%al
jne    12d3 <solveSudoku+0x1a3>
cmpl   $0x0,-0x404(%rbp)
jge    1362 <solveSudoku+0x232>
jmp    136c <solveSudoku+0x23c>
jmp    1367 <solveSudoku+0x237>
jmp    11c0 <solveSudoku+0x90>
add    $0x580,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solveSudoku>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x538,%rsp
mov    %rdi,%r13
lea    0x2a0(%rsp),%r14
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
lea    0x3f0(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
lea    0x150(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1030 <memset@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1050 <readSudoku@plt>
cmp    $0x51,%ebp
mov    $0x50,%eax
cmovge %ebp,%eax
add    $0x1,%eax
lea    -0x1(%rbp),%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %ebp,%r9
imul   $0x38e38e39,%r9,%r8
mov    %r8,%rcx
shr    $0x3f,%rcx
sar    $0x21,%r8
add    %ecx,%r8d
movslq %r8d,%rcx
lea    (%rcx,%rcx,8),%edx
sub    %edx,%r9d
movslq %r9d,%rdx
lea    (%rcx,%rcx,8),%rcx
lea    (%rsp,%rcx,4),%rcx
cmpl   $0x0,(%rcx,%rdx,4)
je     1210 <solveSudoku+0xe0>
add    $0x1,%ebp
add    $0x1,%ebx
cmp    %ebp,%eax
jne    11d0 <solveSudoku+0xa0>
jmp    1275 <solveSudoku+0x145>
xchg   %ax,%ax
mov    %r13,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1040 <setCell@plt>
test   %rax,%rax
je     1230 <solveSudoku+0x100>
add    $0x1,%ebp
cmp    $0x51,%ebp
jl     11b1 <solveSudoku+0x81>
jmp    1275 <solveSudoku+0x145>
lea    0x1(%rbx),%eax
test   %eax,%eax
jle    1275 <solveSudoku+0x145>
mov    %ebx,%eax
imul   $0x38e38e39,%rax,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,8),%ecx
neg    %ecx
imul   $0x38e38e39,%rax,%rax
shr    $0x21,%rax
add    %ebx,%ecx
lea    (%rax,%rax,8),%rax
lea    (%rsp,%rax,4),%rax
add    $0xffffffff,%ebx
cmpl   $0x0,(%rax,%rcx,4)
jne    1230 <solveSudoku+0x100>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    $0x51,%ebp
jl     11b1 <solveSudoku+0x81>
add    $0x538,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @solveSudoku(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca [9 x [9 x i32]]
%8 = alloca [9 x [9 x i32]]
%9 = alloca [9 x [9 x i32]]
%10 = alloca i32
%11 = alloca [9 x [9 x i32]]
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %10
%12 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %8, i64 0, i64 0
%13 = bitcast [9 x i32]* %12 to i32**
%14 = call i32 @memset(i32** %13, i32 0, i32 324)
%15 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %7, i64 0, i64 0
%16 = bitcast [9 x i32]* %15 to i32**
%17 = call i32 @memset(i32** %16, i32 0, i32 324)
%18 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %9, i64 0, i64 0
%19 = bitcast [9 x i32]* %18 to i32**
%20 = call i32 @memset(i32** %19, i32 0, i32 324)
%21 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %11, i64 0, i64 0
%22 = bitcast [9 x i32]* %21 to i32**
%23 = call i32 @memset(i32** %22, i32 0, i32 324)
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %11, i64 0, i64 0
%26 = bitcast [9 x i32]* %25 to i32**
%27 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %8, i64 0, i64 0
%28 = bitcast [9 x i32]* %27 to i32**
%29 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %7, i64 0, i64 0
%30 = bitcast [9 x i32]* %29 to i32**
%31 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %9, i64 0, i64 0
%32 = bitcast [9 x i32]* %31 to i32**
%33 = call i32 @readSudoku(i8** %24, i32** %26, i32** %28, i32** %30, i32** %32)
br label %34
34: ; preds = %3, %100
br label %35
35: ; preds = %51, %34
%36 = load i32, i32* %10
%37 = icmp slt i32 %36, 81
br i1 %37, label %38, label %49
38: ; preds = %35
%39 = load i32, i32* %10
%40 = sdiv i32 %39, 9
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %11, i64 0, i64 %41
%43 = load i32, i32* %10
%44 = srem i32 %43, 9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [9 x i32], [9 x i32]* %42, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = icmp ne i32 %47, 0
br label %49
49: ; preds = %38, %35
%50 = phi i1 [ false, %35 ], [ %48, %38 ]
br i1 %50, label %51, label %54
51: ; preds = %49
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %35
54: ; preds = %49
%55 = load i32, i32* %10
%56 = icmp sge i32 %55, 81
br i1 %56, label %57, label %58
57: ; preds = %54
br label %101
58: ; preds = %54
%59 = load i8**, i8*** %4
%60 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %8, i64 0, i64 0
%61 = bitcast [9 x i32]* %60 to i32**
%62 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %7, i64 0, i64 0
%63 = bitcast [9 x i32]* %62 to i32**
%64 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %9, i64 0, i64 0
%65 = bitcast [9 x i32]* %64 to i32**
%66 = load i32, i32* %10
%67 = sdiv i32 %66, 9
%68 = load i32, i32* %10
%69 = srem i32 %68, 9
%70 = call i64 @setCell(i8** %59, i32** %61, i32** %63, i32** %65, i32 %67, i32 %69)
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %58
%73 = load i32, i32* %10
%74 = add nsw i32 %73, 1
store i32 %74, i32* %10
br label %100
75: ; preds = %58
br label %76
76: ; preds = %93, %75
%77 = load i32, i32* %10
%78 = add nsw i32 %77, -1
store i32 %78, i32* %10
br label %79
79: ; preds = %76
%80 = load i32, i32* %10
%81 = icmp sge i32 %80, 0
br i1 %81, label %82, label %93
82: ; preds = %79
%83 = load i32, i32* %10
%84 = sdiv i32 %83, 9
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %11, i64 0, i64 %85
%87 = load i32, i32* %10
%88 = srem i32 %87, 9
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [9 x i32], [9 x i32]* %86, i64 0, i64 %89
%91 = load i32, i32* %90
%92 = icmp ne i32 %91, 0
br label %93
93: ; preds = %82, %79
%94 = phi i1 [ false, %79 ], [ %92, %82 ]
br i1 %94, label %76, label %95
95: ; preds = %93
%96 = load i32, i32* %10
%97 = icmp slt i32 %96, 0
br i1 %97, label %98, label %99
98: ; preds = %95
br label %101
99: ; preds = %95
br label %100
100: ; preds = %99, %72
br label %34
101: ; preds = %98, %57
ret void
}

LLVM IR (-O2):
define void @solveSudoku(i8** %0, i32 %1, i32 %2) {
%4 = alloca [9 x [9 x i32]]
%5 = alloca [9 x [9 x i32]]
%6 = alloca [9 x [9 x i32]]
%7 = alloca [9 x [9 x i32]]
%8 = bitcast [9 x [9 x i32]]* %4 to i8*
%9 = bitcast [9 x [9 x i32]]* %5 to i8*
%10 = bitcast [9 x [9 x i32]]* %6 to i8*
%11 = bitcast [9 x [9 x i32]]* %7 to i8*
%12 = bitcast [9 x [9 x i32]]* %5 to i32**
%13 = call i32 @memset(i32** %12, i32 0, i32 324)
%14 = bitcast [9 x [9 x i32]]* %4 to i32**
%15 = call i32 @memset(i32** %14, i32 0, i32 324)
%16 = bitcast [9 x [9 x i32]]* %6 to i32**
%17 = call i32 @memset(i32** %16, i32 0, i32 324)
%18 = bitcast [9 x [9 x i32]]* %7 to i32**
%19 = call i32 @memset(i32** %18, i32 0, i32 324)
%20 = call i32 @readSudoku(i8** %0, i32** %18, i32** %12, i32** %14, i32** %16)
br label %21
21: ; preds = %3, %53
%22 = phi i32 [ 0, %3 ], [ %54, %53 ]
%23 = call i32 @llvm.smax.i32(i32 %22, i32 80)
br label %24
24: ; preds = %21, %33
%25 = phi i32 [ %22, %21 ], [ %34, %33 ]
%26 = sdiv i32 %25, 9
%27 = sext i32 %26 to i64
%28 = srem i32 %25, 9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %7, i64 0, i64 %27, i64 %29
%31 = load i32, i32* %30
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %24
%34 = add i32 %25, 1
%35 = icmp eq i32 %25, %23
br i1 %35, label %56, label %24
36: ; preds = %24
%37 = call i64 @setCell(i8** %0, i32** %12, i32** %14, i32** %16, i32 %26, i32 %28)
%38 = icmp eq i64 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %36
%40 = add nsw i32 %25, 1
br label %53
41: ; preds = %36, %45
%42 = phi i32 [ %43, %45 ], [ %25, %36 ]
%43 = add nsw i32 %42, -1
%44 = icmp sgt i32 %42, 0
br i1 %44, label %45, label %56
45: ; preds = %41
%46 = udiv i32 %43, 9
%47 = zext i32 %46 to i64
%48 = urem i32 %43, 9
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds [9 x [9 x i32]], [9 x [9 x i32]]* %7, i64 0, i64 %47, i64 %49
%51 = load i32, i32* %50
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %41
53: ; preds = %45, %39
%54 = phi i32 [ %40, %39 ], [ %43, %45 ]
%55 = icmp slt i32 %54, 81
br i1 %55, label %21, label %56
56: ; preds = %53, %33, %41
ret void
}