// File: /workspace/github_c_makefile_star2_O0/snej[P]zdelta/inftrees.c
// Function: inflate_trees_dynamic
int inflate_trees_dynamic(nl, nd, nzd, c, bl, bd, bzd, tl, td, tzd, hp, z)
uInt nl;                /* number of literal/length codes */
uInt nd;                /* number of distance codes */
uInt nzd;               /* number of zdelta  codes */
uIntf *c;               /* that many (total) code lengths */
uIntf *bl;              /* literal desired/actual bit depth */
uIntf *bd;              /* distance desired/actual bit depth */
uIntf *bzd;             /* zdelta codes desired/actual bit depth */
inflate_huft * FAR *tl; /* literal/length tree result */
inflate_huft * FAR *td; /* distance tree result */
inflate_huft * FAR *tzd;/* zdelta flags tree result */
inflate_huft *hp;       /* space for trees */
zd_streamp z;            /* for messages */
{
  int r;
  uInt hn = 0;          /* hufts used in space */
  uIntf *v;             /* work area for huft_build */

  /* allocate work area */
  if ((v = (uIntf*)ZALLOC(z, MAX_CODES, sizeof(uInt))) == ZD_NULL)
    return ZD_MEM_ERROR;

  /* build literal/length tree */
  r = huft_build(c, nl, 0, cplens, cplext, tl, bl, hp, &hn, v);
  if (r != ZD_OK || *bl == 0)
  {
    if (r == ZD_DATA_ERROR)
      z->msg = (char*)"oversubscribed length trees";
    else if (r != ZD_MEM_ERROR)
    {
      z->msg = (char*)"incomplete length trees";
      r = ZD_DATA_ERROR;
    }
    ZFREE(z, v);
    return r;
  }

  /* build distance tree */
  r = huft_build(c + nl, nd, 257, cpdist, cpdext, td, bd, hp, &hn, v);
  if (r != ZD_OK || (*bd == 0 && nl > 257))
  {
    if (r == ZD_DATA_ERROR)
      z->msg = (char*)"oversubscribed literal/distance tree";
    else if (r == ZD_BUF_ERROR) {
#ifdef PKZIP_BUG_WORKAROUND
      r = ZD_OK;
    }
#else
      z->msg = (char*)"incomplete literal/distance tree";
      r = ZD_DATA_ERROR;
    }
    else if (r != ZD_MEM_ERROR)
    {
      z->msg = (char*)"empty literal/distance tree with lengths";
      r = ZD_DATA_ERROR;
    }
    ZFREE(z, v);
    return r;
#endif
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x58, %rsp
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movl %edi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movl $0x0, -0x38(%rbp)
movq 0x38(%rbp), %rax
movq 0x60(%rax), %rax
movq 0x38(%rbp), %rcx
movq 0x70(%rcx), %rdi
movl $0x120, %esi            # imm = 0x120
movl $0x4, %edx
callq *%rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0xfaef
movl $0xfffffffc, -0xc(%rbp) # imm = 0xFFFFFFFC
jmp 0xfcaf
movq -0x20(%rbp), %rdi
movl -0x10(%rbp), %esi
movq 0x18(%rbp), %r9
movq -0x28(%rbp), %rbx
movq 0x30(%rbp), %r11
movq -0x40(%rbp), %rax
xorl %edx, %edx
leaq 0x1671(%rip), %rcx      # 0x11180
leaq 0x182a(%rip), %r8       # 0x11340
leaq -0x38(%rbp), %r10
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0xefc0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xfb44
movq -0x28(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xfb9a
cmpl $-0x3, -0x34(%rbp)
jne 0xfb5b
movq 0x38(%rbp), %rax
leaq 0x22f7(%rip), %rcx      # 0x11e4c
movq %rcx, 0x50(%rax)
jmp 0xfb79
cmpl $-0x4, -0x34(%rbp)
je 0xfb77
movq 0x38(%rbp), %rax
leaq 0x22fc(%rip), %rcx      # 0x11e68
movq %rcx, 0x50(%rax)
movl $0xfffffffd, -0x34(%rbp) # imm = 0xFFFFFFFD
jmp 0xfb79
movq 0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x38(%rbp), %rcx
movq 0x70(%rcx), %rdi
movq -0x40(%rbp), %rsi
callq *%rax
movl -0x34(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xfcaf
movq -0x20(%rbp), %rdi
movl -0x10(%rbp), %eax
shlq $0x2, %rax
addq %rax, %rdi
movl -0x14(%rbp), %esi
movq 0x20(%rbp), %r9
movq -0x30(%rbp), %rbx
movq 0x30(%rbp), %r11
movq -0x40(%rbp), %rax
movl $0x101, %edx            # imm = 0x101
leaq 0x1939(%rip), %rcx      # 0x11500
leaq 0x1db2(%rip), %r8       # 0x11980
leaq -0x38(%rbp), %r10
movq %rbx, (%rsp)
movq %r11, 0x8(%rsp)
movq %r10, 0x10(%rsp)
movq %rax, 0x18(%rsp)
callq 0xefc0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xfc05
movq -0x30(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xfc78
cmpl $0x101, -0x10(%rbp)     # imm = 0x101
jbe 0xfc78
cmpl $-0x3, -0x34(%rbp)
jne 0xfc1c
movq 0x38(%rbp), %rax
leaq 0x226a(%rip), %rcx      # 0x11e80
movq %rcx, 0x50(%rax)
jmp 0xfc5a
cmpl $-0x5, -0x34(%rbp)
jne 0xfc3a
movq 0x38(%rbp), %rax
leaq 0x2278(%rip), %rcx      # 0x11ea5
movq %rcx, 0x50(%rax)
movl $0xfffffffd, -0x34(%rbp) # imm = 0xFFFFFFFD
jmp 0xfc58
cmpl $-0x4, -0x34(%rbp)
je 0xfc56
movq 0x38(%rbp), %rax
leaq 0x227b(%rip), %rcx      # 0x11ec6
movq %rcx, 0x50(%rax)
movl $0xfffffffd, -0x34(%rbp) # imm = 0xFFFFFFFD
jmp 0xfc58
jmp 0xfc5a
movq 0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x38(%rbp), %rcx
movq 0x70(%rcx), %rdi
movq -0x40(%rbp), %rsi
callq *%rax
movl -0x34(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xfcaf
movl 0x451a(%rip), %ecx      # 0x14198
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movq 0x28(%rbp), %rax
leaq 0x6511(%rip), %rcx      # 0x161a0
movq %rcx, (%rax)
movq 0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x38(%rbp), %rcx
movq 0x70(%rcx), %rdi
movq -0x40(%rbp), %rsi
callq *%rax
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
addq $0x58, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)