#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 */
int **allocate_matrix(int);
char *check_sudoku(int **);
int /*<<< orphan*/ printf(char *, int, char *);
int /*<<< orphan*/ read_matrix(int **);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, n;
  int **m;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    m = allocate_matrix(9);
    read_matrix(m);
    printf("Instancia %d\n%s\n\n", i + 1, check_sudoku(m));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cb <main+0x7b>
mov    $0x9,%edi
call   1040 <allocate_matrix@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <read_matrix@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <check_sudoku@plt>
mov    -0x1c(%rbp),%esi
mov    %rax,%rdx
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <main+0x26>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11b3 <main+0x63>
xor    %ebx,%ebx
lea    0xe89(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    $0x9,%edi
call   1040 <allocate_matrix@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1050 <read_matrix@plt>
add    $0x1,%ebx
mov    %r15,%rdi
call   1060 <check_sudoku@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1030 <printf@plt>
cmp    0xc(%rsp),%ebx
jl     1180 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [18 x i8] c"Instancia %d\0A%s\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32**
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %6
6: ; preds = %19, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = call i32** @allocate_matrix(i32 9)
store i32** %11, i32*** %4
%12 = load i32**, i32*** %4
%13 = call i32 @read_matrix(i32** %12)
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
%16 = load i32**, i32*** %4
%17 = call i8* @check_sudoku(i32** %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %6
22: ; preds = %6
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [18 x i8] c"Instancia %d\0A%s\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ 0, %0 ]
%8 = call i32** @allocate_matrix(i32 9)
%9 = call i32 @read_matrix(i32** %8)
%10 = add nuw nsw i32 %7, 1
%11 = call i8* @check_sudoku(i32** %8)
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %10, i8* %11)
%13 = load i32, i32* %1
%14 = icmp slt i32 %10, %13
br i1 %14, label %6, label %15
15: ; preds = %6, %0
ret i32 0
}