// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/png/pngwrite.c
// Function: png_write_destroy
void /* PRIVATE */
png_write_destroy(png_structp png_ptr)
{
#ifdef PNG_SETJMP_SUPPORTED
   jmp_buf tmp_jmp; /* Save jump buffer */
#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_write_destroy");

   /* Free any memory zlib uses */
   deflateEnd(&png_ptr->zstream);

   /* Free our memory.  png_free checks NULL for us. */
   png_free(png_ptr, png_ptr->zbuf);
   png_free(png_ptr, png_ptr->row_buf);
#ifdef PNG_WRITE_FILTER_SUPPORTED
   png_free(png_ptr, png_ptr->prev_row);
   png_free(png_ptr, png_ptr->sub_row);
   png_free(png_ptr, png_ptr->up_row);
   png_free(png_ptr, png_ptr->avg_row);
   png_free(png_ptr, png_ptr->paeth_row);
#endif

#ifdef PNG_TIME_RFC1123_SUPPORTED
   png_free(png_ptr, png_ptr->time_buffer);
#endif

#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
   png_free(png_ptr, png_ptr->prev_filters);
   png_free(png_ptr, png_ptr->filter_weights);
   png_free(png_ptr, png_ptr->inv_filter_weights);
   png_free(png_ptr, png_ptr->filter_costs);
   png_free(png_ptr, png_ptr->inv_filter_costs);
#endif

#ifdef PNG_SETJMP_SUPPORTED
   /* Reset structure */
   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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
addq $0x128, %rdi            # imm = 0x128
callq 0x852ab
movq 0x198(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x1f0(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x1e8(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x1f8(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x200(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x208(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x210(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x3d0(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x3a8(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x3b0(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x3b8(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x3c0(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
movq 0x3c8(%rbx), %rsi
movq %rbx, %rdi
callq 0x84923
leaq 0x10(%rsp), %r14
movl $0xc8, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xe380
movq 0xe0(%rbx), %r15
movq 0x428(%rbx), %r12
leaq 0xc8(%rbx), %rdi
movups 0xd0(%rbx), %xmm0
movaps %xmm0, (%rsp)
movl $0x3d0, %edx            # imm = 0x3D0
xorl %esi, %esi
callq 0xe270
movaps (%rsp), %xmm0
movups %xmm0, 0xd0(%rbx)
movq %r15, 0xe0(%rbx)
movq %r12, 0x428(%rbx)
movl $0xc8, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0xe380
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq