#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 cleanCell(char **, int **, int **, int **, int, int);
scalar_t__ isAvailable(int **, int **, int **, int, int, int);
bool setCell(char **board, int row[9][9], int col[9][9], int block[9][9], int i,
             int j) {
  int n = cleanCell(board, row, col, block, i, j);
  while (++n <= 9) {
    if (isAvailable(row, col, block, i, j, n)) {
      board[i][j] = n + '0';
      row[i][n - 1] = 1;
      col[j][n - 1] = 1;
      block[i / 3 * 3 + j / 3][n - 1] = 1;
      return true;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<setCell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x2c(%rbp),%r8d
mov    -0x30(%rbp),%r9d
call   1040 <cleanCell@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmp    $0x9,%eax
jg     1245 <setCell+0x125>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
mov    -0x30(%rbp),%r8d
mov    -0x34(%rbp),%r9d
call   1030 <isAvailable@plt>
cmp    $0x0,%rax
je     1240 <setCell+0x120>
mov    -0x34(%rbp),%eax
add    $0x30,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
imul   $0x3,%eax,%ecx
mov    -0x30(%rbp),%eax
mov    $0x3,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x40(%rbp),%rax
add    %edx,%ecx
movslq %ecx,%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
movl   $0x1,-0x4(%rbp)
jmp    124c <setCell+0x12c>
jmp    1160 <setCell+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setCell>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%ebp
mov    %r8d,%ebx
mov    %rsi,%r12
mov    %rdi,0x10(%rsp)
mov    %rdx,(%rsp)
mov    %rcx,0x8(%rsp)
call   1040 <cleanCell@plt>
mov    %eax,%r13d
cmp    $0xa,%eax
mov    $0x9,%eax
cmovge %r13d,%eax
mov    %r13d,%r15d
sub    %eax,%r13d
mov    $0xffffffffffffffff,%r14
cs nopw 0x0(%rax,%rax,1)
lea    (%r14,%r13,1),%eax
cmp    $0xffffffff,%eax
je     123b <setCell+0x11b>
lea    (%r15,%r14,1),%r9
add    $0x2,%r9
mov    %r12,%rdi
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %ebx,%ecx
mov    %ebp,%r8d
call   1030 <isAvailable@plt>
add    $0x1,%r14
test   %rax,%rax
je     1170 <setCell+0x50>
lea    (%r15,%r14,1),%eax
movslq %ebx,%rcx
mov    0x10(%rsp),%rdx
mov    (%rdx,%rcx,8),%rdx
movslq %ebp,%rsi
add    $0x31,%al
mov    %al,(%rdx,%rsi,1)
movslq %r15d,%rax
lea    (%rcx,%rcx,8),%rdx
lea    (%r12,%rdx,4),%rdx
lea    (%rdx,%rax,4),%rdx
movl   $0x1,(%rdx,%r14,4)
lea    (%rsi,%rsi,8),%rdx
mov    (%rsp),%rdi
lea    (%rdi,%rdx,4),%rdx
lea    (%rdx,%rax,4),%rdx
movl   $0x1,(%rdx,%r14,4)
imul   $0x55555556,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
imul   $0x55555556,%rsi,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rdx
add    %esi,%edx
add    %ecx,%edx
movslq %edx,%rcx
lea    (%rcx,%rcx,8),%rcx
mov    0x8(%rsp),%rdx
lea    (%rdx,%rax,4),%rax
lea    (%rax,%rcx,4),%rax
movl   $0x1,(%rax,%r14,4)
mov    $0x1,%eax
jmp    123d <setCell+0x11d>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @setCell(i8** %0, [9 x i32]* %1, [9 x i32]* %2, [9 x i32]* %3, i32 %4, i32 %5) {
%7 = bitcast [9 x i32]* %1 to i32**
%8 = bitcast [9 x i32]* %2 to i32**
%9 = bitcast [9 x i32]* %3 to i32**
%10 = tail call i32 @cleanCell(i8** %0, i32** %7, i32** %8, i32** %9, i32 %4, i32 %5)
%11 = call i32 @llvm.smax.i32(i32 %10, i32 9)
br label %12
12: ; preds = %16, %6
%13 = phi i32 [ %10, %6 ], [ %14, %16 ]
%14 = add nsw i32 %13, 1
%15 = icmp eq i32 %13, %11
br i1 %15, label %36, label %16
16: ; preds = %12
%17 = tail call i64 @isAvailable(i32** %7, i32** %8, i32** %9, i32 %4, i32 %5, i32 %14)
%18 = icmp eq i64 %17, 0
br i1 %18, label %12, label %19
19: ; preds = %16
%20 = trunc i32 %13 to i8
%21 = add i8 %20, 49
%22 = sext i32 %4 to i64
%23 = getelementptr inbounds i8*, i8** %0, i64 %22
%24 = load i8*, i8** %23
%25 = sext i32 %5 to i64
%26 = getelementptr inbounds i8, i8* %24, i64 %25
store i8 %21, i8* %26
%27 = sext i32 %13 to i64
%28 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 %22, i64 %27
store i32 1, i32* %28
%29 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 %25, i64 %27
store i32 1, i32* %29
%30 = srem i32 %4, 3
%31 = sub i32 %4, %30
%32 = sdiv i32 %5, 3
%33 = add nsw i32 %31, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 %34, i64 %27
store i32 1, i32* %35
br label %36
36: ; preds = %12, %19
%37 = phi i32 [ 1, %19 ], [ 0, %12 ]
ret i32 %37
}