// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-mgs/lodepng/lodepng.c
// Function: addChunk_tRNS
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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8f00
movq -0x10(%rbp), %rax
cmpl $0x3, (%rax)
jne 0x93cf
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x938c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
shlq $0x2, %rcx
movzbl 0x3(%rax,%rcx), %eax
cmpl $0xff, %eax
jne 0x937a
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x937c
jmp 0x938c
jmp 0x937e
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x9345
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x93ca
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
shlq $0x2, %rcx
leaq -0x38(%rbp), %rdi
movzbl 0x3(%rax,%rcx), %esi
callq 0x2660
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x9394
jmp 0x94c0
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x9415
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x9410
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x8, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
andl $0xff, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
jmp 0x94be
movq -0x10(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x94bc
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x94ba
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x8, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
andl $0xff, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
shrl $0x8, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
andl $0xff, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
movq -0x10(%rbp), %rax
movl 0x24(%rax), %eax
shrl $0x8, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
movq -0x10(%rbp), %rax
movl 0x24(%rax), %eax
andl $0xff, %eax
leaq -0x38(%rbp), %rdi
movzbl %al, %esi
callq 0x2660
jmp 0x94bc
jmp 0x94be
jmp 0x94c0
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq 0xbf5f(%rip), %rsi      # 0x15432
callq 0x116f0
movl %eax, -0x14(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xf0d0
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)