#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 /*<<< orphan*/ printf(char *, ...);
int findThePositionOfQueen(int mat[10][10], int level) {
  int place = 0;
  int colPos = 0;
  for (int col = 0; col < 10; col++) {
    if (col != 0) {
      mat[level][col - 1] = 0;
    }
    mat[level][col] = 1;
    int topRight = col + level;
    int topLeft = level - col;
    if (level >= 1) {
      for (int row = level - 1; row >= 0; row--) {
        for (int colPos = 0; colPos < 10; colPos++) {
          if (mat[row][col] == 1) {
            mat[level][col] = 0;
            place = 0;
            break;
          }
          if (row - colPos == topLeft || row + colPos == topRight) {
            if (mat[row][colPos] == 1) {
              mat[level][col] = 0;
              place = 0;
              break;
            }
          }
          place = 1;
        }
        if (place == 0)
          break;
      }
    } else {
      place = 1;
    }
    printf("**********************i\n");
    printf("place = %d\n", place);
    for (int i = 0; i < 10; i++) {
      for (int j = 0; j < 10; j++) {
        printf("%d ", mat[i][j]);
      }
      printf("\n");
    }
    printf("\n");
    printf("**********************i\n");
    if (place && ((level + 1) < 10) && findThePositionOfQueen(mat, level + 1))
      return 1;
    else if (level + 1 == 10 && place == 1)
      return 1;
  }
  if (level != 0)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<findThePositionOfQueen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jge    13e2 <findThePositionOfQueen+0x2c2>
cmpl   $0x0,-0x20(%rbp)
je     1177 <findThePositionOfQueen+0x57>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x1,-0x14(%rbp)
jl     12b6 <findThePositionOfQueen+0x196>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jl     12b1 <findThePositionOfQueen+0x191>
movl   $0x0,-0x30(%rbp)
cmpl   $0xa,-0x30(%rbp)
jge    128f <findThePositionOfQueen+0x16f>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1214 <findThePositionOfQueen+0xf4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
movl   $0x0,-0x18(%rbp)
jmp    128f <findThePositionOfQueen+0x16f>
mov    -0x2c(%rbp),%eax
sub    -0x30(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     1232 <findThePositionOfQueen+0x112>
mov    -0x2c(%rbp),%eax
add    -0x30(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    127a <findThePositionOfQueen+0x15a>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x30(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    1275 <findThePositionOfQueen+0x155>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
movl   $0x0,-0x18(%rbp)
jmp    128f <findThePositionOfQueen+0x16f>
jmp    127a <findThePositionOfQueen+0x15a>
movl   $0x1,-0x18(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11c7 <findThePositionOfQueen+0xa7>
cmpl   $0x0,-0x18(%rbp)
jne    129e <findThePositionOfQueen+0x17e>
jmp    12b1 <findThePositionOfQueen+0x191>
jmp    12a3 <findThePositionOfQueen+0x183>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b6 <findThePositionOfQueen+0x96>
jmp    12bd <findThePositionOfQueen+0x19d>
movl   $0x1,-0x18(%rbp)
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    134c <findThePositionOfQueen+0x22c>
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    1330 <findThePositionOfQueen+0x210>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12f4 <findThePositionOfQueen+0x1d4>
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12e3 <findThePositionOfQueen+0x1c3>
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
je     13a5 <findThePositionOfQueen+0x285>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    $0xa,%eax
jge    13a5 <findThePositionOfQueen+0x285>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
call   1030 <findThePositionOfQueen@plt>
cmp    $0x0,%eax
je     13a5 <findThePositionOfQueen+0x285>
movl   $0x1,-0x4(%rbp)
jmp    13ff <findThePositionOfQueen+0x2df>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    $0xa,%eax
jne    13ca <findThePositionOfQueen+0x2aa>
cmpl   $0x1,-0x18(%rbp)
jne    13ca <findThePositionOfQueen+0x2aa>
movl   $0x1,-0x4(%rbp)
jmp    13ff <findThePositionOfQueen+0x2df>
jmp    13cf <findThePositionOfQueen+0x2af>
jmp    13d4 <findThePositionOfQueen+0x2b4>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1144 <findThePositionOfQueen+0x24>
cmpl   $0x0,-0x14(%rbp)
je     13f8 <findThePositionOfQueen+0x2d8>
movl   $0x0,-0x4(%rbp)
jmp    13ff <findThePositionOfQueen+0x2df>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findThePositionOfQueen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %esi,%r13d
mov    %rdi,%rbx
movslq %esi,%rdi
lea    0x1(%rdi),%eax
mov    %eax,0x18(%rsp)
mov    %rdi,%rax
neg    %rax
mov    %rax,0x38(%rsp)
lea    (%rdi,%rdi,4),%rax
lea    (%rbx,%rax,8),%r10
add    $0xfffffffffffffffc,%r10
movq   $0xffffffffffffffd8,0x30(%rsp)
ff ff
lea    0xe87(%rip),%rbp
mov    %esi,%ecx
mov    %esi,%edx
xor    %r12d,%r12d
xor    %r15d,%r15d
mov    %r10,0x28(%rsp)
mov    %esi,0x1c(%rsp)
mov    %rdi,0x40(%rsp)
jmp    11e6 <findThePositionOfQueen+0xa6>
nop
cmp    $0x9,%r13d
sete   %al
mov    0x8(%rsp),%ecx
xor    $0x1,%cl
test   %cl,%al
mov    0x28(%rsp),%r10
jne    1510 <findThePositionOfQueen+0x3d0>
add    $0x1,%r15
add    $0xffffffffffffffff,%r12
mov    0x20(%rsp),%edx
add    $0x1,%edx
mov    0x24(%rsp),%ecx
add    $0xffffffff,%ecx
addq   $0x4,0x30(%rsp)
cmp    $0xa,%r15
mov    0x40(%rsp),%rdi
je     1517 <findThePositionOfQueen+0x3d7>
test   %r15,%r15
je     11f8 <findThePositionOfQueen+0xb8>
lea    -0x1(%r15),%eax
movl   $0x0,0x4(%r10,%rax,4)
movl   $0x1,0x4(%r10,%r15,4)
mov    $0x1,%r14d
mov    $0x1,%al
mov    %eax,0x14(%rsp)
test   %r13d,%r13d
mov    %ecx,0x24(%rsp)
mov    %edx,0x20(%rsp)
jle    13d0 <findThePositionOfQueen+0x290>
mov    %edx,%eax
add    0x38(%rsp),%rax
mov    %ecx,%esi
not    %rsi
mov    %edi,%edx
sub    %r15d,%edx
lea    (%r10,%r15,4),%rcx
add    $0x4,%rcx
mov    %rcx,0x48(%rsp)
mov    %edx,%edx
lea    (%rdx,%rdx,4),%rdx
lea    (%rbx,%rdx,8),%rcx
mov    %rcx,0x50(%rsp)
lea    0x9(%r12),%rcx
mov    %rcx,0x58(%rsp)
lea    0x8(%r12),%rcx
mov    %rcx,0x60(%rsp)
lea    0x7(%r12),%rcx
mov    %rcx,0x8(%rsp)
lea    0x6(%r12),%r13
lea    0x5(%r12),%rdx
lea    0x4(%r12),%r8
lea    0x3(%r12),%r9
lea    0x2(%r12),%r14
add    %rdi,%rsi
xor    %r11d,%r11d
jmp    12ae <findThePositionOfQueen+0x16e>
nopw   0x0(%rax,%rax,1)
lea    (%rdi,%r11,1),%rcx
add    $0xffffffffffffffff,%rcx
add    $0xffffffffffffffff,%r11
add    $0x1,%rcx
add    $0xffffffffffffffd8,%r10
cmp    $0x1,%rcx
jle    14fd <findThePositionOfQueen+0x3bd>
mov    0x30(%rsp),%rcx
cmpl   $0x1,0x4(%r10,%rcx,1)
je     13b0 <findThePositionOfQueen+0x270>
mov    %rsi,%rcx
add    %r11,%rcx
jne    12d5 <findThePositionOfQueen+0x195>
mov    0x50(%rsp),%rcx
cmpl   $0x1,(%rcx)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,%r14d
je     12df <findThePositionOfQueen+0x19f>
cmp    %r11,%rax
jne    12ea <findThePositionOfQueen+0x1aa>
cmpl   $0x1,-0x20(%r10)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,%r9d
je     12f8 <findThePositionOfQueen+0x1b8>
lea    (%r12,%r11,1),%ecx
cmp    $0xffffffff,%ecx
jne    1303 <findThePositionOfQueen+0x1c3>
cmpl   $0x1,-0x1c(%r10)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,%r8d
je     1311 <findThePositionOfQueen+0x1d1>
lea    (%r12,%r11,1),%ecx
cmp    $0xfffffffe,%ecx
jne    131c <findThePositionOfQueen+0x1dc>
cmpl   $0x1,-0x18(%r10)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,%edx
je     132a <findThePositionOfQueen+0x1ea>
lea    (%r12,%r11,1),%ecx
cmp    $0xfffffffd,%ecx
jne    1331 <findThePositionOfQueen+0x1f1>
cmpl   $0x1,-0x14(%r10)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,%r13d
je     133f <findThePositionOfQueen+0x1ff>
lea    (%r12,%r11,1),%ecx
cmp    $0xfffffffc,%ecx
jne    1346 <findThePositionOfQueen+0x206>
cmpl   $0x1,-0x10(%r10)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,0x8(%rsp)
je     1356 <findThePositionOfQueen+0x216>
lea    (%r12,%r11,1),%ecx
cmp    $0xfffffffb,%ecx
jne    135d <findThePositionOfQueen+0x21d>
cmpl   $0x1,-0xc(%r10)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,0x60(%rsp)
je     136d <findThePositionOfQueen+0x22d>
lea    (%r12,%r11,1),%ecx
cmp    $0xfffffffa,%ecx
jne    1374 <findThePositionOfQueen+0x234>
cmpl   $0x1,-0x8(%r10)
je     13b0 <findThePositionOfQueen+0x270>
cmp    %r11d,0x58(%rsp)
je     1384 <findThePositionOfQueen+0x244>
lea    (%r12,%r11,1),%ecx
cmp    $0xfffffff9,%ecx
jne    138b <findThePositionOfQueen+0x24b>
cmpl   $0x1,-0x4(%r10)
je     13b0 <findThePositionOfQueen+0x270>
lea    (%r12,%r11,1),%ecx
cmp    $0xfffffff8,%ecx
jne    1290 <findThePositionOfQueen+0x150>
cmpl   $0x1,(%r10)
jne    1290 <findThePositionOfQueen+0x150>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x48(%rsp),%rax
movl   $0x0,(%rax)
movl   $0x0,0x14(%rsp)
mov    $0x1,%al
mov    %eax,0x8(%rsp)
xor    %r14d,%r14d
jmp    13d8 <findThePositionOfQueen+0x298>
xchg   %ax,%ax
movl   $0x0,0x8(%rsp)
lea    0xc31(%rip),%rdi
call   1040 <puts@plt>
lea    0xc15(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x24,%r14d
nopl   0x0(%rax,%rax,1)
mov    -0x24(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x20(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x1c(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x18(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x14(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x10(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0xc(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x8(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    -0x4(%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx,%r14,1),%esi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x28,%r14
cmp    $0x1b4,%r14
jne    1400 <findThePositionOfQueen+0x2c0>
mov    0x1c(%rsp),%r13d
cmp    $0x9,%r13d
setge  %r14b
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xb42(%rip),%rdi
call   1040 <puts@plt>
mov    0x14(%rsp),%eax
xor    $0x1,%al
or     %r14b,%al
jne    11a0 <findThePositionOfQueen+0x60>
mov    %rbx,%rdi
mov    0x18(%rsp),%esi
call   1050 <findThePositionOfQueen@plt>
test   %eax,%eax
mov    0x28(%rsp),%r10
je     11bb <findThePositionOfQueen+0x7b>
jmp    1510 <findThePositionOfQueen+0x3d0>
movl   $0x0,0x8(%rsp)
mov    $0x1,%r14d
jmp    13d8 <findThePositionOfQueen+0x298>
mov    $0x1,%eax
jmp    151f <findThePositionOfQueen+0x3df>
xor    %eax,%eax
test   %r13d,%r13d
sete   %al
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"**********************i\0A\00"
@.str.1 = [12 x i8] c"place = %d\0A\00"
@.str.2 = [4 x i8] c"%d \00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @findThePositionOfQueen([10 x i32]* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [10 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store [10 x i32]* %0, [10 x i32]** %4
store i32 %1, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %15
15: ; preds = %174, %2
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %177
18: ; preds = %15
%19 = load i32, i32* %8
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = load [10 x i32]*, [10 x i32]** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [10 x i32], [10 x i32]* %22, i64 %24
%26 = load i32, i32* %8
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %25, i64 0, i64 %28
store i32 0, i32* %29
br label %30
30: ; preds = %21, %18
%31 = load [10 x i32]*, [10 x i32]** %4
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [10 x i32], [10 x i32]* %31, i64 %33
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %34, i64 0, i64 %36
store i32 1, i32* %37
%38 = load i32, i32* %8
%39 = load i32, i32* %5
%40 = add nsw i32 %38, %39
store i32 %40, i32* %9
%41 = load i32, i32* %5
%42 = load i32, i32* %8
%43 = sub nsw i32 %41, %42
store i32 %43, i32* %10
%44 = load i32, i32* %5
%45 = icmp sge i32 %44, 1
br i1 %45, label %46, label %118
46: ; preds = %30
%47 = load i32, i32* %5
%48 = sub nsw i32 %47, 1
store i32 %48, i32* %11
br label %49
49: ; preds = %114, %46
%50 = load i32, i32* %11
%51 = icmp sge i32 %50, 0
br i1 %51, label %52, label %117
52: ; preds = %49
store i32 0, i32* %12
br label %53
53: ; preds = %106, %52
%54 = load i32, i32* %12
%55 = icmp slt i32 %54, 10
br i1 %55, label %56, label %109
56: ; preds = %53
%57 = load [10 x i32]*, [10 x i32]** %4
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [10 x i32], [10 x i32]* %57, i64 %59
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [10 x i32], [10 x i32]* %60, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = icmp eq i32 %64, 1
br i1 %65, label %66, label %74
66: ; preds = %56
%67 = load [10 x i32]*, [10 x i32]** %4
%68 = load i32, i32* %5
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [10 x i32], [10 x i32]* %67, i64 %69
%71 = load i32, i32* %8
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [10 x i32], [10 x i32]* %70, i64 0, i64 %72
store i32 0, i32* %73
store i32 0, i32* %6
br label %109
74: ; preds = %56
%75 = load i32, i32* %11
%76 = load i32, i32* %12
%77 = sub nsw i32 %75, %76
%78 = load i32, i32* %10
%79 = icmp eq i32 %77, %78
br i1 %79, label %86, label %80
80: ; preds = %74
%81 = load i32, i32* %11
%82 = load i32, i32* %12
%83 = add nsw i32 %81, %82
%84 = load i32, i32* %9
%85 = icmp eq i32 %83, %84
br i1 %85, label %86, label %105
86: ; preds = %80, %74
%87 = load [10 x i32]*, [10 x i32]** %4
%88 = load i32, i32* %11
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [10 x i32], [10 x i32]* %87, i64 %89
%91 = load i32, i32* %12
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [10 x i32], [10 x i32]* %90, i64 0, i64 %92
%94 = load i32, i32* %93
%95 = icmp eq i32 %94, 1
br i1 %95, label %96, label %104
96: ; preds = %86
%97 = load [10 x i32]*, [10 x i32]** %4
%98 = load i32, i32* %5
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [10 x i32], [10 x i32]* %97, i64 %99
%101 = load i32, i32* %8
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [10 x i32], [10 x i32]* %100, i64 0, i64 %102
store i32 0, i32* %103
store i32 0, i32* %6
br label %109
104: ; preds = %86
br label %105
105: ; preds = %104, %80
store i32 1, i32* %6
br label %106
106: ; preds = %105
%107 = load i32, i32* %12
%108 = add nsw i32 %107, 1
store i32 %108, i32* %12
br label %53
109: ; preds = %96, %66, %53
%110 = load i32, i32* %6
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %113
112: ; preds = %109
br label %117
113: ; preds = %109
br label %114
114: ; preds = %113
%115 = load i32, i32* %11
%116 = add nsw i32 %115, -1
store i32 %116, i32* %11
br label %49
117: ; preds = %112, %49
br label %119
118: ; preds = %30
store i32 1, i32* %6
br label %119
119: ; preds = %118, %117
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%121 = load i32, i32* %6
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %121)
store i32 0, i32* %13
br label %123
123: ; preds = %145, %119
%124 = load i32, i32* %13
%125 = icmp slt i32 %124, 10
br i1 %125, label %126, label %148
126: ; preds = %123
store i32 0, i32* %14
br label %127
127: ; preds = %140, %126
%128 = load i32, i32* %14
%129 = icmp slt i32 %128, 10
br i1 %129, label %130, label %143
130: ; preds = %127
%131 = load [10 x i32]*, [10 x i32]** %4
%132 = load i32, i32* %13
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [10 x i32], [10 x i32]* %131, i64 %133
%135 = load i32, i32* %14
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds [10 x i32], [10 x i32]* %134, i64 0, i64 %136
%138 = load i32, i32* %137
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %138)
br label %140
140: ; preds = %130
%141 = load i32, i32* %14
%142 = add nsw i32 %141, 1
store i32 %142, i32* %14
br label %127
143: ; preds = %127
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %145
145: ; preds = %143
%146 = load i32, i32* %13
%147 = add nsw i32 %146, 1
store i32 %147, i32* %13
br label %123
148: ; preds = %123
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%151 = load i32, i32* %6
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %164
153: ; preds = %148
%154 = load i32, i32* %5
%155 = add nsw i32 %154, 1
%156 = icmp slt i32 %155, 10
br i1 %156, label %157, label %164
157: ; preds = %153
%158 = load [10 x i32]*, [10 x i32]** %4
%159 = load i32, i32* %5
%160 = add nsw i32 %159, 1
%161 = call i32 @findThePositionOfQueen([10 x i32]* %158, i32 %160)
%162 = icmp ne i32 %161, 0
br i1 %162, label %163, label %164
163: ; preds = %157
store i32 1, i32* %3
br label %182
164: ; preds = %157, %153, %148
%165 = load i32, i32* %5
%166 = add nsw i32 %165, 1
%167 = icmp eq i32 %166, 10
br i1 %167, label %168, label %172
168: ; preds = %164
%169 = load i32, i32* %6
%170 = icmp eq i32 %169, 1
br i1 %170, label %171, label %172
171: ; preds = %168
store i32 1, i32* %3
br label %182
172: ; preds = %168, %164
br label %173
173: ; preds = %172
br label %174
174: ; preds = %173
%175 = load i32, i32* %8
%176 = add nsw i32 %175, 1
store i32 %176, i32* %8
br label %15
177: ; preds = %15
%178 = load i32, i32* %5
%179 = icmp ne i32 %178, 0
br i1 %179, label %180, label %181
180: ; preds = %177
store i32 0, i32* %3
br label %182
181: ; preds = %177
store i32 1, i32* %3
br label %182
182: ; preds = %181, %180, %171, %163
%183 = load i32, i32* %3
ret i32 %183
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"place = %d\0A\00"
@.str.2 = [4 x i8] c"%d \00"
@str.4 = [24 x i8] c"**********************i\00"
define i32 @findThePositionOfQueen([10 x i32]* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = icmp sgt i32 %1, 0
%5 = icmp slt i32 %1, 9
%6 = icmp ne i32 %1, 9
%7 = add nsw i32 %1, 1
br label %8
8: ; preds = %2, %190
%9 = phi i64 [ 0, %2 ], [ %191, %190 ]
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = add nuw i64 %9, 4294967295
%13 = and i64 %12, 4294967295
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %3, i64 %13
store i32 0, i32* %14
br label %15
15: ; preds = %11, %8
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %3, i64 %9
store i32 1, i32* %16
%17 = trunc i64 %9 to i32
%18 = add nsw i32 %17, %1
%19 = sub nsw i32 %1, %17
br i1 %4, label %20, label %140
20: ; preds = %15
%21 = zext i32 %19 to i64
%22 = zext i32 %18 to i64
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %21, i64 0
br label %24
24: ; preds = %20, %137
%25 = phi i64 [ %3, %20 ], [ %26, %137 ]
%26 = add nsw i64 %25, -1
%27 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 %9
%28 = load i32, i32* %27
%29 = icmp eq i32 %28, 1
br i1 %29, label %139, label %30
30: ; preds = %24
%31 = icmp eq i64 %26, %21
br i1 %31, label %32, label %35
32: ; preds = %30
%33 = load i32, i32* %23
%34 = icmp eq i32 %33, 1
br i1 %34, label %139, label %35
35: ; preds = %30, %32
%36 = trunc i64 %25 to i32
%37 = add i32 %36, -2
%38 = icmp eq i32 %37, %19
%39 = icmp eq i64 %25, %22
%40 = select i1 %38, i1 true, i1 %39
br i1 %40, label %41, label %45
41: ; preds = %35
%42 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 1
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, 1
br i1 %44, label %139, label %45
45: ; preds = %41, %35
%46 = trunc i64 %25 to i32
%47 = add i32 %46, -3
%48 = icmp eq i32 %47, %19
%49 = trunc i64 %25 to i32
%50 = add i32 %49, 1
%51 = icmp eq i32 %50, %18
%52 = select i1 %48, i1 true, i1 %51
br i1 %52, label %53, label %57
53: ; preds = %45
%54 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 2
%55 = load i32, i32* %54
%56 = icmp eq i32 %55, 1
br i1 %56, label %139, label %57
57: ; preds = %53, %45
%58 = trunc i64 %25 to i32
%59 = add i32 %58, -4
%60 = icmp eq i32 %59, %19
%61 = trunc i64 %25 to i32
%62 = add i32 %61, 2
%63 = icmp eq i32 %62, %18
%64 = select i1 %60, i1 true, i1 %63
br i1 %64, label %65, label %69
65: ; preds = %57
%66 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 3
%67 = load i32, i32* %66
%68 = icmp eq i32 %67, 1
br i1 %68, label %139, label %69
69: ; preds = %65, %57
%70 = trunc i64 %25 to i32
%71 = add i32 %70, -5
%72 = icmp eq i32 %71, %19
%73 = trunc i64 %25 to i32
%74 = add i32 %73, 3
%75 = icmp eq i32 %74, %18
%76 = select i1 %72, i1 true, i1 %75
br i1 %76, label %77, label %81
77: ; preds = %69
%78 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 4
%79 = load i32, i32* %78
%80 = icmp eq i32 %79, 1
br i1 %80, label %139, label %81
81: ; preds = %77, %69
%82 = trunc i64 %25 to i32
%83 = add i32 %82, -6
%84 = icmp eq i32 %83, %19
%85 = trunc i64 %25 to i32
%86 = add i32 %85, 4
%87 = icmp eq i32 %86, %18
%88 = select i1 %84, i1 true, i1 %87
br i1 %88, label %89, label %93
89: ; preds = %81
%90 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 5
%91 = load i32, i32* %90
%92 = icmp eq i32 %91, 1
br i1 %92, label %139, label %93
93: ; preds = %89, %81
%94 = trunc i64 %25 to i32
%95 = add i32 %94, -7
%96 = icmp eq i32 %95, %19
%97 = trunc i64 %25 to i32
%98 = add i32 %97, 5
%99 = icmp eq i32 %98, %18
%100 = select i1 %96, i1 true, i1 %99
br i1 %100, label %101, label %105
101: ; preds = %93
%102 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 6
%103 = load i32, i32* %102
%104 = icmp eq i32 %103, 1
br i1 %104, label %139, label %105
105: ; preds = %101, %93
%106 = trunc i64 %25 to i32
%107 = add i32 %106, -8
%108 = icmp eq i32 %107, %19
%109 = trunc i64 %25 to i32
%110 = add i32 %109, 6
%111 = icmp eq i32 %110, %18
%112 = select i1 %108, i1 true, i1 %111
br i1 %112, label %113, label %117
113: ; preds = %105
%114 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 7
%115 = load i32, i32* %114
%116 = icmp eq i32 %115, 1
br i1 %116, label %139, label %117
117: ; preds = %113, %105
%118 = trunc i64 %25 to i32
%119 = add i32 %118, -9
%120 = icmp eq i32 %119, %19
%121 = trunc i64 %25 to i32
%122 = add i32 %121, 7
%123 = icmp eq i32 %122, %18
%124 = select i1 %120, i1 true, i1 %123
br i1 %124, label %125, label %129
125: ; preds = %117
%126 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 8
%127 = load i32, i32* %126
%128 = icmp eq i32 %127, 1
br i1 %128, label %139, label %129
129: ; preds = %125, %117
%130 = trunc i64 %25 to i32
%131 = add i32 %130, 8
%132 = icmp eq i32 %131, %18
br i1 %132, label %133, label %137
133: ; preds = %129
%134 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %26, i64 9
%135 = load i32, i32* %134
%136 = icmp eq i32 %135, 1
br i1 %136, label %139, label %137
137: ; preds = %133, %129
%138 = icmp sgt i64 %25, 1
br i1 %138, label %24, label %140
139: ; preds = %32, %41, %53, %65, %77, %89, %101, %113, %125, %133, %24
store i32 0, i32* %16
br label %140
140: ; preds = %137, %139, %15
%141 = phi i1 [ true, %15 ], [ false, %139 ], [ true, %137 ]
%142 = phi i1 [ false, %15 ], [ true, %139 ], [ false, %137 ]
%143 = phi i32 [ 1, %15 ], [ 0, %139 ], [ 1, %137 ]
%144 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0))
%145 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %143)
br label %146
146: ; preds = %140, %146
%147 = phi i64 [ 0, %140 ], [ %179, %146 ]
%148 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 0
%149 = load i32, i32* %148
%150 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %149)
%151 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 1
%152 = load i32, i32* %151
%153 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %152)
%154 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 2
%155 = load i32, i32* %154
%156 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %155)
%157 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 3
%158 = load i32, i32* %157
%159 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %158)
%160 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 4
%161 = load i32, i32* %160
%162 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %161)
%163 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 5
%164 = load i32, i32* %163
%165 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %164)
%166 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 6
%167 = load i32, i32* %166
%168 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %167)
%169 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 7
%170 = load i32, i32* %169
%171 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %170)
%172 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 8
%173 = load i32, i32* %172
%174 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %173)
%175 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %147, i64 9
%176 = load i32, i32* %175
%177 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %176)
%178 = tail call i32 @putchar(i32 10)
%179 = add nuw nsw i64 %147, 1
%180 = icmp eq i64 %179, 10
br i1 %180, label %181, label %146
181: ; preds = %146
%182 = tail call i32 @putchar(i32 10)
%183 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0))
%184 = and i1 %5, %141
br i1 %184, label %185, label %188
185: ; preds = %181
%186 = tail call i32 @findThePositionOfQueen([10 x i32]* %0, i32 %7)
%187 = icmp eq i32 %186, 0
br i1 %187, label %190, label %196
188: ; preds = %181
%189 = or i1 %6, %142
br i1 %189, label %190, label %196
190: ; preds = %185, %188
%191 = add nuw nsw i64 %9, 1
%192 = icmp eq i64 %191, 10
br i1 %192, label %193, label %8
193: ; preds = %190
%194 = icmp eq i32 %1, 0
%195 = zext i1 %194 to i32
br label %196
196: ; preds = %188, %185, %193
%197 = phi i32 [ %195, %193 ], [ 1, %185 ], [ 1, %188 ]
ret i32 %197
}