// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/png/pngwrite.c
// Function: png_write_info_before_PLTE
void PNGAPI
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{
   png_debug(1, "in png_write_info_before_PLTE");

   if (png_ptr == NULL || info_ptr == NULL)
      return;
   if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
   {
   /* Write PNG signature */
   png_write_sig(png_ptr);
#ifdef PNG_MNG_FEATURES_SUPPORTED
   if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) && \
      (png_ptr->mng_features_permitted))
   {
      png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
      png_ptr->mng_features_permitted = 0;
   }
#endif
   /* Write IHDR information. */
   png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
      info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
      info_ptr->filter_type,
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
      info_ptr->interlace_type);
#else
      0);
#endif
   /* The rest of these check to see if the valid field has the appropriate
    * flag set, and if it does, writes the chunk.
    */
#ifdef PNG_WRITE_gAMA_SUPPORTED
   if (info_ptr->valid & PNG_INFO_gAMA)
   {
#  ifdef PNG_FLOATING_POINT_SUPPORTED
      png_write_gAMA(png_ptr, info_ptr->gamma);
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
      png_write_gAMA_fixed(png_ptr, info_ptr->int_gamma);
#  endif
#endif
   }
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
   if (info_ptr->valid & PNG_INFO_sRGB)
      png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent);
#endif
#ifdef PNG_WRITE_iCCP_SUPPORTED
   if (info_ptr->valid & PNG_INFO_iCCP)
      png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE,
                     info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
#endif
#ifdef PNG_WRITE_sBIT_SUPPORTED
   if (info_ptr->valid & PNG_INFO_sBIT)
      png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
#endif
#ifdef PNG_WRITE_cHRM_SUPPORTED
   if (info_ptr->valid & PNG_INFO_cHRM)
   {
#ifdef PNG_FLOATING_POINT_SUPPORTED
      png_write_cHRM(png_ptr,
         info_ptr->x_white, info_ptr->y_white,
         info_ptr->x_red, info_ptr->y_red,
         info_ptr->x_green, info_ptr->y_green,
         info_ptr->x_blue, info_ptr->y_blue);
#else
#  ifdef PNG_FIXED_POINT_SUPPORTED
      png_write_cHRM_fixed(png_ptr,
         info_ptr->int_x_white, info_ptr->int_y_white,
         info_ptr->int_x_red, info_ptr->int_y_red,
         info_ptr->int_x_green, info_ptr->int_y_green,
         info_ptr->int_x_blue, info_ptr->int_y_blue);
#  endif
#endif
   }
#endif
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
   if (info_ptr->unknown_chunks_num)
   {
      png_unknown_chunk *up;

      png_debug(5, "writing extra chunks");

      for (up = info_ptr->unknown_chunks;
           up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
           up++)
      {
         int keep = png_handle_as_unknown(png_ptr, up->name);
         if (keep != PNG_HANDLE_CHUNK_NEVER &&
            up->location && !(up->location & PNG_HAVE_PLTE) &&
            !(up->location & PNG_HAVE_IDAT) &&
            ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
            (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
         {
            if (up->size == 0)
               png_warning(png_ptr, "Writing zero-length unknown chunk");
            png_write_chunk(png_ptr, up->name, up->data, up->size);
         }
      }
   }
#endif
      png_ptr->mode |= PNG_WROTE_INFO_BEFORE_PLTE;
   }
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x8c377
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb $0x4, 0x11d(%rdi)
jne 0x8c36c
movq %rsi, %r14
movq %rbx, %rdi
callq 0x9e25e
testb $0x10, 0x11d(%rbx)
je 0x8c1d2
cmpl $0x0, 0x408(%rbx)
je 0x8c1d2
leaq 0x201dd(%rip), %rsi     # 0xac39d
movq %rbx, %rdi
callq 0x92e6e
movl $0x0, 0x408(%rbx)
movl (%r14), %esi
movl 0x4(%r14), %edx
movzbl 0x24(%r14), %ecx
movzbl 0x25(%r14), %r8d
movzbl 0x26(%r14), %r9d
movzbl 0x27(%r14), %eax
movzbl 0x28(%r14), %r10d
movq %rbx, %rdi
pushq %r10
pushq %rax
callq 0x9e3f0
addq $0x10, %rsp
testb $0x1, 0x8(%r14)
je 0x8c216
cvtss2sd 0x34(%r14), %xmm0
movq %rbx, %rdi
callq 0x9ea2a
testb $0x8, 0x9(%r14)
je 0x8c22a
movzbl 0x38(%r14), %esi
movq %rbx, %rdi
callq 0x9ea98
testb $0x10, 0x9(%r14)
je 0x8c250
movq 0xf8(%r14), %rsi
movq 0x100(%r14), %rcx
movl 0x108(%r14), %r8d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x9eae5
testb $0x2, 0x8(%r14)
je 0x8c268
leaq 0x58(%r14), %rsi
movzbl 0x25(%r14), %edx
movq %rbx, %rdi
callq 0x9f332
testb $0x4, 0x8(%r14)
je 0x8c2c2
xorps %xmm0, %xmm0
cvtss2sd 0xa0(%r14), %xmm0
cvtss2sd 0xa4(%r14), %xmm1
cvtss2sd 0xa8(%r14), %xmm2
cvtss2sd 0xac(%r14), %xmm3
cvtss2sd 0xb0(%r14), %xmm4
cvtss2sd 0xb4(%r14), %xmm5
cvtss2sd 0xb8(%r14), %xmm6
cvtss2sd 0xbc(%r14), %xmm7
movq %rbx, %rdi
callq 0x9f41d
cmpq $0x0, 0xf0(%r14)
je 0x8c365
cmpq $0x0, 0xf0(%r14)
jle 0x8c365
movq 0xe8(%r14), %r15
leaq 0x20820(%rip), %r12     # 0xacb0c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x88298
cmpl $0x1, %eax
je 0x8c34a
movb 0x18(%r15), %cl
testb %cl, %cl
sete %dl
testb $0x6, %cl
setne %cl
orb %dl, %cl
jne 0x8c34a
cmpl $0x3, %eax
je 0x8c325
movb 0x3(%r15), %al
andb $0x20, %al
jne 0x8c325
testb $0x1, 0x122(%rbx)
je 0x8c34a
cmpq $0x0, 0x10(%r15)
jne 0x8c337
movq %rbx, %rdi
movq %r12, %rsi
callq 0x92e6e
movq 0x8(%r15), %rdx
movq 0x10(%r15), %rcx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9e2b1
addq $0x20, %r15
movq 0xf0(%r14), %rax
shlq $0x5, %rax
addq 0xe8(%r14), %rax
cmpq %rax, %r15
jb 0x8c2ec
orb $0x4, 0x11d(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq