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

  valid_fd = fopen(validpath, "wb");
  if (valid_fd == NULL)
    goto CantOpenValid;
  
  ecc_fd = fopen(eccpath, "wb");
  if (ecc_fd == NULL)
    goto CantOpenECC;
  
  eccvalid_fd = fopen(eccvalidpath, "wb");
  if (eccvalid_fd == NULL)
    goto CantOpenECCValid;
  
  //
  // Create character arrays from all boolean items.
  //
  for (size_t i = 0; i < kSize; i++)
    valid[i] = mDataIsValid[i] ? 0xff : 0;
  
  for (size_t i = 0; i < DDSGroup1::kSize; i++)
    eccvalid[i] = mECCDataIsValid[i] ? 0xff : 0;
  
  //
  // Write all data items, .
  //
  if (fwrite(mData, sizeof(mData), 1, data_fd) != 1)
    goto CantWriteData;
  if (fwrite(valid, sizeof(valid), 1, valid_fd) != 1)
    goto CantWriteValid;
  if (fwrite(mECCData, sizeof(mECCData), 1, ecc_fd) != 1)
    goto CantWriteECC;
  if (fwrite(eccvalid, sizeof(eccvalid), 1, eccvalid_fd) != 1)
    goto CantWriteECCValid;
  
  res = true;

CantWriteECCValid:
CantWriteECC:
CantWriteValid:
CantWriteData:
  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 $0x20590, %rsp          # imm = 0x20590
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, -0x20590(%rbp)
movb $0x0, -0x20571(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x4019(%rip), %rsi      # 0xf135
callq 0x2130
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb131
jmp 0xb311
movq -0x18(%rbp), %rdi
leaq 0x3ff9(%rip), %rsi      # 0xf135
callq 0x2130
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xb151
jmp 0xb308
movq -0x20(%rbp), %rdi
leaq 0x3fd9(%rip), %rsi      # 0xf135
callq 0x2130
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xb171
jmp 0xb2ff
movq -0x28(%rbp), %rdi
leaq 0x3fb9(%rip), %rsi      # 0xf135
callq 0x2130
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0xb191
jmp 0xb2f6
movq $0x0, -0x20580(%rbp)
cmpq $0x1eea8, -0x20580(%rbp) # imm = 0x1EEA8
jae 0xb1ef
movq -0x20590(%rbp), %rax
movq -0x20580(%rbp), %rcx
movb 0x1eeac(%rax,%rcx), %dl
xorl %eax, %eax
movl $0xff, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movb %al, %cl
movq -0x20580(%rbp), %rax
movb %cl, -0x1eef0(%rbp,%rax)
movq -0x20580(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20580(%rbp)
jmp 0xb19c
movq $0x0, -0x20588(%rbp)
cmpq $0x167c, -0x20588(%rbp) # imm = 0x167C
jae 0xb24d
movq -0x20590(%rbp), %rax
movq -0x20588(%rbp), %rcx
movb 0x3f3d0(%rax,%rcx), %dl
xorl %eax, %eax
movl $0xff, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movb %al, %cl
movq -0x20588(%rbp), %rax
movb %cl, -0x20570(%rbp,%rax)
movq -0x20588(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20588(%rbp)
jmp 0xb1fa
movq -0x20590(%rbp), %rdi
addq $0x4, %rdi
movq -0x30(%rbp), %rcx
movl $0x1eea8, %esi          # imm = 0x1EEA8
movl $0x1, %edx
callq 0x21f0
cmpq $0x1, %rax
je 0xb273
jmp 0xb2ed
leaq -0x1eef0(%rbp), %rdi
movq -0x38(%rbp), %rcx
movl $0x1eea8, %esi          # imm = 0x1EEA8
movl $0x1, %edx
callq 0x21f0
cmpq $0x1, %rax
je 0xb295
jmp 0xb2eb
movq -0x20590(%rbp), %rdi
addq $0x3dd54, %rdi          # imm = 0x3DD54
movq -0x40(%rbp), %rcx
movl $0x167c, %esi           # imm = 0x167C
movl $0x1, %edx
callq 0x21f0
cmpq $0x1, %rax
je 0xb2be
jmp 0xb2e9
leaq -0x20570(%rbp), %rdi
movq -0x48(%rbp), %rcx
movl $0x167c, %esi           # imm = 0x167C
movl $0x1, %edx
callq 0x21f0
cmpq $0x1, %rax
je 0xb2e0
jmp 0xb2e7
movb $0x1, -0x20571(%rbp)
jmp 0xb2e9
jmp 0xb2eb
jmp 0xb2ed
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 -0x20571(%rbp), %al
andb $0x1, %al
addq $0x20590, %rsp          # imm = 0x20590
popq %rbp
retq
nopw %cs:(%rax,%rax)