// File: /workspace/github_cpp_makefile_star2_O1/logicx24[P]RayTracer/lodepng.cpp
// Function: addChunk_bKGD(ucvector*, LodePNGInfo const*)
static unsigned addChunk_bKGD(ucvector* out, const LodePNGInfo* info)
{
  unsigned error = 0;
  ucvector bKGD;
  ucvector_init(&bKGD);
  if(info->color.colortype == LCT_GREY || info->color.colortype == LCT_GREY_ALPHA)
  {
    ucvector_push_back(&bKGD, (unsigned char)(info->background_r / 256));
    ucvector_push_back(&bKGD, (unsigned char)(info->background_r % 256));
  }
  else if(info->color.colortype == LCT_RGB || info->color.colortype == LCT_RGBA)
  {
    ucvector_push_back(&bKGD, (unsigned char)(info->background_r / 256));
    ucvector_push_back(&bKGD, (unsigned char)(info->background_r % 256));
    ucvector_push_back(&bKGD, (unsigned char)(info->background_g / 256));
    ucvector_push_back(&bKGD, (unsigned char)(info->background_g % 256));
    ucvector_push_back(&bKGD, (unsigned char)(info->background_b / 256));
    ucvector_push_back(&bKGD, (unsigned char)(info->background_b % 256));
  }
  else if(info->color.colortype == LCT_PALETTE)
  {
    ucvector_push_back(&bKGD, (unsigned char)(info->background_r % 256)); /*palette index*/
  }

  error = addChunk(out, "bKGD", bKGD.data, bKGD.size);
  ucvector_cleanup(&bKGD);

  return error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r15
movl 0x10(%rsi), %eax
xorl %r12d, %r12d
xorl %ebx, %ebx
cmpq $0x6, %rax
ja 0x12618
movq %rsi, %r13
leaq 0x5237(%rip), %rcx      # 0x175f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x3c(%r13), %ebx
movl $0x1, %r12d
movl $0x1, %edi
callq 0x32e0
testq %rax, %rax
je 0x1247f
movl %ebx, %r14d
movb %bh, (%rax)
jmp 0x12485
movq %r15, -0x40(%rbp)
movl 0x3c(%r13), %r12d
movl $0x1, %r15d
movl $0x1, %edi
callq 0x32e0
movq %rax, %rbx
xorl %r14d, %r14d
testq %rax, %rax
setne %r14b
movq %r13, -0x48(%rbp)
je 0x1244b
movl %r12d, %eax
movb %ah, (%rbx)
jmp 0x12451
movl 0x3c(%r13), %r14d
movl $0x1, %r12d
movl $0x1, %edi
callq 0x32e0
movq %rax, %rbx
testq %rax, %rax
je 0x12653
movb %r14b, (%rbx)
jmp 0x12618
xorl %r15d, %r15d
movl %r12d, %eax
leaq 0x1(%r15), %r13
cmpq %r14, %r15
jae 0x1245e
xorl %ecx, %ecx
jmp 0x124b7
movl %eax, -0x2c(%rbp)
leaq (%r15,%r13), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3400
testq %rax, %rax
je 0x124b2
xorl %ecx, %ecx
movq %rax, %rbx
movq %r12, %r14
jmp 0x124b4
movl %ebx, %r14d
xorl %r12d, %r12d
movq %rax, %rbx
leaq 0x1(,%r12,2), %rsi
movq %rax, %rdi
callq 0x3400
testq %rax, %rax
cmovneq %rax, %rbx
je 0x12618
incq %r12
movb %r14b, -0x1(%rbx,%r12)
jmp 0x12618
movb $0x1, %cl
movl -0x2c(%rbp), %eax
testb %cl, %cl
jne 0x124c3
movb %al, -0x1(%rbx,%r13)
movq %r13, %r15
movq -0x48(%rbp), %r13
movb 0x41(%r13), %al
leaq 0x1(%r15), %rdx
cmpl %r15d, %r14d
jbe 0x124d8
xorl %ecx, %ecx
jmp 0x12517
movb %al, -0x2c(%rbp)
leal (%r14,%r14), %eax
movl %edx, %ecx
shrl %ecx
xorl %r12d, %r12d
cmpl %r15d, %eax
cmovaq %rcx, %r12
movq %rdx, -0x38(%rbp)
addq %rdx, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3400
testq %rax, %rax
je 0x1250e
xorl %ecx, %ecx
movq %rax, %rbx
movq %r12, %r14
jmp 0x12510
movb $0x1, %cl
movb -0x2c(%rbp), %al
movq -0x38(%rbp), %rdx
testb %cl, %cl
jne 0x12522
movb %al, -0x1(%rbx,%rdx)
movq %rdx, %r15
movb 0x40(%r13), %al
leaq 0x1(%r15), %rdx
cmpl %r15d, %r14d
jbe 0x12533
xorl %ecx, %ecx
jmp 0x12572
movb %al, -0x2c(%rbp)
leal (%r14,%r14), %eax
movl %edx, %ecx
shrl %ecx
xorl %r12d, %r12d
cmpl %r15d, %eax
cmovaq %rcx, %r12
movq %rdx, -0x38(%rbp)
addq %rdx, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3400
testq %rax, %rax
je 0x12569
xorl %ecx, %ecx
movq %rax, %rbx
movq %r12, %r14
jmp 0x1256b
movb $0x1, %cl
movb -0x2c(%rbp), %al
movq -0x38(%rbp), %rdx
testb %cl, %cl
jne 0x1257d
movb %al, -0x1(%rbx,%rdx)
movq %rdx, %r15
movb 0x45(%r13), %al
leaq 0x1(%r15), %r13
cmpl %r13d, %r14d
jae 0x125ba
movb %al, -0x2c(%rbp)
leal (%r14,%r14), %eax
leal (%r13,%r13,2), %r12d
shrl %r12d
cmpl %r13d, %eax
cmovbq %r13, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3400
testq %rax, %rax
je 0x125be
xorl %ecx, %ecx
movq %rax, %rbx
movq %r12, %r14
jmp 0x125c0
xorl %ecx, %ecx
jmp 0x125c3
movb $0x1, %cl
movb -0x2c(%rbp), %al
testb %cl, %cl
jne 0x125cf
movb %al, -0x1(%rbx,%r13)
movq %r13, %r15
movq -0x48(%rbp), %rax
movb 0x44(%rax), %r13b
leaq 0x1(%r15), %r12
cmpl %r12d, %r14d
jae 0x12604
addl %r14d, %r14d
leal (%r12,%r12,2), %esi
shrl %esi
cmpl %r12d, %r14d
cmovbq %r12, %rsi
movq %rbx, %rdi
callq 0x3400
testq %rax, %rax
sete %cl
cmovneq %rax, %rbx
jmp 0x12606
xorl %ecx, %ecx
testb %cl, %cl
je 0x1260f
movq %r15, %r12
jmp 0x12614
movb %r13b, -0x1(%rbx,%r12)
movq -0x40(%rbp), %r15
leaq 0x8(%r15), %rsi
leaq 0x6813(%rip), %rcx      # 0x18e36
movq %r15, %rdi
movl %r12d, %edx
movq %rbx, %r8
callq 0xdb5b
testl %eax, %eax
jne 0x1263d
movq 0x8(%r15), %rax
movq %rax, 0x10(%r15)
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3280
xorl %r12d, %r12d
jmp 0x12618