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


x86 assembly (clang, -O0):
<ConvertFromFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <ConvertBitOrder@plt>
cmp    $0x0,%rax
jne    117b <ConvertFromFloat+0x6b>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1176 <ConvertFromFloat+0x66>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    $0x3,%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <ConvertFromFloat+0x31>
jmp    11b5 <ConvertFromFloat+0xa5>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    11b0 <ConvertFromFloat+0xa0>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1182 <ConvertFromFloat+0x72>
jmp    11b5 <ConvertFromFloat+0xa5>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConvertFromFloat>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1030 <ConvertBitOrder@plt>
test   %rax,%rax
je     1136 <ConvertFromFloat+0x26>
movd   0xc(%rsp),%xmm0
movd   %xmm0,(%rbx)
jmp    1144 <ConvertFromFloat+0x34>
movd   0xc(%rsp),%xmm0
movd   %xmm0,%eax
bswap  %eax
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ConvertFromFloat(float %0, i8* nocapture writeonly %1) {
%3 = tail call i64 (...) @ConvertBitOrder()
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = bitcast i8* %1 to float*
store float %0, float* %6
br label %19
7: ; preds = %2
%8 = bitcast float %0 to i32
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %9, i8* %10
%11 = lshr i32 %8, 8
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %12, i8* %13
%14 = lshr i32 %8, 16
%15 = trunc i32 %14 to i8
%16 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %15, i8* %16
%17 = lshr i32 %8, 24
%18 = trunc i32 %17 to i8
store i8 %18, i8* %1
br label %19
19: ; preds = %5, %7
ret void
}