// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/png/pngset.c
// Function: png_set_keep_unknown_chunks
void PNGAPI
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
   chunk_list, int num_chunks)
{
   png_bytep new_list, p;
   int i, old_num_chunks;
   if (png_ptr == NULL)
      return;
   if (num_chunks == 0)
   {
      if (keep == PNG_HANDLE_CHUNK_ALWAYS || keep == PNG_HANDLE_CHUNK_IF_SAFE)
         png_ptr->flags |= PNG_FLAG_KEEP_UNKNOWN_CHUNKS;
      else
         png_ptr->flags &= ~PNG_FLAG_KEEP_UNKNOWN_CHUNKS;

      if (keep == PNG_HANDLE_CHUNK_ALWAYS)
         png_ptr->flags |= PNG_FLAG_KEEP_UNSAFE_CHUNKS;
      else
         png_ptr->flags &= ~PNG_FLAG_KEEP_UNSAFE_CHUNKS;
      return;
   }
   if (chunk_list == NULL)
      return;
   old_num_chunks = png_ptr->num_chunk_list;
   new_list=(png_bytep)png_malloc(png_ptr,
      (png_size_t)
       (5*(num_chunks + old_num_chunks)));
   if (png_ptr->chunk_list != NULL)
   {
      png_memcpy(new_list, png_ptr->chunk_list,
          (png_size_t)(5*old_num_chunks));
      png_free(png_ptr, png_ptr->chunk_list);
      png_ptr->chunk_list=NULL;
   }
   png_memcpy(new_list + 5*old_num_chunks, chunk_list,
       (png_size_t)(5*num_chunks));
   for (p = new_list + 5*old_num_chunks + 4, i = 0; i<num_chunks; i++, p += 5)
      *p=(png_byte)keep;
   png_ptr->num_chunk_list = old_num_chunks + num_chunks;
   png_ptr->chunk_list = new_list;
   png_ptr->free_me |= PNG_FREE_LIST;
}

// Assembly:
testq %rdi, %rdi
je 0x89153
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
testl %ecx, %ecx
je 0x8910c
movq %rdx, %r13
testq %rdx, %rdx
je 0x89145
movl 0x3f0(%rbx), %r15d
leal (%r15,%r14), %eax
movq %rax, 0x10(%rsp)
leal (%rax,%rax,4), %eax
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x91fa8
movq %rax, %r12
movq %rax, (%rsp)
movq 0x3f8(%rbx), %rsi
leal (%r15,%r15,4), %eax
movslq %eax, %r15
testq %rsi, %rsi
je 0x88b97
movq (%rsp), %rdi
movq %r15, %rdx
callq 0xe370
movq 0x3f8(%rbx), %rsi
movq %rbx, %rdi
callq 0x92016
movq $0x0, 0x3f8(%rbx)
movq %rbx, 0x8(%rsp)
addq %r15, %r12
leal (%r14,%r14,4), %eax
movslq %eax, %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0xe370
testl %r14d, %r14d
movq (%rsp), %rbx
jle 0x890ec
movl %r14d, %eax
addl $0xf, %r14d
andl $-0x10, %r14d
decq %rax
movq %rax, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
addq $0x4f, %r12
xorl %eax, %eax
movdqa 0x2392c(%rip), %xmm3    # 0xac510
movdqa 0x23934(%rip), %xmm4    # 0xac520
movdqa 0x2190c(%rip), %xmm5    # 0xaa500
movdqa 0x21914(%rip), %xmm6    # 0xaa510
movdqa 0x2191c(%rip), %xmm7    # 0xaa520
movdqa 0x19673(%rip), %xmm8    # 0xa2280
movdqa 0x1967a(%rip), %xmm9    # 0xa2290
pcmpeqd %xmm10, %xmm10
movq %rax, %xmm11
pshufd $0x44, %xmm11, %xmm11   # xmm11 = xmm11[0,1,0,1]
movdqa %xmm11, %xmm13
por %xmm8, %xmm13
movdqa %xmm0, %xmm12
pxor %xmm9, %xmm12
pxor %xmm9, %xmm13
movdqa %xmm13, %xmm15
pcmpgtd %xmm12, %xmm15
pshufd $0xa0, %xmm15, %xmm14   # xmm14 = xmm15[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm1    # xmm1 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm13
pshufd $0xf5, %xmm13, %xmm13   # xmm13 = xmm13[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm2    # xmm2 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm1, %xmm2
pshufd $0xf5, %xmm15, %xmm15   # xmm15 = xmm15[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm1    # xmm1 = xmm15[0,2,2,3,4,5,6,7]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
movd %xmm1, %ecx
testb $0x1, %cl
je 0x88c91
movb %bpl, -0x4b(%r12)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm13
packsswb %xmm13, %xmm13
movd %xmm13, %ecx
shrl $0x8, %ecx
testb $0x1, %cl
je 0x88cc1
movb %bpl, -0x46(%r12)
movdqa %xmm11, %xmm1
por %xmm7, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm13    # xmm13 = xmm2[0,0,2,2]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm14    # xmm14 = xmm1[1,1,3,3]
movdqa %xmm14, %xmm1
pand %xmm13, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
por %xmm15, %xmm1
packssdw %xmm1, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
movd %xmm1, %ecx
shrl $0x10, %ecx
testb $0x1, %cl
je 0x88d20
movb %bpl, -0x41(%r12)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm2    # xmm2 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm15, %xmm1    # xmm1 = xmm15[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
movd %xmm1, %ecx
shrl $0x18, %ecx
testb $0x1, %cl
je 0x88d58
movb %bpl, -0x3c(%r12)
movdqa %xmm11, %xmm1
por %xmm6, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm14    # xmm14 = xmm2[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm13    # xmm13 = xmm1[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm1    # xmm1 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm2    # xmm2 = xmm15[0,2,2,3,4,5,6,7]
por %xmm1, %xmm2
pxor %xmm10, %xmm2
packssdw %xmm2, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x2, %xmm1, %ecx
testb $0x1, %cl
je 0x88dbd
movb %bpl, -0x37(%r12)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x2, %xmm1, %ecx
shrl $0x8, %ecx
testb $0x1, %cl
je 0x88dec
movb %bpl, -0x32(%r12)
movdqa %xmm11, %xmm1
por %xmm5, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm13    # xmm13 = xmm2[0,0,2,2]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm14    # xmm14 = xmm1[1,1,3,3]
movdqa %xmm14, %xmm1
pand %xmm13, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
por %xmm15, %xmm1
packssdw %xmm1, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x3, %xmm1, %ecx
testb $0x1, %cl
je 0x88e49
movb %bpl, -0x2d(%r12)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm2    # xmm2 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm15, %xmm1    # xmm1 = xmm15[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x3, %xmm1, %ecx
shrl $0x8, %ecx
testb $0x1, %cl
je 0x88e82
movb %bpl, -0x28(%r12)
movdqa %xmm11, %xmm1
por %xmm4, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm14    # xmm14 = xmm2[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm13    # xmm13 = xmm1[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm1    # xmm1 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm2    # xmm2 = xmm15[0,2,2,3,4,5,6,7]
por %xmm1, %xmm2
pxor %xmm10, %xmm2
packssdw %xmm2, %xmm2
packsswb %xmm2, %xmm1
pextrw $0x4, %xmm1, %ecx
testb $0x1, %cl
je 0x88ee7
movb %bpl, -0x23(%r12)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm13
packsswb %xmm13, %xmm1
pextrw $0x4, %xmm1, %ecx
shrl $0x8, %ecx
testb $0x1, %cl
je 0x88f17
movb %bpl, -0x1e(%r12)
movdqa %xmm11, %xmm1
por %xmm3, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm13    # xmm13 = xmm2[0,0,2,2]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm14    # xmm14 = xmm1[1,1,3,3]
movdqa %xmm14, %xmm1
pand %xmm13, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
por %xmm15, %xmm1
packssdw %xmm1, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x5, %xmm1, %ecx
testb $0x1, %cl
je 0x88f74
movb %bpl, -0x19(%r12)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm2    # xmm2 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm15, %xmm1    # xmm1 = xmm15[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x5, %xmm1, %ecx
shrl $0x8, %ecx
testb $0x1, %cl
je 0x88fad
movb %bpl, -0x14(%r12)
movdqa %xmm11, %xmm1
por 0x23546(%rip), %xmm1    # 0xac500
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm14    # xmm14 = xmm2[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm13    # xmm13 = xmm1[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm1    # xmm1 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm2    # xmm2 = xmm15[0,2,2,3,4,5,6,7]
por %xmm1, %xmm2
pxor %xmm10, %xmm2
packssdw %xmm2, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x6, %xmm1, %ecx
testb $0x1, %cl
je 0x89016
movb %bpl, -0xf(%r12)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x6, %xmm1, %ecx
shrl $0x8, %ecx
testb $0x1, %cl
je 0x89045
movb %bpl, -0xa(%r12)
por 0x234a2(%rip), %xmm11   # 0xac4f0
pxor %xmm9, %xmm11
movdqa %xmm11, %xmm1
pcmpgtd %xmm12, %xmm1
pshufd $0xa0, %xmm1, %xmm13    # xmm13 = xmm1[0,0,2,2]
pcmpeqd %xmm12, %xmm11
pshufd $0xf5, %xmm11, %xmm11   # xmm11 = xmm11[1,1,3,3]
movdqa %xmm11, %xmm2
pand %xmm13, %xmm2
pshufd $0xf5, %xmm1, %xmm12    # xmm12 = xmm1[1,1,3,3]
por %xmm12, %xmm2
packssdw %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x7, %xmm1, %ecx
testb $0x1, %cl
je 0x890a3
movb %bpl, -0x5(%r12)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm11, %xmm2    # xmm2 = xmm11[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm12, %xmm1    # xmm1 = xmm12[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x7, %xmm1, %ecx
shrl $0x8, %ecx
testb $0x1, %cl
je 0x890db
movb %bpl, (%r12)
addq $0x10, %rax
addq $0x50, %r12
cmpq %rax, %r14
jne 0x88c1b
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %rcx
movl %eax, 0x3f0(%rcx)
movq %rbx, 0x3f8(%rcx)
orb $0x4, 0x3d9(%rcx)
jmp 0x89145
movl %ebp, %eax
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0x89128
movl 0x120(%rbx), %eax
cmpl $0x3, %ebp
jne 0x89135
orl $0x18000, %eax          # imm = 0x18000
jmp 0x8913f
movl $0xffff7fff, %eax       # imm = 0xFFFF7FFF
andl 0x120(%rbx), %eax
jmp 0x8913a
orl $0x8000, %eax           # imm = 0x8000
andl $0xfffeffff, %eax       # imm = 0xFFFEFFFF
movl %eax, 0x120(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq