#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__ connected(char **);
scalar_t__ four_blocks(char **);
int /*<<< orphan*/ free_3d(char ***);
int ft_checkarray(char **array[]) {
  int i;
  i = -1;
  while (array[++i]) {
    if (!(four_blocks(array[i]) && connected(array[i]))) {
      free_3d(array);
      return (0);
    }
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_checkarray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11ae <ft_checkarray+0x7e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <four_blocks@plt>
cmp    $0x0,%rax
je     1194 <ft_checkarray+0x64>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <connected@plt>
cmp    $0x0,%rax
jne    11a9 <ft_checkarray+0x79>
mov    -0x10(%rbp),%rdi
call   1030 <free_3d@plt>
movl   $0x0,-0x4(%rbp)
jmp    11b5 <ft_checkarray+0x85>
jmp    1143 <ft_checkarray+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_checkarray>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
test   %rdi,%rdi
je     116f <ft_checkarray+0x3f>
call   1040 <four_blocks@plt>
test   %rax,%rax
je     1163 <ft_checkarray+0x33>
mov    (%rbx),%rdi
call   1050 <connected@plt>
add    $0x8,%rbx
test   %rax,%rax
jne    1140 <ft_checkarray+0x10>
mov    %r14,%rdi
call   1030 <free_3d@plt>
xor    %eax,%eax
jmp    1174 <ft_checkarray+0x44>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @ft_checkarray(i8*** %0) {
%2 = alloca i32
%3 = alloca i8***
%4 = alloca i32
store i8*** %0, i8**** %3
store i32 -1, i32* %4
br label %5
5: ; preds = %32, %1
%6 = load i8***, i8**** %3
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
store i32 %8, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8**, i8*** %6, i64 %9
%11 = load i8**, i8*** %10
%12 = icmp ne i8** %11, null
br i1 %12, label %13, label %33
13: ; preds = %5
%14 = load i8***, i8**** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8**, i8*** %14, i64 %16
%18 = load i8**, i8*** %17
%19 = call i64 @four_blocks(i8** %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %13
%22 = load i8***, i8**** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8**, i8*** %22, i64 %24
%26 = load i8**, i8*** %25
%27 = call i64 @connected(i8** %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %21, %13
%30 = load i8***, i8**** %3
%31 = call i32 @free_3d(i8*** %30)
store i32 0, i32* %2
br label %34
32: ; preds = %21
br label %5
33: ; preds = %5
store i32 1, i32* %2
br label %34
34: ; preds = %33, %29
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @ft_checkarray(i8*** %0) {
br label %2
2: ; preds = %11, %1
%3 = phi i64 [ %4, %11 ], [ -1, %1 ]
%4 = add nsw i64 %3, 1
%5 = getelementptr inbounds i8**, i8*** %0, i64 %4
%6 = load i8**, i8*** %5
%7 = icmp eq i8** %6, null
br i1 %7, label %17, label %8
8: ; preds = %2
%9 = tail call i64 @four_blocks(i8** %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = load i8**, i8*** %5
%13 = tail call i64 @connected(i8** %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %2
15: ; preds = %11, %8
%16 = tail call i32 @free_3d(i8*** %0)
br label %17
17: ; preds = %2, %15
%18 = phi i32 [ 0, %15 ], [ 1, %2 ]
ret i32 %18
}