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


x86 assembly (clang, -O0):
<initialize_bias>:
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     11dc <initialize_bias+0xbc>
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)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jge    11c9 <initialize_bias+0xa9>
mov    $0x0,%al
call   1040 <random_zero_to_one@plt>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1186 <initialize_bias+0x66>
jmp    11ce <initialize_bias+0xae>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114a <initialize_bias+0x2a>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_bias>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
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     119f <initialize_bias+0x7f>
mov    %r15d,%r15d
xor    %r13d,%r13d
jmp    1155 <initialize_bias+0x35>
cmp    %r15,%r13
je     119f <initialize_bias+0x7f>
mov    %r13,%rbp
add    $0x1,%r13
mov    0x4(%r14,%rbp,4),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,(%r12,%rbp,8)
cmpl   $0x0,0x4(%r14,%rbp,4)
jle    1150 <initialize_bias+0x30>
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <random_zero_to_one@plt>
mov    (%r12,%rbp,8),%rax
movsd  %xmm0,(%rax,%rbx,8)
add    $0x1,%rbx
movslq (%r14,%r13,4),%rax
cmp    %rax,%rbx
jl     1180 <initialize_bias+0x60>
jmp    1150 <initialize_bias+0x30>
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @initialize_bias(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double**
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
%10 = call i64 @calloc(i32 %9, i32 8)
%11 = inttoptr i64 %10 to double**
store double** %11, double*** %5
store i32 0, i32* %6
br label %12
12: ; preds = %52, %2
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %55
16: ; preds = %12
%17 = load i32*, i32** %3
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %17, i64 %20
%22 = load i32, i32* %21
%23 = call i64 @calloc(i32 %22, i32 8)
%24 = inttoptr i64 %23 to double*
%25 = load double**, double*** %5
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double*, double** %25, i64 %27
store double* %24, double** %28
store i32 0, i32* %7
br label %29
29: ; preds = %48, %16
%30 = load i32, i32* %7
%31 = load i32*, i32** %3
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %31, i64 %34
%36 = load i32, i32* %35
%37 = icmp slt i32 %30, %36
br i1 %37, label %38, label %51
38: ; preds = %29
%39 = call double (...) @random_zero_to_one()
%40 = load double**, double*** %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double*, double** %40, i64 %42
%44 = load double*, double** %43
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
store double %39, double* %47
br label %48
48: ; preds = %38
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %29
51: ; preds = %29
br label %52
52: ; preds = %51
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %12
55: ; preds = %12
%56 = load double**, double*** %5
ret double** %56
}

LLVM IR (-O2):
define double** @initialize_bias(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 %11, label %7
7: ; preds = %2
%8 = zext i32 %3 to i64
br label %12
9: ; preds = %22, %12
%10 = icmp eq i64 %14, %8
br i1 %10, label %11, label %12
11: ; preds = %9, %2
ret double** %5
12: ; preds = %7, %9
%13 = phi i64 [ 0, %7 ], [ %14, %9 ]
%14 = add nuw nsw i64 %13, 1
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = load i32, i32* %15
%17 = tail call i64 @calloc(i32 %16, i32 8)
%18 = inttoptr i64 %17 to double*
%19 = getelementptr inbounds double*, double** %5, i64 %13
store double* %18, double** %19
%20 = load i32, i32* %15
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %9
22: ; preds = %12, %22
%23 = phi i64 [ %27, %22 ], [ 0, %12 ]
%24 = tail call double (...) @random_zero_to_one()
%25 = load double*, double** %19
%26 = getelementptr inbounds double, double* %25, i64 %23
store double %24, double* %26
%27 = add nuw nsw i64 %23, 1
%28 = load i32, i32* %15
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %27, %29
br i1 %30, label %22, label %9
}