// File: /workspace/github_cpp_makefile_star2_O2/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 0x2efaa
movq %rdi, -0x58(%rbp)
leaq 0x2c78b(%rip), %rax     # 0x5b540
movq %rsi, %rdi
movq %rax, %rsi
callq 0x95a0
testq %rax, %rax
je 0x2efc1
movq %rax, %r12
leaq 0x29d76(%rip), %rsi     # 0x58b49
xorl %r14d, %r14d
leaq -0x2c(%rbp), %rbx
leaq -0x50(%rbp), %rcx
leaq -0x4c(%rbp), %r8
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9930
movslq (%rbx), %r13
leaq (,%r13,8), %r15
testq %r13, %r13
pushq $-0x1
popq %rbx
cmovsq %rbx, %r15
movq %r15, %rdi
callq 0x9050
movq %rax, -0x48(%rbp)
movq %r15, %rdi
movq %r13, %r15
callq 0x9050
movq %rax, -0x40(%rbp)
leaq -0x50(%rbp), %rax
movslq (%rax), %rax
leaq (,%rax,8), %rcx
testq %rax, %rax
cmovsq %rbx, %rcx
movq %rcx, -0x38(%rbp)
leaq -0x4c(%rbp), %rax
movslq (%rax), %rax
leaq (,%rax,8), %r13
testq %rax, %rax
cmovsq %rbx, %r13
testl %r15d, %r15d
movl $0x0, %ebx
cmovgl %r15d, %ebx
cmpq %r14, %rbx
je 0x2ee86
movq -0x38(%rbp), %rdi
callq 0x9050
movq -0x48(%rbp), %rcx
movq %rax, (%rcx,%r14,8)
movq %r13, %rdi
callq 0x9050
movq -0x40(%rbp), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
jmp 0x2ee5b
leaq 0x2c1b0(%rip), %r13     # 0x5b03d
xorl %r14d, %r14d
movslq %r15d, %rax
cmpq %rax, %r14
jge 0x2eeff
xorl %ebx, %ebx
xorl %r15d, %r15d
movslq -0x50(%rbp), %rax
cmpq %rax, %r15
jge 0x2eec7
movq -0x48(%rbp), %rax
movq (%rax,%r14,8), %rdx
addq %rbx, %rdx
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x9930
incq %r15
addq $0x8, %rbx
jmp 0x2ee9d
xorl %ebx, %ebx
xorl %r15d, %r15d
movslq -0x4c(%rbp), %rax
cmpq %rax, %r15
jge 0x2eef6
movq -0x40(%rbp), %rax
movq (%rax,%r14,8), %rdx
addq %rbx, %rdx
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x9930
incq %r15
addq $0x8, %rbx
jmp 0x2eecc
incq %r14
movl -0x2c(%rbp), %r15d
jmp 0x2ee90
xorpd %xmm0, %xmm0
xorl %r14d, %r14d
movq -0x58(%rbp), %rbx
movsd %xmm0, -0x38(%rbp)
movslq %r15d, %rax
cmpq %rax, %r14
jge 0x2ef59
movq -0x40(%rbp), %rax
movq (%rax,%r14,8), %rax
movq %rax, 0x30(%rbx)
movq -0x48(%rbp), %rax
movq (%rax,%r14,8), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2ea0e
movq %rbx, %rdi
callq 0x2ea68
movsd -0x38(%rbp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
incq %r14
movl -0x2c(%rbp), %r15d
jmp 0x2ef0a
xorl %r14d, %r14d
movslq %r15d, %rax
cmpq %rax, %r14
jge 0x2ef91
movq -0x48(%rbp), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x2ef76
callq 0x9630
movq -0x40(%rbp), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x2ef88
callq 0x9630
incq %r14
movl -0x2c(%rbp), %r15d
jmp 0x2ef5c
movq -0x48(%rbp), %rdi
callq 0x9630
movq -0x40(%rbp), %rdi
callq 0x9630
movsd -0x38(%rbp), %xmm0
jmp 0x2efb2
movsd 0x280be(%rip), %xmm0    # 0x57070
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29b63(%rip), %rdi     # 0x58b2b
callq 0x9410
pushq $0x1
popq %rdi
callq 0x95d0
nop