#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__ calloc(int, int);
double **initialize_outputs(int *structure, int hidden_layers) {
  double **out_NN = (double **)calloc((hidden_layers + 1), sizeof(double *));
  for (int i = 0; i <= hidden_layers; i++) {
    out_NN[i] = (double *)calloc(structure[i + 1], sizeof(double));
  }
  return out_NN;
}


x86 assembly (clang, -O0):
<initialize_outputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     117d <initialize_outputs+0x6d>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <initialize_outputs+0x2a>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_outputs>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
lea    0x1(%rbp),%r15d
mov    %r15d,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%r12
test   %ebp,%ebp
js     115f <initialize_outputs+0x4f>
mov    %r15d,%r15d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%rbp
mov    0x4(%r14,%rbx,4),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,(%r12,%rbx,8)
mov    %rbp,%rbx
cmp    %rbp,%r15
jne    1140 <initialize_outputs+0x30>
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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