// File: /workspace/github_c_makefile_star2_O0/snej[P]zdelta/deflate.c
// Function: zd_deflateReset
int ZEXPORT zd_deflateReset (strm)
    zd_streamp strm;
{
  deflate_state *s;
  int rw;

  if (strm == ZD_NULL || strm->state == ZD_NULL || 
      strm->zalloc == ZD_NULL || strm->zfree == ZD_NULL ||
      strm->refnum < 0 || strm->refnum > REFNUM) return ZD_STREAM_ERROR;

  strm->total_in = strm->total_out = 0;
  for(rw=0;rw<strm->refnum;++rw) strm->base_out[rw] = 0;

  strm->msg = ZD_NULL; /* use zfree if we ever allocate msg dynamically */
  strm->data_type = Z_UNKNOWN;

  s = (deflate_state *)strm->state;
  s->pending = 0;
  s->pending_out = s->pending_buf;

  if (s->noheader < 0) {
    s->noheader = 0; /* was set to -1 by deflate(..., ZD_FINISH); */
  }
  s->status = s->noheader ? BUSY_STATE : INIT_STATE;
  strm->adler = 1;
  s->last_flush = Z_NO_FLUSH;

  zd_tr_init(s);
  lm_init(s); 

  /* zdelta: initialize the reference hash tables here
   *         the first ref_window_size bytes are inserted 
   *         into the reference dictionary 
   */
  for(rw=0;rw<strm->refnum;++rw){
    if(strm->base_avail[rw] >= MIN_MATCH)  init_ref_window(s,rw);
  }

  /* zdelta: initialize the target hash table here;
   *         this will save us sliding an empty hash table!
   *         no insertions are done
   */
  
  if (strm->avail_in >= MIN_MATCH) 
    init_window(s);
  
  return ZD_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x1f38
movq -0x10(%rbp), %rax
cmpq $0x0, 0x58(%rax)
je 0x1f38
movq -0x10(%rbp), %rax
cmpq $0x0, 0x60(%rax)
je 0x1f38
movq -0x10(%rbp), %rax
cmpq $0x0, 0x68(%rax)
je 0x1f38
movq -0x10(%rbp), %rax
cmpl $0x0, 0x48(%rax)
jl 0x1f38
movq -0x10(%rbp), %rax
cmpl $0x1, 0x48(%rax)
jle 0x1f44
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x207e
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x10(%rbp), %rax
movq $0x0, 0x10(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jge 0x1f8b
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq $0x0, 0x38(%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1f63
movq -0x10(%rbp), %rax
movq $0x0, 0x50(%rax)
movq -0x10(%rbp), %rax
movl $0x2, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, 0x28(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jge 0x1fde
movq -0x18(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %edx
movl $0x2a, %ecx
movl $0x71, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq $0x1, 0x80(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x34(%rax)
movq -0x18(%rbp), %rdi
callq 0x71f0
movq -0x18(%rbp), %rdi
callq 0x2090
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x48(%rcx), %eax
jge 0x2064
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
cmpq $0x3, 0x40(%rax,%rcx,8)
jb 0x2057
movq -0x18(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x2290
jmp 0x2059
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x202f
movq -0x10(%rbp), %rax
cmpl $0x3, 0x8(%rax)
jb 0x2077
movq -0x18(%rbp), %rdi
callq 0x2460
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)