#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 */

/* Variables and functions */
int read(int, unsigned int *, int);
int read_float4(int f, float *x) {
  unsigned int n, *iptr;
  if (read(f, &n, 4) == 4) {
    iptr = (unsigned int *)x;
    *iptr = ((n & 0xff000000) >> 24 | (n & 0x00ff0000) >> 8 |
             (n & 0x0000ff00) << 8 | (n & 0x000000ff) << 24);
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<read_float4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
cmp    $0x4,%eax
jne    1186 <read_float4+0x76>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
mov    -0x14(%rbp),%eax
and    $0xff0000,%eax
shr    $0x8,%eax
or     %eax,%ecx
mov    -0x14(%rbp),%eax
and    $0xff00,%eax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x14(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
or     %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    118d <read_float4+0x7d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_float4>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1030 <read@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
jne    113d <read_float4+0x2d>
mov    0xc(%rsp),%eax
bswap  %eax
mov    %eax,(%rbx)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_float4(i32 %0, float* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %4
store float* %1, float** %5
%8 = load i32, i32* %4
%9 = call i32 @read(i32 %8, i32* %6, i32 4)
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %30
11: ; preds = %2
%12 = load float*, float** %5
%13 = bitcast float* %12 to i32*
store i32* %13, i32** %7
%14 = load i32, i32* %6
%15 = and i32 %14, -16777216
%16 = lshr i32 %15, 24
%17 = load i32, i32* %6
%18 = and i32 %17, 16711680
%19 = lshr i32 %18, 8
%20 = or i32 %16, %19
%21 = load i32, i32* %6
%22 = and i32 %21, 65280
%23 = shl i32 %22, 8
%24 = or i32 %20, %23
%25 = load i32, i32* %6
%26 = and i32 %25, 255
%27 = shl i32 %26, 24
%28 = or i32 %24, %27
%29 = load i32*, i32** %7
store i32 %28, i32* %29
store i32 1, i32* %3
br label %31
30: ; preds = %2
store i32 0, i32* %3
br label %31
31: ; preds = %30, %11
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @read_float4(i32 %0, float* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @read(i32 %0, i32* %3, i32 4)
%6 = icmp eq i32 %5, 4
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = bitcast float* %1 to i32*
%9 = load i32, i32* %3
%10 = tail call i32 @llvm.bswap.i32(i32 %9)
store i32 %10, i32* %8
br label %11
11: ; preds = %2, %7
%12 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %12
}