// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Net.cpp
// Function: Net::BackProp()
inline void Net::BackProp() {
  for (int i = 0; i < mUnits[mLayers - 1]; ++i) {
    mDelta[mLayers - 1][i] = (mDesire[i] - mOutput[mLayers - 1][i]) *
                             mOutput[mLayers - 1][i] *
                             (1.0 - mOutput[mLayers - 1][i]);
  }

  for (int i = mLayers - 2; i >= 1; --i) {
    for (int j = 0; j < mUnits[i]; ++j) {
      mDelta[i][j] = 0.0;
      for (int k = 0; k < mUnits[i + 1]; ++k) {
        mDelta[i][j] += mDelta[i + 1][k] * mWeight[i + 1][k][j];
      }
      mDelta[i][j] *= mOutput[i][j] * (1.0 - mOutput[i][j]);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x20(%rbp), %rdx
movl -0xc(%rbp), %eax
movq 0x8(%rdx), %rcx
movl (%rdx), %edx
subl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x617b2
movq -0x20(%rbp), %rcx
movq 0x30(%rcx), %rax
movslq -0xc(%rbp), %rdx
movsd (%rax,%rdx,8), %xmm0
movq 0x28(%rcx), %rax
movl (%rcx), %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movslq -0xc(%rbp), %rdx
subsd (%rax,%rdx,8), %xmm0
movq 0x28(%rcx), %rax
movl (%rcx), %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movslq -0xc(%rbp), %rdx
mulsd (%rax,%rdx,8), %xmm0
movq 0x28(%rcx), %rax
movl (%rcx), %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movslq -0xc(%rbp), %rdx
movsd 0x5f88e(%rip), %xmm1    # 0xc1010
subsd (%rax,%rdx,8), %xmm1
mulsd %xmm1, %xmm0
movq 0x20(%rcx), %rax
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movslq -0xc(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x61707
movq -0x20(%rbp), %rax
movl (%rax), %eax
subl $0x2, %eax
movl %eax, -0x10(%rbp)
cmpl $0x1, -0x10(%rbp)
jl 0x61905
movl $0x0, -0x14(%rbp)
movq -0x20(%rbp), %rcx
movl -0x14(%rbp), %eax
movq 0x8(%rcx), %rcx
movslq -0x10(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x618f5
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x18(%rbp)
movq -0x20(%rbp), %rcx
movl -0x18(%rbp), %eax
movq 0x8(%rcx), %rcx
movl -0x10(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x61893
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
movl -0x10(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x18(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x10(%rax), %rcx
movl -0x10(%rbp), %edx
addl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x18(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x14(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm2
movq 0x20(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x6180a
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rcx
movslq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x14(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x28(%rax), %rcx
movslq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x14(%rbp), %rdx
movsd 0x5f74c(%rip), %xmm1    # 0xc1010
subsd (%rcx,%rdx,8), %xmm1
mulsd %xmm1, %xmm0
movq 0x20(%rax), %rax
movslq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x14(%rbp), %rcx
mulsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x617cf
jmp 0x618f7
movl -0x10(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x617be
popq %rbp
retq
nopw (%rax,%rax)