// File: /workspace/github_c_makefile_star2_O0/tditlu[P]shadetabler/src/lodepng/lodepng.c
// Function: addChunk_tRNS
static unsigned addChunk_tRNS(ucvector* out, const LodePNGColorMode* info) {
  unsigned char* chunk = 0;

  if(info->colortype == LCT_PALETTE) {
    size_t i, 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) break;
      --amount;
    }
    if(amount) {
      CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, amount, "tRNS"));
      /*add the alpha channel values from the palette*/
      for(i = 0; i != amount; ++i) chunk[8 + i] = info->palette[4 * i + 3];
    }
  } else if(info->colortype == LCT_GREY) {
    if(info->key_defined) {
      CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 2, "tRNS"));
      chunk[8] = (unsigned char)(info->key_r >> 8);
      chunk[9] = (unsigned char)(info->key_r & 255);
    }
  } else if(info->colortype == LCT_RGB) {
    if(info->key_defined) {
      CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 6, "tRNS"));
      chunk[8] = (unsigned char)(info->key_r >> 8);
      chunk[9] = (unsigned char)(info->key_r & 255);
      chunk[10] = (unsigned char)(info->key_g >> 8);
      chunk[11] = (unsigned char)(info->key_g & 255);
      chunk[12] = (unsigned char)(info->key_b >> 8);
      chunk[13] = (unsigned char)(info->key_b & 255);
    }
  }

  if(chunk) lodepng_chunk_generate_crc(chunk);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x3, (%rax)
jne 0xf2bf
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xf240
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
subq $0x1, %rcx
shlq $0x2, %rcx
movzbl 0x3(%rax,%rcx), %eax
cmpl $0xff, %eax
je 0xf226
jmp 0xf240
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xf1fd
cmpq $0x0, -0x30(%rbp)
je 0xf2ba
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rax
movl %eax, %edx
leaq -0x20(%rbp), %rdi
leaq 0xc336(%rip), %rcx      # 0x1b592
callq 0x14120
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0xf275
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xf409
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0xf2b8
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x28(%rbp), %rcx
shlq $0x2, %rcx
movb 0x3(%rax,%rcx), %dl
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movb %dl, (%rax,%rcx)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xf27d
jmp 0xf2ba
jmp 0xf3f2
movq -0x18(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xf32c
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0xf327
movq -0x10(%rbp), %rsi
leaq -0x20(%rbp), %rdi
movl $0x2, %edx
leaq 0xc2ac(%rip), %rcx      # 0x1b592
callq 0x14120
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0xf2ff
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xf409
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x9(%rax)
jmp 0xf3f0
movq -0x18(%rbp), %rax
cmpl $0x2, (%rax)
jne 0xf3ee
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0xf3ec
movq -0x10(%rbp), %rsi
leaq -0x20(%rbp), %rdi
movl $0x6, %edx
leaq 0xc237(%rip), %rcx      # 0x1b592
callq 0x14120
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0xf374
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xf409
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x8(%rax)
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0x9(%rax)
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0xa(%rax)
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0xb(%rax)
movq -0x18(%rbp), %rax
movl 0x24(%rax), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x18(%rbp), %rax
movl 0x24(%rax), %eax
andl $0xff, %eax
movb %al, %cl
movq -0x20(%rbp), %rax
movb %cl, 0xd(%rax)
jmp 0xf3ee
jmp 0xf3f0
jmp 0xf3f2
cmpq $0x0, -0x20(%rbp)
je 0xf402
movq -0x20(%rbp), %rdi
callq 0x5d00
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)