// File: /workspace/github_c_makefile_star2_O0/snej[P]zdelta/inflate.c
// Function: zd_inflateInit2_
int ZEXPORT zd_inflateInit2_(z, w, version, stream_size)
     zd_streamp z;
     int w;
     const char *version;
     int stream_size;
{
  if (version == ZD_NULL || version[0] != ZDLIB_VERSION[0] ||
      stream_size != sizeof(zd_stream))
    return ZD_VERSION_ERROR;
  
  /* initialize state */
  if (z == ZD_NULL || z->refnum<0 || z->refnum>REFNUM)
    return ZD_STREAM_ERROR;
  z->msg = ZD_NULL;
  if (z->zalloc == ZD_NULL)
  {
    z->zalloc = zd_zcalloc;
    z->opaque = (voidpf)0;
  }
  if (z->zfree == ZD_NULL) z->zfree = zd_zcfree;
  if ((z->state = (struct zd_internal_state FAR *)
       ZALLOC(z,1,sizeof(struct zd_internal_state))) == ZD_NULL)
    return ZD_MEM_ERROR;
  z->state->blocks = ZD_NULL;

  /* suppress zdlib header or check at compile time */
#ifdef NO_ERROR_CHECK
  z->state->nowrap = 1;
#else
  z->state->nowrap = 0;
#endif

  /* handle undocumented nowrap option (no zdlib header or check) */
  if (w < 0)
  {
    w = - w;
    z->state->nowrap = 1;
  }

  /* set window size */
  if (w < 8 || w > 15)
  {
    zd_inflateEnd(z);
    return ZD_STREAM_ERROR;
  }
  z->state->wbits = (uInt)w;

  /* create inflate_blocks state */
  if ((z->state->blocks =
       inflate_blocks_new(z, z->state->nowrap ? ZD_NULL : zd_adler32,
			  (uInt)1 << w)) == ZD_NULL)
  {
    zd_inflateEnd(z);
    return ZD_MEM_ERROR;
  }
  Tracev((stderr, "inflate: allocated\n"));
  
  /* reset state */
  zd_inflateReset(z);

  return ZD_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x695b
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
movsbl 0x9780(%rip), %ecx      # 0x100cb
cmpl %ecx, %eax
jne 0x695b
movslq -0x24(%rbp), %rax
cmpq $0x90, %rax
je 0x6967
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0x6ada
cmpq $0x0, -0x10(%rbp)
je 0x6982
movq -0x10(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jl 0x6982
movq -0x10(%rbp), %rax
cmpl $0x1, 0x48(%rax)
jle 0x698e
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x6ada
movq -0x10(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
jne 0x69c0
movq -0x10(%rbp), %rax
leaq 0x43c0(%rip), %rcx      # 0xad70
movq %rcx, 0x60(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x70(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
jne 0x69da
movq -0x10(%rbp), %rax
leaq 0x43da(%rip), %rcx      # 0xadb0
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x70(%rcx), %rdi
movl $0x1, %esi
movl $0x28, %edx
callq *%rax
movq -0x10(%rbp), %rcx
movq %rax, 0x58(%rcx)
cmpq $0x0, %rax
jne 0x6a10
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x6ada
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x0, 0x18(%rax)
cmpl $0x0, -0x14(%rbp)
jge 0x6a4c
xorl %eax, %eax
subl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl $0x1, 0x18(%rax)
cmpl $0x8, -0x14(%rbp)
jl 0x6a58
cmpl $0xf, -0x14(%rbp)
jle 0x6a6a
movq -0x10(%rbp), %rdi
callq 0x6890
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x6ada
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movl 0x18(%rax), %ecx
leaq 0x4352(%rip), %rsi      # 0xade0
xorl %eax, %eax
cmpl $0x0, %ecx
cmovneq %rax, %rsi
movl -0x14(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
callq 0xb1f0
movq -0x10(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq %rax, 0x20(%rcx)
cmpq $0x0, %rax
jne 0x6aca
movq -0x10(%rbp), %rdi
callq 0x6890
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0x6ada
movq -0x10(%rbp), %rdi
callq 0x67e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)