// File: tomfunkhouser[P]gaps/pkgs/png/pngread.c
// Function: png_read_destroy
void /* PRIVATE */
png_read_destroy(png_structp png_ptr, png_infop info_ptr,
    png_infop end_info_ptr)
{
#ifdef PNG_SETJMP_SUPPORTED
   jmp_buf tmp_jmp;
#endif
   png_error_ptr error_fn;
   png_error_ptr warning_fn;
   png_voidp error_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
   png_free_ptr free_fn;
#endif

   png_debug(1, "in png_read_destroy");
 
   if (info_ptr != NULL)
      png_info_destroy(png_ptr, info_ptr);

   if (end_info_ptr != NULL)
      png_info_destroy(png_ptr, end_info_ptr);

   png_free(png_ptr, png_ptr->zbuf);
   png_free(png_ptr, png_ptr->big_row_buf);
   png_free(png_ptr, png_ptr->prev_row);
   png_free(png_ptr, png_ptr->chunkdata);
#ifdef PNG_READ_QUANTIZE_SUPPORTED
   png_free(png_ptr, png_ptr->palette_lookup);
   png_free(png_ptr, png_ptr->quantize_index);
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
   png_free(png_ptr, png_ptr->gamma_table);
#endif
#ifdef PNG_READ_BACKGROUND_SUPPORTED
   png_free(png_ptr, png_ptr->gamma_from_1);
   png_free(png_ptr, png_ptr->gamma_to_1);
#endif
   if (png_ptr->free_me & PNG_FREE_PLTE)
      png_zfree(png_ptr, png_ptr->palette);
   png_ptr->free_me &= ~PNG_FREE_PLTE;
#if defined(PNG_tRNS_SUPPORTED) || \
    defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
   if (png_ptr->free_me & PNG_FREE_TRNS)
      png_free(png_ptr, png_ptr->trans_alpha);
   png_ptr->free_me &= ~PNG_FREE_TRNS;
#endif
#ifdef PNG_READ_hIST_SUPPORTED
   if (png_ptr->free_me & PNG_FREE_HIST)
      png_free(png_ptr, png_ptr->hist);
   png_ptr->free_me &= ~PNG_FREE_HIST;
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
   if (png_ptr->gamma_16_table != NULL)
   {
      int i;
      int istop = (1 << (8 - png_ptr->gamma_shift));
      for (i = 0; i < istop; i++)
      {
         png_free(png_ptr, png_ptr->gamma_16_table[i]);
      }
   png_free(png_ptr, png_ptr->gamma_16_table);
   }
#ifdef PNG_READ_BACKGROUND_SUPPORTED
   if (png_ptr->gamma_16_from_1 != NULL)
   {
      int i;
      int istop = (1 << (8 - png_ptr->gamma_shift));
      for (i = 0; i < istop; i++)
      {
         png_free(png_ptr, png_ptr->gamma_16_from_1[i]);
      }
   png_free(png_ptr, png_ptr->gamma_16_from_1);
   }
   if (png_ptr->gamma_16_to_1 != NULL)
   {
      int i;
      int istop = (1 << (8 - png_ptr->gamma_shift));
      for (i = 0; i < istop; i++)
      {
         png_free(png_ptr, png_ptr->gamma_16_to_1[i]);
      }
   png_free(png_ptr, png_ptr->gamma_16_to_1);
   }
#endif
#endif
#ifdef PNG_TIME_RFC1123_SUPPORTED
   png_free(png_ptr, png_ptr->time_buffer);
#endif

   inflateEnd(&png_ptr->zstream);
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
   png_free(png_ptr, png_ptr->save_buffer);
#endif

#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
#ifdef PNG_TEXT_SUPPORTED
   png_free(png_ptr, png_ptr->current_text);
#endif /* PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */

   /* Save the important info out of the png_struct, in case it is
    * being used again.
    */
#ifdef PNG_SETJMP_SUPPORTED
   png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
#endif

   error_fn = png_ptr->error_fn;
   warning_fn = png_ptr->warning_fn;
   error_ptr = png_ptr->error_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
   free_fn = png_ptr->free_fn;
#endif

   png_memset(png_ptr, 0, png_sizeof(png_struct));

   png_ptr->error_fn = error_fn;
   png_ptr->warning_fn = warning_fn;
   png_ptr->error_ptr = error_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
   png_ptr->free_fn = free_fn;
#endif

#ifdef PNG_SETJMP_SUPPORTED
   png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
#endif

}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movq %rdx, 0x110(%rsp)
cmpq $0x0, 0x118(%rsp)
je 0x102cff
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0xfb980
cmpq $0x0, 0x110(%rsp)
je 0x102d1f
movq 0x120(%rsp), %rdi
movq 0x110(%rsp), %rsi
callq 0xfb980
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x198(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x430(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x1e8(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x488(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x388(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x390(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x298(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2a0(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2a8(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rax
movl 0x3d8(%rax), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x102e4f
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x238(%rax), %rsi
callq 0xfb710
movq 0x120(%rsp), %rax
movl 0x3d8(%rax), %ecx
andl $0xffffefff, %ecx       # imm = 0xFFFFEFFF
movl %ecx, 0x3d8(%rax)
movq 0x120(%rsp), %rax
movl 0x3d8(%rax), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
je 0x102e9d
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2d8(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rax
movl 0x3d8(%rax), %ecx
andl $0xffffdfff, %ecx       # imm = 0xFFFFDFFF
movl %ecx, 0x3d8(%rax)
movq 0x120(%rsp), %rax
movl 0x3d8(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x102ee9
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x398(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rax
movl 0x3d8(%rax), %ecx
andl $-0x9, %ecx
movl %ecx, 0x3d8(%rax)
movq 0x120(%rsp), %rax
cmpq $0x0, 0x2b0(%rax)
je 0x102f90
movq 0x120(%rsp), %rax
movl $0x8, %ecx
subl 0x288(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x18(%rsp)
movl $0x0, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x18(%rsp), %eax
jge 0x102f74
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2b0(%rax), %rax
movslq 0x1c(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x1136d0
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
jmp 0x102f38
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2b0(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rax
cmpq $0x0, 0x2b8(%rax)
je 0x103020
movq 0x120(%rsp), %rax
movl $0x8, %ecx
subl 0x288(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x10(%rsp), %eax
jge 0x103004
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2b8(%rax), %rax
movslq 0x14(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x1136d0
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x102fc8
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2b8(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rax
cmpq $0x0, 0x2c0(%rax)
je 0x1030b0
movq 0x120(%rsp), %rax
movl $0x8, %ecx
subl 0x288(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x8(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x8(%rsp), %eax
jge 0x103094
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2c0(%rax), %rax
movslq 0xc(%rsp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x1136d0
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x103058
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x2c0(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x3d0(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
addq $0x128, %rdi            # imm = 0x128
callq 0x11daf0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x320(%rax), %rsi
callq 0x1136d0
movq 0x120(%rsp), %rdi
movq 0x120(%rsp), %rax
movq 0x378(%rax), %rsi
callq 0x1136d0
leaq 0x40(%rsp), %rdi
movq 0x120(%rsp), %rsi
movl $0xc8, %edx
callq 0xf3d0
movq 0x120(%rsp), %rax
movq 0xd0(%rax), %rax
movq %rax, 0x38(%rsp)
movq 0x120(%rsp), %rax
movq 0xd8(%rax), %rax
movq %rax, 0x30(%rsp)
movq 0x120(%rsp), %rax
movq 0xe0(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x120(%rsp), %rax
movq 0x428(%rax), %rax
movq %rax, 0x20(%rsp)
movq 0x120(%rsp), %rdi
xorl %esi, %esi
movl $0x498, %edx            # imm = 0x498
callq 0xf280
movq 0x38(%rsp), %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0xd0(%rax)
movq 0x30(%rsp), %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0xd8(%rax)
movq 0x28(%rsp), %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0xe0(%rax)
movq 0x20(%rsp), %rcx
movq 0x120(%rsp), %rax
movq %rcx, 0x428(%rax)
movq 0x120(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movl $0xc8, %edx
callq 0xf3d0
addq $0x128, %rsp            # imm = 0x128
retq
nopw %cs:(%rax,%rax)