// File: /workspace/github_cpp_makefile_star2_O1/mhe[P]raytracerframework_cpp/lodepng.cpp
// Function: addChunk_bKGD(ucvector*, LodePNG_InfoPng const*)
static unsigned addChunk_bKGD(ucvector* out, const LodePNG_InfoPng* info)
{
  unsigned error = 0;
  ucvector bKGD;
  ucvector_init(&bKGD);
  if(info->color.colorType == 0 || info->color.colorType == 4)
  {
    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 == 2 || info->color.colorType == 6)
  {
    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 == 3)
  {
    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 $0x18, %rsp
movq %rdi, %r14
movl 0x18(%rsi), %edx
xorl %r12d, %r12d
xorl %eax, %eax
cmpq $0x6, %rdx
ja 0x21a30
movq %rsi, %r15
leaq 0x100b0(%rip), %rcx     # 0x31850
movslq (%rcx,%rdx,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
movl 0x44(%r15), %ebx
movl $0x8, %edi
callq 0x5420
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
je 0x21872
movl %ebx, %r13d
movb %bh, -0x1(%rax,%rcx)
movl $0x2, %r12d
jmp 0x2187b
movl 0x44(%r15), %r12d
movl $0x8, %edi
callq 0x5420
xorl %ebx, %ebx
testq %rax, %rax
setne %bl
leal (,%rbx,8), %edx
testq %rax, %rax
movl %r12d, -0x2c(%rbp)
je 0x21835
movl %r12d, %ecx
movb %ch, -0x1(%rax,%rbx)
movl $0x2, %r13d
jmp 0x2183b
movl 0x44(%r15), %ebx
movl $0x8, %edi
callq 0x5420
xorl %r12d, %r12d
testq %rax, %rax
setne %r12b
je 0x21a30
movq %rax, %rcx
addq %r12, %rcx
jmp 0x21a2d
movl $0x1, %r13d
leal (,%r13,4), %ecx
cmpl %edx, %ecx
jbe 0x2186e
movq %rdx, -0x38(%rbp)
leal (,%r13,8), %r12d
movq %rax, %rdi
movq %rax, -0x40(%rbp)
movq %r12, %rsi
callq 0x5500
testq %rax, %rax
je 0x218b1
xorl %ecx, %ecx
movq %r12, %rdx
jmp 0x218be
xorl %ecx, %ecx
jmp 0x218be
movl %ebx, %r13d
movl $0x1, %r12d
testq %rax, %rax
jne 0x2189f
movq %rcx, %rbx
leal (,%r12,8), %esi
movq %rax, %r15
movq %rax, %rdi
callq 0x5500
testq %rax, %rax
je 0x21a6e
xorl %ecx, %ecx
testb %cl, %cl
jne 0x21a30
movl %r13d, %ebx
jmp 0x21a29
movb $0x1, %cl
movq %rbx, %r13
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rdx
movq %r14, -0x40(%rbp)
testb %cl, %cl
movl -0x2c(%rbp), %ecx
jne 0x218ce
movb %cl, -0x1(%rax,%r13)
movb 0x49(%r15), %sil
leaq 0x1(%r13), %r14
leal (,%r14,4), %ecx
cmpl %edx, %ecx
jbe 0x2190c
movb %sil, -0x2c(%rbp)
movq %rdx, -0x38(%rbp)
leal (,%r14,8), %r12d
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x5500
testq %rax, %rax
je 0x21910
xorl %ecx, %ecx
movq %r12, %rdx
jmp 0x2191c
xorl %ecx, %ecx
jmp 0x21920
movb $0x1, %cl
movq %r13, %r14
movq %rbx, %rax
movq -0x38(%rbp), %rdx
movb -0x2c(%rbp), %sil
testb %cl, %cl
jne 0x21929
movb %sil, -0x1(%rax,%r14)
movb 0x48(%r15), %sil
leaq 0x1(%r14), %r13
leal (,%r13,4), %ecx
cmpl %edx, %ecx
jbe 0x21967
movb %sil, -0x2c(%rbp)
movq %rdx, -0x38(%rbp)
leal (,%r13,8), %r12d
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x5500
testq %rax, %rax
je 0x2196b
xorl %ecx, %ecx
movq %r12, %rdx
jmp 0x21977
xorl %ecx, %ecx
jmp 0x2197b
movb $0x1, %cl
movq %r14, %r13
movq %rbx, %rax
movq -0x38(%rbp), %rdx
movb -0x2c(%rbp), %sil
testb %cl, %cl
jne 0x21984
movb %sil, -0x1(%rax,%r13)
movb 0x4d(%r15), %sil
leaq 0x1(%r13), %r14
leal (,%r14,4), %ecx
cmpl %edx, %ecx
jbe 0x219c2
movb %sil, -0x2c(%rbp)
movq %rdx, -0x38(%rbp)
leal (,%r14,8), %r12d
movq %rax, %rbx
movq %rax, %rdi
movq %r12, %rsi
callq 0x5500
testq %rax, %rax
je 0x219c6
xorl %ecx, %ecx
movq %r12, %rdx
jmp 0x219d2
xorl %ecx, %ecx
jmp 0x219d6
movb $0x1, %cl
movq %r13, %r14
movq %rbx, %rax
movq -0x38(%rbp), %rdx
movb -0x2c(%rbp), %sil
testb %cl, %cl
jne 0x219df
movb %sil, -0x1(%rax,%r14)
movl 0x4c(%r15), %ebx
leaq 0x1(%r14), %r12
leal (,%r12,4), %ecx
cmpl %edx, %ecx
jbe 0x21a12
movl %ebx, %r15d
leal (,%r12,8), %esi
movq %rax, %rbx
movq %rax, %rdi
callq 0x5500
testq %rax, %rax
je 0x21a16
xorl %ecx, %ecx
jmp 0x21a1e
xorl %ecx, %ecx
jmp 0x21a21
movb $0x1, %cl
movq %r14, %r12
movq %rbx, %rax
movl %r15d, %ebx
testb %cl, %cl
movq -0x40(%rbp), %r14
jne 0x21a30
leaq (%rax,%r12), %rcx
movb %bl, -0x1(%rcx)
leaq 0x8(%r14), %rsi
leaq 0x10188(%rip), %rcx     # 0x31bc3
movq %rax, %rbx
movq %r14, %rdi
movl %r12d, %edx
movq %rax, %r8
callq 0x1d440
testl %eax, %eax
jne 0x21a58
movq 0x8(%r14), %rax
movq %rax, 0x10(%r14)
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5390
movb $0x1, %cl
movq %rbx, %r12
movq %r15, %rax
jmp 0x218a1