#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_put(int **, int, int, int);
int /*<<< orphan*/ next_empty(int **, int *, int *);
void solve(int sudoku[9][9]) {
  int x, y, i;
  if (!next_empty(sudoku, &x, &y)) {
    return;
  }
  for (i = 1; i < 10; i++) {
    if (can_put(sudoku, x, y, i)) {
      sudoku[x][y] = i;
      solve(sudoku);
      int a, b;
      if (!next_empty(sudoku, &a, &b)) {
        return;
      }
    }
  }
  sudoku[x][y] = 0;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <next_empty@plt>
cmp    $0x0,%eax
jne    115b <solve+0x2b>
jmp    11fb <solve+0xcb>
movl   $0x1,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11e1 <solve+0xb1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <can_put@plt>
cmp    $0x0,%rax
je     11ce <solve+0x9e>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
call   1030 <solve@plt>
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <next_empty@plt>
cmp    $0x0,%eax
jne    11c9 <solve+0x99>
jmp    11fb <solve+0xcb>
jmp    11ce <solve+0x9e>
jmp    11d3 <solve+0xa3>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <solve+0x32>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <next_empty@plt>
test   %eax,%eax
je     11d9 <solve+0xa9>
mov    $0x1,%ebp
lea    0x14(%rsp),%r14
lea    0x10(%rsp),%r15
jmp    1178 <solve+0x48>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
cmp    $0xa,%ebp
je     11c0 <solve+0x90>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
mov    %ebp,%ecx
call   1050 <can_put@plt>
test   %rax,%rax
je     1170 <solve+0x40>
movslq 0xc(%rsp),%rax
movslq 0x8(%rsp),%rcx
lea    (%rax,%rax,8),%rax
lea    (%rbx,%rax,4),%rax
mov    %ebp,(%rax,%rcx,4)
mov    %rbx,%rdi
call   1030 <solve@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <next_empty@plt>
test   %eax,%eax
jne    1170 <solve+0x40>
jmp    11d9 <solve+0xa9>
movslq 0xc(%rsp),%rax
movslq 0x8(%rsp),%rcx
lea    (%rax,%rax,8),%rax
lea    (%rbx,%rax,4),%rax
movl   $0x0,(%rax,%rcx,4)
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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