#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 */
scalar_t__ isBigEndian();
float FloatVal(float f) {
  {
    (void)((
        int (*)(char failed_static_assertion[(sizeof(float) == 4) ? 1 : -1]))0);
  };
  if (isBigEndian()) {
    union {
      float f;
      unsigned char b[4];
    } dat1, dat2;
    dat1.f = f;
    dat2.b[0] = dat1.b[3];
    dat2.b[1] = dat1.b[2];
    dat2.b[2] = dat1.b[1];
    dat2.b[3] = dat1.b[0];
    return dat2.f;
  } else
    return f;
}


x86 assembly (clang, -O0):
<FloatVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <isBigEndian@plt>
cmp    $0x0,%rax
je     115f <FloatVal+0x4f>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xd(%rbp),%al
mov    %al,-0x18(%rbp)
mov    -0xe(%rbp),%al
mov    %al,-0x17(%rbp)
mov    -0xf(%rbp),%al
mov    %al,-0x16(%rbp)
mov    -0x10(%rbp),%al
mov    %al,-0x15(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1169 <FloatVal+0x59>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FloatVal>:
push   %rax
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1030 <isBigEndian@plt>
test   %rax,%rax
je     1135 <FloatVal+0x25>
movd   0x4(%rsp),%xmm0
movd   %xmm0,%eax
bswap  %eax
movd   %eax,%xmm0
pop    %rax
ret
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @FloatVal(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca %union.anon
%5 = alloca %union.anon
store float %0, float* %3
%6 = call i64 (...) @isBigEndian()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %33
8: ; preds = %1
%9 = load float, float* %3
%10 = bitcast %union.anon* %4 to float*
store float %9, float* %10
%11 = bitcast %union.anon* %4 to [4 x i8]*
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %11, i64 0, i64 3
%13 = load i8, i8* %12
%14 = bitcast %union.anon* %5 to [4 x i8]*
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %14, i64 0, i64 0
store i8 %13, i8* %15
%16 = bitcast %union.anon* %4 to [4 x i8]*
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %16, i64 0, i64 2
%18 = load i8, i8* %17
%19 = bitcast %union.anon* %5 to [4 x i8]*
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %19, i64 0, i64 1
store i8 %18, i8* %20
%21 = bitcast %union.anon* %4 to [4 x i8]*
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %21, i64 0, i64 1
%23 = load i8, i8* %22
%24 = bitcast %union.anon* %5 to [4 x i8]*
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %24, i64 0, i64 2
store i8 %23, i8* %25
%26 = bitcast %union.anon* %4 to [4 x i8]*
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %26, i64 0, i64 0
%28 = load i8, i8* %27
%29 = bitcast %union.anon* %5 to [4 x i8]*
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %29, i64 0, i64 3
store i8 %28, i8* %30
%31 = bitcast %union.anon* %5 to float*
%32 = load float, float* %31
store float %32, float* %2
br label %35
33: ; preds = %1
%34 = load float, float* %3
store float %34, float* %2
br label %35
35: ; preds = %33, %8
%36 = load float, float* %2
ret float %36
}

LLVM IR (-O2):
define float @FloatVal(float %0) {
%2 = tail call i64 (...) @isBigEndian()
%3 = icmp eq i64 %2, 0
%4 = bitcast float %0 to i32
%5 = tail call i32 @llvm.bswap.i32(i32 %4)
%6 = bitcast i32 %5 to float
%7 = select i1 %3, float %0, float %6
ret float %7
}