// File: /workspace/github_cpp_makefile_star2_O1/mhe[P]raytracerframework_cpp/lodepng.cpp
// Function: addChunk_tRNS(ucvector*, LodePNG_InfoColor const*)
static unsigned addChunk_tRNS(ucvector* out, const LodePNG_InfoColor* info)
{
  unsigned error = 0;
  size_t i;
  ucvector tRNS;
  ucvector_init(&tRNS);
  if(info->colorType == 3)
  {
    for(i = 0; i < info->palettesize; i++) ucvector_push_back(&tRNS, info->palette[4 * i + 3]); /*add only alpha channel*/
  }
  else if(info->colorType == 0)
  {
    if(info->key_defined)
    {
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r / 256));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r % 256));
    }
  }
  else if(info->colorType == 2)
  {
    if(info->key_defined)
    {
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r / 256));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_r % 256));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_g / 256));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_g % 256));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_b / 256));
      ucvector_push_back(&tRNS, (unsigned char)(info->key_b % 256));
    }
  }
  
  error = addChunk(out, "tRNS", tRNS.data, tRNS.size);
  ucvector_cleanup(&tRNS);
  
  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl (%rsi), %ecx
testl %ecx, %ecx
movq %rdi, -0x40(%rbp)
je 0x2150b
cmpl $0x2, %ecx
movq %rsi, -0x38(%rbp)
je 0x214cf
xorl %eax, %eax
movl $0x0, %edx
cmpl $0x3, %ecx
jne 0x21731
cmpq $0x0, 0x10(%rsi)
je 0x21533
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %edx, %edx
xorl %eax, %eax
movq 0x8(%rsi), %rcx
movb 0x3(%rcx,%r14,4), %r15b
leaq 0x1(%rdx), %r12
leaq 0x4(,%rdx,4), %rcx
cmpq %r13, %rcx
jbe 0x214a0
movq %r13, -0x48(%rbp)
movq %rdx, -0x30(%rbp)
leaq (,%r12,8), %r13
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x5500
testq %rax, %rax
je 0x214a7
xorl %ecx, %ecx
movq %r12, %rdx
movq -0x38(%rbp), %rsi
jmp 0x214b8
xorl %ecx, %ecx
movq %r12, %rdx
jmp 0x214b8
movb $0x1, %cl
movq %rbx, %rax
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x48(%rbp), %r13
testb %cl, %cl
jne 0x214c1
movb %r15b, -0x1(%rax,%rdx)
incq %r14
cmpq 0x10(%rsi), %r14
jb 0x21458
jmp 0x21731
cmpl $0x0, 0x18(%rsi)
je 0x21533
movl 0x1c(%rsi), %r14d
movl $0x8, %edi
callq 0x5420
xorl %ebx, %ebx
testq %rax, %rax
setne %bl
leal (,%rbx,8), %r15d
testq %rax, %rax
movl %r14d, -0x30(%rbp)
je 0x2153c
movl %r14d, %ecx
movb %ch, -0x1(%rax,%rbx)
movl $0x2, %r12d
jmp 0x21542
cmpl $0x0, 0x18(%rsi)
je 0x21533
movl 0x1c(%rsi), %ebx
movl $0x8, %edi
callq 0x5420
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
je 0x21575
movb %bh, -0x1(%rax,%rcx)
movl $0x2, %edx
jmp 0x2157a
xorl %eax, %eax
xorl %edx, %edx
jmp 0x21731
movl $0x1, %r12d
leal (,%r12,4), %ecx
cmpl %r15d, %ecx
jbe 0x21571
leal (,%r12,8), %r13d
movq %rax, %r14
movq %rax, %rdi
movq %r13, %rsi
callq 0x5500
testq %rax, %rax
je 0x215b1
xorl %ecx, %ecx
movq %r13, %r15
jmp 0x215b9
xorl %ecx, %ecx
jmp 0x215b9
movl $0x1, %edx
testq %rax, %rax
jne 0x2170a
movq %rcx, %r13
movl %ebx, %r12d
movq %rdx, %r15
leal (,%rdx,8), %esi
movq %rax, %rbx
movq %rax, %rdi
callq 0x5500
testq %rax, %rax
je 0x2171b
xorl %ecx, %ecx
movq %r15, %rdx
jmp 0x21723
movb $0x1, %cl
movq %rbx, %r12
movq %r14, %rax
movq -0x38(%rbp), %rdx
testb %cl, %cl
movl -0x30(%rbp), %ecx
jne 0x215c9
movb %cl, -0x1(%rax,%r12)
movb 0x21(%rdx), %sil
leaq 0x1(%r12), %r13
leal (,%r13,4), %ecx
cmpl %r15d, %ecx
jbe 0x21605
movb %sil, -0x30(%rbp)
leal (,%r13,8), %esi
movq %rax, %r14
movq %rax, %rdi
movq %rsi, %rbx
callq 0x5500
testq %rax, %rax
je 0x21609
xorl %ecx, %ecx
movq %rbx, %r15
jmp 0x21611
xorl %ecx, %ecx
jmp 0x21619
movb $0x1, %cl
movq %r12, %r13
movq %r14, %rax
movq -0x38(%rbp), %rdx
movb -0x30(%rbp), %sil
testb %cl, %cl
jne 0x21622
movb %sil, -0x1(%rax,%r13)
movb 0x20(%rdx), %sil
leaq 0x1(%r13), %r12
leal (,%r12,4), %ecx
cmpl %r15d, %ecx
jbe 0x2165d
movb %sil, -0x30(%rbp)
leal (,%r12,8), %esi
movq %rax, %r14
movq %rax, %rdi
movq %rsi, %rbx
callq 0x5500
testq %rax, %rax
je 0x21661
xorl %ecx, %ecx
movq %rbx, %r15
jmp 0x21669
xorl %ecx, %ecx
jmp 0x21671
movb $0x1, %cl
movq %r13, %r12
movq %r14, %rax
movq -0x38(%rbp), %rdx
movb -0x30(%rbp), %sil
testb %cl, %cl
jne 0x2167a
movb %sil, -0x1(%rax,%r12)
movb 0x25(%rdx), %sil
leaq 0x1(%r12), %r13
leal (,%r13,4), %ecx
cmpl %r15d, %ecx
jbe 0x216b6
movb %sil, -0x30(%rbp)
leal (,%r13,8), %esi
movq %rax, %r14
movq %rax, %rdi
movq %rsi, %rbx
callq 0x5500
testq %rax, %rax
je 0x216ba
xorl %ecx, %ecx
movq %rbx, %r15
jmp 0x216c2
xorl %ecx, %ecx
jmp 0x216ca
movb $0x1, %cl
movq %r12, %r13
movq %r14, %rax
movq -0x38(%rbp), %rdx
movb -0x30(%rbp), %sil
testb %cl, %cl
jne 0x216d3
movb %sil, -0x1(%rax,%r13)
movl 0x24(%rdx), %ebx
leaq 0x1(%r13), %rdx
leal (,%rdx,4), %ecx
cmpl %r15d, %ecx
jbe 0x2170a
movl %ebx, %r15d
movq %rdx, %r14
leal (,%rdx,8), %esi
movq %rax, %rbx
movq %rax, %rdi
callq 0x5500
testq %rax, %rax
je 0x2170e
xorl %ecx, %ecx
movq %r14, %rdx
jmp 0x21716
xorl %ecx, %ecx
jmp 0x21726
movb $0x1, %cl
movq %r13, %rdx
movq %rbx, %rax
movl %r15d, %ebx
jmp 0x21726
movb $0x1, %cl
movq %r13, %rdx
movq %rbx, %rax
movl %r12d, %ebx
testb %cl, %cl
jne 0x21731
leaq (%rax,%rdx), %rcx
movb %bl, -0x1(%rcx)
movq -0x40(%rbp), %r14
leaq 0x8(%r14), %rsi
leaq 0x1047e(%rip), %rcx     # 0x31bbe
movq %rax, %r15
movq %r14, %rdi
movq %rax, %r8
callq 0x1d440
testl %eax, %eax
jne 0x2175a
movq 0x8(%r14), %rax
movq %rax, 0x10(%r14)
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5390