#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 check_col(int, int, char **);
int check_line(int, int, char **);
int check_square(int, int, int, char **);
int check_all(int x, int y, int value, char **map) {
  if (check_col(x, value, map) == 1 && check_line(y, value, map) == 1 &&
      check_square(x, y, value, map) == 1)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<check_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <check_col@plt>
cmp    $0x1,%eax
jne    119c <check_all+0x6c>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1050 <check_line@plt>
cmp    $0x1,%eax
jne    119c <check_all+0x6c>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <check_square@plt>
cmp    $0x1,%eax
jne    119c <check_all+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    11a3 <check_all+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_all>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edi,%r15d
mov    %edx,%esi
mov    %rcx,%rdx
call   1040 <check_col@plt>
cmp    $0x1,%eax
jne    117f <check_all+0x4f>
mov    %r14d,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1050 <check_line@plt>
cmp    $0x1,%eax
jne    117f <check_all+0x4f>
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %rbx,%rcx
call   1030 <check_square@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
je     1181 <check_all+0x51>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_all(i32 %0, i32 %1, i32 %2, i8** %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8** %3, i8*** %9
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = load i8**, i8*** %9
%13 = call i32 @check_col(i32 %10, i32 %11, i8** %12)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %29
15: ; preds = %4
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = load i8**, i8*** %9
%19 = call i32 @check_line(i32 %16, i32 %17, i8** %18)
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %29
21: ; preds = %15
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = load i8**, i8*** %9
%26 = call i32 @check_square(i32 %22, i32 %23, i32 %24, i8** %25)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %29
28: ; preds = %21
store i32 1, i32* %5
br label %30
29: ; preds = %21, %15, %4
store i32 0, i32* %5
br label %30
30: ; preds = %29, %28
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @check_all(i32 %0, i32 %1, i32 %2, i8** %3) {
%5 = tail call i32 @check_col(i32 %0, i32 %2, i8** %3)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i32 @check_line(i32 %1, i32 %2, i8** %3)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i32 @check_square(i32 %0, i32 %1, i32 %2, i8** %3)
%12 = icmp eq i32 %11, 1
br i1 %12, label %14, label %13
13: ; preds = %10, %7, %4
br label %14
14: ; preds = %10, %13
%15 = phi i32 [ 0, %13 ], [ 1, %10 ]
ret i32 %15
}