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


x86 assembly (clang, -O0):
<FreeDbl2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113f <FreeDbl2D+0x1f>
jmp    117a <FreeDbl2D+0x5a>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1171 <FreeDbl2D+0x51>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <FreeDbl1D@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <FreeDbl2D+0x26>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FreeDbl2D>:
test   %rdi,%rdi
je     115f <FreeDbl2D+0x3f>
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1152 <FreeDbl2D+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1040 <FreeDbl1D@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <FreeDbl2D+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
ret

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

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