// File: /workspace/github_cpp_makefile_star2_O2/ke6jjj[P]r-dat/DDSFrameReceiver.cc
// Function: DDSFrameReceiver::ReceiveFrame(Track const&, Track const&)
void
DDSFrameReceiver::ReceiveFrame(const Track& a, const Track& b)
{
  //
  // Construct a new DDS Group 3 object to receive the track pair
  //
  DDSGroup3 frame;
  
  //
  // Combine the tracks into a frame and do all the necessary
  // de-interleaving.
  //
  DDSGroup3::DecodeError result = frame.DecodeFrame(a, b);
  
  //
  // Dump information about the frame.
  //
  const char *area_name;
  switch (frame.Area()) {
  case DDSGroup3::DEVICE_AREA:
    area_name = "DEVICE";
    break;
  case DDSGroup3::REFERENCE_AREA:
    area_name = "REFERENCE";
    break;
  case DDSGroup3::SYSTEM_AREA:
    area_name = "SYSTEM";
    break;
  case DDSGroup3::DATA_AREA:
    area_name = "DATA";
    break;
  case DDSGroup3::EOD_AREA:
    area_name = "END-OF-DATA";
    break;
  default:
    area_name = "?";
    break;
  }
  
  printf("\n");

  if (result != DDSGroup3::DECODE_OK) {
    printf("Group 3 decode: %s\n",
      DDSGroup3::ErrorDescription(result)
    );
  }
  
  printf("Area          : %s\n", area_name);
  printf("Absolute frame: %06d\n", frame.AbsoluteFrameID());
  printf("Basic Group   : %05d\n", frame.BasicGroupID());
  printf("Sub frame     : %02d", frame.LogicalFrameID());
  if (frame.IsLastLogicalFrame())
    printf(" (Last of group)");
  if (frame.IsECC3Frame())
    printf(" (ECC3)");
  printf("\n");
  printf("File          : %04d\n", frame.Separator1Count());
  printf("Record        : 0x%08x\n", frame.RecordCount());

  //
  // Print out error statistics for the frame.
  //
  const DATFrame& underFrame = frame.Frame();

  unsigned int c1_errors = underFrame.C1Errors();
  unsigned int c1_uncorrectable = underFrame.C1UncorrectableErrors();
  unsigned int c1_corrected = c1_errors - c1_uncorrectable;
  unsigned int c2_uncorrectable = underFrame.C2UncorrectableErrors();
  unsigned int c2_corrected = c1_uncorrectable - c2_uncorrectable;

  printf("Errors  C1/C2 : %d/%d",
    c1_corrected,
    c2_corrected
  );

  if (c2_uncorrectable > 0)
    printf(" %d UNCORRECTED\n", c2_uncorrectable);
  else
    printf(" (all corrected)\n");

  switch (mState) {
  case DATA:
    //
    // In data state until we see an END-OF-DATA marker.
    //
    if (frame.Area() == DDSGroup3::EOD_AREA)
      mState = EOT;
    break;
  case EOT:
    //
    // We're in EOT state until we see another area.
    //
    if (frame.Area() != DDSGroup3::EOD_AREA) {
      //
      // We're in a new tape session.
      //
      mCurrentSession++;
      mState = DATA;
      printf("------------------------ START OF SESSION %d\n", mCurrentSession);
    }
  }
  
  //
  // If we hit an End-of-File mark we need to stop; any data after this mark
  // may have duplicate group identifiers and will corrupt any existing
  // groups before it.
  //
  if (mOutputDirectory != NULL && mCurrentSession == mDumpSession) {
    if (frame.Area() == DDSGroup3::EOD_AREA) {
      if (mHaveGroup) {
        DumpGroup();
      }
    } else if (frame.Area() == DDSGroup3::DATA_AREA) {
      AddFrame(frame);
    }
  }

  fflush(stdout);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x2dc0, %rsp           # imm = 0x2DC0
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x4e58
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x4e9e
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x4e7a
cmpl $0x6, %eax
jae 0x48fa
movl %eax, %eax
leaq 0x49eb(%rip), %rcx      # 0x92dc
movslq (%rcx,%rax,4), %r14
addq %rcx, %r14
jmp 0x4901
leaq 0x4826(%rip), %r14      # 0x9127
pushq $0xa
popq %rdi
callq 0x2180
testl %ebp, %ebp
je 0x4925
movl %ebp, %edi
callq 0x50d6
leaq 0x480e(%rip), %rdi      # 0x9129
movq %rax, %rsi
xorl %eax, %eax
callq 0x2040
leaq 0x4811(%rip), %rdi      # 0x913d
movq %r14, %rsi
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x4e82
leaq 0x480a(%rip), %rdi      # 0x9151
movl %eax, %esi
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x4e86
leaq 0x4806(%rip), %rdi      # 0x9167
movl %eax, %esi
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x4e8a
movzbl %al, %esi
leaq 0x47ff(%rip), %rdi      # 0x917d
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x4e8e
testb %al, %al
je 0x49a1
leaq 0x47f8(%rip), %rdi      # 0x9192
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x4e92
testb %al, %al
je 0x49bd
leaq 0x47ed(%rip), %rdi      # 0x91a3
xorl %eax, %eax
callq 0x2040
pushq $0xa
popq %rdi
callq 0x2180
leaq 0x8(%rsp), %rdi
callq 0x4e96
leaq 0x47d5(%rip), %rdi      # 0x91ab
movl %eax, %esi
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x4e9a
leaq 0x47d1(%rip), %rdi      # 0x91c1
movl %eax, %esi
xorl %eax, %eax
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x4e74
movq %rax, %r15
movq %rax, %rdi
callq 0x599a
movq %rax, %r14
movq %r15, %rdi
callq 0x59a2
movq %rax, %r12
movq %r15, %rdi
callq 0x59aa
movq %rax, %r15
subl %r12d, %r14d
subl %r15d, %r12d
leaq 0x47a5(%rip), %rdi      # 0x91d9
movl %r14d, %esi
movl %r12d, %edx
xorl %eax, %eax
callq 0x2040
testl %r15d, %r15d
je 0x4a59
leaq 0x443a(%rip), %rdi      # 0x8e87
movl %r15d, %esi
xorl %eax, %eax
callq 0x2040
jmp 0x4a65
leaq 0x4526(%rip), %rdi      # 0x8f86
callq 0x21c0
movl 0x18(%rbx), %eax
cmpl $0x1, %eax
je 0x4a89
testl %eax, %eax
jne 0x4ab2
leaq 0x8(%rsp), %rdi
callq 0x4e7a
cmpl $0x5, %eax
jne 0x4ab2
movl $0x1, 0x18(%rbx)
jmp 0x4ab2
leaq 0x8(%rsp), %rdi
callq 0x4e7a
cmpl $0x5, %eax
je 0x4ab2
movl 0x2c(%rbx), %esi
incl %esi
movl %esi, 0x2c(%rbx)
andl $0x0, 0x18(%rbx)
leaq 0x4744(%rip), %rdi      # 0x91ef
xorl %eax, %eax
callq 0x2040
cmpq $0x0, 0x20(%rbx)
je 0x4afc
movl 0x2c(%rbx), %eax
cmpl 0x28(%rbx), %eax
jne 0x4afc
leaq 0x8(%rsp), %rdi
callq 0x4e7a
cmpl $0x5, %eax
jne 0x4ae0
cmpb $0x1, 0x10(%rbx)
jne 0x4afc
movq %rbx, %rdi
callq 0x4b46
jmp 0x4afc
leaq 0x8(%rsp), %rdi
callq 0x4e7a
cmpl $0x4, %eax
jne 0x4afc
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x4c4a
movq 0xa4bd(%rip), %rax      # 0xefc0
movq (%rax), %rdi
callq 0x2120
leaq 0x8(%rsp), %rdi
callq 0x4e6a
addq $0x2dc0, %rsp           # imm = 0x2DC0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4b31
jmp 0x4b31
jmp 0x4b31
jmp 0x4b31
jmp 0x4b31
jmp 0x4b31
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4e6a
movq %rbx, %rdi
callq 0x21e0