// File: /workspace/github_cpp_makefile_star2_O1/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:
xorl %eax, %eax
movl %eax, 0x44(%rdi)
movabsq $0x100000001, %rcx      # imm = 0x100000001
movq %rcx, 0x58(%rdi)
movq %rcx, 0x50(%rdi)
movl $0xffffffff, 0x70(%rdi) # imm = 0xFFFFFFFF
xorps %xmm0, %xmm0
movups %xmm0, 0x74(%rdi)
movl %eax, 0x84(%rdi)
movq 0x98(%rdi), %rcx
movq %rcx, 0x88(%rdi)
movq $0x0, 0xa8(%rdi)
movl %eax, 0xb0(%rdi)
movw $0x400, 0x2200(%rdi,%rax,2) # imm = 0x400
incq %rax
cmpq $0x10, %rax
jne 0x33c17
leaq 0x2400(%rdi), %rax
xorl %ecx, %ecx
movw $0x400, %dx             # imm = 0x400
xorl %esi, %esi
movw %dx, -0x180(%rax,%rsi,2)
movw %dx, (%rax,%rsi,2)
incq %rsi
cmpq $0x10, %rsi
jne 0x33c39
movw %dx, 0x2220(%rdi,%rcx,2)
movw %dx, 0x2238(%rdi,%rcx,2)
movw %dx, 0x2250(%rdi,%rcx,2)
movw %dx, 0x2268(%rdi,%rcx,2)
incq %rcx
addq $0x20, %rax
cmpq $0xc, %rcx
jne 0x33c37
leaq 0x2580(%rdi), %rax
xorl %ecx, %ecx
xorl %edx, %edx
movw $0x400, (%rax,%rdx,2)   # imm = 0x400
incq %rdx
cmpq $0x40, %rdx
jne 0x33c86
incq %rcx
subq $-0x80, %rax
cmpq $0x4, %rcx
jne 0x33c84
xorl %eax, %eax
movw $0x400, 0x2780(%rdi,%rax,2) # imm = 0x400
incq %rax
cmpq $0x80, %rax
jne 0x33ca4
movl 0xc0(%rdi), %edx
movl 0xbc(%rdi), %eax
leal (%rax,%rdx), %ecx
cmpl $0x37, %ecx
ja 0x33cf2
movq 0x68(%rdi), %rsi
movl $0x300, %r8d            # imm = 0x300
shlq %cl, %r8
cmpq $0x1, %r8
adcq $0x0, %r8
xorl %ecx, %ecx
movw $0x400, (%rsi,%rcx,2)   # imm = 0x400
incq %rcx
cmpq %rcx, %r8
jne 0x33ce4
xorl %ecx, %ecx
movw $0x400, 0x2880(%rdi,%rcx,2) # imm = 0x400
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33cf4
xorl %ecx, %ecx
movw $0x400, 0x2a80(%rdi,%rcx,2) # imm = 0x400
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33d0c
xorl %ecx, %ecx
movw $0x400, 0x2c80(%rdi,%rcx,2) # imm = 0x400
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33d24
xorl %ecx, %ecx
movw $0x400, 0x2e80(%rdi,%rcx,2) # imm = 0x400
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33d3c
movq $0x0, 0x30(%rdi)
xorl %ecx, %ecx
movl $0x40000000, 0xf888(%rdi,%rcx) # imm = 0x40000000
addq $0x20, %rcx
cmpq $0x10000, %rcx          # imm = 0x10000
jne 0x33d5c
movl $0x0, 0x4c(%rdi)
movb 0xc4(%rdi), %cl
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shll %cl, %esi
movl $0x100, %r8d            # imm = 0x100
movl $0x100, %r9d            # imm = 0x100
movl %edx, %ecx
shll %cl, %r9d
movl %eax, %ecx
shrl %cl, %r8d
notl %esi
movl %esi, 0x64(%rdi)
subl %r8d, %r9d
movl %r9d, 0x60(%rdi)
retq