// File: ke6jjj[P]r-dat/BasicGroup.cc
// Function: BasicGroup::LoadFromFile(char const*, char const*, char const*, char const*)
bool
BasicGroup::LoadFromFile(const char *datapath, const char *validpath,
  const char *eccpath, const char *eccvalidpath)
{
  FILE *data_fd, *valid_fd, *ecc_fd, *eccvalid_fd;
  DataArray data, valid;
  DDSGroup1::DataArray ecc, eccvalid;
  bool res = false;
  
  data_fd = fopen(datapath, "rb");
  if (data_fd == NULL)
    goto CantOpenData;

  valid_fd = fopen(validpath, "rb");
  if (valid_fd == NULL)
    goto CantOpenValid;
  
  ecc_fd = fopen(eccpath, "rb");
  if (ecc_fd == NULL)
    goto CantOpenECC;
  
  eccvalid_fd = fopen(eccvalidpath, "rb");
  if (eccvalid_fd == NULL)
    goto CantOpenECCValid;
    
  //
  // Read in all the data items to temporary places.
  //
  if (fread(data, sizeof(data), 1, data_fd) != 1)
    goto ShortDataRead;

  if (fread(valid, sizeof(valid), 1, valid_fd) != 1)
    goto ShortValidRead;

  if (fread(ecc, sizeof(ecc), 1, ecc_fd) != 1)
    goto ShortECCRead;

  if (fread(eccvalid, sizeof(eccvalid), 1, eccvalid_fd) != 1)
    goto ShortECCValidRead;
  
  //
  // Copy the temporary data into our member variables, translating
  // booleans where needed.
  //
  for (size_t i = 0; i < kSize; i++) {
    mData[i] = data[i];
    mDataIsValid[i] = valid[i] != 0;
  }
  for (size_t i = 0; i < DDSGroup1::kSize; i++) {
    mECCData[i] = ecc[i];
    mECCDataIsValid[i] = eccvalid[i] != 0;
  }
  
  res = true;

ShortECCValidRead:
ShortECCRead:
ShortValidRead:
ShortDataRead:
  fclose(eccvalid_fd);
CantOpenECCValid:
  fclose(ecc_fd);
CantOpenECC:
  fclose(valid_fd);
CantOpenValid:
  fclose(data_fd);
CantOpenData:
  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40ac0, %rsp          # imm = 0x40AC0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40ac0(%rbp)
movb $0x0, -0x40aa1(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x4c44(%rip), %rsi      # 0xfaf0
callq 0x2130
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xaec1
jmp 0xb0cd
movq -0x18(%rbp), %rdi
leaq 0x4c24(%rip), %rsi      # 0xfaf0
callq 0x2130
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xaee1
jmp 0xb0c4
movq -0x20(%rbp), %rdi
leaq 0x4c04(%rip), %rsi      # 0xfaf0
callq 0x2130
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xaf01
jmp 0xb0bb
movq -0x28(%rbp), %rdi
leaq 0x4be4(%rip), %rsi      # 0xfaf0
callq 0x2130
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xaf21
jmp 0xb0b2
leaq -0x1eef0(%rbp), %rdi
movq -0x30(%rbp), %rcx
movl $0x1eea8, %esi          # imm = 0x1EEA8
movl $0x1, %edx
callq 0x21b0
cmpq $0x1, %rax
je 0xaf46
jmp 0xb0a9
leaq -0x3dda0(%rbp), %rdi
movq -0x38(%rbp), %rcx
movl $0x1eea8, %esi          # imm = 0x1EEA8
movl $0x1, %edx
callq 0x21b0
cmpq $0x1, %rax
je 0xaf6b
jmp 0xb0a7
leaq -0x3f420(%rbp), %rdi
movq -0x40(%rbp), %rcx
movl $0x167c, %esi           # imm = 0x167C
movl $0x1, %edx
callq 0x21b0
cmpq $0x1, %rax
je 0xaf90
jmp 0xb0a5
leaq -0x40aa0(%rbp), %rdi
movq -0x48(%rbp), %rcx
movl $0x167c, %esi           # imm = 0x167C
movl $0x1, %edx
callq 0x21b0
cmpq $0x1, %rax
je 0xafb5
jmp 0xb0a3
movq $0x0, -0x40ab0(%rbp)
cmpq $0x1eea8, -0x40ab0(%rbp) # imm = 0x1EEA8
jae 0xb027
movq -0x40ac0(%rbp), %rax
movq -0x40ab0(%rbp), %rcx
movb -0x1eef0(%rbp,%rcx), %dl
movq -0x40ab0(%rbp), %rcx
movb %dl, 0x4(%rax,%rcx)
movq -0x40ab0(%rbp), %rcx
movzbl -0x3dda0(%rbp,%rcx), %ecx
cmpl $0x0, %ecx
setne %dl
movq -0x40ab0(%rbp), %rcx
andb $0x1, %dl
movb %dl, 0x1eeac(%rax,%rcx)
movq -0x40ab0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40ab0(%rbp)
jmp 0xafc0
movq $0x0, -0x40ab8(%rbp)
cmpq $0x167c, -0x40ab8(%rbp) # imm = 0x167C
jae 0xb09c
movq -0x40ac0(%rbp), %rax
movq -0x40ab8(%rbp), %rcx
movb -0x3f420(%rbp,%rcx), %dl
movq -0x40ab8(%rbp), %rcx
movb %dl, 0x3dd54(%rax,%rcx)
movq -0x40ab8(%rbp), %rcx
movzbl -0x40aa0(%rbp,%rcx), %ecx
cmpl $0x0, %ecx
setne %dl
movq -0x40ab8(%rbp), %rcx
andb $0x1, %dl
movb %dl, 0x3f3d0(%rax,%rcx)
movq -0x40ab8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40ab8(%rbp)
jmp 0xb032
movb $0x1, -0x40aa1(%rbp)
jmp 0xb0a5
jmp 0xb0a7
jmp 0xb0a9
movq -0x48(%rbp), %rdi
callq 0x20e0
movq -0x40(%rbp), %rdi
callq 0x20e0
movq -0x38(%rbp), %rdi
callq 0x20e0
movq -0x30(%rbp), %rdi
callq 0x20e0
movb -0x40aa1(%rbp), %al
andb $0x1, %al
addq $0x40ac0, %rsp          # imm = 0x40AC0
popq %rbp
retq
nop