#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*/ vclear(double *, double, int);
void clear2D(double ***xx, int numrows, int numcols, double val) {
  double **array;
  int i;
  array = *xx;
  for (i = numrows - 1; i >= 0; i--) {
    vclear(array[i], val, numcols);
  }
}


x86 assembly (clang, -O0):
<clear2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     116c <clear2D+0x5c>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%esi
call   1030 <vclear@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    113b <clear2D+0x2b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear2D>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    114f <clear2D+0x3f>
mov    %edx,%r14d
mov    (%rdi),%rbx
mov    %esi,%ebp
add    $0x1,%rbp
movsd  %xmm0,0x8(%rsp)
xchg   %ax,%ax
lea    -0x2(%rbp),%eax
mov    (%rbx,%rax,8),%rdi
movsd  0x8(%rsp),%xmm0
mov    %r14d,%esi
call   1030 <vclear@plt>
add    $0xffffffffffffffff,%rbp
cmp    $0x1,%rbp
ja     1130 <clear2D+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @clear2D(double*** nocapture %0, i32 %1, i32 %2, double %3) {
%5 = load double**, double*** %0
%6 = icmp sgt i32 %1, 0
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %8, %7 ], [ %11, %9 ]
%11 = add nsw i64 %10, -1
%12 = and i64 %11, 4294967295
%13 = getelementptr inbounds double*, double** %5, i64 %12
%14 = load double*, double** %13
%15 = tail call i32 @vclear(double* %14, double %3, i32 %2)
%16 = icmp ugt i64 %10, 1
br i1 %16, label %9, label %17
17: ; preds = %9, %4
ret void
}