#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 /*<<< orphan*/ FreeDbl2D(double **, int);
int /*<<< orphan*/ free(void *);
void FreeDbl3D(double ***s, int size1, int size2) {
  int i;
  if (!s)
    return;
  for (i = 0; i < size1; i++)
    FreeDbl2D(s[i], size2);
  free((void *)s);
  return;
}


x86 assembly (clang, -O0):
<FreeDbl3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1142 <FreeDbl3D+0x22>
jmp    1180 <FreeDbl3D+0x60>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1177 <FreeDbl3D+0x57>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%esi
call   1030 <FreeDbl2D@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1149 <FreeDbl3D+0x29>
mov    -0x8(%rbp),%rdi
call   1040 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FreeDbl3D>:
test   %rdi,%rdi
je     1167 <FreeDbl3D+0x47>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
test   %esi,%esi
jle    1155 <FreeDbl3D+0x35>
mov    %edx,%r14d
mov    %esi,%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rdi
mov    %r14d,%esi
call   1030 <FreeDbl2D@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <FreeDbl3D+0x20>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <free@plt>
ret

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

LLVM IR (-O2):
define void @FreeDbl3D(double*** %0, i32 %1, i32 %2) {
%4 = icmp eq double*** %0, null
br i1 %4, label %19, label %5
5: ; preds = %3
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %16
7: ; preds = %5
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %14, %9 ]
%11 = getelementptr inbounds double**, double*** %0, i64 %10
%12 = load double**, double*** %11
%13 = tail call i32 @FreeDbl2D(double** %12, i32 %2)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %8
br i1 %15, label %16, label %9
16: ; preds = %9, %5
%17 = bitcast double*** %0 to i8*
%18 = tail call i32 @free(i8* %17)
br label %19
19: ; preds = %3, %16
ret void
}