// File: /workspace/github_cpp_makefile_star2_O2/sisong[P]ApkDiffPatch/lzma/C/LzmaEnc.c
// Function: LzmaEnc_Init
static void LzmaEnc_Init(CLzmaEnc *p)
{
  unsigned i;
  p->state = 0;
  p->reps[0] =
  p->reps[1] =
  p->reps[2] =
  p->reps[3] = 1;

  RangeEnc_Init(&p->rc);

  for (i = 0; i < (1 << kNumAlignBits); i++)
    p->posAlignEncoder[i] = kProbInitValue;

  for (i = 0; i < kNumStates; i++)
  {
    unsigned j;
    for (j = 0; j < LZMA_NUM_PB_STATES_MAX; j++)
    {
      p->isMatch[i][j] = kProbInitValue;
      p->isRep0Long[i][j] = kProbInitValue;
    }
    p->isRep[i] = kProbInitValue;
    p->isRepG0[i] = kProbInitValue;
    p->isRepG1[i] = kProbInitValue;
    p->isRepG2[i] = kProbInitValue;
  }

  {
    for (i = 0; i < kNumLenToPosStates; i++)
    {
      CLzmaProb *probs = p->posSlotEncoder[i];
      unsigned j;
      for (j = 0; j < (1 << kNumPosSlotBits); j++)
        probs[j] = kProbInitValue;
    }
  }
  {
    for (i = 0; i < kNumFullDistances; i++)
      p->posEncoders[i] = kProbInitValue;
  }

  {
    const size_t num = (size_t)0x300 << (p->lp + p->lc);
    size_t k;
    CLzmaProb *probs = p->litProbs;
    for (k = 0; k < num; k++)
      probs[k] = kProbInitValue;
  }


  LenEnc_Init(&p->lenProbs);
  LenEnc_Init(&p->repLenProbs);

  p->optEnd = 0;
  p->optCur = 0;

  {
    for (i = 0; i < kNumOpts; i++)
      p->opt[i].price = kInfinityPrice;
  }

  p->additionalOffset = 0;

  p->pbMask = ((unsigned)1 << p->pb) - 1;
  p->lpMask = ((UInt32)0x100 << p->lp) - ((unsigned)0x100 >> p->lc);

  // p->mf_Failure = False;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
andl $0x0, 0x44(%rdi)
movaps 0x290e2(%rip), %xmm0    # 0x54a80
movups %xmm0, 0x50(%rdi)
orl $-0x1, 0x70(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x74(%rdi)
andl $0x0, 0x84(%rdi)
movq 0x98(%rdi), %rax
movq %rax, 0x88(%rdi)
andq $0x0, 0xa8(%rdi)
andl $0x0, 0xb0(%rdi)
xorl %eax, %eax
cmpq $0x10, %rax
je 0x2b9e8
movw $0x400, 0x2200(%rbx,%rax,2) # imm = 0x400
incq %rax
jmp 0x2b9d3
leaq 0x2400(%rbx), %rax
xorl %ecx, %ecx
movw $0x400, %dx             # imm = 0x400
cmpq $0xc, %rcx
je 0x2ba3d
xorl %esi, %esi
cmpq $0x10, %rsi
je 0x2ba14
movw %dx, -0x180(%rax,%rsi,2)
movw %dx, (%rax,%rsi,2)
incq %rsi
jmp 0x2b9fd
movw %dx, 0x2220(%rbx,%rcx,2)
movw %dx, 0x2238(%rbx,%rcx,2)
movw %dx, 0x2250(%rbx,%rcx,2)
movw %dx, 0x2268(%rbx,%rcx,2)
incq %rcx
addq $0x20, %rax
jmp 0x2b9f5
leaq 0x2580(%rbx), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x2ba68
xorl %edx, %edx
cmpq $0x40, %rdx
je 0x2ba5f
movw $0x400, (%rax,%rdx,2)   # imm = 0x400
incq %rdx
jmp 0x2ba4e
incq %rcx
subq $-0x80, %rax
jmp 0x2ba46
xorl %eax, %eax
cmpq $0x80, %rax
je 0x2ba81
movw $0x400, 0x2780(%rbx,%rax,2) # imm = 0x400
incq %rax
jmp 0x2ba6a
movl 0xbc(%rbx), %ecx
addl 0xc0(%rbx), %ecx
movl $0x300, %eax            # imm = 0x300
shlq %cl, %rax
movq 0x68(%rbx), %rcx
xorl %edx, %edx
cmpq %rdx, %rax
je 0x2baab
movw $0x400, (%rcx,%rdx,2)   # imm = 0x400
incq %rdx
jmp 0x2ba9b
leaq 0x2880(%rbx), %rdi
callq 0x2e2b2
leaq 0x2c80(%rbx), %rdi
callq 0x2e2b2
andq $0x0, 0x30(%rbx)
xorl %eax, %eax
cmpq $0x10000, %rax          # imm = 0x10000
je 0x2bae3
movl $0x40000000, 0xf888(%rbx,%rax) # imm = 0x40000000
addq $0x20, %rax
jmp 0x2baca
andl $0x0, 0x4c(%rbx)
movb 0xc4(%rbx), %cl
pushq $-0x1
popq %rax
shll %cl, %eax
notl %eax
movl %eax, 0x64(%rbx)
movb 0xbc(%rbx), %al
movb 0xc0(%rbx), %cl
movl $0x100, %edx            # imm = 0x100
movl $0x100, %esi            # imm = 0x100
shll %cl, %esi
movl %eax, %ecx
shrl %cl, %edx
subl %edx, %esi
movl %esi, 0x60(%rbx)
popq %rbx
retq