#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 */
void *vrna_alloc(int);
void allocateProbabilityArrays(double **unpaired,
                               double ***conditional_unpaired, int length) {
  int i;
  *unpaired = vrna_alloc(sizeof(double) * (length + 1));
  *conditional_unpaired = vrna_alloc(sizeof(double *) * (length + 1));
  for (i = 1; i <= length; ++i)
    (*conditional_unpaired)[i] = vrna_alloc(sizeof(double) * (length + 1));
}


x86 assembly (clang, -O0):
<allocateProbabilityArrays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <vrna_alloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <vrna_alloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11a3 <allocateProbabilityArrays+0x93>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <vrna_alloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <allocateProbabilityArrays+0x54>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocateProbabilityArrays>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x8(,%r12,8),%ebp
mov    %ebp,%edi
call   1030 <vrna_alloc@plt>
mov    %rax,(%r15)
mov    %ebp,%edi
call   1030 <vrna_alloc@plt>
mov    %rax,(%r14)
test   %r12d,%r12d
jle    1167 <allocateProbabilityArrays+0x57>
add    $0x1,%r12d
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <vrna_alloc@plt>
mov    (%r14),%rcx
mov    %rax,(%rcx,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <allocateProbabilityArrays+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @allocateProbabilityArrays(double** %0, double*** %1, i32 %2) {
%4 = alloca double**
%5 = alloca double***
%6 = alloca i32
%7 = alloca i32
store double** %0, double*** %4
store double*** %1, double**** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = mul i64 8, %10
%12 = trunc i64 %11 to i32
%13 = call i8* @vrna_alloc(i32 %12)
%14 = bitcast i8* %13 to double*
%15 = load double**, double*** %4
store double* %14, double** %15
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = mul i64 8, %18
%20 = trunc i64 %19 to i32
%21 = call i8* @vrna_alloc(i32 %20)
%22 = bitcast i8* %21 to double**
%23 = load double***, double**** %5
store double** %22, double*** %23
store i32 1, i32* %7
br label %24
24: ; preds = %41, %3
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = icmp sle i32 %25, %26
br i1 %27, label %28, label %44
28: ; preds = %24
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = mul i64 8, %31
%33 = trunc i64 %32 to i32
%34 = call i8* @vrna_alloc(i32 %33)
%35 = bitcast i8* %34 to double*
%36 = load double***, double**** %5
%37 = load double**, double*** %36
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double*, double** %37, i64 %39
store double* %35, double** %40
br label %41
41: ; preds = %28
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %24
44: ; preds = %24
ret void
}

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