// File: /workspace/github_cpp_makefile_star2_O3/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
movq %rdi, 0x20(%rsp)
testl %eax, %eax
je 0xbe9a
movq %rsi, 0x10(%rsp)
cmpl $0x2, %eax
je 0xbe62
movl $0x0, %ebp
movq $0x0, 0x8(%rsp)
cmpl $0x3, %eax
jne 0xc159
movq 0x10(%rsi), %rbx
testq %rbx, %rbx
je 0xbed4
movq 0x8(%rsi), %rax
cmpb $-0x1, -0x1(%rax,%rbx,4)
jne 0xbee4
decq %rbx
jne 0xbe50
jmp 0xbed4
cmpl $0x0, 0x18(%rsi)
je 0xbed4
movl 0x1c(%rsi), %ebx
movl $0x1, %edi
movl $0x1, %r13d
callq 0x21e0
testq %rax, %rax
je 0xbf60
movl $0x1, %r14d
movl $0x2, %r13d
movl %ebx, %r12d
movb %bh, (%rax)
jmp 0xbf66
cmpl $0x0, 0x18(%rsi)
je 0xbed4
movl 0x1c(%rsi), %ebx
movl $0x1, %edi
movl $0x1, %r13d
callq 0x21e0
movq %rax, %rdi
testq %rax, %rax
je 0xc11e
movl $0x1, %ebp
movl $0x2, %r13d
movl %ebx, %r14d
movb %bh, (%rdi)
jmp 0xc123
movq $0x0, 0x8(%rsp)
xorl %ebp, %ebp
jmp 0xc159
xorl %r13d, %r13d
xorl %edi, %edi
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq 0x8(%rsi), %rax
leaq 0x1(%rbp), %r15
movb 0x3(%rax,%r13,4), %r14b
cmpq %r15, %rdi
jae 0xbf3b
movq %rdi, 0x18(%rsp)
leaq (%rdi,%rdi), %rax
leaq (%r15,%r15,2), %r12
movq 0x8(%rsp), %rdi
shrq %r12
cmpq %r15, %rax
cmovbq %r15, %r12
movq %r12, %rsi
callq 0x2260
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
testq %rax, %rax
jne 0xbf43
jmp 0xbf53
movq 0x8(%rsp), %rax
movq %rdi, %r12
movb %r14b, -0x1(%rax,%r15)
movq %r12, %rdi
movq %r15, %rbp
movq %rax, 0x8(%rsp)
incq %r13
cmpq %r13, %rbx
jne 0xbef4
jmp 0xc159
movl %ebx, %r12d
xorl %r14d, %r14d
leal (%r14,%r14), %edx
movl %r13d, %ecx
shrl %ecx
xorl %ebp, %ebp
movq %rax, %rbx
movq %rbx, %rdi
cmpl %r13d, %edx
cmovaeq %rcx, %rbp
leaq (%rbp,%r13), %r15
movq %r15, %rsi
callq 0x2260
testq %rax, %rax
je 0xbfb7
movq 0x10(%rsp), %rcx
movb %r12b, -0x1(%rax,%r13)
leaq 0x1(%r13), %rsi
movl 0x20(%rcx), %r12d
leaq 0x20(%rcx), %rdi
movl %r12d, %r9d
shrl $0x8, %r9d
testq %rbp, %rbp
movq %rax, %rbp
jne 0xc01d
jmp 0xbfd8
movq 0x10(%rsp), %rax
leaq 0x1(%r14), %rsi
movq %r14, %r13
movq %r14, %r15
movq %rbx, %rbp
movl 0x20(%rax), %r12d
leaq 0x20(%rax), %rdi
movl %r12d, %r9d
shrl $0x8, %r9d
leal (%r15,%r15), %eax
movl %esi, %ecx
movq %r15, %rbx
shrl %ecx
xorl %r15d, %r15d
movq %rsi, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
movq %rbp, %rdi
movl %r9d, %r14d
cmpl %r13d, %eax
cmovaq %rcx, %r15
addq %rsi, %r15
movq %r15, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl %r14d, %r9d
movl %r12d, %edx
testq %rax, %rax
je 0xc037
movb %r9b, -0x1(%rax,%rsi)
addq $0x2, %r13
movq %rsi, %rcx
movq %r15, %rbx
movq %rax, %rbp
movl (%rdi), %edx
movq %r13, %rsi
movq %rcx, %r13
cmpl %r13d, %ebx
jbe 0xc049
movq 0x10(%rsp), %rcx
movq %rbp, %rax
movq %rbx, %r12
jmp 0xc082
leal (%rbx,%rbx), %eax
movl %esi, %ecx
shrl %ecx
xorl %r12d, %r12d
movq %rbp, %rdi
movq %rsi, %r14
movl %edx, %r15d
cmpl %r13d, %eax
cmovaq %rcx, %r12
addq %rsi, %r12
movq %r12, %rsi
callq 0x2260
movq 0x10(%rsp), %rcx
movl %r15d, %edx
movq %r14, %rsi
testq %rax, %rax
je 0xc19d
movb %dl, -0x1(%rax,%rsi)
leaq 0x1(%rsi), %rdx
movq %r12, %rbx
movq %rax, %rbp
movb 0x25(%rcx), %r14b
cmpl %esi, %ebx
jbe 0xc0a0
movq %rbp, %rax
movq %rbx, %r12
jmp 0xc0d5
leal (%rbx,%rbx), %eax
movl %edx, %ecx
shrl %ecx
xorl %r12d, %r12d
movq %rbp, %rdi
movq %rsi, %r13
movq %rdx, %r15
cmpl %esi, %eax
cmovaq %rcx, %r12
addq %rdx, %r12
movq %r12, %rsi
callq 0x2260
movq 0x10(%rsp), %rcx
movq %r15, %rdx
testq %rax, %rax
je 0xc1a8
movb %r14b, -0x1(%rax,%rdx)
leaq 0x1(%rdx), %r13
movq %r12, %rbx
movq %rax, %rbp
movl 0x24(%rcx), %r14d
cmpl %edx, %ebx
jbe 0xc0f1
movq %rbp, %rax
jmp 0xc118
addl %ebx, %ebx
movl %r13d, %eax
shrl %eax
xorl %esi, %esi
movq %rbp, 0x8(%rsp)
movq %rbp, %rdi
movq %rdx, %rbp
cmpl %edx, %ebx
cmovaq %rax, %rsi
addq %r13, %rsi
callq 0x2260
testq %rax, %rax
je 0xc159
leaq (%rax,%r13), %rcx
jmp 0xc14d
movl %ebx, %r14d
xorl %ebp, %ebp
leal (%rbp,%rbp), %eax
movl %r13d, %ecx
shrl %ecx
xorl %esi, %esi
movq %rdi, 0x8(%rsp)
cmpl %r13d, %eax
cmovaeq %rcx, %rsi
addq %r13, %rsi
callq 0x2260
testq %rax, %rax
je 0xc159
movq %rax, %rcx
addq %r13, %rcx
movq %r13, %rbp
movb %r14b, -0x1(%rcx)
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rbx
movq 0x8(%rsp), %r14
leaq 0x70f8(%rip), %rcx      # 0x13262
movl %ebp, %edx
leaq 0x8(%rbx), %rsi
movq %rbx, %rdi
movq %r14, %r8
callq 0x74dc
testl %eax, %eax
jne 0xc187
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
movq %rsi, %rdx
movq %r13, %rsi
jmp 0xc090
movq %r13, %rax
movq %rdx, %r13
movq %rax, %rdx
jmp 0xc0e4