#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__ HTS_calloc(size_t, int);
double **HTS_alloc_matrix(size_t x, size_t y) {
  size_t i;
  double **p = (double **)HTS_calloc(x, sizeof(double *));
  for (i = 0; i < x; i++)
    p[i] = (double *)HTS_calloc(y, sizeof(double));
  return p;
}


x86 assembly (clang, -O0):
<HTS_alloc_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <HTS_calloc@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1176 <HTS_alloc_matrix+0x66>
mov    -0x10(%rbp),%rdi
mov    $0x8,%esi
call   1030 <HTS_calloc@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113a <HTS_alloc_matrix+0x2a>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HTS_alloc_matrix>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x8,%esi
call   1030 <HTS_calloc@plt>
mov    %rax,%r12
test   %r15,%r15
je     115a <HTS_alloc_matrix+0x4a>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x8,%esi
call   1030 <HTS_calloc@plt>
mov    %rax,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <HTS_alloc_matrix+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double** @HTS_alloc_matrix(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca double**
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = call i64 @HTS_calloc(i64 %7, i32 8)
%9 = inttoptr i64 %8 to double**
store double** %9, double*** %6
store i64 0, i64* %5
br label %10
10: ; preds = %21, %2
%11 = load i64, i64* %5
%12 = load i64, i64* %3
%13 = icmp ult i64 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i64, i64* %4
%16 = call i64 @HTS_calloc(i64 %15, i32 8)
%17 = inttoptr i64 %16 to double*
%18 = load double**, double*** %6
%19 = load i64, i64* %5
%20 = getelementptr inbounds double*, double** %18, i64 %19
store double* %17, double** %20
br label %21
21: ; preds = %14
%22 = load i64, i64* %5
%23 = add i64 %22, 1
store i64 %23, i64* %5
br label %10
24: ; preds = %10
%25 = load double**, double*** %6
ret double** %25
}

LLVM IR (-O2):
define double** @HTS_alloc_matrix(i64 %0, i64 %1) {
%3 = tail call i64 @HTS_calloc(i64 %0, i32 8)
%4 = inttoptr i64 %3 to double**
%5 = icmp eq i64 %0, 0
br i1 %5, label %13, label %6
6: ; preds = %2, %6
%7 = phi i64 [ %11, %6 ], [ 0, %2 ]
%8 = tail call i64 @HTS_calloc(i64 %1, i32 8)
%9 = inttoptr i64 %8 to double*
%10 = getelementptr inbounds double*, double** %4, i64 %7
store double* %9, double** %10
%11 = add nuw i64 %7, 1
%12 = icmp eq i64 %11, %0
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret double** %4
}