#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 in_square(char **, int, int);
int check_per_square(char **map) {
  int i;
  int j;
  int status;
  i = 0;
  while (i < 9) {
    j = 0;
    while (j < 9) {
      status = in_square(map, i, j);
      j += 3;
    }
    i += 3;
  }
  return (status);
}


x86 assembly (clang, -O0):
<check_per_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jge    116c <check_per_square+0x5c>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jge    115e <check_per_square+0x4e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <in_square@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <check_per_square+0x24>
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <check_per_square+0x13>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_per_square>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
xor    %edx,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x6,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %edx,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x3,%edx
call   1030 <in_square@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x6,%edx
pop    %rbx
jmp    1030 <in_square@plt>

LLVM IR (-O0):
define i32 @check_per_square(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %6
6: ; preds = %20, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 9
br i1 %8, label %9, label %23
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %13, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 9
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i8**, i8*** %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 @in_square(i8** %14, i32 %15, i32 %16)
store i32 %17, i32* %5
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 3
store i32 %19, i32* %4
br label %10
20: ; preds = %10
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 3
store i32 %22, i32* %3
br label %6
23: ; preds = %6
%24 = load i32, i32* %5
ret i32 %24
}

LLVM IR (-O2):
define i32 @check_per_square(i8** %0) {
%2 = tail call i32 @in_square(i8** %0, i32 0, i32 0)
%3 = tail call i32 @in_square(i8** %0, i32 0, i32 3)
%4 = tail call i32 @in_square(i8** %0, i32 0, i32 6)
%5 = tail call i32 @in_square(i8** %0, i32 3, i32 0)
%6 = tail call i32 @in_square(i8** %0, i32 3, i32 3)
%7 = tail call i32 @in_square(i8** %0, i32 3, i32 6)
%8 = tail call i32 @in_square(i8** %0, i32 6, i32 0)
%9 = tail call i32 @in_square(i8** %0, i32 6, i32 3)
%10 = tail call i32 @in_square(i8** %0, i32 6, i32 6)
ret i32 %10
}