// File: /workspace/github_cpp_makefile_star2_O3/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 0x8b5d2
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb $0x4, 0x11d(%rdi)
jne 0x8b5c7
movq %rsi, %r14
movq %rbx, %rdi
callq 0x9d86a
testb $0x10, 0x11d(%rbx)
je 0x8b42a
cmpl $0x0, 0x408(%rbx)
je 0x8b42a
leaq 0x20fc5(%rip), %rsi     # 0xac3dd
movq %rbx, %rdi
callq 0x9214d
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 0x9d9fc
addq $0x10, %rsp
movl 0x8(%r14), %eax
testb $0x1, %al
je 0x8b473
cvtss2sd 0x34(%r14), %xmm0
movq %rbx, %rdi
callq 0x9e058
movl 0x8(%r14), %eax
btl $0xb, %eax
jae 0x8b48a
movzbl 0x38(%r14), %esi
movq %rbx, %rdi
callq 0x9e0c6
movl 0x8(%r14), %eax
btl $0xc, %eax
jae 0x8b4b3
movq 0xf8(%r14), %rsi
movq 0x100(%r14), %rcx
movl 0x108(%r14), %r8d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x9e113
movl 0x8(%r14), %eax
testb $0x2, %al
je 0x8b4cc
leaq 0x58(%r14), %rsi
movzbl 0x25(%r14), %edx
movq %rbx, %rdi
callq 0x9e989
movl 0x8(%r14), %eax
testb $0x4, %al
je 0x8b523
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 0x9ea74
cmpq $0x0, 0xf0(%r14)
je 0x8b5c0
jle 0x8b5c0
movq 0xe8(%r14), %r15
leaq 0x21607(%rip), %r12     # 0xacb4c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x874b4
cmpl $0x1, %eax
je 0x8b5a5
movb 0x18(%r15), %cl
testb %cl, %cl
sete %dl
testb $0x6, %cl
setne %cl
orb %dl, %cl
jne 0x8b5a5
cmpl $0x3, %eax
je 0x8b57e
movb 0x3(%r15), %al
andb $0x20, %al
jne 0x8b57e
testb $0x1, 0x122(%rbx)
je 0x8b5a5
movq 0x10(%r15), %rcx
testq %rcx, %rcx
jne 0x8b596
movq %rbx, %rdi
movq %r12, %rsi
callq 0x9214d
movq 0x10(%r15), %rcx
movq 0x8(%r15), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9d8bd
addq $0x20, %r15
movq 0xf0(%r14), %rax
shlq $0x5, %rax
addq 0xe8(%r14), %rax
cmpq %rax, %r15
jb 0x8b545
orb $0x4, 0x11d(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq