LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/RDATDecoder.cc
// Function: RDATDecoder::RDATDecoder(float)
RDATDecoder::RDATDecoder(float sampleRate)
: mSyncWindowCurPos(0), mSyncWindowSyncPos(0),
  mClockDetected(false), mClockRatioThreshold(0.97),
  mClockAlpha(1.0 / 30.0),
  //
  // A track is 196 blocks in duration. Convert that to samples and
  // add padding.
  //
  mTrackDuration((sampleRate / kSymbolRate) * 10 * 36 * 196 * 1.05),
  mTrackInProgress(false)
{
  int i;
  
  //
  // Create a filter bank/window for the clock detector.
  //
  mSyncWindowSize = sampleRate / kSymbolRate;
  mSyncWindow = new float[mSyncWindowSize];
  mSyncWindowEvalPos = mSyncWindowSize / 2;
  mSyncWindowNextEvalPos = mSyncWindowEvalPos;
  
  for (i = 0; i < mSyncWindowSize; i++)
    mSyncWindow[i] = 0.0;

  //
  // Keep a history of the sign of the last sample.
  //
  mLastSign = 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xd16a(%rip), %rax      # 0xf9e0
movq %rax, (%rdi)
movq $0x0, 0x1c(%rdi)
xorl %eax, %eax
movb %al, 0x2c(%rdi)
movabsq $0x3d0888893f7851ec, %rcx # imm = 0x3D0888893F7851EC
movq %rcx, 0x30(%rdi)
divss 0x6a0c(%rip), %xmm0     # 0x92a8
movss 0x6a08(%rip), %xmm1     # 0x92ac
mulss %xmm0, %xmm1
mulss 0x6a00(%rip), %xmm1     # 0x92b0
mulss 0x69fc(%rip), %xmm1     # 0x92b4
movb %al, 0x40(%rdi)
cvtss2sd %xmm1, %xmm1
mulsd 0x6a01(%rip), %xmm1     # 0x92c8
cvttsd2si %xmm1, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0x69f5(%rip), %xmm1     # 0x92d0
cvttsd2si %xmm1, %rdx
andq %rcx, %rdx
orq %rax, %rdx
cvttss2si %xmm0, %ebp
movq %rdx, 0x48(%rdi)
movl %ebp, 0x18(%rdi)
movslq %ebp, %r14
leaq (,%r14,4), %rax
testl %r14d, %r14d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movl %r14d, %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
sarl %ecx
movq %rax, 0x10(%rbx)
movl %ecx, 0x24(%rbx)
movl %ecx, 0x28(%rbx)
testl %r14d, %r14d
jle 0x2938
movl %ebp, %edx
shlq $0x2, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x20a0
movb $0x0, 0x38(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/RDATDecoder.cc
// Function: RDATDecoder::EvaluateClock()
void
RDATDecoder::EvaluateClock()
{
  int i, maxI, minI;
  float max = 0.0, min = 100.0, ratio;

  for (i = maxI = 0; i < mSyncWindowSize; i++) {
    //
    // Find the highest peak.
    //
    if (mSyncWindow[i] > max) {
      max = mSyncWindow[i];
      maxI = i;
    }
    //
    // And the lowest valley.
    //
    if (mSyncWindow[i] < min)
      min = mSyncWindow[i];
  }
  
  if (maxI != mSyncWindowSyncPos) {
    //
    // We've found a new sync position.
    // In the future we might calculate clock error here.
    //
    mSyncWindowSyncPos = maxI;
    mSyncWindowNextEvalPos = (maxI + mSyncWindowSize / 2) %
                              mSyncWindowSize;
  }
  
  //
  // If there is a significant difference between the highest
  // peak and the lowest valley then we have a good clock signal.
  //
  if (max > 0.0)
    ratio = min / max;
  else
    ratio = 0.0;

  if (ratio < mClockRatioThreshold) {
    if (!mClockDetected && mDecoder != NULL)
      mDecoder->ClockDetected(true);
    mClockDetected = true;
  } else {
    if (mClockDetected && mDecoder != NULL)
      mDecoder->ClockDetected(false);
    mClockDetected = false;
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x18(%rdi), %rcx
testq %rcx, %rcx
jle 0x2b62
movq 0x10(%rbx), %rax
xorl %esi, %esi
xorps %xmm3, %xmm3
movss 0x6786(%rip), %xmm2     # 0x92c0
xorl %edx, %edx
movss (%rax,%rsi,4), %xmm0
ucomiss %xmm3, %xmm0
cmoval %esi, %edx
movaps %xmm0, %xmm1
maxss %xmm3, %xmm1
minss %xmm2, %xmm0
incq %rsi
movaps %xmm0, %xmm2
movaps %xmm1, %xmm3
cmpq %rsi, %rcx
jne 0x2b3c
jmp 0x2b6f
xorl %edx, %edx
movss 0x6754(%rip), %xmm0     # 0x92c0
xorps %xmm1, %xmm1
cmpl 0x20(%rbx), %edx
je 0x2b88
movl %edx, 0x20(%rbx)
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
addl %edx, %eax
cltd
idivl %ecx
movl %edx, 0x28(%rbx)
divss %xmm1, %xmm0
xorps %xmm2, %xmm2
cmpltss %xmm1, %xmm2
andps %xmm0, %xmm2
movss 0x30(%rbx), %xmm0
ucomiss %xmm2, %xmm0
movb 0x2c(%rbx), %al
jbe 0x2bbe
movb $0x1, %bpl
testb %al, %al
jne 0x2bd9
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x2bd9
movq (%rdi), %rax
movl $0x1, %esi
jmp 0x2bd2
testb %al, %al
je 0x2bd7
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x2bd7
movq (%rdi), %rax
xorl %ebp, %ebp
xorl %esi, %esi
callq *0x8(%rax)
jmp 0x2bd9
xorl %ebp, %ebp
movb %bpl, 0x2c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DATWordReceiver.cc
// Function: DATWordReceiver::DumpWord(unsigned short, unsigned short)
void
DATWordReceiver::DumpWord(uint16_t raw, uint16_t decode)
{
  if (decode & WORD_SYNC) {
    printf("\nSYNC");
  } else if (decode & WORD_ATF2) {
    printf(" AT2");
  } else if (decode & WORD_ATF3) {
    printf(" AT3");
  } else if (decode & WORD_INVALID) {
    printf(" XXX");
  } else {
    printf(" %02x", decode);
  }
}

// Assembly:
btl $0x8, %edx
jb 0x2d93
btl $0x9, %edx
jb 0x2d9c
btl $0xa, %edx
jb 0x2da5
testw %dx, %dx
js 0x2dae
leaq 0x6dbb(%rip), %rdi      # 0x9b45
movl %edx, %esi
xorl %eax, %eax
jmp 0x2040
leaq 0x6d96(%rip), %rdi      # 0x9b30
jmp 0x2db5
leaq 0x6d93(%rip), %rdi      # 0x9b36
jmp 0x2db5
leaq 0x6d8f(%rip), %rdi      # 0x9b3b
jmp 0x2db5
leaq 0x6d8b(%rip), %rdi      # 0x9b40
xorl %eax, %eax
jmp 0x2040
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DATWordReceiver.cc
// Function: DATWordReceiver::ReceiveWord(unsigned short, unsigned short)
void
DATWordReceiver::ReceiveWord(uint16_t raw, uint16_t decode)
{
  if (decode & WORD_SYNC)
    mBlock.Reset();
  if (decode & WORD_ATF2)
    mBlockReceiver->ReceiveATFTone(2);
  if (decode & WORD_ATF3)
    mBlockReceiver->ReceiveATFTone(3);

  bool complete = mBlock.AddByte(raw, decode);

  if (complete)
    DumpCurrentBlock();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
btl $0x8, %edx
jae 0x2dda
leaq 0x8(%rbx), %rdi
callq 0x2f5e
btl $0x9, %ebp
jae 0x2df2
movq 0xa0(%rbx), %rdi
movq (%rdi), %rax
movl $0x2, %esi
callq *0x10(%rax)
btl $0xa, %ebp
jae 0x2e0a
movq 0xa0(%rbx), %rdi
movq (%rdi), %rax
movl $0x3, %esi
callq *0x10(%rax)
leaq 0x8(%rbx), %r15
movzwl %r14w, %esi
movzwl %bp, %edx
movq %r15, %rdi
callq 0x2f6a
testb %al, %al
je 0x2e43
movq 0xa0(%rbx), %rdi
movq (%rdi), %rax
movq %r15, %rsi
callq *0x8(%rax)
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2f5e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DATWordReceiver.cc
// Function: DATWordReceiver::TrackDetected(bool)
void
DATWordReceiver::TrackDetected(bool up)
{
  if (mDump)
    return;

  if (up == false) {
    //
    // Track is ending. Dump any pending blocks.
    //
    DumpCurrentBlock();
  }

  //
  // Notify the block receiver of the new track state.
  //
  mBlockReceiver->TrackDetected(up);
}

// Assembly:
cmpb $0x0, (%rdi)
je 0x2e76
retq
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
testb %bl, %bl
jne 0x2ea0
movq 0xa0(%r14), %rdi
leaq 0x8(%r14), %r15
movq (%rdi), %rax
movq %r15, %rsi
callq *0x8(%rax)
movq %r15, %rdi
callq 0x2f5e
movq 0xa0(%r14), %rdi
movq (%rdi), %rax
movq (%rax), %rax
movzbl %bl, %esi
popq %rbx
popq %r14
popq %r15
jmpq *%rax
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DATWordReceiver.cc
// Function: DATWordReceiver::Stop()
void
DATWordReceiver::Stop()
{
  if (mBlock.Size() > 0)
    DumpCurrentBlock();
  if (mBlockReceiver != NULL)
    mBlockReceiver->Stop();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x8(%rdi), %r14
movq %r14, %rdi
callq 0x2f94
testq %rax, %rax
je 0x2ee8
movq 0xa0(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x8(%rax)
movq %r14, %rdi
callq 0x2f5e
movq 0xa0(%rbx), %rdi
testq %rdi, %rdi
je 0x2f01
movq (%rdi), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *0x18(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/RDATEQDecoder.cc
// Function: RDATEQDecoder::RDATEQDecoder(float)
RDATEQDecoder::RDATEQDecoder(float sampleRate)
: mSyncWindowCurPos(0), mSyncWindowSyncPos(0),
  mClockDetected(false), mClockRatioThreshold(0.97),
  mClockAlpha(1.0 / 30.0)
{
  int i;
  
  //
  // Create a filter bank/window for the clock detector.
  //
  mSyncWindowSize = sampleRate / kSymbolRate;
  mSyncWindow = new float[mSyncWindowSize];
  mSyncWindowEvalPos = mSyncWindowSize / 2;
  mSyncWindowNextEvalPos = mSyncWindowEvalPos;
  
  for (i = 0; i < mSyncWindowSize; i++)
    mSyncWindow[i] = 0.0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0xc8fe(%rip), %rax      # 0xfae0
movq %rax, (%rdi)
movq $0x0, 0x1c(%rdi)
movb $0x0, 0x2c(%rdi)
movabsq $0x3d0888893f7851ec, %rax # imm = 0x3D0888893F7851EC
divss 0x60a5(%rip), %xmm0     # 0x92a8
cvttss2si %xmm0, %ebp
movq %rax, 0x30(%rdi)
movl %ebp, 0x18(%rdi)
movslq %ebp, %r14
leaq (,%r14,4), %rax
testl %r14d, %r14d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movl %r14d, %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
sarl %ecx
movq %rax, 0x10(%rbx)
movl %ecx, 0x24(%rbx)
movl %ecx, 0x28(%rbx)
testl %r14d, %r14d
jle 0x3259
movl %ebp, %edx
shlq $0x2, %rdx
movq %rax, %rdi
xorl %esi, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x20a0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/RDATEQDecoder.cc
// Function: RDATEQDecoder::Process(float*, unsigned long)
void
RDATEQDecoder::Process(float *samples, size_t count)
{
  size_t i;
  float signal;
  bool sign, zeroCross;
  
  for (i = 0; i < count; i++) {
    //
    // Look at the sample.
    //
    signal = samples[i];

    //
    // Send the baseband signal to the clock detector.
    // If it returns true, then the clock detector has
    // achieved a good lock and suggests sampling the
    // signal now.
    //
    if (ClockDetect(signal)) {
      //
      // Signal should be sampled now.
      //
      mDecoder->ReceiveSample(signal);
    }
  }
}

// Assembly:
testq %rdx, %rdx
je 0x3306
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %r12d, %r12d
movss (%r14,%r12,4), %xmm0
movq %r15, %rdi
movss %xmm0, 0x4(%rsp)
callq 0x3308
testb %al, %al
je 0x32f3
movq 0x8(%r15), %rdi
movq (%rdi), %rax
movss 0x4(%rsp), %xmm0
callq *0x10(%rax)
incq %r12
cmpq %r12, %rbx
jne 0x32cb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/Track.cc
// Function: Track::AddBlock(DATBlock const&)
void
Track::AddBlock(const DATBlock& block)
{
  if (!BlockHeaderIsValid(block)) {
    //
    // Block doesn't have a valid header, but there might reason to
    // accept it.
    //
    if (mHaveLastBlock && block.Size() == 36) {
      if ((mLastBlockNumber >= 0    && mLastBlockNumber < 0x7f) ||
          (mLastBlockNumber >= 0x88 && mLastBlockNumber < 0x8f) ||
          (mLastBlockNumber >= 0x80 && mLastBlockNumber < 0x88)) {
        //
        // This block doesn't have a valid header but we've received blocks
        // before it that are ok and we're still expecting blocks in this
        // region. It is likely that this block simply has a bad header but
        // its byte payload is just fine. Let's interpret this block as being
        // the next block in the sequence.
        //
        AddGuessedBlock(mLastBlockNumber + 1, block);
        mLastBlockNumber++;
      }
    }
    return;
  }
  
  //
  // Block header checks out. Add the block data to the location
  // that it identifies itself as.
  //
  AddVerifiedBlock(block);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2f94
cmpq $0x4, %rax
jae 0x3517
cmpb $0x1, 0x25af(%rbx)
jne 0x350f
movq %r14, %rdi
callq 0x2f94
cmpq $0x24, %rax
jne 0x350f
movb 0x25b0(%rbx), %al
cmpb $0x7f, %al
setb %cl
leal 0x78(%rax), %edx
cmpb $0x7, %dl
setb %dl
orb %cl, %dl
jne 0x34f1
cmpb $0x7f, %al
sete %cl
cmpb $-0x78, %al
setae %dl
orb %cl, %dl
jne 0x350f
incb %al
movzbl %al, %esi
movb $0x0, 0x251f(%rbx,%rsi)
movq %rbx, %rdi
movq %r14, %rdx
callq 0x3914
incb 0x25b0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x2fa0
movzwl 0x2(%rax), %edx
movzwl 0x4(%rax), %ecx
movl %ecx, %esi
orl %edx, %esi
movzwl 0x6(%rax), %eax
movl %eax, %edi
orw %si, %di
js 0x34b4
xorl %edx, %ecx
xorl %eax, %ecx
movzbl %cl, %eax
testw %ax, %ax
jne 0x34b4
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x356c
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/Track.cc
// Function: Track::DataFill(unsigned char, DATBlock const&)
void
Track::DataFill(uint8_t block_number, const DATBlock& block)
{
  //
  // Copy the bytes into our large block array while also marking
  // those bytes which are valid and invalid.
  //
  size_t count = block.Size();
  if (count < 4)
    return;

  count -= 4;

  if (count > 32)
    count = 32;
  
  const uint16_t *bytes = block.FlaggedBytes();
  for (size_t i = 0; i < count; i++) {
    mData[block_number][i] = bytes[i+4] & 0xff;
    mDataIsValid[block_number][i] = (bytes[i+4] & 0x8000) == 0;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
movq %rdx, %rdi
callq 0x2f94
cmpq $0x4, %rax
jb 0x3989
movq %rax, %r14
movq %r15, %rdi
callq 0x2fa0
addq $-0x4, %r14
je 0x3989
cmpq $0x20, %r14
movl $0x20, %ecx
cmovbq %r14, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
movzbl %bpl, %edx
shll $0x5, %edx
addq %rbx, %rdx
addq $0x128f, %rdx           # imm = 0x128F
xorl %esi, %esi
movb 0x8(%rax,%rsi,2), %dil
movb %dil, -0x1200(%rdx,%rsi)
cmpw $0x0, 0x8(%rax,%rsi,2)
setns (%rdx,%rsi)
incq %rsi
cmpq %rsi, %rcx
jne 0x396a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/AudioFrameReceiver.cc
// Function: AudioFrameReceiver::IsFrame(Track const&, Track const&)
bool
AudioFrameReceiver::IsFrame(const Track& A, const Track& B)
{
  //
  // We have a previous track. Are these two a pair or are they
  // separate?
  //
  const uint8_t *A_abstime;
  const uint8_t *B_abstime;
  bool A_good;
  bool B_good;
      
  //
  // Examine their absolute times. (Subcode 2).
  //
  A_good = A.GetSubcode(2, &A_abstime);
  B_good = B.GetSubcode(2, &B_abstime);

  //
  // These two tracks are look like a pair if they have the same, measurable
  // absolute time.
  //
  bool timeGood = A_good && B_good && (memcmp(A_abstime, B_abstime, 7) == 0);
  
  //
  // Finally, just make sure that neither track is in the wrong spot.
  //
  printf("Pair times good: %d\n", timeGood);
  printf("Pairs          : %d %d\n", A.GetHead(), B.GetHead());

  return timeGood
         && A.GetHead() != Track::HEAD_B
         && B.GetHead() != Track::HEAD_A;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
leaq 0x10(%rsp), %rdx
movq %rsi, %rdi
movl $0x2, %esi
callq 0x35cc
movl %eax, %ebp
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movl $0x2, %esi
callq 0x35cc
testb %bpl, %bpl
je 0x3be7
testb %al, %al
je 0x3be7
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movl (%rax), %r12d
movl 0x3(%rax), %r13d
xorl (%rcx), %r12d
xorl 0x3(%rcx), %r13d
xorl %esi, %esi
movl %r12d, %eax
orl %r13d, %eax
sete %sil
leaq 0x601a(%rip), %rdi      # 0x9bbc
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2040
movq %r14, %rdi
callq 0x3494
movl %eax, %r15d
movq %rbx, %rdi
callq 0x3494
leaq 0x600c(%rip), %rdi      # 0x9bd1
movl %r15d, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2040
orl %r12d, %r13d
jne 0x3c1f
movq %r14, %rdi
callq 0x3494
cmpl $0x1, %eax
jne 0x3c30
xorl %ebp, %ebp
jmp 0x3c1f
leaq 0x5fce(%rip), %rdi      # 0x9bbc
xorl %ebp, %ebp
xorl %esi, %esi
xorl %eax, %eax
callq 0x2040
movq %r14, %rdi
callq 0x3494
movl %eax, %r14d
movq %rbx, %rdi
callq 0x3494
leaq 0x5fbe(%rip), %rdi      # 0x9bd1
movl %r14d, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0x2040
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x3494
testl %eax, %eax
setne %bpl
jmp 0x3c1f
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/AudioFrameReceiver.cc
// Function: AudioFrameReceiver::SetDumpFile(char const*)
bool
AudioFrameReceiver::SetDumpFile(const char *path)
{
  mFile = fopen(path, "wb");
  mFramesWritten = 0;
  
  if (mFile != NULL) {
    uint8_t header_space[kWAVHeaderSize + kWAVFormatChunkHeaderSize +
                         kWAVDataChunkHeaderSize];
    memset(header_space, 0, sizeof(header_space));
    fwrite(header_space, sizeof(header_space), 1, mFile);
  }
  
  return mFile != NULL;
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rsi, %rax
movq %rdi, %rbx
leaq 0x5694(%rip), %rsi      # 0x9f32
movq %rax, %rdi
callq 0x2120
movq %rax, 0x8(%rbx)
movq $0x0, 0x10(%rbx)
testq %rax, %rax
je 0x48da
xorps %xmm0, %xmm0
movq %rsp, %rdi
movups %xmm0, 0x1c(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
movl $0x2c, %esi
movl $0x1, %edx
movq %rax, %rcx
callq 0x21f0
cmpq $0x0, 0x8(%rbx)
setne %al
addq $0x30, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DDSFrameReceiver.cc
// Function: DDSFrameReceiver::DumpGroup()
void
DDSFrameReceiver::DumpGroup()
{
  //
  // Perform ECC3 correction on the group. It's likely complete now.
  //
  bool correct = mBasicGroup->Correct();
  uint32_t group_id = mBasicGroup->BasicGroupID();
  printf("Group ECC3    : %s (Group %d)\n", correct ? "GOOD" : "----BAD---",
         group_id);
  printf("------------------------------------------------------------\n");
  
  //
  // Figure out what file name we should store this group's data under.
  //
  char *groupFilename, *validName, *eccName, *eccValidName;
  groupFilename = validName = eccName = eccValidName = NULL;
  GenerateGroupFilenames(group_id, groupFilename, validName, eccName,
    eccValidName);
  
  //
  // Dump the group data to disk.
  //
  mBasicGroup->DumpToFile(groupFilename, validName, eccName, eccValidName);

  free(groupFilename);
  free(validName);
  free(eccName);
  free(eccValidName);

  //
  // Mark that we now have no group.
  //
  mHaveGroup = false;
  delete mBasicGroup;
  mBasicGroup = NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
callq 0x6d92
movl %eax, %r14d
movq 0x8(%rbx), %rdi
callq 0x6e40
movl %eax, %ebp
leaq 0x5565(%rip), %rax      # 0xa22c
leaq 0x5563(%rip), %rsi      # 0xa231
testb %r14b, %r14b
cmovneq %rax, %rsi
leaq 0x5531(%rip), %rdi      # 0xa20d
xorl %r14d, %r14d
movl %ebp, %edx
xorl %eax, %eax
callq 0x2040
leaq 0x5589(%rip), %rdi      # 0xa278
callq 0x21b0
leaq 0x8(%rsp), %rax
movq %r14, (%rax)
movq %rax, %r9
leaq 0x10(%rsp), %r15
movq %r14, (%r15)
leaq 0x18(%rsp), %r12
movq %r14, (%r12)
leaq 0x20(%rsp), %r13
movq %r14, (%r13)
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
movq %r12, %rcx
movq %r15, %r8
movq %rax, %r14
callq 0x4f2e
movq 0x8(%rbx), %rdi
movq (%r13), %rsi
movq (%r12), %rdx
movq (%r15), %rcx
movq (%r14), %r8
callq 0x6ab4
movq (%r13), %rdi
callq 0x2130
movq (%r12), %rdi
callq 0x2130
movq (%r15), %rdi
callq 0x2130
movq (%r14), %rdi
callq 0x2130
movb $0x0, 0x10(%rbx)
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x4d8a
movq %r14, %rdi
callq 0x68ea
movl $0x40a4c, %esi          # imm = 0x40A4C
movq %r14, %rdi
callq 0x20f0
movq $0x0, 0x8(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DDSFrameReceiver.cc
// Function: DDSFrameReceiver::AddFrame(DDSGroup3&)
void
DDSFrameReceiver::AddFrame(DDSGroup3& frame)
{
  //
  // Is this a continuation of the last group or a new group?
  //
  if (mHaveGroup && mGroupNumber != frame.BasicGroupID()) {
    //
    // We have a basic group but this frame is outside of it.
    // Dump the current group.
    //
    DumpGroup();
  }
  
  //
  // Is this the start of a new group?
  //
  if (!mHaveGroup) {      
    //
    // Prepare a new group with this frame's group number.
    // This may also entail loading anything we currently know about this
    // group from a previous decoding process.
    //
    NewGroup(frame.BasicGroupID());
  }
  
  //
  // De-whiten the data into a G1 group.
  //
  DDSGroup1 g1(frame);
  
  //
  // Copy it into the basic group in the appropriate spot.
  //
  mBasicGroup->AddSubFrame(g1);
    
  //
  // If this was the last frame of the group, dump the group.
  //
  if (frame.IsLastLogicalFrame())
    DumpGroup();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x2d08, %rsp           # imm = 0x2D08
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, 0x10(%rdi)
jne 0x4dd2
movl 0x14(%rbx), %ebp
movq %r14, %rdi
callq 0x4fde
cmpl %eax, %ebp
je 0x4dd2
movq %rbx, %rdi
callq 0x4c98
cmpb $0x0, 0x10(%rbx)
jne 0x4dea
movq %r14, %rdi
callq 0x4fde
movq %rbx, %rdi
movl %eax, %esi
callq 0x4e5a
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x6608
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0x6c3c
movq %r14, %rdi
callq 0x4fe6
testb %al, %al
je 0x4e1a
movq %rbx, %rdi
callq 0x4c98
leaq 0x8(%rsp), %rdi
callq 0x66e2
addq $0x2d08, %rsp           # imm = 0x2D08
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x66e2
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DDSFrameReceiver.cc
// Function: DDSFrameReceiver::NewGroup(unsigned int)
void
DDSFrameReceiver::NewGroup(uint32_t group_id)
{
  //
  // Construct a new group object.
  //
  mBasicGroup = new BasicGroup(group_id);
  
  //
  // Figure out what file name we would have previously stored this
  // group's data under, if available.
  //
  char *groupFilename, *validName, *eccName, *eccValidName;
  groupFilename = validName = eccName = eccValidName = NULL;
  GenerateGroupFilenames(group_id, groupFilename, validName, eccName,
    eccValidName);
  
  //
  // Load any previous data for this group.
  //
  mBasicGroup->LoadFromFile(groupFilename, validName, eccName, eccValidName);
  
  free(groupFilename);
  free(validName);
  free(eccName);
  free(eccValidName);

  //
  // Mark that we now have a group.
  //
  mHaveGroup = true;
  mGroupNumber = group_id;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebx
movq %rdi, %r14
movl $0x40a4c, %edi          # imm = 0x40A4C
callq 0x20e0
movq %rax, %r15
movq %rax, %rdi
movl %ebx, %esi
callq 0x68bc
movq %r15, 0x8(%r14)
xorl %eax, %eax
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
leaq 0x10(%rsp), %r12
movq %rax, (%r12)
leaq 0x18(%rsp), %r13
movq %rax, (%r13)
leaq 0x20(%rsp), %rbp
movq %rax, (%rbp)
movq %r14, %rdi
movl %ebx, %esi
movq %rbp, %rdx
movq %r13, %rcx
movq %r12, %r8
movq %r15, %r9
callq 0x4f2e
movq 0x8(%r14), %rdi
movq (%rbp), %rsi
movq (%r13), %rdx
movq (%r12), %rcx
movq (%r15), %r8
callq 0x68ec
movq (%rbp), %rdi
callq 0x2130
movq (%r13), %rdi
callq 0x2130
movq (%r12), %rdi
callq 0x2130
movq (%r15), %rdi
callq 0x2130
movb $0x1, 0x10(%r14)
movl %ebx, 0x14(%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x40a4c, %esi          # imm = 0x40A4C
movq %r15, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DDSFrameReceiver.cc
// Function: DDSFrameReceiver::GenerateGroupFilenames(unsigned int, char*&, char*&, char*&, char*&)
void
DDSFrameReceiver::GenerateGroupFilenames(uint32_t group_id,
  char*& groupFilename, char*& validName, char*& eccName, char*& eccValidName)
{
  asprintf(&groupFilename, "%s/g%06d.bin", mOutputDirectory, group_id);
  asprintf(&validName,     "%s/g%06d.val", mOutputDirectory, group_id);
  asprintf(&eccName,       "%s/g%06d.ecc.bin", mOutputDirectory, group_id);
  asprintf(&eccValidName,  "%s/g%06d.ecc.val", mOutputDirectory, group_id);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %rax
movl %esi, %ebp
movq %rdi, %r14
movq 0x20(%rdi), %rdx
leaq 0x52ea(%rip), %rsi      # 0xa23c
movq %rax, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2080
movq 0x20(%r14), %rdx
leaq 0x52e0(%rip), %rsi      # 0xa249
movq %r12, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2080
movq 0x20(%r14), %rdx
leaq 0x52d6(%rip), %rsi      # 0xa256
movq %r15, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2080
movq 0x20(%r14), %rdx
leaq 0x52d0(%rip), %rsi      # 0xa267
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2080
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DDSGroup3.cc
// Function: DDSGroup3::DecodeFrame(Track const&, Track const&)
DDSGroup3::DecodeError
DDSGroup3::DecodeFrame(const Track& A, const Track& B)
{
  //
  // Retrieve the items from subcode id #3 from both tracks.
  // 
  const uint8_t *a_subcode, *b_subcode;
  
  if (!A.GetSubcode(3, &a_subcode))
    return A_MISSING_SUBCODE_3;
  if (!B.GetSubcode(3, &b_subcode))
    return B_MISSING_SUBCODE_3;
  
  //
  // Every track should have a valid subcode pack 3. Let's fetch it from
  // both tracks and make certain they match. (This may be redundant as
  // the frame pairing protocol is supposed to have checked this earlier).
  //
  DDSSubcodePack3 a3, b3;
  a3.Decode(a_subcode);
  b3.Decode(b_subcode);
    
  //
  // Assert that both tracks contain the same absolute frame number.
  //
  if (a3.mAbsoluteFrameID != b3.mAbsoluteFrameID)
    return ABSOLUTE_FRAME_MISMATCH;
    
  //
  // Record frame numbers and such.
  //
  mPartitionID = PartitionID(a3.mPartitionID);
  mAreaID   = AreaID(a3.mAreaID);
  mAbsoluteFrameID = a3.mAbsoluteFrameID;

  //
  // Fetch additional items, depending on the Area of the tape
  // we're supposedly in.
  //
  switch (mAreaID) {
  case DEVICE_AREA:
  case REFERENCE_AREA:
  case SYSTEM_AREA:
  case EOD_AREA:
    //
    // Not handling these areas yet.
    //
    return DECODE_OK;
  case DATA_AREA:
    //
    // Data area frames also have data, which we should check and store.
    //
    // Assert that both tracks of this famre also agree on their logical
    // frame number (this frame's position within the larger Basic Group).
    //
    if (a3.mLogicalFrameID != b3.mLogicalFrameID)
      return LOGICAL_FRAME_MISMATCH;
    
    return HandleDataAreaFrame(a3, A, B);
    break;
  default:
    return UNKNOWN_AREA_ID;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x18(%rsp), %rdx
movq %rsi, %rdi
movl $0x3, %esi
callq 0x35cc
movl %eax, %ecx
movl $0x1, %eax
testb %cl, %cl
je 0x50de
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movl $0x3, %esi
callq 0x35cc
movl %eax, %ecx
movl $0x2, %eax
testb %cl, %cl
je 0x50de
xorl %eax, %eax
movq %rsp, %r12
movb %al, (%r12)
leaq 0x20(%rsp), %r13
movb %al, (%r13)
movq 0x18(%rsp), %rsi
movq %r12, %rdi
callq 0x6550
movq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0x6550
movl 0x4(%r12), %edx
movl $0x6, %eax
cmpl 0x4(%r13), %edx
jne 0x50de
movzbl 0x1(%rsp), %eax
movl %eax, 0x4(%r15)
movzbl 0x2(%rsp), %ecx
movl %ecx, (%r15)
movl %edx, 0x8(%r15)
cmpl $0x3, %ecx
jae 0x50a8
xorl %eax, %eax
jmp 0x50de
movl $0x0, %eax
cmpl $0x5, %ecx
je 0x50de
cmpl $0x4, %ecx
jne 0x50d9
movb 0xa(%rsp), %cl
movl $0x7, %eax
cmpb 0x2a(%rsp), %cl
jne 0x50de
movq %rsp, %rsi
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x50ec
jmp 0x50de
movl $0x8, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECC_C1.cc
// Function: ECC_C1::ComputeSyndrome(unsigned char (&) [4])
bool
ECC_C1::ComputeSyndrome(uint8_t (&syndrome)[ECC_C1::kTwoT])
{
  //
  // Multiply the filled in vector by the check matrix to produce a
  // result vector.
  //
  bool ok = true;
  for (size_t i = 0; i < kTwoT; i++) {
    uint8_t result = 0;
    for (size_t j = 0; j < kN; j++) {
      result ^= ECC_GF28_multiply(mData[j], gHp[i][j]);
    }

    syndrome[i] = result;

    //
    // Everything is ok if all previous entries are zero and this
    // entry is zero.
    //
    ok = ok && result == 0;
  }

  return ok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %r14
movb $0x1, %bpl
leaq 0x50e6(%rip), %r15      # 0xa3f0
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ecx, %ecx
movl %ecx, %ebx
movzbl (%r14,%r13), %edi
movzbl (%r15,%r13), %esi
callq 0x5b24
movl %eax, %ecx
xorb %bl, %cl
incq %r13
cmpq $0x20, %r13
jne 0x5312
movq (%rsp), %rdx
movb %cl, (%rdx,%r12)
cmpb %bl, %al
sete %al
andb %al, %bpl
incq %r12
addq $0x20, %r15
cmpq $0x4, %r12
jne 0x530d
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/./ReedSolomon_EUA.h
// Function: unsigned char poly_evaluate<4ul>(unsigned char const (&) [4ul], unsigned char)
uint8_t
poly_evaluate(const uint8_t (&in)[n], uint8_t x)
{
  uint8_t y = x;
  uint8_t r = in[0];
  
  for (size_t i = 1; i < n; i++) {
    r ^= ECC_GF28_multiply(in[i], y);
    y = ECC_GF28_multiply(y, x);
  }
  
  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %eax
movq %rdi, %rbx
movb (%rdi), %bpl
movl $0x1, %r12d
movzbl %al, %r14d
movzbl (%rbx,%r12), %edi
movzbl %al, %r15d
movl %r15d, %esi
callq 0x5b24
xorb %al, %bpl
movl %r15d, %edi
movl %r14d, %esi
callq 0x5b24
incq %r12
cmpq $0x4, %r12
jne 0x58a0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECC_GF28.cc
// Function: ECC_GF28_multiply(unsigned char, unsigned char)
uint8_t
ECC_GF28_multiply(uint8_t a, uint8_t b)
{
  if (a == 0 || b == 0)
    return 0;

  if (a == 1)
    return b;

  if (b == 1)
    return a;
  
  //
  // Use the discrete logarithm table to make multiplicaton an O(1)
  // operation.
  //
  return kPowAlpha[(kLogAlpha[a] + kLogAlpha[b]) % 255];
}

// Assembly:
testl %edi, %edi
sete %cl
testl %esi, %esi
sete %dl
orb %cl, %dl
je 0x5b35
xorl %eax, %eax
retq
movl %esi, %eax
cmpb $0x1, %dil
je 0x5b34
cmpb $0x1, %al
jne 0x5b44
movl %edi, %eax
retq
movzbl %dil, %ecx
leaq 0x4a51(%rip), %rdx      # 0xa5a0
movzbl (%rcx,%rdx), %ecx
movzbl %al, %eax
movzbl (%rax,%rdx), %eax
addl %ecx, %eax
imulq $0x1010102, %rax, %rcx  # imm = 0x1010102
shrq $0x20, %rcx
movl %ecx, %edx
shll $0x8, %edx
subl %edx, %ecx
addl %eax, %ecx
leaq 0x4929(%rip), %rax      # 0xa4a0
movb (%rcx,%rax), %al
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECC_GF28.cc
// Function: ECC_GF28_evaluate(unsigned char const*, unsigned char, unsigned long)
uint8_t
ECC_GF28_evaluate(const uint8_t p[], uint8_t x, size_t n)
{
  uint8_t y = 1;
  uint8_t res = 0;
  
  for (size_t i = 0; i < n; i++) {
    res ^= ECC_GF28_multiply(p[i], y);
    y = ECC_GF28_multiply(y, x);
  }
  
  return res;
}

// Assembly:
testq %rdx, %rdx
je 0x5c73
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
movzbl %sil, %ecx
movb $0x1, %r11b
xorl %r8d, %r8d
leaq 0x49f8(%rip), %r9       # 0xa5a0
leaq 0x48f1(%rip), %r10      # 0xa4a0
xorl %eax, %eax
movzbl (%rdi,%r8), %r14d
testq %r14, %r14
sete %bl
testb %r11b, %r11b
sete %bpl
orb %bl, %bpl
je 0x5bcc
xorl %ebx, %ebx
jmp 0x5c08
movl %r11d, %ebx
cmpb $0x1, %r14b
je 0x5c08
movl %r14d, %ebx
cmpb $0x1, %r11b
je 0x5c08
movzbl (%r14,%r9), %ebx
movzbl %r11b, %r14d
movzbl (%r14,%r9), %r14d
addl %ebx, %r14d
imulq $0x1010102, %r14, %rbx  # imm = 0x1010102
shrq $0x20, %rbx
movl %ebx, %ebp
shll $0x8, %ebp
subl %ebp, %ebx
addl %r14d, %ebx
movb (%rbx,%r10), %bl
xorl %ebp, %ebp
testb %sil, %sil
je 0x5c5b
testb %r11b, %r11b
je 0x5c5b
cmpb $0x1, %sil
sete %r14b
cmpb $0x1, %r11b
sete %r15b
movzbl %r11b, %r11d
movl %r11d, %ebp
cmovel %ecx, %ebp
orb %r14b, %r15b
jne 0x5c5b
movzbl (%r11,%r9), %r11d
movzbl (%rcx,%r9), %r14d
addl %r11d, %r14d
imulq $0x1010102, %r14, %r11  # imm = 0x1010102
shrq $0x20, %r11
movl %r11d, %ebp
shll $0x8, %ebp
subl %ebp, %r11d
addl %r14d, %r11d
movb (%r11,%r10), %bpl
xorb %bl, %al
incq %r8
movl %ebp, %r11d
cmpq %r8, %rdx
jne 0x5bb1
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECC_C2.cc
// Function: ECC_C2::ComputeSyndrome(unsigned char*)
bool
ECC_C2::ComputeSyndrome(uint8_t syndrome[ECC_C2::kTwoT])
{
  //
  // Multiply the filled in vector by the check matrix to produce a
  // result vector.
  //
  bool ok = true;
  for (size_t i = 0; i < kTwoT; i++) {
    uint8_t result = 0;
    for (size_t j = 0; j < kN; j++) {
      result ^= ECC_GF28_multiply(mData[j], gHq[i][j]);
    }

    syndrome[i] = result;

    //
    // Everything is ok if all previous entries are zero and this
    // entry is zero.
    //
    ok = ok && result == 0;
  }

  return ok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %r14
movb $0x1, %bpl
leaq 0x4ac2(%rip), %r15      # 0xa7b0
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ecx, %ecx
movl %ecx, %ebx
movzbl (%r14,%r13), %edi
movzbl (%r15,%r13), %esi
callq 0x5b24
movl %eax, %ecx
xorb %bl, %cl
incq %r13
cmpq $0x20, %r13
jne 0x5cf6
movq (%rsp), %rdx
movb %cl, (%rdx,%r12)
cmpb %bl, %al
sete %al
andb %al, %bpl
incq %r12
addq $0x20, %r15
cmpq $0x6, %r12
jne 0x5cf1
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECCFill_C1.cc
// Function: ECCFill_C1::Data(unsigned long)
uint8_t&
ECCFill_C1::Data(size_t position)
{
  size_t block, byte;
  
  compute_offsets(position, mInterleaveSet == ECCFill_C1::EVEN ? 0 : 1,
                  mBlockPairStart, block, byte);
  
  return mData[block][byte];
}

// Assembly:
xorl %ecx, %ecx
cmpl $0x0, 0x1c(%rdi)
setne %cl
movl 0x18(%rdi), %edx
movq %rsi, %rax
shrq $0x4, %rax
addq %rdx, %rax
andl $0xf, %esi
leaq (%rcx,%rsi,2), %rcx
shlq $0x5, %rax
addq 0x8(%rdi), %rax
addq %rcx, %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECCFill_C1.cc
// Function: ECCFill_C1::Valid(unsigned long)
bool&
ECCFill_C1::Valid(size_t position)
{
  size_t block, byte;
  
  compute_offsets(position, mInterleaveSet == ECCFill_C1::EVEN ? 0 : 1,
                  mBlockPairStart, block, byte);
  
  return mDataIsValid[block][byte];
}

// Assembly:
xorl %ecx, %ecx
cmpl $0x0, 0x1c(%rdi)
setne %cl
movl 0x18(%rdi), %edx
movq %rsi, %rax
shrq $0x4, %rax
addq %rdx, %rax
andl $0xf, %esi
leaq (%rcx,%rsi,2), %rcx
shlq $0x5, %rax
addq 0x10(%rdi), %rax
addq %rcx, %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DDSSubcode.cc
// Function: DDSSubcodePack3::Decode(unsigned char const*)
void
DDSSubcodePack3::Decode(const uint8_t *bytes)
{
  uint8_t part;
  uint8_t area_id;
  uint32_t abs_frame_num;
  uint8_t csum1;
  uint8_t csum2;
  uint8_t lfid;
  bool is_last;
  
  part = (bytes[0] & 8) ? 1 : 0;
  area_id = bytes[0] & 7;
  abs_frame_num = DecodeU24(&bytes[1]);
  csum1 = bytes[4];
  csum2 = bytes[5];
  lfid = bytes[6];
  
  mValid = true;
  mPartitionID = part;
  mAreaID = area_id;
  mAbsoluteFrameID = abs_frame_num;
  mChecksum1 = csum1;
  mChecksum2 = csum2;
  mLogicalFrameID = lfid & 0x3f;
  mIsLastLogicalFrame = (lfid & 0x80) == 0x80;
  mIsECC3Frame = (lfid & 0x40) == 0x40;
}

// Assembly:
movb (%rsi), %al
movl %eax, %ecx
shrb $0x3, %cl
andb $0x1, %cl
andb $0x7, %al
movzbl 0x1(%rsi), %edx
shll $0x10, %edx
movzbl 0x2(%rsi), %r8d
shll $0x8, %r8d
orl %edx, %r8d
movzbl 0x3(%rsi), %edx
orl %r8d, %edx
movzwl 0x4(%rsi), %r8d
movb 0x6(%rsi), %sil
movb $0x1, (%rdi)
movb %cl, 0x1(%rdi)
movb %al, 0x2(%rdi)
movl %edx, 0x4(%rdi)
movw %r8w, 0x8(%rdi)
movl %esi, %eax
andb $0x3f, %al
movb %al, 0xa(%rdi)
movl %esi, %eax
shrb $0x7, %al
movb %al, 0xb(%rdi)
shrb $0x6, %sil
andb $0x1, %sil
movb %sil, 0xc(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/DDSGroup1.cc
// Function: DDSGroup1::DDSGroup1(DDSGroup3&)
DDSGroup1::DDSGroup1(DDSGroup3& g3)
  : mBasicGroupID(g3.BasicGroupID()), mSubFrameID(g3.LogicalFrameID()),
    mIsECCFrame(g3.IsECC3Frame()), mIsLastFrame(g3.IsLastLogicalFrame())
{
  //
  // The data in the G3 is a G2 group wrapper with a header row. The G2
  // group is a G1 group with a data whitening LFSR stream added to it.
  // We need to remove that whitening as we write the data out.
  //
  
  //
  // Fetch a pointer to the data and validity arrays of the G3 frame.
  //
  const DATFrame::DataArray& data = g3.Frame().Data();
  const DATFrame::ValidityArray& valid = g3.Frame().Valid();
  
  uint16_t lfsr = 1;
  
  for (size_t i = 1; i < DATFrame::kUserDataRows; i++) {
    for (size_t j = 0; j < DATFrame::kBytesPerRow; j++) {
      //
      // Look up the data.
      //
      uint8_t byte = data[i][j];
      
      //
      // Dewhiten it.
      //
      byte ^= (lfsr & 0xff);
      
      //
      // Store it in our array.
      //
      mData[(i - 1) * 4 + j] = byte;
      mDataIsValid[(i - 1) * 4 + j] = valid[i][j];
       
      //
      // Crank the LFSR.
      //
      lfsr = (((uint16_t)(G2LFSR[lfsr & 0x1ff])) << 7) | ((lfsr >> 8) & 0xff);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x4fde
movl %eax, 0x2cf8(%rbx)
movq %r15, %rdi
callq 0x4fe2
movb %al, 0x2cfc(%rbx)
movq %r15, %rdi
callq 0x4fe6
movb %al, 0x2cfd(%rbx)
movq %r15, %rdi
callq 0x4fea
movb %al, 0x2cfe(%rbx)
movq %r15, %rdi
callq 0x4fcc
movq %rax, %rdi
callq 0x5ae6
movq %rax, %r14
movq %r15, %rdi
callq 0x4fcc
movq %rax, %rdi
callq 0x5aea
addq $0x4, %r14
addq $0x4, %rax
movl $0x1, %ecx
movw $0x1, %dx
leaq 0x422a(%rip), %rsi      # 0xa8b0
xorl %edi, %edi
movzwl %dx, %edx
movb (%r14,%rdi), %r8b
xorb %dl, %r8b
movb %r8b, (%rbx,%rdi)
movb (%rax,%rdi), %r8b
movb %r8b, 0x167c(%rbx,%rdi)
movl %edx, %r8d
andl $0x1ff, %r8d            # imm = 0x1FF
movzbl (%r8,%rsi), %r8d
shll $0x7, %r8d
shrl $0x8, %edx
orl %r8d, %edx
incq %rdi
cmpq $0x4, %rdi
jne 0x6688
incq %rcx
addq $0x4, %r14
addq $0x4, %rax
addq $0x4, %rbx
cmpq $0x5a0, %rcx            # imm = 0x5A0
jne 0x6686
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/File.cc
// Function: File::Open(char const*, unsigned long)
bool
File::Open(const char *path, size_t quanta)
{
  mFd = ::open(path, O_RDONLY);
  if (mFd == -1)
    return false;

  mOpen = true;
  Reset(quanta);

  return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movq %rsi, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x20b0
movl %eax, %ebp
movl %eax, 0x4(%r14)
cmpl $-0x1, %eax
je 0x6794
movb $0x1, (%r14)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x67a0
cmpl $-0x1, %ebp
setne %al
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/File.cc
// Function: File::Reset(unsigned long)
void
File::Reset(size_t quanta)
{
  delete mResidual;
  mQuanta = quanta;
  mResidual = new char[mQuanta];
  mResidualCount = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x67bd
movl $0x1, %esi
callq 0x20f0
movq %r14, 0x10(%rbx)
movq %r14, %rdi
callq 0x2030
movq %rax, 0x8(%rbx)
movq $0x0, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/File.cc
// Function: File::Open(int, unsigned long)
bool
File::Open(int fd, size_t quanta)
{
  mFd = fd;
  if (mFd == -1)
    return false;

  mOpen = true;
  Reset(quanta);

  return true;
}

// Assembly:
pushq %rbx
movl %esi, %ebx
movl %esi, 0x4(%rdi)
cmpl $-0x1, %esi
je 0x67f4
movb $0x1, (%rdi)
movq %rdx, %rsi
callq 0x67a0
cmpl $-0x1, %ebx
setne %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/File.cc
// Function: File::Read(void*, unsigned long)
size_t
File::Read(void *buf, size_t count)
{
  char *cbuf = (char *) buf;

  if (!mOpen)
    return 0;

  if (count == 0)
    return 0;
  
  size_t total = count * mQuanta;

  //
  // Copy in any residual data first.
  //
  if (mResidualCount > 0) {
    memcpy(cbuf, mResidual, mResidualCount);
    total -= mResidualCount;
  }

  size_t pos = mResidualCount;

  while (total > 0) {
    int nread = ::read(mFd, &cbuf[pos], total);
    if (nread == -1 || nread == 0) {
      //
      // Some sort of error occurred. Probably a signal.
      //
      break;
    }
    total -= nread;
    pos += nread;
  }

  //
  // Is there any residual data?
  //
  size_t residue = pos % mQuanta;
  if (residue != 0) {
    memcpy(mResidual, &cbuf[pos - residue], residue);
    pos -= residue;
  }

  mResidualCount = residue;

  return pos / mQuanta;
}

// Assembly:
xorl %eax, %eax
testq %rdx, %rdx
je 0x68ae
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, (%rdi)
je 0x68a5
movq %rdx, %r12
movq %rsi, %r14
imulq 0x10(%rbx), %r12
movq 0x18(%rbx), %rdx
testq %rdx, %rdx
je 0x6840
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x20c0
subq 0x18(%rbx), %r12
movq 0x18(%rbx), %r15
xorl %r13d, %r13d
testq %r12, %r12
je 0x6872
movl 0x4(%rbx), %edi
leaq (%r14,%r15), %rsi
movq %r12, %rdx
callq 0x2190
leal 0x1(%rax), %ecx
cmpl $0x2, %ecx
cltq
cmovbq %r13, %rax
subq %rax, %r12
addq %rax, %r15
cmpl $0x1, %ecx
ja 0x6847
movq %r15, %rax
xorl %edx, %edx
divq 0x10(%rbx)
movq %rdx, %r12
testq %rdx, %rdx
je 0x6898
movq 0x8(%rbx), %rdi
subq %r12, %r15
addq %r15, %r14
movq %r14, %rsi
movq %r12, %rdx
callq 0x20c0
movq %r12, 0x18(%rbx)
movq %r15, %rax
xorl %edx, %edx
divq 0x10(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/BasicGroup.cc
// Function: BasicGroup::Correct()
bool
BasicGroup::Correct()
{
  ECC_C3 C3;
  size_t uncorrectableErrors = 0;
  
  for (ECCFill_C3 c3_fill(*this); !c3_fill.End(); c3_fill.Next()) {
    //
    // Fill the error check vector.
    //      
    C3.Fill(c3_fill);

    //
    // Detect errors in this vector and correct them.
    //
    ECC_C3::Status ok = C3.Correct();
    switch (ok) {
    case ECC_C3::NO_ERRORS:
      //
      // No errors. Nothing to be done.
      //
      break;
    case ECC_C3::CORRECTED:
      //
      // There were errors but they were corrected.
      // Put the corrected data back into the track.
      //
      C3.Dump(c3_fill);
      break;
    case ECC_C3::UNCORRECTABLE:
      //
      // Slice was uncorrectable. Leave it as is.
      //
      uncorrectableErrors++;
      break;
    }
  }
  
  return uncorrectableErrors == 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %rdi
callq 0x6fe0
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
callq 0x6e80
xorl %r15d, %r15d
leaq 0x68(%rsp), %rbx
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
callq 0x6f2e
testb %al, %al
jne 0x6e08
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6fe4
movq %r14, %rdi
callq 0x709a
cmpl $0x1, %eax
je 0x6df3
cmpl $0x2, %eax
jne 0x6dfe
incq %r15
jmp 0x6dfe
movq %r14, %rdi
movq %rbx, %rsi
callq 0x729a
movq %rbx, %rdi
callq 0x6edc
jmp 0x6dc5
testq %r15, %r15
sete %bl
leaq 0xc(%rsp), %rdi
callq 0x6fe2
movl %ebx, %eax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x6e2b
jmp 0x6e2b
movq %rax, %rbx
leaq 0xc(%rsp), %rdi
callq 0x6fe2
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECCFill_C3.cc
// Function: ECCFill_C3::Data(unsigned long)
uint8_t&
ECCFill_C3::Data(size_t position)
{
  bool isECC;
  const size_t offset = compute_offset(position, mByteSlice, mTrackPair,
    mInterleaveSet, isECC);
  
  if (!isECC)
    return mData[offset];
  else
    return mECCData[offset];
}

// Assembly:
movl 0x28(%rdi), %eax
movl 0x2c(%rdi), %edx
movl 0x30(%rdi), %ecx
shll $0x3, %eax
testb $0x1, %sil
jne 0x6f54
leal (%rax,%rdx,2), %eax
addl $0x2, %eax
jmp 0x6f5a
leal (%rdx,%rdx,2), %edx
leal (%rax,%rdx,2), %eax
shrq %rsi
imulq $0x167c, %rsi, %rdx     # imm = 0x167C
xorl %r8d, %r8d
cmpq $0x16, %rsi
cmovneq %rdx, %r8
addl %ecx, %eax
addq %r8, %rax
movq 0x18(%rdi), %rcx
addq %rax, %rcx
addq 0x8(%rdi), %rax
cmpq $0x16, %rsi
cmoveq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECCFill_C3.cc
// Function: ECCFill_C3::Valid(unsigned long)
bool&
ECCFill_C3::Valid(size_t position)
{
  bool isECC;
  const size_t offset = compute_offset(position, mByteSlice, mTrackPair,
    mInterleaveSet, isECC);

  if (!isECC)
    return mDataIsValid[offset];
  else
    return mECCDataIsValid[offset];
}

// Assembly:
movl 0x28(%rdi), %eax
movl 0x2c(%rdi), %edx
movl 0x30(%rdi), %ecx
shll $0x3, %eax
testb $0x1, %sil
jne 0x6fa2
leal (%rax,%rdx,2), %eax
addl $0x2, %eax
jmp 0x6fa8
leal (%rdx,%rdx,2), %edx
leal (%rax,%rdx,2), %eax
shrq %rsi
imulq $0x167c, %rsi, %rdx     # imm = 0x167C
xorl %r8d, %r8d
cmpq $0x16, %rsi
cmovneq %rdx, %r8
addl %ecx, %eax
addq %r8, %rax
movq 0x20(%rdi), %rcx
addq %rax, %rcx
addq 0x10(%rdi), %rax
cmpq $0x16, %rsi
cmoveq %rcx, %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/ECC_C3.cc
// Function: ECC_C3::ComputeSyndrome(unsigned char*)
bool
ECC_C3::ComputeSyndrome(uint8_t syndrome[ECC_C3::kTwoT])
{
  //
  // Multiply the filled in vector by the check matrix to produce a
  // result vector.
  //
  bool ok = true;
  for (size_t i = 0; i < kTwoT; i++) {
    uint8_t result = 0;
    for (size_t j = 0; j < kN; j++) {
      result ^= ECC_GF28_multiply(mData[j], gHi[i][j]);
    }

    syndrome[i] = result;

    //
    // Everything is ok if all previous entries are zero and this
    // entry is zero.
    //
    ok = ok && result == 0;
  }

  return ok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, (%rsp)
movq %rdi, %r14
movb $0x1, %bpl
leaq 0x3b1e(%rip), %r15      # 0xab60
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ecx, %ecx
movl %ecx, %ebx
movzbl (%r14,%r13), %edi
movzbl (%r15,%r13), %esi
callq 0x5b24
movl %eax, %ecx
xorb %bl, %cl
incq %r13
cmpq $0x2e, %r13
jne 0x704a
movq (%rsp), %rdx
movb %cl, (%rdx,%r12)
cmpb %bl, %al
sete %al
andb %al, %bpl
leaq 0x1(%r12), %rax
addq $0x2e, %r15
testq %r12, %r12
movq %rax, %r12
je 0x7045
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/XDR.cc
// Function: XDR::AddString(char const*, unsigned long)
bool
XDR::AddString(const char *str, size_t len)
{
  if (!SizeCheck(len))
    return false;
  
  memcpy(&mData[mPosition], str, len);
  mPosition += len;
  
  return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %r15
movq 0x8(%rdi), %rdi
leaq (%rdi,%rdx), %r12
cmpq %r15, %r12
ja 0x764d
movq %rdx, %rbx
addq 0x10(%r14), %rdi
callq 0x20c0
addq %rbx, 0x8(%r14)
cmpq %r15, %r12
setbe %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/XDR.cc
// Function: XDR::AddI16(short)
bool
XDR::AddI16(int16_t i)
{
  if (!SizeCheck(2))
    return false;
  
  mData[mPosition] = (i & 0xff);
  mData[mPosition+1] = (i >> 8) & 0xff;
  mPosition += 2;
  
  return true;
}

// Assembly:
movl %esi, %ecx
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
leaq 0x2(%rsi), %rdx
cmpq %rax, %rdx
ja 0x7699
pushq %rbx
movq 0x10(%rdi), %r8
movb %cl, (%r8,%rsi)
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rbx
movb %ch, 0x1(%rbx,%rsi)
addq $0x2, 0x8(%rdi)
popq %rbx
cmpq %rax, %rdx
setbe %al
retq
// File: /workspace/github_cpp_makefile_star2_O1/ke6jjj[P]r-dat/XDR.cc
// Function: XDR::AddI32(int)
bool
XDR::AddI32(int32_t i)
{
  if (!SizeCheck(4))
    return false;
  
  mData[mPosition] = (i & 0xff);
  mData[mPosition+1] = (i >> 8) & 0xff;
  mData[mPosition+2] = (i >> 16) & 0xff;
  mData[mPosition+3] = (i >> 24) & 0xff;
  mPosition += 4;
  
  return true;
}

// Assembly:
movl %esi, %ecx
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
leaq 0x4(%rsi), %rdx
cmpq %rax, %rdx
ja 0x7723
pushq %rbx
movq 0x10(%rdi), %r8
movb %cl, (%r8,%rsi)
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %rbx
movb %ch, 0x1(%rbx,%rsi)
movl %ecx, %esi
shrl $0x10, %esi
movq 0x8(%rdi), %r8
movq 0x10(%rdi), %r9
movb %sil, 0x2(%r9,%r8)
shrl $0x18, %ecx
movq 0x8(%rdi), %rsi
movq 0x10(%rdi), %r8
movb %cl, 0x3(%r8,%rsi)
addq $0x4, 0x8(%rdi)
popq %rbx
cmpq %rax, %rdx
setbe %al
retq