// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/libraries/libwebp/src/dsp/lossless.c
// Function: VP8LConvertFromBGRA
void VP8LConvertFromBGRA(const uint32_t* const in_data, int num_pixels,
                         WEBP_CSP_MODE out_colorspace, uint8_t* const rgba) {
  switch (out_colorspace) {
    case MODE_RGB:
      VP8LConvertBGRAToRGB(in_data, num_pixels, rgba);
      break;
    case MODE_RGBA:
      VP8LConvertBGRAToRGBA(in_data, num_pixels, rgba);
      break;
    case MODE_rgbA:
      VP8LConvertBGRAToRGBA(in_data, num_pixels, rgba);
      WebPApplyAlphaMultiply(rgba, 0, num_pixels, 1, 0);
      break;
    case MODE_BGR:
      VP8LConvertBGRAToBGR(in_data, num_pixels, rgba);
      break;
    case MODE_BGRA:
      CopyOrSwap(in_data, num_pixels, rgba, 1);
      break;
    case MODE_bgrA:
      CopyOrSwap(in_data, num_pixels, rgba, 1);
      WebPApplyAlphaMultiply(rgba, 0, num_pixels, 1, 0);
      break;
    case MODE_ARGB:
      CopyOrSwap(in_data, num_pixels, rgba, 0);
      break;
    case MODE_Argb:
      CopyOrSwap(in_data, num_pixels, rgba, 0);
      WebPApplyAlphaMultiply(rgba, 1, num_pixels, 1, 0);
      break;
    case MODE_RGBA_4444:
      VP8LConvertBGRAToRGBA4444(in_data, num_pixels, rgba);
      break;
    case MODE_rgbA_4444:
      VP8LConvertBGRAToRGBA4444(in_data, num_pixels, rgba);
      WebPApplyAlphaMultiply4444(rgba, num_pixels, 1, 0);
      break;
    case MODE_RGB_565:
      VP8LConvertBGRAToRGB565(in_data, num_pixels, rgba);
      break;
    default:
      assert(0);          // Code flow should not reach here.
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0xa, %edx
ja 0xdab20
movq %rcx, %rbx
movl %esi, %ebp
movq %rdi, %rsi
movl %edx, %eax
leaq 0x511ed(%rip), %rcx     # 0x12bbe8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xa0a15(%rip), %rax     # 0x17b420
jmp 0xdaab4
testl %ebp, %ebp
jle 0xdaa2e
movslq %ebp, %rax
leaq (%rsi,%rax,4), %rax
movl (%rsi), %ecx
addq $0x4, %rsi
bswapl %ecx
movl %ecx, (%rbx)
addq $0x4, %rbx
cmpq %rax, %rsi
jb 0xdaa1b
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
testl %ebp, %ebp
jle 0xdaa56
movslq %ebp, %rax
leaq (%rsi,%rax,4), %rax
movq %rbx, %rcx
movl (%rsi), %edx
addq $0x4, %rsi
bswapl %edx
movl %edx, (%rcx)
addq $0x4, %rcx
cmpq %rax, %rsi
jb 0xdaa43
leaq 0xa07ab(%rip), %rax     # 0x17b208
movq (%rax), %rax
movq %rbx, %rdi
movl $0x1, %esi
jmp 0xdab0e
movq 0xa09bc(%rip), %rax     # 0x17b430
jmp 0xdaab4
movslq %ebp, %rdx
shlq $0x2, %rdx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x552d0
movq %rsi, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq *0xa098f(%rip)          # 0x17b428
jmp 0xdaaff
movq 0xa0986(%rip), %rax     # 0x17b428
jmp 0xdaab4
movq 0xa098d(%rip), %rax     # 0x17b438
jmp 0xdaab4
movq 0xa098c(%rip), %rax     # 0x17b440
movq %rsi, %rdi
movl %ebp, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rax
movq %rsi, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq *0xa0966(%rip)          # 0x17b438
leaq 0xa0737(%rip), %rax     # 0x17b210
movq (%rax), %rax
movq %rbx, %rdi
movl %ebp, %esi
movl $0x1, %edx
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rax
movslq %ebp, %rdx
shlq $0x2, %rdx
movq %rbx, %rdi
callq 0x552d0
leaq 0xa0702(%rip), %rax     # 0x17b208
movq (%rax), %rax
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
movl $0x1, %ecx
xorl %r8d, %r8d
addq $0x8, %rsp
popq %rbx
popq %rbp
jmpq *%rax
leaq 0x51823(%rip), %rdi     # 0x12c34a
leaq 0x510fa(%rip), %rsi     # 0x12bc28
leaq 0x5118b(%rip), %rcx     # 0x12bcc0
movl $0x237, %edx            # imm = 0x237
callq 0x55710