#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int GLuint;
typedef int GLubyte;
typedef float GLfloat;

/* Variables and functions */
void extract8888(int isSwap, const void *packedPixel,
                 GLfloat extractComponents[]) {
  GLuint uint;
  if (isSwap) {
    uint = (GLuint)(((GLuint)((const GLubyte *)(packedPixel))[3]) << 24 |
                    ((GLuint)((const GLubyte *)(packedPixel))[2]) << 16 |
                    ((GLuint)((const GLubyte *)(packedPixel))[1]) << 8 |
                    ((const GLubyte *)(packedPixel))[0]);
  } else {
    uint = *(const GLuint *)packedPixel;
  }
  extractComponents[0] = (float)((uint & 0xff000000) >> 24) / 255.0;
  extractComponents[1] = (float)((uint & 0x00ff0000) >> 16) / 255.0;
  extractComponents[2] = (float)((uint & 0x0000ff00) >> 8) / 255.0;
  extractComponents[3] = (float)((uint & 0x000000ff)) / 255.0;
}


x86 assembly (clang, -O0):
<extract8888>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1149 <extract8888+0x49>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x18,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
or     (%rcx),%eax
mov    %eax,-0x1c(%rbp)
jmp    1152 <extract8888+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movzbl -0x19(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x1c(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6f(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x1c(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe43(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x1c(%rbp),%eax
and    $0xff,%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract8888>:
test   %edi,%edi
je     111e <extract8888+0x1e>
mov    0xc(%rsi),%ecx
shl    $0x18,%ecx
mov    0x4(%rsi),%eax
mov    0x8(%rsi),%edi
shl    $0x10,%edi
or     %ecx,%edi
shl    $0x8,%eax
or     %edi,%eax
or     (%rsi),%eax
jmp    1120 <extract8888+0x20>
mov    (%rsi),%eax
mov    %eax,%ecx
shr    $0x10,%ecx
movd   %eax,%xmm0
shr    $0x8,%eax
movd   %ecx,%xmm1
movd   %eax,%xmm2
movdqa %xmm0,%xmm3
punpcklqdq %xmm2,%xmm3
shufps $0x20,%xmm3,%xmm1
psrld  $0x18,%xmm0
andps  0xeb4(%rip),%xmm1
movss  %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm0
divps  0xeb6(%rip),%xmm0
movups %xmm0,(%rdx)
ret

LLVM IR (-O0):
define void @extract8888(i32 %0, i8* %1, float* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca float*
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store float* %2, float** %6
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %33
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 3
%14 = load i32, i32* %13
%15 = shl i32 %14, 24
%16 = load i8*, i8** %5
%17 = bitcast i8* %16 to i32*
%18 = getelementptr inbounds i32, i32* %17, i64 2
%19 = load i32, i32* %18
%20 = shl i32 %19, 16
%21 = or i32 %15, %20
%22 = load i8*, i8** %5
%23 = bitcast i8* %22 to i32*
%24 = getelementptr inbounds i32, i32* %23, i64 1
%25 = load i32, i32* %24
%26 = shl i32 %25, 8
%27 = or i32 %21, %26
%28 = load i8*, i8** %5
%29 = bitcast i8* %28 to i32*
%30 = getelementptr inbounds i32, i32* %29, i64 0
%31 = load i32, i32* %30
%32 = or i32 %27, %31
store i32 %32, i32* %7
br label %37
33: ; preds = %3
%34 = load i8*, i8** %5
%35 = bitcast i8* %34 to i32*
%36 = load i32, i32* %35
store i32 %36, i32* %7
br label %37
37: ; preds = %33, %10
%38 = load i32, i32* %7
%39 = and i32 %38, -16777216
%40 = lshr i32 %39, 24
%41 = uitofp i32 %40 to float
%42 = fpext float %41 to double
%43 = fdiv double %42, 2.550000e+02
%44 = fptrunc double %43 to float
%45 = load float*, float** %6
%46 = getelementptr inbounds float, float* %45, i64 0
store float %44, float* %46
%47 = load i32, i32* %7
%48 = and i32 %47, 16711680
%49 = ashr i32 %48, 16
%50 = sitofp i32 %49 to float
%51 = fpext float %50 to double
%52 = fdiv double %51, 2.550000e+02
%53 = fptrunc double %52 to float
%54 = load float*, float** %6
%55 = getelementptr inbounds float, float* %54, i64 1
store float %53, float* %55
%56 = load i32, i32* %7
%57 = and i32 %56, 65280
%58 = ashr i32 %57, 8
%59 = sitofp i32 %58 to float
%60 = fpext float %59 to double
%61 = fdiv double %60, 2.550000e+02
%62 = fptrunc double %61 to float
%63 = load float*, float** %6
%64 = getelementptr inbounds float, float* %63, i64 2
store float %62, float* %64
%65 = load i32, i32* %7
%66 = and i32 %65, 255
%67 = sitofp i32 %66 to float
%68 = fpext float %67 to double
%69 = fdiv double %68, 2.550000e+02
%70 = fptrunc double %69 to float
%71 = load float*, float** %6
%72 = getelementptr inbounds float, float* %71, i64 3
store float %70, float* %72
ret void
}

LLVM IR (-O2):
define void @extract8888(i32 %0, i8* nocapture %1, float* nocapture writeonly %2) {
%4 = icmp eq i32 %0, 0
%5 = bitcast i8* %1 to i32*
br i1 %4, label %23, label %6
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %1, i64 12
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = shl i32 %9, 24
%11 = getelementptr inbounds i8, i8* %1, i64 8
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
%14 = shl i32 %13, 16
%15 = or i32 %14, %10
%16 = getelementptr inbounds i8, i8* %1, i64 4
%17 = bitcast i8* %16 to i32*
%18 = load i32, i32* %17
%19 = shl i32 %18, 8
%20 = or i32 %15, %19
%21 = load i32, i32* %5
%22 = or i32 %20, %21
br label %25
23: ; preds = %3
%24 = load i32, i32* %5
br label %25
25: ; preds = %23, %6
%26 = phi i32 [ %22, %6 ], [ %24, %23 ]
%27 = lshr i32 %26, 16
%28 = lshr i32 %26, 8
%29 = insertelement <4 x i32> poison, i32 %26, i64 0
%30 = insertelement <4 x i32> %29, i32 %27, i64 1
%31 = insertelement <4 x i32> %30, i32 %28, i64 2
%32 = insertelement <4 x i32> %31, i32 %26, i64 3
%33 = lshr <4 x i32> %32, <i32 24, i32 255, i32 255, i32 255>
%34 = and <4 x i32> %32, <i32 poison, i32 255, i32 255, i32 255>
%35 = shufflevector <4 x i32> %33, <4 x i32> %34, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
%36 = uitofp <4 x i32> %35 to <4 x float>
%37 = sitofp <4 x i32> %35 to <4 x float>
%38 = shufflevector <4 x float> %36, <4 x float> %37, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
%39 = fdiv <4 x float> %38, <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>
%40 = bitcast float* %2 to <4 x float>*
store <4 x float> %39, <4 x float>* %40
ret void
}