// File: /workspace/github_cpp_makefile_star2_O1/wrighteagle2d[P]wrighteaglebase/Debug/../src/Net.cpp
// Function: Net::TestOnFile(char const*)
real Net::TestOnFile(const char *fname) {
  if (mUnits == 0)
    return -1.0;
  FILE *fp;
  if ((fp = fopen(fname, "r")) == 0) {
    perror("BPN::TrainOnFile(char *fname)");
    exit(1);
  }
  int patterns;
  int input_size;
  int desire_size;
  real **input;
  real **desire;

  SCAN_PARAMS(patterns, input_size, desire_size)

  input = new real *[patterns];
  desire = new real *[patterns];
  for (int i = 0; i < patterns; ++i) {
    input[i] = new real[input_size];
    desire[i] = new real[desire_size];
  }

  SCAN_TRAIN(patterns, input_size, desire_size, input, desire)

  real error = 0.0;
  for (int p = 0; p < patterns; ++p) {
    SetDesire(desire[p]);
    Run(input[p], 0);
    error += Error();
  }

  for (int i = 0; i < patterns; ++i) {
    delete[] input[i];
    delete[] desire[i];
  }
  delete[] input;
  delete[] desire;

  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
cmpq $0x0, 0x8(%rdi)
je 0x385c9
movq %rdi, -0x58(%rbp)
leaq 0x37175(%rip), %rax     # 0x6f590
movq %rsi, %rdi
movq %rax, %rsi
callq 0x95a0
testq %rax, %rax
je 0x38631
movq %rax, %r12
leaq 0x34754(%rip), %rsi     # 0x6cb8d
leaq -0x2c(%rbp), %rbx
leaq -0x40(%rbp), %rcx
leaq -0x3c(%rbp), %r8
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9930
movslq (%rbx), %rbx
leaq (,%rbx,8), %r14
testq %rbx, %rbx
movq $-0x1, %r13
cmovsq %r13, %r14
movq %r14, %rdi
callq 0x9050
movq %rax, -0x48(%rbp)
movq %r14, %rdi
callq 0x9050
movq %rax, %rdx
testq %rbx, %rbx
jle 0x384e2
movq %rbx, %r14
movslq -0x40(%rbp), %rax
leaq (,%rax,8), %rsi
testq %rax, %rax
cmovsq %r13, %rsi
movq %rsi, -0x38(%rbp)
movslq -0x3c(%rbp), %rax
leaq (,%rax,8), %r15
testq %rax, %rax
cmovsq %r13, %r15
xorl %ebx, %ebx
movq -0x38(%rbp), %rdi
movq %rdx, %r13
callq 0x9050
movq -0x48(%rbp), %rcx
movq %rax, (%rcx,%rbx,8)
movq %r15, %rdi
callq 0x9050
movq %r13, %rdx
movq %rax, (%r13,%rbx,8)
incq %rbx
cmpq %rbx, %r14
jne 0x384b6
movq %rdx, -0x50(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x3856b
xorl %r15d, %r15d
cmpl $0x0, -0x40(%rbp)
movq -0x48(%rbp), %r13
jle 0x38527
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%r13,%r15,8), %rdx
addq %rbx, %rdx
movq %r12, %rdi
leaq 0x36b7d(%rip), %rsi     # 0x6f08d
xorl %eax, %eax
callq 0x9930
incq %r14
movslq -0x40(%rbp), %rax
addq $0x8, %rbx
cmpq %rax, %r14
jl 0x384fe
cmpl $0x0, -0x3c(%rbp)
movq -0x50(%rbp), %r13
jle 0x3855f
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%r13,%r15,8), %rdx
addq %rbx, %rdx
movq %r12, %rdi
leaq 0x36b45(%rip), %rsi     # 0x6f08d
xorl %eax, %eax
callq 0x9930
incq %r14
movslq -0x3c(%rbp), %rax
addq $0x8, %rbx
cmpq %rax, %r14
jl 0x38536
incq %r15
movslq -0x2c(%rbp), %rax
cmpq %rax, %r15
jl 0x384ef
cmpl $0x0, -0x2c(%rbp)
movq -0x50(%rbp), %r14
xorpd %xmm0, %xmm0
jle 0x385d3
xorl %r15d, %r15d
movq -0x48(%rbp), %rbx
movq -0x58(%rbp), %r12
movsd %xmm0, -0x38(%rbp)
movq (%r14,%r15,8), %rax
movq %rax, 0x30(%r12)
movq (%rbx,%r15,8), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x37c8a
movq %r12, %rdi
callq 0x37daa
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
incq %r15
movslq -0x2c(%rbp), %rax
cmpq %rax, %r15
jl 0x38584
jmp 0x385d7
movsd 0x32ac7(%rip), %xmm0    # 0x6b098
jmp 0x38622
movq -0x48(%rbp), %rbx
movsd %xmm0, -0x38(%rbp)
cmpl $0x0, -0x2c(%rbp)
jle 0x3860d
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rdi
testq %rdi, %rdi
je 0x385f3
callq 0x9630
movq (%r14,%r15,8), %rdi
testq %rdi, %rdi
je 0x38601
callq 0x9630
incq %r15
movslq -0x2c(%rbp), %rax
cmpq %rax, %r15
jl 0x385e5
movq %rbx, %rdi
callq 0x9630
movq %r14, %rdi
callq 0x9630
movsd -0x38(%rbp), %xmm0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x9f31
nop