// File: /workspace/github_cpp_makefile_star2_O1/phillip-h[P]fractal-gen/lodepng.cpp
// Function: addChunk_tRNS(ucvector*, LodePNGColorMode const*)
static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info)
{
  unsigned error = 0;
  size_t i;
  ucvector tRNS;
  ucvector_init(&tRNS);
  if(info->colortype == LCT_PALETTE)
  {
    size_t amount = info->palettesize;
    /*the tail of palette values that all have 255 as alpha, does not have to be encoded*/
    for(i = info->palettesize; i != 0; --i)
    {
      if(info->palette[4 * (i - 1) + 3] == 255) --amount;
      else break;
    }
    /*add only alpha channel*/
    for(i = 0; i != amount; ++i) ucvector_push_back(&tRNS, info->palette[4 * i + 3]);
  }
  else if(info->colortype == LCT_GREY)
  {
    if(info->key_defined)
    {
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r >> 8));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r & 255));
    }
  }
  else if(info->colortype == LCT_RGB)
  {
    if(info->key_defined)
    {
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r >> 8));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r & 255));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_g >> 8));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_g & 255));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_b >> 8));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_b & 255));
    }
  }

  error = addChunk(out, "tRNS", tRNS.data, tRNS.size);
  ucvector_cleanup(&tRNS);

  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl (%rsi), %eax
testl %eax, %eax
movq %rdi, 0x18(%rsp)
je 0xbf84
cmpl $0x2, %eax
movq %rsi, 0x8(%rsp)
je 0xbf58
xorl %edx, %edx
movl $0x0, %r12d
cmpl $0x3, %eax
jne 0xc19a
movq 0x10(%rsi), %r13
testq %r13, %r13
je 0xbebb
movq 0x8(%rsi), %rax
cmpb $-0x1, -0x1(%rax,%r13,4)
jne 0xbebb
decq %r13
jne 0xbeab
xorl %r13d, %r13d
testq %r13, %r13
je 0xbfa8
xorl %ebx, %ebx
xorl %edi, %edi
xorl %r12d, %r12d
xorl %edx, %edx
movq 0x8(%rsi), %rax
movb 0x3(%rax,%rbx,4), %bpl
leaq 0x1(%r12), %r14
cmpq %r14, %rdi
jae 0xbf23
movq %r12, 0x10(%rsp)
leaq (%rdi,%rdi), %rax
leaq (%r14,%r14,2), %r12
shrq %r12
cmpq %r14, %rax
cmovbq %r14, %r12
movq %rdx, %r15
movq %rdi, 0x20(%rsp)
movq %rdx, %rdi
movq %r12, %rsi
callq 0x2260
testq %rax, %rax
je 0xbf27
xorl %ecx, %ecx
movq %rax, %rdx
movq %r12, %rdi
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rsi
jmp 0xbf3b
xorl %ecx, %ecx
jmp 0xbf3b
movb $0x1, %cl
movq %r15, %rdx
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rsi
movq 0x20(%rsp), %rdi
testb %cl, %cl
jne 0xbf47
movb %bpl, -0x1(%rdx,%r14)
movq %r14, %r12
incq %rbx
cmpq %rbx, %r13
jne 0xbecd
jmp 0xc19a
cmpl $0x0, 0x18(%rsi)
je 0xbfa8
movl 0x1c(%rsi), %ebx
movl $0x1, %r12d
movl $0x1, %edi
callq 0x21e0
movq %rax, %rdx
xorl %r13d, %r13d
testq %rax, %rax
setne %r13b
je 0xbfb2
movb %bh, (%rdx)
jmp 0xbfb5
cmpl $0x0, 0x18(%rsi)
je 0xbfa8
movl 0x1c(%rsi), %ebx
movl $0x1, %r12d
movl $0x1, %edi
callq 0x21e0
testq %rax, %rax
je 0xbfe6
movl %ebx, %ebp
movb %bh, (%rax)
jmp 0xbfeb
xorl %edx, %edx
xorl %r12d, %r12d
jmp 0xc19a
xorl %r12d, %r12d
leaq 0x1(%r12), %r14
cmpq %r13, %r12
jae 0xbfc3
xorl %ecx, %ecx
jmp 0xc01f
movq %r12, %rbp
addq %r14, %r12
movq %rdx, %r15
movq %rdx, %rdi
movq %r12, %rsi
callq 0x2260
testq %rax, %rax
je 0xc017
xorl %ecx, %ecx
movq %rax, %rdx
movq %r12, %r13
jmp 0xc01c
movl %ebx, %ebp
xorl %r12d, %r12d
leaq 0x1(%r12,%r12), %rsi
movq %rax, %rbx
movq %rax, %rdi
callq 0x2260
movq %rbx, %rdx
testq %rax, %rax
cmovneq %rax, %rdx
je 0xc19a
incq %r12
leaq (%rdx,%r12), %rax
jmp 0xc196
movb $0x1, %cl
movq %r15, %rdx
movq %rbp, %r12
movq 0x8(%rsp), %rax
testb %cl, %cl
jne 0xc030
movb %bl, -0x1(%rdx,%r14)
movq %r14, %r12
movb 0x21(%rax), %bl
leaq 0x1(%r12), %r15
cmpl %r12d, %r13d
jbe 0xc041
xorl %ecx, %ecx
jmp 0xc087
leal (%r13,%r13), %eax
movl %r15d, %ecx
shrl %ecx
movq %r12, %rsi
xorl %r12d, %r12d
movq %rsi, %rbp
cmpl %esi, %eax
cmovaq %rcx, %r12
addq %r15, %r12
movq %rdx, %r14
movq %rdx, %rdi
movq %r12, %rsi
callq 0x2260
testq %rax, %rax
je 0xc07a
xorl %ecx, %ecx
movq %rax, %rdx
movq %r12, %r13
jmp 0xc07f
movb $0x1, %cl
movq %r14, %rdx
movq %rbp, %r12
movq 0x8(%rsp), %rax
testb %cl, %cl
jne 0xc093
movb %bl, -0x1(%rdx,%r15)
movq %r15, %r12
movb 0x20(%rax), %bl
leaq 0x1(%r12), %r15
cmpl %r12d, %r13d
jbe 0xc0a4
xorl %ecx, %ecx
jmp 0xc0ea
leal (%r13,%r13), %eax
movl %r15d, %ecx
shrl %ecx
movq %r12, %rsi
xorl %r12d, %r12d
movq %rsi, %rbp
cmpl %esi, %eax
cmovaq %rcx, %r12
addq %r15, %r12
movq %rdx, %r14
movq %rdx, %rdi
movq %r12, %rsi
callq 0x2260
testq %rax, %rax
je 0xc0dd
xorl %ecx, %ecx
movq %rax, %rdx
movq %r12, %r13
jmp 0xc0e2
movb $0x1, %cl
movq %r14, %rdx
movq %rbp, %r12
movq 0x8(%rsp), %rax
testb %cl, %cl
jne 0xc0f6
movb %bl, -0x1(%rdx,%r15)
movq %r15, %r12
movb 0x25(%rax), %bl
leaq 0x1(%r12), %r15
cmpl %r15d, %r13d
jae 0xc136
movq %r12, %rbp
leal (%r13,%r13), %eax
leal (%r15,%r15,2), %r12d
shrl %r12d
cmpl %r15d, %eax
cmovbq %r15, %r12
movq %rdx, %r14
movq %rdx, %rdi
movq %r12, %rsi
callq 0x2260
testq %rax, %rax
je 0xc13a
xorl %ecx, %ecx
movq %rax, %rdx
movq %r12, %r13
jmp 0xc13f
xorl %ecx, %ecx
jmp 0xc147
movb $0x1, %cl
movq %r14, %rdx
movq %rbp, %r12
movq 0x8(%rsp), %rax
testb %cl, %cl
jne 0xc153
movb %bl, -0x1(%rdx,%r15)
movq %r15, %r12
movl 0x24(%rax), %ebp
leaq 0x1(%r12), %rbx
cmpl %ebx, %r13d
jae 0xc189
addl %r13d, %r13d
leal (%rbx,%rbx,2), %esi
shrl %esi
cmpl %ebx, %r13d
cmovbq %rbx, %rsi
movq %rdx, %r14
movq %rdx, %rdi
callq 0x2260
movq %r14, %rdx
testq %rax, %rax
sete %cl
cmovneq %rax, %rdx
jmp 0xc18b
xorl %ecx, %ecx
testb %cl, %cl
jne 0xc19a
leaq (%rdx,%rbx), %rax
movq %rbx, %r12
movb %bpl, -0x1(%rax)
movq 0x18(%rsp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x7058(%rip), %rcx      # 0x13202
movq %rdx, %r14
movq %rbx, %rdi
movl %r12d, %edx
movq %r14, %r8
callq 0x74cd
testl %eax, %eax
jne 0xc1c7
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rbx)
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21b0