#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ copy_pointer(int /*<<< orphan*/ *, double *, int,
                                int /*<<< orphan*/, double **,
                                int /*<<< orphan*/ *, int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free_matrix(double ***, int, int);
int get_output_in_decimal(int, double **);
double **initialize_matrix(int, int, int /*<<< orphan*/);
double **matrix_addition(double **, int /*<<< orphan*/, int, int, double **,
                         int /*<<< orphan*/, int, int, int /*<<< orphan*/);
double **matrix_multiplication(double **, int, int, double **, int, int);
double **matrix_sigmoid(double **, int, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void test_neural_net(int *structure, int hidden_layers, int test_instances,
                     double **test_input_matrix, double ***NN, double **bias,
                     int orig_min, char *out_filename) {
  FILE *out_file = fopen(out_filename, "w");
  for (int n = 0; n < test_instances; n++) {
    double **out;
    double **in = initialize_matrix(structure[0], 1, 0);
    copy_pointer(NULL, test_input_matrix[n], structure[0], 0, in, NULL,
                 structure[0], 1);
    for (int i = 0; i <= hidden_layers; i++) {
      double **layer_bias = initialize_matrix(structure[i + 1], 1, 0);
      copy_pointer(NULL, bias[i], structure[i + 1], 0, layer_bias, NULL,
                   structure[i + 1], 1);
      double **v_mul = matrix_multiplication(NN[i], structure[i + 1],
                                             structure[i], in, structure[i], 1);
      free_matrix(&in, structure[i], 1);
      double **v_add = matrix_addition(v_mul, 0, structure[i + 1], 1,
                                       layer_bias, 0, structure[i + 1], 1, 0);
      free_matrix(&v_mul, structure[i + 1], 1);
      out = matrix_sigmoid(v_add, structure[i + 1], 1);
      free_matrix(&v_add, structure[i + 1], 1);
      free_matrix(&layer_bias, structure[i + 1], 1);
      in = out;
    }
    int output = get_output_in_decimal(structure[hidden_layers + 1], out);
    free_matrix(&out, structure[hidden_layers + 1], 1);
    char out_str[20];
    sprintf(out_str, "%d\n", output + orig_min);
    fputs(out_str, out_file);
  }
  fclose(out_file);
}


x86 assembly (clang, -O0):
<test_neural_net>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    0x18(%rbp),%rdi
lea    0xe1d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1473 <test_neural_net+0x2c3>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <initialize_matrix@plt>
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x48(%rbp),%r8
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
xor    %ecx,%ecx
mov    %ecx,%r9d
xor    %ecx,%ecx
mov    %r9,%rdi
mov    %eax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1060 <copy_pointer@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1408 <test_neural_net+0x258>
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <initialize_matrix@plt>
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x58(%rbp),%r8
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
xor    %ecx,%ecx
mov    %ecx,%r9d
xor    %ecx,%ecx
mov    %r9,%rdi
mov    %eax,(%rsp)
movl   $0x1,0x8(%rsp)
call   1060 <copy_pointer@plt>
mov    -0x20(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x48(%rbp),%rcx
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%r8
mov    (%rax,%r8,4),%r8d
mov    $0x1,%r9d
call   1030 <matrix_multiplication@plt>
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    -0x48(%rbp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x58(%rbp),%r8
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
xor    %r9d,%r9d
mov    $0x1,%ecx
mov    %r9d,%esi
mov    %eax,(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1080 <matrix_addition@plt>
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    -0x60(%rbp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    -0x68(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    $0x1,%edx
call   1090 <matrix_sigmoid@plt>
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    -0x68(%rbp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    -0x8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    -0x58(%rbp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1252 <test_neural_net+0xa2>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x40(%rbp),%rsi
call   10c0 <get_output_in_decimal@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    -0x40(%rbp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
lea    -0x80(%rbp),%rdi
mov    -0x6c(%rbp),%edx
add    0x10(%rbp),%edx
lea    0xbaf(%rip),%rsi
call   10b0 <sprintf@plt>
lea    -0x80(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <fputs@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11f3 <test_neural_net+0x43>
mov    -0x30(%rbp),%rdi
call   1050 <fclose@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_neural_net>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,%r15
mov    %r8,%r13
mov    %rcx,0x48(%rsp)
mov    %edx,%ebp
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbx
mov    0xb8(%rsp),%rdi
lea    0xe1e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,0x20(%rsp)
test   %ebp,%ebp
jle    13e8 <test_neural_net+0x238>
mov    0x18(%rsp),%rax
lea    0x1(%rax),%r12d
movslq %r12d,%rax
mov    %rax,0x40(%rsp)
mov    %ebp,%eax
mov    %rax,0x38(%rsp)
xor    %ebp,%ebp
lea    0x60(%rsp),%r14
mov    %r12,0x58(%rsp)
jmp    128d <test_neural_net+0xdd>
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rsi
mov    %r13,%r12
mov    %r15,%r13
mov    0x40(%rsp),%r15
mov    (%rbx,%r15,4),%edi
call   10c0 <get_output_in_decimal@plt>
mov    %eax,%ebp
mov    (%rbx,%r15,4),%esi
lea    0x10(%rsp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
add    0xb0(%rsp),%ebp
mov    %r14,%rdi
lea    0xda3(%rip),%rsi
mov    %ebp,%edx
call   10b0 <sprintf@plt>
mov    %r14,%rdi
mov    0x20(%rsp),%rsi
call   1070 <fputs@plt>
mov    0x50(%rsp),%rbp
add    $0x1,%rbp
cmp    0x38(%rsp),%rbp
mov    %r13,%r15
mov    %r12,%r13
je     13e8 <test_neural_net+0x238>
mov    (%rbx),%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <initialize_matrix@plt>
mov    %rax,0x8(%rsp)
mov    0x48(%rsp),%rcx
mov    (%rcx,%rbp,8),%rsi
mov    (%rbx),%edx
xor    %edi,%edi
xor    %ecx,%ecx
mov    %rax,%r8
xor    %r9d,%r9d
push   $0x1
push   %rdx
call   1060 <copy_pointer@plt>
add    $0x10,%rsp
cmpl   $0x0,0x18(%rsp)
mov    %rbp,0x50(%rsp)
js     1220 <test_neural_net+0x70>
xor    %ebp,%ebp
mov    %r13,%r12
mov    %r15,%r13
nopl   0x0(%rax)
lea    0x1(%rbp),%r15
mov    0x4(%rbx,%rbp,4),%edi
mov    $0x1,%esi
xor    %edx,%edx
call   10d0 <initialize_matrix@plt>
mov    %rax,0x60(%rsp)
mov    0x0(%r13,%rbp,8),%rsi
mov    0x4(%rbx,%rbp,4),%edx
xor    %edi,%edi
xor    %ecx,%ecx
mov    %rax,%r8
xor    %r9d,%r9d
push   $0x1
push   %rdx
call   1060 <copy_pointer@plt>
add    $0x10,%rsp
mov    (%r12,%rbp,8),%rdi
mov    (%rbx,%rbp,4),%edx
mov    0x4(%rbx,%rbp,4),%esi
mov    0x8(%rsp),%rcx
mov    %edx,%r8d
mov    $0x1,%r9d
call   1030 <matrix_multiplication@plt>
mov    %rax,0x30(%rsp)
mov    (%rbx,%rbp,4),%esi
lea    0x8(%rsp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    0x30(%rsp),%rdi
mov    0x4(%rbx,%rbp,4),%edx
mov    0x60(%rsp),%r8
sub    $0x8,%rsp
xor    %esi,%esi
mov    $0x1,%ecx
xor    %r9d,%r9d
push   $0x0
push   $0x1
push   %rdx
call   1080 <matrix_addition@plt>
add    $0x20,%rsp
mov    %rax,0x28(%rsp)
mov    0x4(%rbx,%rbp,4),%esi
lea    0x30(%rsp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    0x28(%rsp),%rdi
mov    0x4(%rbx,%rbp,4),%esi
mov    $0x1,%edx
call   1090 <matrix_sigmoid@plt>
mov    %rax,0x10(%rsp)
mov    0x4(%rbx,%rbp,4),%esi
lea    0x28(%rsp),%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    0x4(%rbx,%rbp,4),%esi
mov    %r14,%rdi
mov    $0x1,%edx
call   1040 <free_matrix@plt>
mov    0x10(%rsp),%rsi
mov    %rsi,0x8(%rsp)
mov    %r15,%rbp
cmp    %r15,0x58(%rsp)
jne    12e0 <test_neural_net+0x130>
jmp    122b <test_neural_net+0x7b>
mov    0x20(%rsp),%rdi
call   1050 <fclose@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @test_neural_net(i32* %0, i32 %1, i32 %2, double** %3, double*** %4, double** %5, i32 %6, i8* %7) {
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca double**
%13 = alloca double***
%14 = alloca double**
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i32
%19 = alloca double**
%20 = alloca double**
%21 = alloca i32
%22 = alloca double**
%23 = alloca double**
%24 = alloca double**
%25 = alloca i32
%26 = alloca [20 x i8]
store i32* %0, i32** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store double** %3, double*** %12
store double*** %4, double**** %13
store double** %5, double*** %14
store i32 %6, i32* %15
store i8* %7, i8** %16
%27 = load i8*, i8** %16
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %28, i32** %17
store i32 0, i32* %18
br label %29
29: ; preds = %183, %8
%30 = load i32, i32* %18
%31 = load i32, i32* %11
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %186
33: ; preds = %29
%34 = load i32*, i32** %9
%35 = getelementptr inbounds i32, i32* %34, i64 0
%36 = load i32, i32* %35
%37 = call double** @initialize_matrix(i32 %36, i32 1, i32 0)
store double** %37, double*** %20
%38 = load double**, double*** %12
%39 = load i32, i32* %18
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double*, double** %38, i64 %40
%42 = load double*, double** %41
%43 = load i32*, i32** %9
%44 = getelementptr inbounds i32, i32* %43, i64 0
%45 = load i32, i32* %44
%46 = load double**, double*** %20
%47 = load i32*, i32** %9
%48 = getelementptr inbounds i32, i32* %47, i64 0
%49 = load i32, i32* %48
%50 = call i32 @copy_pointer(i32* null, double* %42, i32 %45, i32 0, double** %46, i32* null, i32 %49, i32 1)
store i32 0, i32* %21
br label %51
51: ; preds = %156, %33
%52 = load i32, i32* %21
%53 = load i32, i32* %10
%54 = icmp sle i32 %52, %53
br i1 %54, label %55, label %159
55: ; preds = %51
%56 = load i32*, i32** %9
%57 = load i32, i32* %21
%58 = add nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i32, i32* %56, i64 %59
%61 = load i32, i32* %60
%62 = call double** @initialize_matrix(i32 %61, i32 1, i32 0)
store double** %62, double*** %22
%63 = load double**, double*** %14
%64 = load i32, i32* %21
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double*, double** %63, i64 %65
%67 = load double*, double** %66
%68 = load i32*, i32** %9
%69 = load i32, i32* %21
%70 = add nsw i32 %69, 1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %68, i64 %71
%73 = load i32, i32* %72
%74 = load double**, double*** %22
%75 = load i32*, i32** %9
%76 = load i32, i32* %21
%77 = add nsw i32 %76, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %75, i64 %78
%80 = load i32, i32* %79
%81 = call i32 @copy_pointer(i32* null, double* %67, i32 %73, i32 0, double** %74, i32* null, i32 %80, i32 1)
%82 = load double***, double**** %13
%83 = load i32, i32* %21
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double**, double*** %82, i64 %84
%86 = load double**, double*** %85
%87 = load i32*, i32** %9
%88 = load i32, i32* %21
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %87, i64 %90
%92 = load i32, i32* %91
%93 = load i32*, i32** %9
%94 = load i32, i32* %21
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i32, i32* %93, i64 %95
%97 = load i32, i32* %96
%98 = load double**, double*** %20
%99 = load i32*, i32** %9
%100 = load i32, i32* %21
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32, i32* %99, i64 %101
%103 = load i32, i32* %102
%104 = call double** @matrix_multiplication(double** %86, i32 %92, i32 %97, double** %98, i32 %103, i32 1)
store double** %104, double*** %23
%105 = load i32*, i32** %9
%106 = load i32, i32* %21
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i32, i32* %105, i64 %107
%109 = load i32, i32* %108
%110 = call i32 @free_matrix(double*** %20, i32 %109, i32 1)
%111 = load double**, double*** %23
%112 = load i32*, i32** %9
%113 = load i32, i32* %21
%114 = add nsw i32 %113, 1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i32, i32* %112, i64 %115
%117 = load i32, i32* %116
%118 = load double**, double*** %22
%119 = load i32*, i32** %9
%120 = load i32, i32* %21
%121 = add nsw i32 %120, 1
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i32, i32* %119, i64 %122
%124 = load i32, i32* %123
%125 = call double** @matrix_addition(double** %111, i32 0, i32 %117, i32 1, double** %118, i32 0, i32 %124, i32 1, i32 0)
store double** %125, double*** %24
%126 = load i32*, i32** %9
%127 = load i32, i32* %21
%128 = add nsw i32 %127, 1
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i32, i32* %126, i64 %129
%131 = load i32, i32* %130
%132 = call i32 @free_matrix(double*** %23, i32 %131, i32 1)
%133 = load double**, double*** %24
%134 = load i32*, i32** %9
%135 = load i32, i32* %21
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i32, i32* %134, i64 %137
%139 = load i32, i32* %138
%140 = call double** @matrix_sigmoid(double** %133, i32 %139, i32 1)
store double** %140, double*** %19
%141 = load i32*, i32** %9
%142 = load i32, i32* %21
%143 = add nsw i32 %142, 1
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i32, i32* %141, i64 %144
%146 = load i32, i32* %145
%147 = call i32 @free_matrix(double*** %24, i32 %146, i32 1)
%148 = load i32*, i32** %9
%149 = load i32, i32* %21
%150 = add nsw i32 %149, 1
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i32, i32* %148, i64 %151
%153 = load i32, i32* %152
%154 = call i32 @free_matrix(double*** %22, i32 %153, i32 1)
%155 = load double**, double*** %19
store double** %155, double*** %20
br label %156
156: ; preds = %55
%157 = load i32, i32* %21
%158 = add nsw i32 %157, 1
store i32 %158, i32* %21
br label %51
159: ; preds = %51
%160 = load i32*, i32** %9
%161 = load i32, i32* %10
%162 = add nsw i32 %161, 1
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i32, i32* %160, i64 %163
%165 = load i32, i32* %164
%166 = load double**, double*** %19
%167 = call i32 @get_output_in_decimal(i32 %165, double** %166)
store i32 %167, i32* %25
%168 = load i32*, i32** %9
%169 = load i32, i32* %10
%170 = add nsw i32 %169, 1
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i32, i32* %168, i64 %171
%173 = load i32, i32* %172
%174 = call i32 @free_matrix(double*** %19, i32 %173, i32 1)
%175 = getelementptr inbounds [20 x i8], [20 x i8]* %26, i64 0, i64 0
%176 = load i32, i32* %25
%177 = load i32, i32* %15
%178 = add nsw i32 %176, %177
%179 = call i32 @sprintf(i8* %175, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %178)
%180 = getelementptr inbounds [20 x i8], [20 x i8]* %26, i64 0, i64 0
%181 = load i32*, i32** %17
%182 = call i32 @fputs(i8* %180, i32* %181)
br label %183
183: ; preds = %159
%184 = load i32, i32* %18
%185 = add nsw i32 %184, 1
store i32 %185, i32* %18
br label %29
186: ; preds = %29
%187 = load i32*, i32** %17
%188 = call i32 @fclose(i32* %187)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @test_neural_net(i32* nocapture %0, i32 %1, i32 %2, double** nocapture %3, double*** nocapture %4, double** nocapture %5, i32 %6, i8* nocapture %7) {
%9 = alloca double**
%10 = alloca double**
%11 = alloca double**
%12 = alloca double**
%13 = alloca double**
%14 = alloca [20 x i8]
%15 = tail call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = icmp sgt i32 %2, 0
br i1 %16, label %17, label %30
17: ; preds = %8
%18 = bitcast double*** %9 to i8*
%19 = bitcast double*** %10 to i8*
%20 = icmp slt i32 %1, 0
%21 = bitcast double*** %11 to i8*
%22 = bitcast double*** %12 to i8*
%23 = bitcast double*** %13 to i8*
%24 = add i32 %1, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %0, i64 %25
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %14, i64 0, i64 0
%28 = zext i32 %2 to i64
%29 = zext i32 %24 to i64
br label %32
30: ; preds = %42, %8
%31 = call i32 @fclose(i32* %15)
ret void
32: ; preds = %17, %42
%33 = phi i64 [ 0, %17 ], [ %51, %42 ]
%34 = load i32, i32* %0
%35 = call double** @initialize_matrix(i32 %34, i32 1, i32 0)
store double** %35, double*** %10
%36 = getelementptr inbounds double*, double** %3, i64 %33
%37 = load double*, double** %36
%38 = load i32, i32* %0
%39 = call i32 @copy_pointer(i32* null, double* %37, i32 %38, i32 0, double** %35, i32* null, i32 %38, i32 1)
br i1 %20, label %40, label %53
40: ; preds = %32
%41 = load double**, double*** %9
br label %42
42: ; preds = %53, %40
%43 = phi double** [ %41, %40 ], [ %85, %53 ]
%44 = load i32, i32* %26
%45 = call i32 @get_output_in_decimal(i32 %44, double** %43)
%46 = load i32, i32* %26
%47 = call i32 @free_matrix(double*** %9, i32 %46, i32 1)
%48 = add nsw i32 %45, %6
%49 = call i32 @sprintf(i8* %27, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = call i32 @fputs(i8* %27, i32* %15)
%51 = add nuw nsw i64 %33, 1
%52 = icmp eq i64 %51, %28
br i1 %52, label %30, label %32
53: ; preds = %32, %53
%54 = phi i64 [ %55, %53 ], [ 0, %32 ]
%55 = add nuw nsw i64 %54, 1
%56 = getelementptr inbounds i32, i32* %0, i64 %55
%57 = load i32, i32* %56
%58 = call double** @initialize_matrix(i32 %57, i32 1, i32 0)
store double** %58, double*** %11
%59 = getelementptr inbounds double*, double** %5, i64 %54
%60 = load double*, double** %59
%61 = load i32, i32* %56
%62 = call i32 @copy_pointer(i32* null, double* %60, i32 %61, i32 0, double** %58, i32* null, i32 %61, i32 1)
%63 = getelementptr inbounds double**, double*** %4, i64 %54
%64 = load double**, double*** %63
%65 = load i32, i32* %56
%66 = getelementptr inbounds i32, i32* %0, i64 %54
%67 = load i32, i32* %66
%68 = load double**, double*** %10
%69 = call double** @matrix_multiplication(double** %64, i32 %65, i32 %67, double** %68, i32 %67, i32 1)
store double** %69, double*** %12
%70 = load i32, i32* %66
%71 = call i32 @free_matrix(double*** %10, i32 %70, i32 1)
%72 = load double**, double*** %12
%73 = load i32, i32* %56
%74 = load double**, double*** %11
%75 = call double** @matrix_addition(double** %72, i32 0, i32 %73, i32 1, double** %74, i32 0, i32 %73, i32 1, i32 0)
store double** %75, double*** %13
%76 = load i32, i32* %56
%77 = call i32 @free_matrix(double*** %12, i32 %76, i32 1)
%78 = load double**, double*** %13
%79 = load i32, i32* %56
%80 = call double** @matrix_sigmoid(double** %78, i32 %79, i32 1)
store double** %80, double*** %9
%81 = load i32, i32* %56
%82 = call i32 @free_matrix(double*** %13, i32 %81, i32 1)
%83 = load i32, i32* %56
%84 = call i32 @free_matrix(double*** %11, i32 %83, i32 1)
%85 = load double**, double*** %9
store double** %85, double*** %10
%86 = icmp eq i64 %55, %29
br i1 %86, label %42, label %53
}