#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__ IsConflict(int *, int, int, int);
void PlaceQueenMethodNumIter(int board[], int n, int row, int *num) {
  if (row == n) {
    *num += 1;
    return;
  }
  int i;
  for (i = 0; i < n; ++i) {
    if (IsConflict(board, n, row, i))
      continue;
    board[row] = i;
    PlaceQueenMethodNumIter(board, n, row + 1, num);
  }
}


x86 assembly (clang, -O0):
<PlaceQueenMethodNumIter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1152 <PlaceQueenMethodNumIter+0x32>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11b8 <PlaceQueenMethodNumIter+0x98>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b8 <PlaceQueenMethodNumIter+0x98>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <IsConflict@plt>
cmp    $0x0,%rax
je     1186 <PlaceQueenMethodNumIter+0x66>
jmp    11aa <PlaceQueenMethodNumIter+0x8a>
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rcx
call   1040 <PlaceQueenMethodNumIter@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1159 <PlaceQueenMethodNumIter+0x39>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PlaceQueenMethodNumIter>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
cmp    %esi,%edx
jne    1138 <PlaceQueenMethodNumIter+0x18>
addl   $0x1,(%r14)
jmp    1196 <PlaceQueenMethodNumIter+0x76>
mov    %esi,%ebp
test   %esi,%esi
jle    1196 <PlaceQueenMethodNumIter+0x76>
mov    %edx,%r15d
mov    %rdi,%r13
movslq %edx,%rax
mov    %rax,(%rsp)
lea    0x1(%r15),%r12d
xor    %ebx,%ebx
jmp    1167 <PlaceQueenMethodNumIter+0x47>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebx
cmp    %ebx,%ebp
je     1196 <PlaceQueenMethodNumIter+0x76>
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %ebx,%ecx
call   1030 <IsConflict@plt>
test   %rax,%rax
jne    1160 <PlaceQueenMethodNumIter+0x40>
mov    (%rsp),%rax
mov    %ebx,0x0(%r13,%rax,4)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    %r14,%rcx
call   1040 <PlaceQueenMethodNumIter@plt>
jmp    1160 <PlaceQueenMethodNumIter+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @PlaceQueenMethodNumIter(i32* %0, i32 %1, i32 %2, i32* nocapture %3) {
%5 = icmp eq i32 %2, %1
br i1 %5, label %12, label %6
6: ; preds = %4
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %23
8: ; preds = %6
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = add nsw i32 %2, 1
br label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %23
15: ; preds = %8, %20
%16 = phi i32 [ 0, %8 ], [ %21, %20 ]
%17 = tail call i64 @IsConflict(i32* %0, i32 %1, i32 %2, i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 %16, i32* %10
tail call void @PlaceQueenMethodNumIter(i32* %0, i32 %1, i32 %11, i32* %3)
br label %20
20: ; preds = %15, %19
%21 = add nuw nsw i32 %16, 1
%22 = icmp eq i32 %21, %1
br i1 %22, label %23, label %15
23: ; preds = %20, %6, %12
ret void
}