// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/png/png.c
// Function: png_free_data
void PNGAPI
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
   int num)
{
   png_debug(1, "in png_free_data");

   if (png_ptr == NULL || info_ptr == NULL)
      return;

#ifdef PNG_TEXT_SUPPORTED
   /* Free text item num or (if num == -1) all text items */
   if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
   {
      if (num != -1)
      {
         if (info_ptr->text && info_ptr->text[num].key)
         {
            png_free(png_ptr, info_ptr->text[num].key);
            info_ptr->text[num].key = NULL;
         }
      }
      else
      {
         int i;
         for (i = 0; i < info_ptr->num_text; i++)
             png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, i);
         png_free(png_ptr, info_ptr->text);
         info_ptr->text = NULL;
         info_ptr->num_text=0;
      }
   }
#endif

#ifdef PNG_tRNS_SUPPORTED
   /* Free any tRNS entry */
   if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
   {
      png_free(png_ptr, info_ptr->trans_alpha);
      info_ptr->trans_alpha = NULL;
      info_ptr->valid &= ~PNG_INFO_tRNS;
   }
#endif

#ifdef PNG_sCAL_SUPPORTED
   /* Free any sCAL entry */
   if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
   {
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
      png_free(png_ptr, info_ptr->scal_s_width);
      png_free(png_ptr, info_ptr->scal_s_height);
      info_ptr->scal_s_width = NULL;
      info_ptr->scal_s_height = NULL;
#endif
      info_ptr->valid &= ~PNG_INFO_sCAL;
   }
#endif

#ifdef PNG_pCAL_SUPPORTED
   /* Free any pCAL entry */
   if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
   {
      png_free(png_ptr, info_ptr->pcal_purpose);
      png_free(png_ptr, info_ptr->pcal_units);
      info_ptr->pcal_purpose = NULL;
      info_ptr->pcal_units = NULL;
      if (info_ptr->pcal_params != NULL)
         {
            int i;
            for (i = 0; i < (int)info_ptr->pcal_nparams; i++)
            {
               png_free(png_ptr, info_ptr->pcal_params[i]);
               info_ptr->pcal_params[i] = NULL;
            }
            png_free(png_ptr, info_ptr->pcal_params);
            info_ptr->pcal_params = NULL;
         }
      info_ptr->valid &= ~PNG_INFO_pCAL;
   }
#endif

#ifdef PNG_iCCP_SUPPORTED
   /* Free any iCCP entry */
   if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
   {
      png_free(png_ptr, info_ptr->iccp_name);
      png_free(png_ptr, info_ptr->iccp_profile);
      info_ptr->iccp_name = NULL;
      info_ptr->iccp_profile = NULL;
      info_ptr->valid &= ~PNG_INFO_iCCP;
   }
#endif

#ifdef PNG_sPLT_SUPPORTED
   /* Free a given sPLT entry, or (if num == -1) all sPLT entries */
   if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
   {
      if (num != -1)
      {
         if (info_ptr->splt_palettes)
         {
            png_free(png_ptr, info_ptr->splt_palettes[num].name);
            png_free(png_ptr, info_ptr->splt_palettes[num].entries);
            info_ptr->splt_palettes[num].name = NULL;
            info_ptr->splt_palettes[num].entries = NULL;
         }
      }
      else
      {
         if (info_ptr->splt_palettes_num)
         {
            int i;
            for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
               png_free_data(png_ptr, info_ptr, PNG_FREE_SPLT, i);

            png_free(png_ptr, info_ptr->splt_palettes);
            info_ptr->splt_palettes = NULL;
            info_ptr->splt_palettes_num = 0;
         }
         info_ptr->valid &= ~PNG_INFO_sPLT;
      }
   }
#endif

#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
   if (png_ptr->unknown_chunk.data)
   {
      png_free(png_ptr, png_ptr->unknown_chunk.data);
      png_ptr->unknown_chunk.data = NULL;
   }

   if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
   {
      if (num != -1)
      {
          if (info_ptr->unknown_chunks)
          {
             png_free(png_ptr, info_ptr->unknown_chunks[num].data);
             info_ptr->unknown_chunks[num].data = NULL;
          }
      }
      else
      {
         int i;

         if (info_ptr->unknown_chunks_num)
         {
            for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
               png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);

            png_free(png_ptr, info_ptr->unknown_chunks);
            info_ptr->unknown_chunks = NULL;
            info_ptr->unknown_chunks_num = 0;
         }
      }
   }
#endif

#ifdef PNG_hIST_SUPPORTED
   /* Free any hIST entry */
   if ((mask & PNG_FREE_HIST)  & info_ptr->free_me)
   {
      png_free(png_ptr, info_ptr->hist);
      info_ptr->hist = NULL;
      info_ptr->valid &= ~PNG_INFO_hIST;
   }
#endif

   /* Free any PLTE entry that was internally allocated */
   if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
   {
      png_zfree(png_ptr, info_ptr->palette);
      info_ptr->palette = NULL;
      info_ptr->valid &= ~PNG_INFO_PLTE;
      info_ptr->num_palette = 0;
   }

#ifdef PNG_INFO_IMAGE_SUPPORTED
   /* Free any image bits attached to the info structure */
   if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
   {
      if (info_ptr->row_pointers)
      {
         int row;
         for (row = 0; row < (int)info_ptr->height; row++)
         {
            png_free(png_ptr, info_ptr->row_pointers[row]);
            info_ptr->row_pointers[row] = NULL;
         }
         png_free(png_ptr, info_ptr->row_pointers);
         info_ptr->row_pointers = NULL;
      }
      info_ptr->valid &= ~PNG_INFO_IDAT;
   }
#endif

   if (num == -1)
      info_ptr->free_me &= ~mask;
   else
      info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x7a77d
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r15
movl 0xe4(%rsi), %eax
andl %edx, %eax
btl $0xe, %eax
movslq %r14d, %r13
jae 0x7a457
cmpl $-0x1, %r14d
je 0x7a421
movq 0x48(%rbx), %rax
testq %rax, %rax
je 0x7a457
imulq $0x38, %r13, %r12
movq 0x8(%rax,%r12), %rsi
testq %rsi, %rsi
je 0x7a457
movq %r15, %rdi
callq 0x84923
movq 0x48(%rbx), %rax
andq $0x0, 0x8(%rax,%r12)
jmp 0x7a457
xorl %r12d, %r12d
cmpl 0x3c(%rbx), %r12d
jge 0x7a442
movq %r15, %rdi
movq %rbx, %rsi
movl $0x4000, %edx           # imm = 0x4000
movl %r12d, %ecx
callq 0x7a3b5
incl %r12d
jmp 0x7a424
movq 0x48(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
andq $0x0, 0x48(%rbx)
andl $0x0, 0x3c(%rbx)
movl 0xe4(%rbx), %eax
movl %ebp, %ecx
andl %eax, %ecx
btl $0xd, %ecx
jae 0x7a482
movq 0x60(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
andq $0x0, 0x60(%rbx)
andb $-0x11, 0x8(%rbx)
movl 0xe4(%rbx), %eax
movl %ebp, %ecx
andl %eax, %ecx
btl $0x8, %ecx
jae 0x7a490
andb $-0x41, 0x9(%rbx)
testb %al, %bpl
jns 0x7a51f
movq 0xc0(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
movq 0xd0(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
andq $0x0, 0xc0(%rbx)
andq $0x0, 0xd0(%rbx)
xorl %eax, %eax
cmpq %rax, 0xd8(%rbx)
je 0x7a515
xorl %r12d, %r12d
movzbl 0xe1(%rbx), %eax
movq 0xd8(%rbx), %rsi
cmpq %rax, %r12
jae 0x7a505
movq (%rsi,%r12,8), %rsi
movq %r15, %rdi
callq 0x84923
movq 0xd8(%rbx), %rax
andq $0x0, (%rax,%r12,8)
incq %r12
jmp 0x7a4d5
movq %r15, %rdi
callq 0x84923
andq $0x0, 0xd8(%rbx)
andb $-0x5, 0x9(%rbx)
movl 0xe4(%rbx), %eax
movl %ebp, %ecx
andl %eax, %ecx
testb $0x10, %cl
je 0x7a55a
movq 0xf8(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
movq 0x100(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
xorps %xmm0, %xmm0
movups %xmm0, 0xf8(%rbx)
andb $-0x11, 0x9(%rbx)
movl 0xe4(%rbx), %eax
andl %ebp, %eax
testb $0x20, %al
je 0x7a611
cmpl $-0x1, %r14d
je 0x7a5b5
movq 0x110(%rbx), %rax
testq %rax, %rax
je 0x7a611
movq %r13, %r12
shlq $0x5, %r12
movq (%rax,%r12), %rsi
movq %r15, %rdi
callq 0x84923
movq 0x110(%rbx), %rax
movq 0x10(%rax,%r12), %rsi
movq %r15, %rdi
callq 0x84923
movq 0x110(%rbx), %rax
andq $0x0, (%rax,%r12)
andq $0x0, 0x10(%rax,%r12)
jmp 0x7a611
movl 0x118(%rbx), %eax
testl %eax, %eax
je 0x7a60d
movq %r13, (%rsp)
xorl %r12d, %r12d
pushq $0x20
popq %r13
cmpl %eax, %r12d
jge 0x7a5eb
movq %r15, %rdi
movq %rbx, %rsi
movl %r13d, %edx
movl %r12d, %ecx
callq 0x7a3b5
incl %r12d
movl 0x118(%rbx), %eax
jmp 0x7a5ca
movq 0x110(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
andq $0x0, 0x110(%rbx)
andl $0x0, 0x118(%rbx)
movq (%rsp), %r13
andb $-0x21, 0x9(%rbx)
movq 0x468(%r15), %rsi
testq %rsi, %rsi
je 0x7a62d
movq %r15, %rdi
callq 0x84923
andq $0x0, 0x468(%r15)
movl 0xe4(%rbx), %eax
andl %ebp, %eax
btl $0x9, %eax
jae 0x7a6b9
cmpl $-0x1, %r14d
je 0x7a66d
movq 0xe8(%rbx), %rax
testq %rax, %rax
je 0x7a6b9
shlq $0x5, %r13
movq 0x8(%rax,%r13), %rsi
movq %r15, %rdi
callq 0x84923
movq 0xe8(%rbx), %rax
andq $0x0, 0x8(%rax,%r13)
jmp 0x7a6b9
movq 0xf0(%rbx), %rax
testq %rax, %rax
je 0x7a6b9
xorl %r12d, %r12d
cmpl %eax, %r12d
jge 0x7a6a0
movq %r15, %rdi
movq %rbx, %rsi
movl $0x200, %edx            # imm = 0x200
movl %r12d, %ecx
callq 0x7a3b5
incl %r12d
movq 0xf0(%rbx), %rax
jmp 0x7a67c
movq 0xe8(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
xorps %xmm0, %xmm0
movups %xmm0, 0xe8(%rbx)
movl 0xe4(%rbx), %eax
movl %ebp, %ecx
andl %eax, %ecx
testb $0x8, %cl
je 0x7a6e9
movq 0x98(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
andq $0x0, 0x98(%rbx)
andb $-0x41, 0x8(%rbx)
movl 0xe4(%rbx), %eax
movl %ebp, %ecx
andl %eax, %ecx
btl $0xc, %ecx
jae 0x7a713
movq 0x18(%rbx), %rsi
movq %r15, %rdi
callq 0x84923
andq $0x0, 0x18(%rbx)
andb $-0x9, 0x8(%rbx)
andw $0x0, 0x20(%rbx)
movl 0xe4(%rbx), %eax
andl %ebp, %eax
testb $0x40, %al
je 0x7a767
cmpq $0x0, 0x140(%rbx)
je 0x7a763
xorl %r12d, %r12d
movslq 0x4(%rbx), %rax
movq 0x140(%rbx), %rsi
cmpq %rax, %r12
jge 0x7a753
movq (%rsi,%r12,8), %rsi
movq %r15, %rdi
callq 0x84923
movq 0x140(%rbx), %rax
andq $0x0, (%rax,%r12,8)
incq %r12
jmp 0x7a726
movq %r15, %rdi
callq 0x84923
andq $0x0, 0x140(%rbx)
andb $0x7f, 0x9(%rbx)
movl %ebp, %eax
andl $0xffffbddf, %eax       # imm = 0xFFFFBDDF
cmpl $-0x1, %r14d
cmovel %ebp, %eax
notl %eax
andl %eax, 0xe4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq