// File: 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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x44(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x5c(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x58(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x54(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x50(%rax)
movq -0x8(%rbp), %rdi
addq $0x70, %rdi
callq 0x682d0
movl $0x0, -0xc(%rbp)
cmpl $0x10, -0xc(%rbp)
jae 0x67f99
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movw $0x400, 0x2200(%rax,%rcx,2) # imm = 0x400
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x67f77
movl $0x0, -0xc(%rbp)
cmpl $0xc, -0xc(%rbp)
jae 0x6804e
movl $0x0, -0x10(%rbp)
cmpl $0x10, -0x10(%rbp)
jae 0x67ffc
movq -0x8(%rbp), %rax
addq $0x2280, %rax           # imm = 0x2280
movl -0xc(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl -0x10(%rbp), %ecx
movw $0x400, (%rax,%rcx,2)   # imm = 0x400
movq -0x8(%rbp), %rax
addq $0x2400, %rax           # imm = 0x2400
movl -0xc(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl -0x10(%rbp), %ecx
movw $0x400, (%rax,%rcx,2)   # imm = 0x400
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x67fb1
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movw $0x400, 0x2220(%rax,%rcx,2) # imm = 0x400
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movw $0x400, 0x2238(%rax,%rcx,2) # imm = 0x400
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movw $0x400, 0x2250(%rax,%rcx,2) # imm = 0x400
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movw $0x400, 0x2268(%rax,%rcx,2) # imm = 0x400
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x67fa0
movl $0x0, -0xc(%rbp)
cmpl $0x4, -0xc(%rbp)
jae 0x680a5
movq -0x8(%rbp), %rax
addq $0x2580, %rax           # imm = 0x2580
movl -0xc(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x40, -0x1c(%rbp)
jae 0x68098
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
movw $0x400, (%rax,%rcx,2)   # imm = 0x400
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6807a
jmp 0x6809a
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x68055
movl $0x0, -0xc(%rbp)
cmpl $0x80, -0xc(%rbp)
jae 0x680d1
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
movw $0x400, 0x2780(%rax,%rcx,2) # imm = 0x400
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x680ac
movq -0x8(%rbp), %rax
movl 0xc0(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0xbc(%rcx), %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x300, %eax            # imm = 0x300
shlq %cl, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x6812f
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
movw $0x400, (%rax,%rcx,2)   # imm = 0x400
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x68109
movq -0x8(%rbp), %rdi
addq $0x2880, %rdi           # imm = 0x2880
callq 0x69f40
movq -0x8(%rbp), %rdi
addq $0x2c80, %rdi           # imm = 0x2C80
callq 0x69f40
movq -0x8(%rbp), %rax
movl $0x0, 0x34(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x30(%rax)
movl $0x0, -0xc(%rbp)
cmpl $0x800, -0xc(%rbp)      # imm = 0x800
jae 0x6819a
movq -0x8(%rbp), %rax
addq $0xf888, %rax           # imm = 0xF888
movl -0xc(%rbp), %ecx
shlq $0x5, %rcx
addq %rcx, %rax
movl $0x40000000, (%rax)     # imm = 0x40000000
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x6816c
movq -0x8(%rbp), %rax
movl $0x0, 0x4c(%rax)
movq -0x8(%rbp), %rax
movl 0xc4(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, %ecx
subl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x64(%rax)
movq -0x8(%rbp), %rax
movl 0xc0(%rax), %ecx
movl $0x100, %eax            # imm = 0x100
shll %cl, %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rax
movl 0xbc(%rax), %ecx
movl $0x100, %eax            # imm = 0x100
shrl %cl, %eax
movl -0x3c(%rbp), %ecx
subl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x60(%rax)
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)