#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 GLushort;
typedef int GLubyte;
typedef float GLfloat;

/* Variables and functions */
void extract5551(int isSwap, const void *packedPixel,
                 GLfloat extractComponents[]) {
  GLushort ushort;
  if (isSwap) {
    ushort = (GLushort)(((GLushort)((const GLubyte *)(packedPixel))[1]) << 8 |
                        ((const GLubyte *)(packedPixel))[0]);
  } else {
    ushort = *(const GLushort *)packedPixel;
  }
  extractComponents[0] = (float)((ushort & 0xf800) >> 11) / 31.0;
  extractComponents[1] = (float)((ushort & 0x07c0) >> 6) / 31.0;
  extractComponents[2] = (float)((ushort & 0x003e) >> 1) / 31.0;
  extractComponents[3] = (float)((ushort & 0x0001));
}


x86 assembly (clang, -O0):
<extract5551>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1131 <extract5551+0x31>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
or     (%rcx),%eax
mov    %eax,-0x1c(%rbp)
jmp    113a <extract5551+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
and    $0xf800,%eax
sar    $0xb,%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeab(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x1c(%rbp),%eax
and    $0x7c0,%eax
sar    $0x6,%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe80(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x1c(%rbp),%eax
and    $0x3e,%eax
sar    $0x1,%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x1c(%rbp),%eax
and    $0x1,%eax
cvtsi2ss %eax,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract5551>:
test   %edi,%edi
je     110e <extract5551+0xe>
mov    0x4(%rsi),%eax
shl    $0x8,%eax
or     (%rsi),%eax
jmp    1110 <extract5551+0x10>
mov    (%rsi),%eax
mov    %eax,%ecx
shr    $0xb,%ecx
and    $0x1f,%ecx
cvtsi2ss %ecx,%xmm0
movss  0xedc(%rip),%xmm1
mov    %eax,%ecx
shr    $0x6,%ecx
and    $0x1f,%ecx
cvtsi2ss %ecx,%xmm2
divss  %xmm1,%xmm0
movss  %xmm0,(%rdx)
divss  %xmm1,%xmm2
mov    %eax,%ecx
shr    %ecx
and    $0x1f,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
movss  %xmm2,0x4(%rdx)
divss  %xmm1,%xmm0
movss  %xmm0,0x8(%rdx)
and    $0x1,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rdx)
ret

LLVM IR (-O0):
define void @extract5551(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 %21
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = load i8*, i8** %5
%17 = bitcast i8* %16 to i32*
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = or i32 %15, %19
store i32 %20, i32* %7
br label %25
21: ; preds = %3
%22 = load i8*, i8** %5
%23 = bitcast i8* %22 to i32*
%24 = load i32, i32* %23
store i32 %24, i32* %7
br label %25
25: ; preds = %21, %10
%26 = load i32, i32* %7
%27 = and i32 %26, 63488
%28 = ashr i32 %27, 11
%29 = sitofp i32 %28 to float
%30 = fpext float %29 to double
%31 = fdiv double %30, 3.100000e+01
%32 = fptrunc double %31 to float
%33 = load float*, float** %6
%34 = getelementptr inbounds float, float* %33, i64 0
store float %32, float* %34
%35 = load i32, i32* %7
%36 = and i32 %35, 1984
%37 = ashr i32 %36, 6
%38 = sitofp i32 %37 to float
%39 = fpext float %38 to double
%40 = fdiv double %39, 3.100000e+01
%41 = fptrunc double %40 to float
%42 = load float*, float** %6
%43 = getelementptr inbounds float, float* %42, i64 1
store float %41, float* %43
%44 = load i32, i32* %7
%45 = and i32 %44, 62
%46 = ashr i32 %45, 1
%47 = sitofp i32 %46 to float
%48 = fpext float %47 to double
%49 = fdiv double %48, 3.100000e+01
%50 = fptrunc double %49 to float
%51 = load float*, float** %6
%52 = getelementptr inbounds float, float* %51, i64 2
store float %50, float* %52
%53 = load i32, i32* %7
%54 = and i32 %53, 1
%55 = sitofp i32 %54 to float
%56 = load float*, float** %6
%57 = getelementptr inbounds float, float* %56, i64 3
store float %55, float* %57
ret void
}

LLVM IR (-O2):
define void @extract5551(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 %13, label %6
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %1, i64 4
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = load i32, i32* %5
%12 = or i32 %10, %11
br label %15
13: ; preds = %3
%14 = load i32, i32* %5
br label %15
15: ; preds = %13, %6
%16 = phi i32 [ %12, %6 ], [ %14, %13 ]
%17 = lshr i32 %16, 11
%18 = and i32 %17, 31
%19 = sitofp i32 %18 to float
%20 = fdiv float %19, 3.100000e+01
store float %20, float* %2
%21 = lshr i32 %16, 6
%22 = and i32 %21, 31
%23 = sitofp i32 %22 to float
%24 = fdiv float %23, 3.100000e+01
%25 = getelementptr inbounds float, float* %2, i64 1
store float %24, float* %25
%26 = lshr i32 %16, 1
%27 = and i32 %26, 31
%28 = sitofp i32 %27 to float
%29 = fdiv float %28, 3.100000e+01
%30 = getelementptr inbounds float, float* %2, i64 2
store float %29, float* %30
%31 = and i32 %16, 1
%32 = sitofp i32 %31 to float
%33 = getelementptr inbounds float, float* %2, i64 3
store float %32, float* %33
ret void
}