// File: sisong[P]ApkDiffPatch/lzma/C/LzFindMt.c
// Function: MatchFinderMt_Init
static void MatchFinderMt_Init(void *_p)
{
  CMatchFinderMt *p = (CMatchFinderMt *)_p;
  CMatchFinder *mf = MF(p);
  
  p->btBufPos =
  p->btBufPosLimit = NULL;
  p->hashBufPos =
  p->hashBufPosLimit = 0;
  p->hashNumAvail = 0; // 21.03
  
  p->failure_BT = False;

  /* Init without data reading. We don't want to read data in this thread */
  MatchFinder_Init_4(mf);

  MatchFinder_Init_LowHash(mf);
  
  p->pointerToCurPos = Inline_MatchFinder_GetPointerToCurrentPos(mf);
  p->btNumAvailBytes = 0;
  p->failure_LZ_BT = False;
  // p->failure_LZ_LZ = False;
  
  p->lzPos =
      1; // optimal smallest value
      // 0; // for debug: ignores match to start
      // kNormalizeAlign; // for debug

  p->hash = mf->hash;
  p->fixedHashSize = mf->fixedHashSize;
  // p->hash4Mask = mf->hash4Mask;
  p->crc = mf->crc;
  // memcpy(p->crc, mf->crc, sizeof(mf->crc));

  p->son = mf->son;
  p->matchMaxLen = mf->matchMaxLen;
  p->numHashBytes = mf->numHashBytes;
  
  /* (mf->pos) and (mf->streamPos) were already initialized to 1 in MatchFinder_Init_4() */
  // mf->streamPos = mf->pos = 1; // optimal smallest value
      // 0; // for debug: ignores match to start
      // kNormalizeAlign; // for debug

  /* we must init (p->pos = mf->pos) for BT, because
     BT code needs (p->pos == delta_value_for_empty_hash_record == mf->pos) */
  p->pos = mf->pos; // do not change it
  
  p->cyclicBufferPos = (p->pos - CYC_TO_POS_OFFSET);
  p->cyclicBufferSize = mf->cyclicBufferSize;
  p->buffer = mf->buffer;
  p->cutValue = mf->cutValue;
  // p->son[0] = p->son[1] = 0; // unused: to init skipped record for speculated accesses.
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x520(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2dc(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2d8(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2e0(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x2e4(%rax)
movq -0x18(%rbp), %rdi
callq 0x6fc60
movq -0x18(%rbp), %rdi
callq 0x6fba0
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x20(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movl 0x6c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rcx
addq $0x78, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x2e8(%rax)
movq -0x18(%rbp), %rax
movl 0x24(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2f0(%rax)
movq -0x18(%rbp), %rax
movl 0x5c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2f4(%rax)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2f8(%rax)
movq -0x10(%rbp), %rax
movl 0x2f8(%rax), %ecx
subl $0x0, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x308(%rax)
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x30c(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x300(%rax)
movq -0x18(%rbp), %rax
movl 0x3c(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x310(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)