#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__ ConvertBitOrder();
void ConvertToFloat(unsigned char *cnv, float *val) {
  unsigned char *out;
  int i;
  out = (unsigned char *)val;
  if (ConvertBitOrder() == 0)
    for (i = 0; i < 4; i++)
      out[i] = cnv[3 - i];
  else
    for (i = 0; i < 4; i++)
      out[i] = cnv[i];
}


x86 assembly (clang, -O0):
<ConvertToFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <ConvertBitOrder@plt>
cmp    $0x0,%rax
jne    117a <ConvertToFloat+0x6a>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1175 <ConvertToFloat+0x65>
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <ConvertToFloat+0x30>
jmp    11b4 <ConvertToFloat+0xa4>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11af <ConvertToFloat+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1181 <ConvertToFloat+0x71>
jmp    11b4 <ConvertToFloat+0xa4>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertToFloat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <ConvertBitOrder@plt>
test   %rax,%rax
je     113f <ConvertToFloat+0x2f>
mov    (%rbx),%al
mov    %al,(%r14)
mov    0x1(%rbx),%al
mov    %al,0x1(%r14)
mov    0x2(%rbx),%al
mov    %al,0x2(%r14)
add    $0x3,%rbx
jmp    1153 <ConvertToFloat+0x43>
mov    0x3(%rbx),%al
mov    %al,(%r14)
mov    0x2(%rbx),%al
mov    %al,0x1(%r14)
mov    0x1(%rbx),%al
mov    %al,0x2(%r14)
mov    (%rbx),%al
mov    %al,0x3(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ConvertToFloat(i8* %0, float* %1) {
%3 = alloca i8*
%4 = alloca float*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store float* %1, float** %4
%7 = load float*, float** %4
%8 = bitcast float* %7 to i8*
store i8* %8, i8** %5
%9 = call i64 (...) @ConvertBitOrder()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %30
11: ; preds = %2
store i32 0, i32* %6
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %29
15: ; preds = %12
%16 = load i8*, i8** %3
%17 = load i32, i32* %6
%18 = sub nsw i32 3, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %16, i64 %19
%21 = load i8, i8* %20
%22 = load i8*, i8** %5
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 %21, i8* %25
br label %26
26: ; preds = %15
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %12
29: ; preds = %12
br label %48
30: ; preds = %2
store i32 0, i32* %6
br label %31
31: ; preds = %44, %30
%32 = load i32, i32* %6
%33 = icmp slt i32 %32, 4
br i1 %33, label %34, label %47
34: ; preds = %31
%35 = load i8*, i8** %3
%36 = load i32, i32* %6
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = load i8*, i8** %5
%41 = load i32, i32* %6
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
store i8 %39, i8* %43
br label %44
44: ; preds = %34
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %31
47: ; preds = %31
br label %48
48: ; preds = %47, %29
ret void
}

LLVM IR (-O2):
define void @ConvertToFloat(i8* nocapture %0, float* nocapture writeonly %1) {
%3 = bitcast float* %1 to i8*
%4 = tail call i64 (...) @ConvertBitOrder()
%5 = icmp eq i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = load i8, i8* %0
store i8 %7, i8* %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %9, i8* %10
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %3, i64 2
store i8 %12, i8* %13
%14 = getelementptr inbounds i8, i8* %0, i64 3
br label %24
15: ; preds = %2
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
store i8 %17, i8* %3
%18 = getelementptr inbounds i8, i8* %0, i64 2
%19 = load i8, i8* %18
%20 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %19, i8* %20
%21 = getelementptr inbounds i8, i8* %0, i64 1
%22 = load i8, i8* %21
%23 = getelementptr inbounds i8, i8* %3, i64 2
store i8 %22, i8* %23
br label %24
24: ; preds = %6, %15
%25 = phi i8* [ %14, %6 ], [ %0, %15 ]
%26 = load i8, i8* %25
%27 = getelementptr inbounds i8, i8* %3, i64 3
store i8 %26, i8* %27
ret void
}