#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 */
struct Board {
  int dummy;
};

/* Variables and functions */
int checkBoxes(struct Board *);
int checkCols(struct Board *);
int checkDone(struct Board *);
int checkRows(struct Board *);
int solve(struct Board *board) {
  int change = 1, done;
  while (!(done = checkDone(board)) && change) {
    change = 0;
    change |= checkRows(board);
    change |= checkCols(board);
    change |= checkBoxes(board);
  }
  return done;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <checkDone@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
jne    1179 <solve+0x39>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1189 <solve+0x49>
jmp    11c2 <solve+0x82>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <checkRows@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <checkCols@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <checkBoxes@plt>
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <solve+0x13>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <checkDone@plt>
test   %eax,%eax
je     1160 <solve+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xchg   %ax,%ax
mov    %r14,%rdi
call   1050 <checkRows@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1030 <checkCols@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1060 <checkBoxes@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <checkDone@plt>
test   %eax,%eax
jne    1153 <solve+0x13>
or     %r15d,%ebx
or     %ebp,%ebx
jne    1160 <solve+0x20>
jmp    1153 <solve+0x13>

LLVM IR (-O0):
%struct.Board = type { i32 }
define i32 @solve(%struct.Board* %0) {
%2 = alloca %struct.Board*
%3 = alloca i32
%4 = alloca i32
store %struct.Board* %0, %struct.Board** %2
store i32 1, i32* %3
br label %5
5: ; preds = %14, %1
%6 = load %struct.Board*, %struct.Board** %2
%7 = call i32 @checkDone(%struct.Board* %6)
store i32 %7, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br label %12
12: ; preds = %9, %5
%13 = phi i1 [ false, %5 ], [ %11, %9 ]
br i1 %13, label %14, label %27
14: ; preds = %12
store i32 0, i32* %3
%15 = load %struct.Board*, %struct.Board** %2
%16 = call i32 @checkRows(%struct.Board* %15)
%17 = load i32, i32* %3
%18 = or i32 %17, %16
store i32 %18, i32* %3
%19 = load %struct.Board*, %struct.Board** %2
%20 = call i32 @checkCols(%struct.Board* %19)
%21 = load i32, i32* %3
%22 = or i32 %21, %20
store i32 %22, i32* %3
%23 = load %struct.Board*, %struct.Board** %2
%24 = call i32 @checkBoxes(%struct.Board* %23)
%25 = load i32, i32* %3
%26 = or i32 %25, %24
store i32 %26, i32* %3
br label %5
27: ; preds = %12
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
%struct.Board = type { i32 }
define i32 @solve(%struct.Board* %0) {
%2 = tail call i32 @checkDone(%struct.Board* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1, %4
%5 = tail call i32 @checkRows(%struct.Board* %0)
%6 = tail call i32 @checkCols(%struct.Board* %0)
%7 = or i32 %6, %5
%8 = tail call i32 @checkBoxes(%struct.Board* %0)
%9 = or i32 %7, %8
%10 = tail call i32 @checkDone(%struct.Board* %0)
%11 = icmp eq i32 %10, 0
%12 = icmp ne i32 %9, 0
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %4, label %14
14: ; preds = %4, %1
%15 = phi i32 [ %2, %1 ], [ %10, %4 ]
ret i32 %15
}