// File: /workspace/github_cpp_makefile_star2_O2/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 0x7e302
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testb $0x4, 0x11d(%rdi)
jne 0x7e2f7
movq %rsi, %r14
movq %rbx, %rdi
callq 0x8f1ae
testb $0x10, 0x11d(%rbx)
je 0x7e153
cmpl $0x0, 0x408(%rbx)
je 0x7e153
leaq 0x1efb9(%rip), %rsi     # 0x9d0fd
movq %rbx, %rdi
callq 0x84a53
andl $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 0x8f30f
popq %rax
popq %rcx
movl 0x8(%r14), %eax
testb $0x1, %al
je 0x7e19a
cvtss2sd 0x34(%r14), %xmm0
movq %rbx, %rdi
callq 0x8f927
movl 0x8(%r14), %eax
btl $0xb, %eax
jae 0x7e1b1
movzbl 0x38(%r14), %esi
movq %rbx, %rdi
callq 0x8f991
movl 0x8(%r14), %eax
btl $0xc, %eax
jae 0x7e1da
movq 0xf8(%r14), %rsi
movq 0x100(%r14), %rcx
movl 0x108(%r14), %r8d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x8f9dc
movl 0x8(%r14), %eax
testb $0x2, %al
je 0x7e1f3
leaq 0x58(%r14), %rsi
movzbl 0x25(%r14), %edx
movq %rbx, %rdi
callq 0x901f3
movl 0x8(%r14), %eax
testb $0x4, %al
je 0x7e247
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 0x902d9
movq 0xf0(%r14), %rax
testq %rax, %rax
je 0x7e2f0
movq 0xe8(%r14), %rcx
leaq 0x1f5c7(%rip), %r15     # 0x9d82c
movq %rcx, %r12
shlq $0x5, %rax
addq %rcx, %rax
cmpq %rax, %r12
jae 0x7e2f0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x7a87f
cmpl $0x1, %eax
je 0x7e2d9
movb 0x18(%r12), %cl
testb %cl, %cl
sete %dl
testb $0x6, %cl
setne %cl
orb %dl, %cl
jne 0x7e2d9
cmpl $0x3, %eax
je 0x7e2af
movb 0x3(%r12), %al
andb $0x20, %al
jne 0x7e2af
testb $0x1, 0x122(%rbx)
je 0x7e2d9
movq 0x10(%r12), %rcx
testq %rcx, %rcx
jne 0x7e2c9
movq %rbx, %rdi
movq %r15, %rsi
callq 0x84a53
movq 0x10(%r12), %rcx
movq 0x8(%r12), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x8f1fc
addq $0x20, %r12
movq 0xe8(%r14), %rcx
movq 0xf0(%r14), %rax
jmp 0x7e268
orb $0x4, 0x11d(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq