// File: sisong[P]ApkDiffPatch/lzma/C/LzmaEnc.c
// Function: LenEnc_Encode
static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, unsigned posState)
{
  UInt32 range, ttt, newBound;
  CLzmaProb *probs = p->low;
  range = rc->range;
  RC_BIT_PRE(rc, probs)
  if (sym >= kLenNumLowSymbols)
  {
    RC_BIT_1(rc, probs)
    probs += kLenNumLowSymbols;
    RC_BIT_PRE(rc, probs)
    if (sym >= kLenNumLowSymbols * 2)
    {
      RC_BIT_1(rc, probs)
      rc->range = range;
      // RcTree_Encode(rc, p->high, kLenNumHighBits, sym - kLenNumLowSymbols * 2);
      LitEnc_Encode(rc, p->high, sym - kLenNumLowSymbols * 2);
      return;
    }
    sym -= kLenNumLowSymbols;
  }

  // RcTree_Encode(rc, probs + (posState << kLenNumLowBits), kLenNumLowBits, sym);
  {
    unsigned m;
    unsigned bit;
    RC_BIT_0(rc, probs)
    probs += (posState << (1 + kLenNumLowBits));
    bit = (sym >> 2)    ; RC_BIT(rc, probs + 1, bit)  m = (1 << 1) + bit;
    bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit)  m = (m << 1) + bit;
    bit =  sym       & 1; RC_BIT(rc, probs + m, bit)
    rc->range = range;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x30(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0xb, %eax
imull -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x8, -0x14(%rbp)
jb 0x6deca
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x20(%rbp), %eax
movl -0x20(%rbp), %ecx
shrl $0x5, %ecx
subl %ecx, %eax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, (%rax)
cmpl $0x1000000, -0x1c(%rbp) # imm = 0x1000000
jae 0x6de24
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6db00
movq -0x30(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0xb, %eax
imull -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x10, -0x14(%rbp)
jb 0x6dec1
movl -0x24(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x20(%rbp), %eax
movl -0x20(%rbp), %ecx
shrl $0x5, %ecx
subl %ecx, %eax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, (%rax)
cmpl $0x1000000, -0x1c(%rbp) # imm = 0x1000000
jae 0x6de99
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6db00
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x200, %rsi            # imm = 0x200
movl -0x14(%rbp), %edx
subl $0x10, %edx
callq 0x6ae70
jmp 0x6e16e
movl -0x14(%rbp), %eax
subl $0x8, %eax
movl %eax, -0x14(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x20(%rbp), %eax
movl $0x800, %ecx            # imm = 0x800
subl -0x20(%rbp), %ecx
shrl $0x5, %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, (%rax)
cmpl $0x1000000, -0x1c(%rbp) # imm = 0x1000000
jae 0x6df05
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6db00
movl -0x18(%rbp), %ecx
shll $0x4, %ecx
movq -0x30(%rbp), %rax
movl %ecx, %ecx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
shrl $0x2, %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movzwl 0x2(%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0xb, %eax
imull -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
subl -0x38(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
andl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
andl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x38(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x24(%rbp), %eax
andl -0x3c(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x3c(%rbp), %eax
andl $0x7e1, %eax            # imm = 0x7E1
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
addl $0x1f, %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
subl -0x20(%rbp), %eax
sarl $0x5, %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, 0x2(%rax)
cmpl $0x1000000, -0x1c(%rbp) # imm = 0x1000000
jae 0x6dfd3
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6db00
movl -0x38(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x34(%rbp)
movl -0x14(%rbp), %eax
shrl %eax
andl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0xb, %eax
imull -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
subl -0x38(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
andl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
andl -0x40(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x40(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x38(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
movl -0x24(%rbp), %eax
andl -0x40(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x40(%rbp), %eax
andl $0x7e1, %eax            # imm = 0x7E1
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
addl $0x1f, %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
subl -0x20(%rbp), %eax
sarl $0x5, %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movw %ax, %dx
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
movw %dx, (%rax,%rcx,2)
cmpl $0x1000000, -0x1c(%rbp) # imm = 0x1000000
jae 0x6e09c
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6db00
movl -0x34(%rbp), %eax
shll %eax
addl -0x38(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x14(%rbp), %eax
andl $0x1, %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
movzwl (%rax,%rcx,2), %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
shrl $0xb, %eax
imull -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
subl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
andl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
andl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %ecx
movl -0x1c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x44(%rbp), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
addq 0x8(%rax), %rcx
movq %rcx, 0x8(%rax)
movl -0x38(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
movl -0x24(%rbp), %eax
andl -0x44(%rbp), %eax
addl -0x1c(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x44(%rbp), %eax
andl $0x7e1, %eax            # imm = 0x7E1
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl $0x1f, %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
subl -0x20(%rbp), %eax
sarl $0x5, %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movw %ax, %dx
movq -0x30(%rbp), %rax
movl -0x34(%rbp), %ecx
movw %dx, (%rax,%rcx,2)
cmpl $0x1000000, -0x1c(%rbp) # imm = 0x1000000
jae 0x6e165
movl -0x1c(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6db00
movl -0x1c(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)