#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__ isValidSudoku(char **, int, int *);
void *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char **argv) {
  int i, j;
  char *str = argv[1];
  int *col_sizes = malloc(9 * sizeof(int));
  char **board = malloc(9 * sizeof(char *));
  for (i = 0; i < 9; i++) {
    board[i] = malloc(10);
    strcpy(board[i], str + i * 9);
    for (j = 0; j < 9; j++) {
      printf("%c ", board[i][j]);
    }
    col_sizes[i] = 9;
    printf("\n");
  }
  printf("%s\n", isValidSudoku(board, 9, col_sizes) ? "true" : "false");
  for (i = 0; i < 9; i++) {
    for (j = 0; j < 9; j++) {
      printf("%c ", board[i][j]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x24,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x48,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jge    1232 <main+0xf2>
mov    $0xa,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rsi
imul   $0x9,-0x14(%rbp),%eax
cltq
add    %rax,%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x9,-0x18(%rbp)
jge    1207 <main+0xc7>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11cd <main+0x8d>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x9,(%rax,%rcx,4)
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x45>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x9,%esi
call   1040 <isValidSudoku@plt>
mov    %rax,%rcx
lea    0xdbf(%rip),%rsi
lea    0xdb3(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jge    12d9 <main+0x199>
movl   $0x0,-0x18(%rbp)
cmpl   $0x9,-0x18(%rbp)
jge    12bd <main+0x17d>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1283 <main+0x143>
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1272 <main+0x132>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x8(%rsi),%r13
mov    $0x24,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    $0x48,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
lea    0xe70(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    %rax,(%r14,%rbp,8)
mov    %rax,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
movsbl (%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x1(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x2(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x3(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x4(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x5(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x6(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x7(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsbl 0x8(%rbx),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movl   $0x9,(%r15,%rbp,4)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
add    $0x9,%r13
cmp    $0x9,%rbp
jne    11a0 <main+0x40>
mov    %r14,%rdi
mov    $0x9,%esi
mov    %r15,%rdx
call   1060 <isValidSudoku@plt>
test   %rax,%rax
lea    0xd92(%rip),%rax
lea    0xd86(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
lea    0xd72(%rip),%rbx
xor    %ebp,%ebp
mov    (%r14,%rbp,8),%rax
movsbl (%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x1(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x2(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x3(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x4(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x5(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x6(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x7(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%r14,%rbp,8),%rax
movsbl 0x8(%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    $0x9,%rbp
jne    1290 <main+0x130>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [5 x i8] c"true\00"
@.str.4 = [6 x i8] c"false\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %8
%14 = call i8* @malloc(i32 36)
%15 = bitcast i8* %14 to i32*
store i32* %15, i32** %9
%16 = call i8* @malloc(i32 72)
%17 = bitcast i8* %16 to i8**
store i8** %17, i8*** %10
store i32 0, i32* %6
br label %18
18: ; preds = %62, %2
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 9
br i1 %20, label %21, label %65
21: ; preds = %18
%22 = call i8* @malloc(i32 10)
%23 = load i8**, i8*** %10
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
store i8* %22, i8** %26
%27 = load i8**, i8*** %10
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = load i8*, i8** %8
%33 = load i32, i32* %6
%34 = mul nsw i32 %33, 9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %32, i64 %35
%37 = call i32 @strcpy(i8* %31, i8* %36)
store i32 0, i32* %7
br label %38
38: ; preds = %53, %21
%39 = load i32, i32* %7
%40 = icmp slt i32 %39, 9
br i1 %40, label %41, label %56
41: ; preds = %38
%42 = load i8**, i8*** %10
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %51)
br label %53
53: ; preds = %41
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %38
56: ; preds = %38
%57 = load i32*, i32** %9
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32, i32* %57, i64 %59
store i32 9, i32* %60
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %62
62: ; preds = %56
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
br label %18
65: ; preds = %18
%66 = load i8**, i8*** %10
%67 = load i32*, i32** %9
%68 = call i64 @isValidSudoku(i8** %66, i32 9, i32* %67)
%69 = icmp ne i64 %68, 0
%70 = zext i1 %69 to i64
%71 = select i1 %69, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %71)
store i32 0, i32* %6
br label %73
73: ; preds = %97, %65
%74 = load i32, i32* %6
%75 = icmp slt i32 %74, 9
br i1 %75, label %76, label %100
76: ; preds = %73
store i32 0, i32* %7
br label %77
77: ; preds = %92, %76
%78 = load i32, i32* %7
%79 = icmp slt i32 %78, 9
br i1 %79, label %80, label %95
80: ; preds = %77
%81 = load i8**, i8*** %10
%82 = load i32, i32* %6
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8*, i8** %81, i64 %83
%85 = load i8*, i8** %84
%86 = load i32, i32* %7
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %85, i64 %87
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %90)
br label %92
92: ; preds = %80
%93 = load i32, i32* %7
%94 = add nsw i32 %93, 1
store i32 %94, i32* %7
br label %77
95: ; preds = %77
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %97
97: ; preds = %95
%98 = load i32, i32* %6
%99 = add nsw i32 %98, 1
store i32 %99, i32* %6
br label %73
100: ; preds = %73
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c \00"
@.str.3 = [5 x i8] c"true\00"
@.str.4 = [6 x i8] c"false\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call dereferenceable_or_null(36) i8* @malloc(i32 36)
%6 = bitcast i8* %5 to i32*
%7 = tail call dereferenceable_or_null(72) i8* @malloc(i32 72)
%8 = bitcast i8* %7 to i8**
br label %9
9: ; preds = %2, %9
%10 = phi i64 [ 0, %2 ], [ %53, %9 ]
%11 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%12 = getelementptr inbounds i8*, i8** %8, i64 %10
store i8* %11, i8** %12
%13 = mul nuw nsw i64 %10, 9
%14 = getelementptr inbounds i8, i8* %4, i64 %13
%15 = tail call i32 @strcpy(i8* %11, i8* %14)
%16 = load i8, i8* %11
%17 = sext i8 %16 to i32
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds i8, i8* %11, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds i8, i8* %11, i64 2
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds i8, i8* %11, i64 3
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds i8, i8* %11, i64 4
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds i8, i8* %11, i64 5
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds i8, i8* %11, i64 6
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = getelementptr inbounds i8, i8* %11, i64 7
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds i8, i8* %11, i64 8
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %49)
%51 = getelementptr inbounds i32, i32* %6, i64 %10
store i32 9, i32* %51
%52 = tail call i32 @putchar(i32 10)
%53 = add nuw nsw i64 %10, 1
%54 = icmp eq i64 %53, 9
br i1 %54, label %55, label %9
55: ; preds = %9
%56 = tail call i64 @isValidSudoku(i8** %8, i32 9, i32* %6)
%57 = icmp eq i64 %56, 0
%58 = select i1 %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%59 = tail call i32 @puts(i8* dereferenceable(1) %58)
br label %60
60: ; preds = %55, %60
%61 = phi i64 [ 0, %55 ], [ %108, %60 ]
%62 = getelementptr inbounds i8*, i8** %8, i64 %61
%63 = load i8*, i8** %62
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %65)
%67 = load i8*, i8** %62
%68 = getelementptr inbounds i8, i8* %67, i64 1
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %70)
%72 = load i8*, i8** %62
%73 = getelementptr inbounds i8, i8* %72, i64 2
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %75)
%77 = load i8*, i8** %62
%78 = getelementptr inbounds i8, i8* %77, i64 3
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %80)
%82 = load i8*, i8** %62
%83 = getelementptr inbounds i8, i8* %82, i64 4
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %85)
%87 = load i8*, i8** %62
%88 = getelementptr inbounds i8, i8* %87, i64 5
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %90)
%92 = load i8*, i8** %62
%93 = getelementptr inbounds i8, i8* %92, i64 6
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %95)
%97 = load i8*, i8** %62
%98 = getelementptr inbounds i8, i8* %97, i64 7
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %100)
%102 = load i8*, i8** %62
%103 = getelementptr inbounds i8, i8* %102, i64 8
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %105)
%107 = tail call i32 @putchar(i32 10)
%108 = add nuw nsw i64 %61, 1
%109 = icmp eq i64 %108, 9
br i1 %109, label %110, label %60
110: ; preds = %60
ret i32 0
}