// File: /workspace/github_cpp_makefile_star2_O3/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)
movaps 0x2c1ad(%rip), %xmm0    # 0x5f960
movups %xmm0, 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)
movdqa 0x2c17e(%rip), %xmm0    # 0x5f970
movdqu %xmm0, 0x2200(%rdi)
movdqu %xmm0, 0x2210(%rdi)
leaq 0x2400(%rdi), %rcx
movw $0x400, %dx             # imm = 0x400
xorl %esi, %esi
movdqu %xmm0, -0x180(%rcx,%rsi,2)
movdqu %xmm0, (%rcx,%rsi,2)
addq $0x8, %rsi
cmpq $0x10, %rsi
jne 0x3380f
movw %dx, 0x2220(%rdi,%rax,2)
movw %dx, 0x2238(%rdi,%rax,2)
movw %dx, 0x2250(%rdi,%rax,2)
movw %dx, 0x2268(%rdi,%rax,2)
incq %rax
addq $0x20, %rcx
cmpq $0xc, %rax
jne 0x3380d
leaq 0x2580(%rdi), %rax
xorl %ecx, %ecx
xorl %edx, %edx
movdqu %xmm0, (%rax,%rdx,2)
addq $0x8, %rdx
cmpq $0x40, %rdx
jne 0x3385f
incq %rcx
subq $-0x80, %rax
cmpq $0x4, %rcx
jne 0x3385d
xorl %eax, %eax
movdqu %xmm0, 0x2780(%rdi,%rax,2)
addq $0x8, %rax
cmpq $0x80, %rax
jne 0x3387d
movl 0xc0(%rdi), %edx
movl 0xbc(%rdi), %eax
leal (%rax,%rdx), %ecx
cmpl $0x37, %ecx
ja 0x33b87
movq 0x68(%rdi), %rsi
movl $0x300, %r8d            # imm = 0x300
shlq %cl, %r8
cmpq $0x1, %r8
adcq $0x0, %r8
leaq 0x7(%r8), %rcx
andq $-0xf8, %rcx
decq %r8
movq %r8, %xmm1
pshufd $0x44, %xmm1, %xmm1     # xmm1 = xmm1[0,1,0,1]
movdqa 0x2c0a1(%rip), %xmm2    # 0x5f980
movdqa 0x2c0a9(%rip), %xmm3    # 0x5f990
movdqa 0x2c0b1(%rip), %xmm4    # 0x5f9a0
movdqa 0x2c0b9(%rip), %xmm5    # 0x5f9b0
xorl %r8d, %r8d
movdqa 0x2c0be(%rip), %xmm6    # 0x5f9c0
pxor %xmm6, %xmm1
pcmpeqd %xmm7, %xmm7
movdqa 0x2c0bd(%rip), %xmm8    # 0x5f9d0
movdqa %xmm5, %xmm9
pxor %xmm6, %xmm9
movdqa %xmm9, %xmm11
pcmpgtd %xmm1, %xmm11
pshufd $0xa0, %xmm11, %xmm10   # xmm10 = xmm11[0,0,2,2]
pshuflw $0xe8, %xmm10, %xmm12   # xmm12 = xmm10[0,2,2,3,4,5,6,7]
pcmpeqd %xmm1, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
pshuflw $0xe8, %xmm9, %xmm13    # xmm13 = xmm9[0,2,2,3,4,5,6,7]
pand %xmm12, %xmm13
pshufd $0xf5, %xmm11, %xmm11   # xmm11 = xmm11[1,1,3,3]
pshuflw $0xe8, %xmm11, %xmm12   # xmm12 = xmm11[0,2,2,3,4,5,6,7]
por %xmm13, %xmm12
pxor %xmm7, %xmm12
packssdw %xmm12, %xmm12
movd %xmm12, %r9d
testb $0x1, %r9b
je 0x33976
movw $0x400, (%rsi,%r8,2)    # imm = 0x400
pand %xmm10, %xmm9
por %xmm11, %xmm9
packssdw %xmm9, %xmm9
pxor %xmm7, %xmm9
packssdw %xmm9, %xmm9
movd %xmm9, %r9d
shrl $0x10, %r9d
testb $0x1, %r9b
je 0x339a6
movw $0x400, 0x2(%rsi,%r8,2) # imm = 0x400
movdqa %xmm4, %xmm10
pxor %xmm6, %xmm10
movdqa %xmm10, %xmm11
pcmpgtd %xmm1, %xmm11
pshufd $0xa0, %xmm11, %xmm9    # xmm9 = xmm11[0,0,2,2]
pcmpeqd %xmm1, %xmm10
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
movdqa %xmm10, %xmm12
pand %xmm9, %xmm12
pshufd $0xf5, %xmm11, %xmm11   # xmm11 = xmm11[1,1,3,3]
por %xmm11, %xmm12
packssdw %xmm12, %xmm12
pxor %xmm7, %xmm12
packssdw %xmm12, %xmm12
pextrw $0x2, %xmm12, %r9d
testb $0x1, %r9b
je 0x33a03
movw $0x400, 0x4(%rsi,%r8,2) # imm = 0x400
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm10, %xmm10   # xmm10 = xmm10[0,1,2,3,4,5,4,6]
pand %xmm9, %xmm10
pshufhw $0x84, %xmm11, %xmm9    # xmm9 = xmm11[0,1,2,3,4,5,4,6]
por %xmm10, %xmm9
pxor %xmm7, %xmm9
packssdw %xmm9, %xmm9
pextrw $0x3, %xmm9, %r9d
testb $0x1, %r9b
je 0x33a3d
movw $0x400, 0x6(%rsi,%r8,2) # imm = 0x400
movdqa %xmm3, %xmm9
pxor %xmm6, %xmm9
movdqa %xmm9, %xmm11
pcmpgtd %xmm1, %xmm11
pshufd $0xa0, %xmm11, %xmm10   # xmm10 = xmm11[0,0,2,2]
pshuflw $0xe8, %xmm10, %xmm12   # xmm12 = xmm10[0,2,2,3,4,5,6,7]
pcmpeqd %xmm1, %xmm9
pshufd $0xf5, %xmm9, %xmm9     # xmm9 = xmm9[1,1,3,3]
pshuflw $0xe8, %xmm9, %xmm13    # xmm13 = xmm9[0,2,2,3,4,5,6,7]
pand %xmm12, %xmm13
pshufd $0xf5, %xmm11, %xmm11   # xmm11 = xmm11[1,1,3,3]
pshuflw $0xe8, %xmm11, %xmm12   # xmm12 = xmm11[0,2,2,3,4,5,6,7]
por %xmm13, %xmm12
pxor %xmm7, %xmm12
packssdw %xmm12, %xmm12
pextrw $0x4, %xmm12, %r9d
testb $0x1, %r9b
je 0x33aa2
movw $0x400, 0x8(%rsi,%r8,2) # imm = 0x400
pand %xmm10, %xmm9
por %xmm11, %xmm9
packssdw %xmm9, %xmm9
pxor %xmm7, %xmm9
packssdw %xmm9, %xmm9
pextrw $0x5, %xmm9, %r9d
testb $0x1, %r9b
je 0x33acf
movw $0x400, 0xa(%rsi,%r8,2) # imm = 0x400
movdqa %xmm2, %xmm10
pxor %xmm6, %xmm10
movdqa %xmm10, %xmm11
pcmpgtd %xmm1, %xmm11
pshufd $0xa0, %xmm11, %xmm9    # xmm9 = xmm11[0,0,2,2]
pcmpeqd %xmm1, %xmm10
pshufd $0xf5, %xmm10, %xmm10   # xmm10 = xmm10[1,1,3,3]
movdqa %xmm10, %xmm12
pand %xmm9, %xmm12
pshufd $0xf5, %xmm11, %xmm11   # xmm11 = xmm11[1,1,3,3]
por %xmm11, %xmm12
packssdw %xmm12, %xmm12
pxor %xmm7, %xmm12
packssdw %xmm12, %xmm12
pextrw $0x6, %xmm12, %r9d
testb $0x1, %r9b
je 0x33b2c
movw $0x400, 0xc(%rsi,%r8,2) # imm = 0x400
pshufhw $0x84, %xmm9, %xmm9     # xmm9 = xmm9[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm10, %xmm10   # xmm10 = xmm10[0,1,2,3,4,5,4,6]
pand %xmm9, %xmm10
pshufhw $0x84, %xmm11, %xmm9    # xmm9 = xmm11[0,1,2,3,4,5,4,6]
por %xmm10, %xmm9
pxor %xmm7, %xmm9
packssdw %xmm9, %xmm9
pextrw $0x7, %xmm9, %r9d
testb $0x1, %r9b
je 0x33b66
movw $0x400, 0xe(%rsi,%r8,2) # imm = 0x400
addq $0x8, %r8
paddq %xmm8, %xmm5
paddq %xmm8, %xmm4
paddq %xmm8, %xmm3
paddq %xmm8, %xmm2
cmpq %r8, %rcx
jne 0x33913
xorl %ecx, %ecx
movdqu %xmm0, 0x2880(%rdi,%rcx,2)
addq $0x8, %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33b89
xorl %ecx, %ecx
movdqu %xmm0, 0x2a80(%rdi,%rcx,2)
addq $0x8, %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33ba1
xorl %ecx, %ecx
movdqu %xmm0, 0x2c80(%rdi,%rcx,2)
addq $0x8, %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33bb9
xorl %ecx, %ecx
movdqu %xmm0, 0x2e80(%rdi,%rcx,2)
addq $0x8, %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x33bd1
movq $0x0, 0x30(%rdi)
xorl %ecx, %ecx
movl $0x40000000, 0xf888(%rdi,%rcx) # imm = 0x40000000
addq $0x20, %rcx
cmpq $0x10000, %rcx          # imm = 0x10000
jne 0x33bf1
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