// File: /workspace/github_cpp_makefile_star2_O1/sisong[P]ApkDiffPatch/lzma/C/LzmaEnc.c
// Function: LzmaEnc_SetProps
Z7_NO_INLINE
SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props2)
{
  // GET_CLzmaEnc_p
  CLzmaEncProps props = *props2;
  LzmaEncProps_Normalize(&props);

  if (props.lc > LZMA_LC_MAX
      || props.lp > LZMA_LP_MAX
      || props.pb > LZMA_PB_MAX)
    return SZ_ERROR_PARAM;


  if (props.dictSize > kLzmaMaxHistorySize)
    props.dictSize = kLzmaMaxHistorySize;

  #ifndef LZMA_LOG_BSR
  {
    const UInt64 dict64 = props.dictSize;
    if (dict64 > ((UInt64)1 << kDicLogSizeMaxCompress))
      return SZ_ERROR_PARAM;
  }
  #endif

  p->dictSize = props.dictSize;
  {
    unsigned fb = (unsigned)props.fb;
    if (fb < 5)
      fb = 5;
    if (fb > LZMA_MATCH_LEN_MAX)
      fb = LZMA_MATCH_LEN_MAX;
    p->numFastBytes = fb;
  }
  p->lc = (unsigned)props.lc;
  p->lp = (unsigned)props.lp;
  p->pb = (unsigned)props.pb;
  p->fastMode = (props.algo == 0);
  // p->_maxMode = True;
  MFB.btMode = (Byte)(props.btMode ? 1 : 0);
  // MFB.btMode = (Byte)(props.btMode);
  {
    unsigned numHashBytes = 4;
    if (props.btMode)
    {
           if (props.numHashBytes <  2) numHashBytes = 2;
      else if (props.numHashBytes <  4) numHashBytes = (unsigned)props.numHashBytes;
    }
    if (props.numHashBytes >= 5) numHashBytes = 5;

    MFB.numHashBytes = numHashBytes;
    // MFB.numHashBytes_Min = 2;
    MFB.numHashOutBits = (Byte)props.numHashOutBits;
  }

  MFB.cutValue = props.mc;

  p->writeEndMark = (BoolInt)props.writeEndMark;

  #ifndef Z7_ST
  /*
  if (newMultiThread != _multiThread)
  {
    ReleaseMatchFinder();
    _multiThread = newMultiThread;
  }
  */
  p->multiThread = (props.numThreads > 1);
  p->matchFinderMt.btSync.affinity =
  p->matchFinderMt.hashSync.affinity = props.affinity;
  #endif

  return SZ_OK;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movl $0x9, %ecx
movq %r14, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %r14, %rdi
callq 0x33112
movl 0x8(%r14), %ecx
movl 0xc(%r14), %edx
cmpl $0x9, %ecx
setge %al
cmpl $0x5, %edx
setge %dil
orb %al, %dil
movl 0x10(%r14), %esi
cmpl $0x5, %esi
setge %al
orb %dil, %al
movl $0x5, %eax
jne 0x33618
movl 0x4(%rsp), %eax
movl $0xf0000000, %edi       # imm = 0xF0000000
cmpl %edi, %eax
cmovbl %eax, %edi
movl %edi, 0x4(%rsp)
movl %edi, 0xf4(%rbx)
movl 0x18(%rsp), %edi
cmpl $0x6, %edi
movl $0x5, %eax
cmovbl %eax, %edi
movl $0x111, %r8d            # imm = 0x111
cmpl %r8d, %edi
cmovael %r8d, %edi
movl %edi, 0x48(%rbx)
movl %ecx, 0xbc(%rbx)
movl %edx, 0xc0(%rbx)
movl %esi, 0xc4(%rbx)
xorl %ecx, %ecx
cmpl $0x0, 0x14(%rsp)
sete %cl
movl %ecx, 0xcc(%rbx)
cmpl $0x0, 0x1c(%rsp)
setne 0x649(%rbx)
je 0x335c2
movl 0x20(%rsp), %edx
movl $0x2, %ecx
cmpl $0x2, %edx
jl 0x335c7
cmpl $0x4, %edx
movl $0x4, %ecx
cmovll %edx, %ecx
jmp 0x335c7
movl $0x4, %ecx
cmpl $0x5, 0x20(%rsp)
cmovll %ecx, %eax
movl %eax, 0x684(%rbx)
movb 0x24(%rsp), %al
movb %al, 0x699(%rbx)
movl 0x28(%rsp), %eax
movl %eax, 0x664(%rbx)
movl 0x2c(%rsp), %eax
movl %eax, 0xd0(%rbx)
xorl %eax, %eax
cmpl $0x2, 0x30(%rsp)
setge %al
movl %eax, 0xd8(%rbx)
movq 0x40(%rsp), %rax
movq %rax, 0x430(%rbx)
movq %rax, 0x168(%rbx)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r14
retq