// File: /workspace/github_cpp_makefile_star2_O3/sisong[P]ApkDiffPatch/lzma/C/LzmaEnc.c
// Function: LzmaEnc_AllocAndInit
static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
{
  unsigned i;
  for (i = kEndPosModelIndex / 2; i < kDicLogSizeMax; i++)
    if (p->dictSize <= ((UInt32)1 << i))
      break;
  p->distTableSize = i * 2;

  p->finished = False;
  p->result = SZ_OK;
  p->nowPos64 = 0;
  p->needInit = 1;
  RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig))
  LzmaEnc_Init(p);
  LzmaEnc_InitPrices(p);
  return SZ_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %rbx
movl 0xf4(%rdi), %eax
movl $0x7, %ecx
movl $0x1, %edx
shll %cl, %edx
cmpl %edx, %eax
jbe 0x33409
incl %ecx
cmpl $0x20, %ecx
jne 0x333f2
movl $0x20, %ecx
addl %ecx, %ecx
movl %ecx, 0xf0(%rbx)
xorl %r13d, %r13d
movl %r13d, 0xd4(%rbx)
movl %r13d, 0xf8(%rbx)
movq $0x0, 0xe0(%rbx)
movl $0x1, 0xdc(%rbx)
cmpq $0x0, 0x98(%rbx)
jne 0x33469
movl $0x10000, %esi          # imm = 0x10000
movq %r15, %rdi
callq *(%r15)
movq %rax, 0x98(%rbx)
testq %rax, %rax
je 0x335c9
addq $0x10000, %rax          # imm = 0x10000
movq %rax, 0x90(%rbx)
cmpl $0x0, 0xd8(%rbx)
je 0x33489
cmpl $0x0, 0xcc(%rbx)
jne 0x33489
xorl %r13d, %r13d
cmpb $0x0, 0x649(%rbx)
setne %r13b
movl %r13d, 0xfc(%rbx)
movl 0xc0(%rbx), %r12d
addl 0xbc(%rbx), %r12d
movq 0x68(%rbx), %rsi
testq %rsi, %rsi
je 0x334ba
cmpq $0x0, 0x1f888(%rbx)
je 0x334ba
cmpl %r12d, 0xc8(%rbx)
je 0x33529
movq %r15, %rdi
callq *0x8(%r15)
movq 0x1f888(%rbx), %rsi
movq %r15, %rdi
callq *0x8(%r15)
xorl %eax, %eax
movq %rax, 0x68(%rbx)
movq %rax, 0x1f888(%rbx)
movl $0x600, %r13d           # imm = 0x600
movl %r12d, %ecx
shlq %cl, %r13
movq %r15, %rdi
movq %r13, %rsi
callq *(%r15)
movq %rax, 0x68(%rbx)
movq %r15, %rdi
movq %r13, %rsi
callq *(%r15)
movq %rax, 0x1f888(%rbx)
movq 0x68(%rbx), %rsi
testq %rsi, %rsi
je 0x335a7
testq %rax, %rax
je 0x335a7
movl %r12d, 0xc8(%rbx)
movl 0xfc(%rbx), %r13d
movl 0xf4(%rbx), %esi
cmpl $0x1000001, %esi        # imm = 0x1000001
setae 0x64a(%rbx)
movl %esi, %eax
andl $0xbfffffff, %eax       # imm = 0xBFFFFFFF
xorl %ecx, %ecx
negl %eax
seto %cl
subl %ecx, %esi
movl $0x800, %eax            # imm = 0x800
leal (%rsi,%rax), %ecx
movl %ebp, %edx
subl %esi, %edx
cmpl %ebp, %ecx
cmovael %eax, %edx
testl %r13d, %r13d
je 0x335d0
leaq 0x100(%rbx), %r15
movl 0x48(%rbx), %ecx
movq %r15, %rdi
movl $0x112, %r8d            # imm = 0x112
movq %r14, %r9
callq 0x39d75
testl %eax, %eax
jne 0x33610
movq %r15, (%rbx)
cmpl $0xffffff, 0x660(%rbx)  # imm = 0xFFFFFF
setae 0x64a(%rbx)
leaq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x3a1e4
jmp 0x335fe
movq %r15, %rdi
callq *0x8(%r15)
movq 0x1f888(%rbx), %rsi
movq %r15, %rdi
callq *0x8(%r15)
xorl %eax, %eax
movq %rax, 0x68(%rbx)
movq %rax, 0x1f888(%rbx)
movl $0x2, %eax
jmp 0x33610
leaq 0x628(%rbx), %r15
movl 0x48(%rbx), %ecx
movq %r15, %rdi
movl $0x112, %r8d            # imm = 0x112
movq %r14, %r9
callq 0x3772b
testl %eax, %eax
je 0x335c9
movq %r15, (%rbx)
leaq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0x384b0
movq %rbx, %rdi
callq 0x337a7
movq %rbx, %rdi
callq 0x33c40
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq