#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 */
char cellsort(char ***, char, char);
char columneliminate(char ***, char, char);
char columnsort(char ***, char, char);
char gridcolumneliminate(char ***, char, char);
char grideliminate(char ***, char, char);
char gridroweliminate(char ***, char, char);
char gridsort(char ***, char, char);
char roweliminate(char ***, char, char);
char rowsort(char ***, char, char);
void solve(char grid[9][9][10]) {
  char i, j, f;
  do
    for (f = i = 0; i < 9; ++i)
      for (j = 0; j < 9; ++j) {
        f |= gridcolumneliminate(grid, i, j);
        f |= gridroweliminate(grid, i, j);
        f |= grideliminate(grid, i, j);
        f |= columneliminate(grid, i, j);
        f |= roweliminate(grid, i, j);
        f |= gridsort(grid, i, j);
        f |= columnsort(grid, i, j);
        f |= rowsort(grid, i, j);
        f |= cellsort(grid, i, j);
      }
  while (f);
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
movb   $0x0,-0xb(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x9,%eax
jge    12f8 <solve+0x168>
movb   $0x0,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
cmp    $0x9,%eax
jge    12e6 <solve+0x156>
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   10a0 <gridcolumneliminate@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1070 <gridroweliminate@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1050 <grideliminate@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1060 <columneliminate@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1080 <roweliminate@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   10b0 <gridsort@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1040 <columnsort@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1030 <rowsort@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1090 <cellsort@plt>
movsbl %al,%ecx
movsbl -0xb(%rbp),%eax
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xa(%rbp),%al
add    $0x1,%al
mov    %al,-0xa(%rbp)
jmp    11b5 <solve+0x25>
jmp    12eb <solve+0x15b>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    11a4 <solve+0x14>
jmp    12fd <solve+0x16d>
cmpb   $0x0,-0xb(%rbp)
jne    119c <solve+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebp,%ebp
mov    %eax,0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%r15d
movsbl %bpl,%ebp
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   10a0 <gridcolumneliminate@plt>
mov    %eax,%r12d
or     %bl,%r12b
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1070 <gridroweliminate@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1050 <grideliminate@plt>
mov    %eax,%r13d
or     %bl,%r13b
or     %r12b,%r13b
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1060 <columneliminate@plt>
mov    %eax,%r12d
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1080 <roweliminate@plt>
mov    %eax,%ebx
or     %r12b,%bl
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   10b0 <gridsort@plt>
mov    %eax,%r12d
or     %bl,%r12b
or     %r13b,%r12b
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1040 <columnsort@plt>
mov    %eax,%ebx
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1030 <rowsort@plt>
mov    %eax,%r13d
or     %bl,%r13b
mov    %r14,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1090 <cellsort@plt>
mov    %eax,%ebx
mov    0x4(%rsp),%eax
or     %r13b,%bl
or     %r12b,%bl
add    $0x1,%bpl
cmp    $0x9,%bpl
jne    11c0 <solve+0x30>
add    $0x1,%al
cmp    $0x9,%al
jne    11b0 <solve+0x20>
xor    %eax,%eax
test   %bl,%bl
mov    $0x0,%ebx
jne    11b0 <solve+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @solve([9 x [10 x i8]]* %0) {
%2 = alloca [9 x [10 x i8]]*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store [9 x [10 x i8]]* %0, [9 x [10 x i8]]** %2
br label %6
6: ; preds = %115, %1
store i8 0, i8* %3
store i8 0, i8* %5
br label %7
7: ; preds = %111, %6
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 9
br i1 %10, label %11, label %114
11: ; preds = %7
store i8 0, i8* %4
br label %12
12: ; preds = %107, %11
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = icmp slt i32 %14, 9
br i1 %15, label %16, label %110
16: ; preds = %12
%17 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%18 = bitcast [9 x [10 x i8]]* %17 to i8***
%19 = load i8, i8* %3
%20 = load i8, i8* %4
%21 = call signext i8 @gridcolumneliminate(i8*** %18, i8 signext %19, i8 signext %20)
%22 = sext i8 %21 to i32
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = or i32 %24, %22
%26 = trunc i32 %25 to i8
store i8 %26, i8* %5
%27 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%28 = bitcast [9 x [10 x i8]]* %27 to i8***
%29 = load i8, i8* %3
%30 = load i8, i8* %4
%31 = call signext i8 @gridroweliminate(i8*** %28, i8 signext %29, i8 signext %30)
%32 = sext i8 %31 to i32
%33 = load i8, i8* %5
%34 = sext i8 %33 to i32
%35 = or i32 %34, %32
%36 = trunc i32 %35 to i8
store i8 %36, i8* %5
%37 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%38 = bitcast [9 x [10 x i8]]* %37 to i8***
%39 = load i8, i8* %3
%40 = load i8, i8* %4
%41 = call signext i8 @grideliminate(i8*** %38, i8 signext %39, i8 signext %40)
%42 = sext i8 %41 to i32
%43 = load i8, i8* %5
%44 = sext i8 %43 to i32
%45 = or i32 %44, %42
%46 = trunc i32 %45 to i8
store i8 %46, i8* %5
%47 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%48 = bitcast [9 x [10 x i8]]* %47 to i8***
%49 = load i8, i8* %3
%50 = load i8, i8* %4
%51 = call signext i8 @columneliminate(i8*** %48, i8 signext %49, i8 signext %50)
%52 = sext i8 %51 to i32
%53 = load i8, i8* %5
%54 = sext i8 %53 to i32
%55 = or i32 %54, %52
%56 = trunc i32 %55 to i8
store i8 %56, i8* %5
%57 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%58 = bitcast [9 x [10 x i8]]* %57 to i8***
%59 = load i8, i8* %3
%60 = load i8, i8* %4
%61 = call signext i8 @roweliminate(i8*** %58, i8 signext %59, i8 signext %60)
%62 = sext i8 %61 to i32
%63 = load i8, i8* %5
%64 = sext i8 %63 to i32
%65 = or i32 %64, %62
%66 = trunc i32 %65 to i8
store i8 %66, i8* %5
%67 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%68 = bitcast [9 x [10 x i8]]* %67 to i8***
%69 = load i8, i8* %3
%70 = load i8, i8* %4
%71 = call signext i8 @gridsort(i8*** %68, i8 signext %69, i8 signext %70)
%72 = sext i8 %71 to i32
%73 = load i8, i8* %5
%74 = sext i8 %73 to i32
%75 = or i32 %74, %72
%76 = trunc i32 %75 to i8
store i8 %76, i8* %5
%77 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%78 = bitcast [9 x [10 x i8]]* %77 to i8***
%79 = load i8, i8* %3
%80 = load i8, i8* %4
%81 = call signext i8 @columnsort(i8*** %78, i8 signext %79, i8 signext %80)
%82 = sext i8 %81 to i32
%83 = load i8, i8* %5
%84 = sext i8 %83 to i32
%85 = or i32 %84, %82
%86 = trunc i32 %85 to i8
store i8 %86, i8* %5
%87 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%88 = bitcast [9 x [10 x i8]]* %87 to i8***
%89 = load i8, i8* %3
%90 = load i8, i8* %4
%91 = call signext i8 @rowsort(i8*** %88, i8 signext %89, i8 signext %90)
%92 = sext i8 %91 to i32
%93 = load i8, i8* %5
%94 = sext i8 %93 to i32
%95 = or i32 %94, %92
%96 = trunc i32 %95 to i8
store i8 %96, i8* %5
%97 = load [9 x [10 x i8]]*, [9 x [10 x i8]]** %2
%98 = bitcast [9 x [10 x i8]]* %97 to i8***
%99 = load i8, i8* %3
%100 = load i8, i8* %4
%101 = call signext i8 @cellsort(i8*** %98, i8 signext %99, i8 signext %100)
%102 = sext i8 %101 to i32
%103 = load i8, i8* %5
%104 = sext i8 %103 to i32
%105 = or i32 %104, %102
%106 = trunc i32 %105 to i8
store i8 %106, i8* %5
br label %107
107: ; preds = %16
%108 = load i8, i8* %4
%109 = add i8 %108, 1
store i8 %109, i8* %4
br label %12
110: ; preds = %12
br label %111
111: ; preds = %110
%112 = load i8, i8* %3
%113 = add i8 %112, 1
store i8 %113, i8* %3
br label %7
114: ; preds = %7
br label %115
115: ; preds = %114
%116 = load i8, i8* %5
%117 = icmp ne i8 %116, 0
br i1 %117, label %6, label %118
118: ; preds = %115
ret void
}

LLVM IR (-O2):
define void @solve([9 x [10 x i8]]* %0) {
%2 = bitcast [9 x [10 x i8]]* %0 to i8***
br label %3
3: ; preds = %32, %1
%4 = phi i8 [ 0, %1 ], [ %33, %32 ]
%5 = phi i8 [ 0, %1 ], [ %34, %32 ]
br label %6
6: ; preds = %3, %6
%7 = phi i8 [ %4, %3 ], [ %26, %6 ]
%8 = phi i8 [ 0, %3 ], [ %27, %6 ]
%9 = tail call signext i8 @gridcolumneliminate(i8*** %2, i8 signext %5, i8 signext %8)
%10 = or i8 %9, %7
%11 = tail call signext i8 @gridroweliminate(i8*** %2, i8 signext %5, i8 signext %8)
%12 = or i8 %10, %11
%13 = tail call signext i8 @grideliminate(i8*** %2, i8 signext %5, i8 signext %8)
%14 = or i8 %12, %13
%15 = tail call signext i8 @columneliminate(i8*** %2, i8 signext %5, i8 signext %8)
%16 = or i8 %14, %15
%17 = tail call signext i8 @roweliminate(i8*** %2, i8 signext %5, i8 signext %8)
%18 = or i8 %16, %17
%19 = tail call signext i8 @gridsort(i8*** %2, i8 signext %5, i8 signext %8)
%20 = or i8 %18, %19
%21 = tail call signext i8 @columnsort(i8*** %2, i8 signext %5, i8 signext %8)
%22 = or i8 %20, %21
%23 = tail call signext i8 @rowsort(i8*** %2, i8 signext %5, i8 signext %8)
%24 = or i8 %22, %23
%25 = tail call signext i8 @cellsort(i8*** %2, i8 signext %5, i8 signext %8)
%26 = or i8 %24, %25
%27 = add nuw nsw i8 %8, 1
%28 = icmp eq i8 %27, 9
br i1 %28, label %29, label %6
29: ; preds = %6
%30 = add nuw nsw i8 %5, 1
%31 = icmp eq i8 %30, 9
br i1 %31, label %35, label %32
32: ; preds = %29, %35
%33 = phi i8 [ %26, %29 ], [ 0, %35 ]
%34 = phi i8 [ %30, %29 ], [ 0, %35 ]
br label %3
35: ; preds = %29
%36 = icmp eq i8 %26, 0
br i1 %36, label %37, label %32
37: ; preds = %35
ret void
}