#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__ can_place(int *, int, int);
int /*<<< orphan*/ print_board(int *);
void place(int *board, int row) {
  if (row == 8) {
    print_board(board);
    return;
  }
  for (int i = 0; i <= 8; i++) {
    if (can_place(board, row, i)) {
      board[row * 8 + i] = 1;
      place(board, row + 1);
      board[row * 8 + i] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<place>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jne    1157 <place+0x27>
mov    -0x8(%rbp),%rdi
call   1040 <print_board@plt>
jmp    11d1 <place+0xa1>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jg     11d1 <place+0xa1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <can_place@plt>
cmp    $0x0,%rax
je     11be <place+0x8e>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1050 <place@plt>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
add    -0x10(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    11c3 <place+0x93>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115e <place+0x2e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<place>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
cmp    $0x8,%esi
jne    1150 <place+0x20>
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <print_board@plt>
mov    %esi,%r12d
lea    0x0(,%r12,8),%eax
lea    0x1(%r12),%r14d
movslq %eax,%r15
mov    %rbx,%rdi
xor    %edx,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     118d <place+0x5d>
movl   $0x1,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x1,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     11c7 <place+0x97>
lea    0x0(,%r15,4),%rbp
or     $0x4,%rbp
movl   $0x1,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x2,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     1201 <place+0xd1>
lea    0x0(,%r15,4),%rbp
or     $0x8,%rbp
movl   $0x1,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x3,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     123b <place+0x10b>
lea    0x0(,%r15,4),%rbp
or     $0xc,%rbp
movl   $0x1,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x4,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     1275 <place+0x145>
lea    0x0(,%r15,4),%rbp
or     $0x10,%rbp
movl   $0x1,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x5,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     12af <place+0x17f>
lea    0x0(,%r15,4),%rbp
or     $0x14,%rbp
movl   $0x1,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x6,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     12e9 <place+0x1b9>
lea    0x0(,%r15,4),%rbp
or     $0x18,%rbp
movl   $0x1,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x7,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     1323 <place+0x1f3>
lea    0x0(,%r15,4),%rbp
or     $0x1c,%rbp
movl   $0x1,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,(%rbx,%rbp,1)
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x8,%edx
call   1030 <can_place@plt>
test   %rax,%rax
je     1355 <place+0x225>
movl   $0x1,0x20(%rbx,%r15,4)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <place@plt>
movl   $0x0,0x20(%rbx,%r15,4)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @place(i32* %0, i32 %1) {
%3 = icmp eq i32 %1, 8
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = shl nsw i32 %1, 3
%6 = add nsw i32 %1, 1
%7 = sext i32 %5 to i64
%8 = tail call i64 @can_place(i32* %0, i32 %1, i32 0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %12
10: ; preds = %2
%11 = tail call i32 @print_board(i32* %0)
br label %62
12: ; preds = %4
%13 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 1, i32* %13
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %13
br label %14
14: ; preds = %4, %12
%15 = tail call i64 @can_place(i32* %0, i32 %1, i32 1)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = or i64 %7, 1
%19 = getelementptr inbounds i32, i32* %0, i64 %18
store i32 1, i32* %19
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %19
br label %20
20: ; preds = %17, %14
%21 = tail call i64 @can_place(i32* %0, i32 %1, i32 2)
%22 = icmp eq i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = or i64 %7, 2
%25 = getelementptr inbounds i32, i32* %0, i64 %24
store i32 1, i32* %25
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %25
br label %26
26: ; preds = %23, %20
%27 = tail call i64 @can_place(i32* %0, i32 %1, i32 3)
%28 = icmp eq i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = or i64 %7, 3
%31 = getelementptr inbounds i32, i32* %0, i64 %30
store i32 1, i32* %31
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %31
br label %32
32: ; preds = %29, %26
%33 = tail call i64 @can_place(i32* %0, i32 %1, i32 4)
%34 = icmp eq i64 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = or i64 %7, 4
%37 = getelementptr inbounds i32, i32* %0, i64 %36
store i32 1, i32* %37
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %37
br label %38
38: ; preds = %35, %32
%39 = tail call i64 @can_place(i32* %0, i32 %1, i32 5)
%40 = icmp eq i64 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %38
%42 = or i64 %7, 5
%43 = getelementptr inbounds i32, i32* %0, i64 %42
store i32 1, i32* %43
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %43
br label %44
44: ; preds = %41, %38
%45 = tail call i64 @can_place(i32* %0, i32 %1, i32 6)
%46 = icmp eq i64 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = or i64 %7, 6
%49 = getelementptr inbounds i32, i32* %0, i64 %48
store i32 1, i32* %49
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %49
br label %50
50: ; preds = %47, %44
%51 = tail call i64 @can_place(i32* %0, i32 %1, i32 7)
%52 = icmp eq i64 %51, 0
br i1 %52, label %56, label %53
53: ; preds = %50
%54 = or i64 %7, 7
%55 = getelementptr inbounds i32, i32* %0, i64 %54
store i32 1, i32* %55
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %55
br label %56
56: ; preds = %53, %50
%57 = tail call i64 @can_place(i32* %0, i32 %1, i32 8)
%58 = icmp eq i64 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %56
%60 = add nsw i64 %7, 8
%61 = getelementptr inbounds i32, i32* %0, i64 %60
store i32 1, i32* %61
tail call void @place(i32* %0, i32 %6)
store i32 0, i32* %61
br label %62
62: ; preds = %56, %59, %10
ret void
}