#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__ conflict(int *, int, int);
int /*<<< orphan*/ print_board(int *);
int solve(int *board, int row) {
  if (row > 9) {
    print_board(board);
    return 0;
  }
  for (int i = 0; i < 10; i = i + 1) {
    if (conflict(board, row, i)) {
    } else {
      board[row * 10 + i] = 1;
      solve(board, row + 1);
      board[row * 10 + i] = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jle    115e <solve+0x2e>
mov    -0x10(%rbp),%rdi
call   1050 <print_board@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e0 <solve+0xb0>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    11d9 <solve+0xa9>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <conflict@plt>
cmp    $0x0,%rax
je     118d <solve+0x5d>
jmp    11c6 <solve+0x96>
mov    -0x10(%rbp),%rax
imul   $0xa,-0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
call   1030 <solve@plt>
mov    -0x10(%rbp),%rax
imul   $0xa,-0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    11cb <solve+0x9b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1165 <solve+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
cmp    $0x9,%esi
jle    1153 <solve+0x23>
mov    %rbx,%rdi
call   1050 <print_board@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %esi,%r14d
lea    (%r14,%r14,1),%eax
lea    (%rax,%rax,4),%eax
lea    0x1(%r14),%r15d
cltq
lea    (%rbx,%rax,4),%r12
xor    %ebp,%ebp
jmp    117a <solve+0x4a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    $0xa,%rbp
je     1148 <solve+0x18>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1040 <conflict@plt>
test   %rax,%rax
jne    1170 <solve+0x40>
movl   $0x1,(%r12,%rbp,4)
mov    %rbx,%rdi
mov    %r15d,%esi
call   1030 <solve@plt>
movl   $0x0,(%r12,%rbp,4)
jmp    1170 <solve+0x40>

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

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