// File: /workspace/github_cpp_makefile_star2_O3/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), %eax
testl %eax, %eax
movq %rdi, -0x50(%rbp)
je 0x202af
cmpl $0x2, %eax
movq %rsi, -0x38(%rbp)
je 0x20230
xorl %r14d, %r14d
movl $0x0, %edx
cmpl $0x3, %eax
jne 0x20458
cmpq $0x0, 0x10(%rsi)
je 0x20453
xorl %ebx, %ebx
xorl %ecx, %ecx
xorl %edx, %edx
xorl %r14d, %r14d
movq 0x8(%rsi), %rax
movb 0x3(%rax,%rbx,4), %dil
leaq 0x1(%rdx), %r12
leaq 0x4(,%rdx,4), %rax
cmpq %rcx, %rax
jbe 0x2020e
leaq (,%r12,8), %r13
movb %dil, -0x40(%rbp)
movq %r14, %rdi
movq %r13, %rsi
movq %rdx, %r15
movq %rcx, -0x30(%rbp)
callq 0x44f0
movb -0x40(%rbp), %dil
movq -0x30(%rbp), %rcx
movq %r15, %rdx
movq -0x38(%rbp), %rsi
testq %rax, %rax
jne 0x20214
jmp 0x20222
movq %r14, %rax
movq %rcx, %r13
movb %dil, -0x1(%rax,%r12)
movq %r13, %rcx
movq %r12, %rdx
movq %rax, %r14
incq %rbx
cmpq 0x10(%rsi), %rbx
jb 0x201c0
jmp 0x20458
cmpl $0x0, 0x18(%rsi)
je 0x20453
movl 0x1c(%rsi), %ebx
movl $0x8, %edi
callq 0x4410
movq %rax, %rdi
testq %rax, %rax
je 0x202e0
movl $0x8, %r13d
rolw $0x8, %bx
movw %bx, (%rdi)
movl $0x2, %eax
movq %rax, -0x48(%rbp)
movl $0x3, %r15d
movl $0xc, %eax
movq %rax, -0x30(%rbp)
movq -0x38(%rbp), %rax
leaq 0x20(%rax), %r12
movl 0x20(%rax), %ebx
leal (,%r15,8), %r14d
movq %rdi, -0x40(%rbp)
movq %r14, %rsi
callq 0x44f0
movq %r12, %rdi
movq %r14, %r12
testq %rax, %rax
movq -0x30(%rbp), %rdx
movq -0x48(%rbp), %rsi
jne 0x20314
jmp 0x20333
cmpl $0x0, 0x18(%rsi)
je 0x20453
movl 0x1c(%rsi), %r14d
movl $0x8, %edi
callq 0x4410
testq %rax, %rax
je 0x2042b
movl %r14d, %ecx
movb %ch, (%rax)
movl $0x2, %r13d
jmp 0x20440
movq %rdi, %r14
movl $0x8, %r12d
movl $0x8, %edi
callq 0x4410
testq %rax, %rax
je 0x20494
movb %bl, (%rax)
movq -0x38(%rbp), %rcx
leaq 0x20(%rcx), %rdi
movl 0x20(%rcx), %ebx
movl $0x1, %esi
movl $0x2, %r15d
movq %r15, %rcx
movb %bh, -0x1(%rax,%rcx)
addq $0x2, %rsi
leal (,%rsi,4), %edx
movq %rsi, %r15
movq %r12, %r13
movq %rcx, %rsi
movq %rax, -0x40(%rbp)
movb (%rdi), %bl
cmpl %r13d, %edx
movq %r13, %r12
jbe 0x20372
movq %rsi, -0x48(%rbp)
movq %rdx, -0x30(%rbp)
leal (,%r15,8), %r13d
movq -0x40(%rbp), %r14
movq %r14, %rdi
movq %r13, %rsi
callq 0x44f0
testq %rax, %rax
movq -0x38(%rbp), %rcx
jne 0x2037d
movq %r15, %rdx
movq -0x48(%rbp), %r15
movq -0x30(%rbp), %rsi
jmp 0x20393
movq -0x40(%rbp), %rax
movq %r12, %r13
movq -0x38(%rbp), %rcx
movb %bl, -0x1(%rax,%r15)
leaq 0x1(%r15), %rdx
leal (,%rdx,4), %esi
movq %r13, %r12
movq %rax, %r14
movb 0x25(%rcx), %bl
cmpl %r12d, %esi
jbe 0x203de
movq %rsi, -0x30(%rbp)
movq %r12, -0x40(%rbp)
movq %r15, %r12
leal (,%rdx,8), %r13d
movq %r14, %rdi
movq %r13, %rsi
movq %rdx, %r15
callq 0x44f0
movq %r13, %rsi
movq %r15, %rdx
movq -0x38(%rbp), %rcx
testq %rax, %rax
jne 0x203e4
movq %rdx, %r13
movq %r12, %rdx
movq %r14, %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %r8
jmp 0x203f7
movq %r14, %rax
movq %r12, %rsi
movb %bl, -0x1(%rax,%rdx)
leaq 0x1(%rdx), %r13
leal (,%r13,4), %r8d
movq %rax, %rdi
movl 0x24(%rcx), %r9d
cmpl %esi, %r8d
jbe 0x20426
leal (,%r13,8), %esi
movl %r9d, %r15d
movq %rdi, %rbx
movq %rdx, %r14
callq 0x44f0
movq %r14, %rdx
movq %rbx, %r14
movl %r15d, %r9d
testq %rax, %rax
jne 0x20443
jmp 0x20458
movq %rdi, %rax
jmp 0x20443
movl $0x8, %edi
callq 0x4410
testq %rax, %rax
je 0x20453
movl $0x1, %r13d
movl %r14d, %r9d
leaq (%rax,%r13), %rcx
movb %r9b, -0x1(%rcx)
movq %rax, %r14
movq %r13, %rdx
jmp 0x20458
xorl %r14d, %r14d
xorl %edx, %edx
movq -0x50(%rbp), %rbx
leaq 0x8(%rbx), %rsi
leaq 0x10767(%rip), %rcx     # 0x30bce
movq %rbx, %rdi
movq %r14, %r8
callq 0x1c3c3
testl %eax, %eax
jne 0x2047e
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 0x4380
movl $0x1, %r15d
movl $0x4, %eax
movq %rax, -0x30(%rbp)
movq $0x0, -0x48(%rbp)
xorl %r13d, %r13d
movq -0x38(%rbp), %rax
movq %r14, %rdi
jmp 0x2027c