#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*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ position_cursor(int /*<<< orphan*/ ***, int, int,
                                   int /*<<< orphan*/);
void position_cursor_first_blank(uint8_t (*board)[9][9], int *cursor_row,
                                 int *cursor_col) {
  int row, col;
  for (row = 0; row < 9; row++) {
    for (col = 0; col < 9; col++) {
      if ((0) == (*board)[row][col]) {
        position_cursor(board, row, col, (0));
        *cursor_row = row;
        *cursor_col = col;
        return;
      }
    }
  }
}


x86 assembly (clang, -O0):
<position_cursor_first_blank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jge    11b2 <position_cursor_first_blank+0xa2>
movl   $0x0,-0x20(%rbp)
cmpl   $0x9,-0x20(%rbp)
jge    119f <position_cursor_first_blank+0x8f>
mov    -0x8(%rbp),%rcx
movslq -0x1c(%rbp),%rax
imul   $0x24,%rax,%rax
add    %rax,%rcx
movslq -0x20(%rbp),%rdx
xor    %eax,%eax
cmp    (%rcx,%rdx,4),%eax
jne    118c <position_cursor_first_blank+0x7c>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
xor    %ecx,%ecx
call   1030 <position_cursor@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11b2 <position_cursor_first_blank+0xa2>
jmp    1191 <position_cursor_first_blank+0x81>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113c <position_cursor_first_blank+0x2c>
jmp    11a4 <position_cursor_first_blank+0x94>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <position_cursor_first_blank+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<position_cursor_first_blank>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
lea    0x20(%rdi),%rax
xor    %r12d,%r12d
xor    %ebx,%ebx
cmpl   $0x0,-0x20(%rax)
je     11aa <position_cursor_first_blank+0x9a>
cmpl   $0x0,-0x1c(%rax)
je     116c <position_cursor_first_blank+0x5c>
cmpl   $0x0,-0x18(%rax)
je     1174 <position_cursor_first_blank+0x64>
cmpl   $0x0,-0x14(%rax)
je     117c <position_cursor_first_blank+0x6c>
cmpl   $0x0,-0x10(%rax)
je     1184 <position_cursor_first_blank+0x74>
cmpl   $0x0,-0xc(%rax)
je     118c <position_cursor_first_blank+0x7c>
cmpl   $0x0,-0x8(%rax)
je     1194 <position_cursor_first_blank+0x84>
cmpl   $0x0,-0x4(%rax)
je     119c <position_cursor_first_blank+0x8c>
cmpl   $0x0,(%rax)
je     11a4 <position_cursor_first_blank+0x94>
add    $0x1,%rbx
add    $0x24,%rax
cmp    $0x9,%rbx
jne    1127 <position_cursor_first_blank+0x17>
jmp    11bc <position_cursor_first_blank+0xac>
mov    $0x1,%r12d
jmp    11aa <position_cursor_first_blank+0x9a>
mov    $0x2,%r12d
jmp    11aa <position_cursor_first_blank+0x9a>
mov    $0x3,%r12d
jmp    11aa <position_cursor_first_blank+0x9a>
mov    $0x4,%r12d
jmp    11aa <position_cursor_first_blank+0x9a>
mov    $0x5,%r12d
jmp    11aa <position_cursor_first_blank+0x9a>
mov    $0x6,%r12d
jmp    11aa <position_cursor_first_blank+0x9a>
mov    $0x7,%r12d
jmp    11aa <position_cursor_first_blank+0x9a>
mov    $0x8,%r12d
mov    %ebx,%esi
mov    %r12d,%edx
xor    %ecx,%ecx
call   1030 <position_cursor@plt>
mov    %ebx,(%r15)
mov    %r12d,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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