// File: wrighteagle2d[P]wrighteaglebase/Debug/../src/Net.cpp
// Function: Net::Construct(char const*)
void Net::Construct(const char *fname) {
  FILE *fp;
  if ((fp = fopen(fname, "r")) == 0) {
    perror("BPN::Construct(char *fname)");
    exit(1);
  }
#ifdef BINARY
  if (fread(&mLayers, sizeof(mLayers), 1, fp) < 1) {
    Assert(0);
  }
  mUnits = new int[mLayers];
  if (fread(mUnits, sizeof(*mUnits), mLayers, fp) < 1) {
    Assert(0);
  }
  if (fread(&mEta, sizeof(mEta), 1, fp) < 1) {
    Assert(0);
  }
  if (fread(&mAlpha, sizeof(mAlpha), 1, fp) < 1) {
    Assert(0);
  }
  Memaloc();
  InitWeight();

  for (int i = 1; i < mLayers; ++i) {
    for (int j = 0; j < mUnits[i]; ++j) {
      if (fread(mWeight[i][j], sizeof(*mWeight[i][j]), mUnits[i - 1] + 1, fp) <
          1) {
        Assert(0);
      }
    }
  }
#else
  fscanf(fp, "#mLayers\n%d\n#mUnits\n", &mLayers);
  mUnits = new int[mLayers];
  for (int i = 0; i < mLayers; ++i) {
    fscanf(fp, "%d ", &mUnits[i]);
  }
  fscanf(fp, "\n#mEta\n%lf\n#mAlpha\n%lf\n#mWeight\n", &mEta, &mAlpha);
  int tmp;
  Memaloc();
  InitWeight();

  for (int i = 1; i < mLayers; ++i) {
    fscanf(fp, "#Layer %d\n", &tmp);
    for (int j = 0; j < mUnits[i]; ++j) {
      for (int k = 0; k < mUnits[i - 1] + 1; ++k) {
        fscanf(fp, "%lf ", &mWeight[i][j][k]);
      }
      fscanf(fp, "\n");
    }
    fscanf(fp, "\n");
  }
#endif
  fclose(fp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x6543d(%rip), %rsi     # 0xc5620
callq 0xa710
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x60208
leaq 0x628ae(%rip), %rdi     # 0xc2aa7
callq 0xa4c0
movl $0x1, %edi
callq 0xa740
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0xa8e0
cmpq $0x1, %rax
jae 0x60227
jmp 0x60227
movq -0x28(%rbp), %rax
movslq (%rax), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xa050
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rdi
movslq (%rax), %rdx
movq -0x18(%rbp), %rcx
movl $0x4, %esi
callq 0xa8e0
cmpq $0x1, %rax
jae 0x60277
jmp 0x60277
movq -0x28(%rbp), %rdi
addq $0x38, %rdi
movq -0x18(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0xa8e0
cmpq $0x1, %rax
jae 0x6029a
jmp 0x6029a
movq -0x28(%rbp), %rdi
addq $0x40, %rdi
movq -0x18(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0xa8e0
cmpq $0x1, %rax
jae 0x602bd
jmp 0x602bd
movq -0x28(%rbp), %rdi
callq 0x605d0
movq -0x28(%rbp), %rdi
callq 0x60930
movl $0x1, -0x1c(%rbp)
movq -0x28(%rbp), %rcx
movl -0x1c(%rbp), %eax
cmpl (%rcx), %eax
jge 0x6035d
movl $0x0, -0x20(%rbp)
movq -0x28(%rbp), %rcx
movl -0x20(%rbp), %eax
movq 0x8(%rcx), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x6034d
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rcx
movslq -0x1c(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movslq -0x20(%rbp), %rdx
movq (%rcx,%rdx,8), %rdi
movq 0x8(%rax), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
addl $0x1, %eax
movslq %eax, %rdx
movq -0x18(%rbp), %rcx
movl $0x8, %esi
callq 0xa8e0
cmpq $0x1, %rax
jae 0x60340
jmp 0x60340
jmp 0x60342
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x602e8
jmp 0x6034f
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x602d6
movq -0x18(%rbp), %rdi
callq 0xa5b0
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)