#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__ isSafe(int **, int, int, int);
int /*<<< orphan*/ isUnassigned(int **, int *, int *);
int sudokuUtility(int grid[9][9]) {
  int row, col;
  if (!isUnassigned(grid, &row, &col))
    return 1;
  int num;
  for (num = 1; num <= 9; ++num) {
    if (isSafe(grid, row, col, num)) {
      grid[row][col] = num;
      if (sudokuUtility(grid))
        return 1;
      grid[row][col] = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<sudokuUtility>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <isUnassigned@plt>
cmp    $0x0,%eax
jne    1162 <sudokuUtility+0x32>
movl   $0x1,-0x4(%rbp)
jmp    11fa <sudokuUtility+0xca>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jg     11f3 <sudokuUtility+0xc3>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <isSafe@plt>
cmp    $0x0,%rax
je     11e0 <sudokuUtility+0xb0>
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rdi
call   1050 <sudokuUtility@plt>
cmp    $0x0,%eax
je     11c6 <sudokuUtility+0x96>
movl   $0x1,-0x4(%rbp)
jmp    11fa <sudokuUtility+0xca>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    11e5 <sudokuUtility+0xb5>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1169 <sudokuUtility+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sudokuUtility>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <isUnassigned@plt>
test   %eax,%eax
je     11a8 <sudokuUtility+0x78>
mov    $0x1,%ebp
jmp    1158 <sudokuUtility+0x28>
xchg   %ax,%ax
add    $0x1,%ebp
cmp    $0xa,%ebp
je     11af <sudokuUtility+0x7f>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %rbx,%rdi
mov    %ebp,%ecx
call   1030 <isSafe@plt>
test   %rax,%rax
je     1150 <sudokuUtility+0x20>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rcx
lea    (%rax,%rax,8),%rax
lea    (%rbx,%rax,4),%rax
mov    %ebp,(%rax,%rcx,4)
mov    %rbx,%rdi
call   1050 <sudokuUtility@plt>
test   %eax,%eax
jne    11a8 <sudokuUtility+0x78>
movslq 0x4(%rsp),%rax
movslq (%rsp),%rcx
lea    (%rax,%rax,8),%rax
lea    (%rbx,%rax,4),%rax
movl   $0x0,(%rax,%rcx,4)
jmp    1150 <sudokuUtility+0x20>
mov    $0x1,%eax
jmp    11b1 <sudokuUtility+0x81>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sudokuUtility([9 x i32]* %0) {
%2 = alloca i32
%3 = alloca [9 x i32]*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store [9 x i32]* %0, [9 x i32]** %3
%7 = load [9 x i32]*, [9 x i32]** %3
%8 = bitcast [9 x i32]* %7 to i32**
%9 = call i32 @isUnassigned(i32** %8, i32* %4, i32* %5)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %1
store i32 1, i32* %2
br label %50
12: ; preds = %1
store i32 1, i32* %6
br label %13
13: ; preds = %46, %12
%14 = load i32, i32* %6
%15 = icmp sle i32 %14, 9
br i1 %15, label %16, label %49
16: ; preds = %13
%17 = load [9 x i32]*, [9 x i32]** %3
%18 = bitcast [9 x i32]* %17 to i32**
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = call i64 @isSafe(i32** %18, i32 %19, i32 %20, i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %45
24: ; preds = %16
%25 = load i32, i32* %6
%26 = load [9 x i32]*, [9 x i32]** %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [9 x i32], [9 x i32]* %26, i64 %28
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [9 x i32], [9 x i32]* %29, i64 0, i64 %31
store i32 %25, i32* %32
%33 = load [9 x i32]*, [9 x i32]** %3
%34 = call i32 @sudokuUtility([9 x i32]* %33)
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %24
store i32 1, i32* %2
br label %50
37: ; preds = %24
%38 = load [9 x i32]*, [9 x i32]** %3
%39 = load i32, i32* %4
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [9 x i32], [9 x i32]* %38, i64 %40
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [9 x i32], [9 x i32]* %41, i64 0, i64 %43
store i32 0, i32* %44
br label %45
45: ; preds = %37, %16
br label %46
46: ; preds = %45
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %13
49: ; preds = %13
store i32 0, i32* %2
br label %50
50: ; preds = %49, %36, %11
%51 = load i32, i32* %2
ret i32 %51
}

LLVM IR (-O2):
define i32 @sudokuUtility([9 x i32]* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = bitcast [9 x i32]* %0 to i32**
%7 = call i32 @isUnassigned(i32** %6, i32* %2, i32* %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %32, label %9
9: ; preds = %1, %29
%10 = phi i32 [ %30, %29 ], [ 1, %1 ]
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i64 @isSafe(i32** %6, i32 %11, i32 %12, i32 %10)
%14 = icmp eq i64 %13, 0
br i1 %14, label %29, label %15
15: ; preds = %9
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %17, i64 %19
store i32 %10, i32* %20
%21 = call i32 @sudokuUtility([9 x i32]* %0)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %32
23: ; preds = %15
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [9 x i32], [9 x i32]* %0, i64 %25, i64 %27
store i32 0, i32* %28
br label %29
29: ; preds = %9, %23
%30 = add nuw nsw i32 %10, 1
%31 = icmp eq i32 %30, 10
br i1 %31, label %32, label %9
32: ; preds = %15, %29, %1
%33 = phi i32 [ 1, %1 ], [ 0, %29 ], [ 1, %15 ]
ret i32 %33
}