#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 extract8888rev(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 & 0x000000FF)) / 255.0;
  extractComponents[1] = (float)((uint & 0x0000FF00) >> 8) / 255.0;
  extractComponents[2] = (float)((uint & 0x00FF0000) >> 16) / 255.0;
  extractComponents[3] = (float)((uint & 0xFF000000) >> 24) / 255.0;
}


x86 assembly (clang, -O0):
<extract8888rev>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1149 <extract8888rev+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 <extract8888rev+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movzbl -0x1c(%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)
movzbl -0x1b(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
movzbl -0x1a(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
movzbl -0x19(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract8888rev>:
test   %edi,%edi
je     111e <extract8888rev+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 <extract8888rev+0x20>
mov    (%rsi),%eax
mov    %eax,%ecx
shr    $0x8,%ecx
movd   %ecx,%xmm0
movd   %eax,%xmm1
shr    $0x10,%eax
pshufd $0x0,%xmm1,%xmm2
punpckldq %xmm0,%xmm1
movd   %eax,%xmm0
punpcklqdq %xmm0,%xmm1
pand   0xeb7(%rip),%xmm1
psrld  $0x18,%xmm2
shufps $0x23,%xmm1,%xmm2
shufps $0x24,%xmm2,%xmm1
cvtdq2ps %xmm1,%xmm0
divps  0xeb0(%rip),%xmm0
movups %xmm0,(%rdx)
ret

LLVM IR (-O0):
define void @extract8888rev(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, 255
%40 = sitofp i32 %39 to float
%41 = fpext float %40 to double
%42 = fdiv double %41, 2.550000e+02
%43 = fptrunc double %42 to float
%44 = load float*, float** %6
%45 = getelementptr inbounds float, float* %44, i64 0
store float %43, float* %45
%46 = load i32, i32* %7
%47 = and i32 %46, 65280
%48 = ashr i32 %47, 8
%49 = sitofp i32 %48 to float
%50 = fpext float %49 to double
%51 = fdiv double %50, 2.550000e+02
%52 = fptrunc double %51 to float
%53 = load float*, float** %6
%54 = getelementptr inbounds float, float* %53, i64 1
store float %52, float* %54
%55 = load i32, i32* %7
%56 = and i32 %55, 16711680
%57 = ashr i32 %56, 16
%58 = sitofp i32 %57 to float
%59 = fpext float %58 to double
%60 = fdiv double %59, 2.550000e+02
%61 = fptrunc double %60 to float
%62 = load float*, float** %6
%63 = getelementptr inbounds float, float* %62, i64 2
store float %61, float* %63
%64 = load i32, i32* %7
%65 = and i32 %64, -16777216
%66 = lshr i32 %65, 24
%67 = uitofp 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 @extract8888rev(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, 8
%28 = lshr i32 %26, 16
%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 = and <4 x i32> %32, <i32 255, i32 255, i32 255, i32 poison>
%34 = lshr <4 x i32> %32, <i32 255, i32 255, i32 255, i32 24>
%35 = shufflevector <4 x i32> %33, <4 x i32> %34, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
%36 = sitofp <4 x i32> %35 to <4 x float>
%37 = uitofp <4 x i32> %35 to <4 x float>
%38 = shufflevector <4 x float> %36, <4 x float> %37, <4 x i32> <i32 0, i32 1, i32 2, 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
}