#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 */
long pow(double, double);
float real2float(const char *xreal) {
  union {
    unsigned long l;
    char c[4];
  } yreal;
  long vorzeichen, exponent, mantisse, i;
  for (i = 0; i < 4; i++)
    yreal.c[i] = xreal[i];
  vorzeichen = ((yreal.l & 0x80000000) != 0);
  exponent = ((yreal.l & 0x7f000000) >> 24) - 64;
  mantisse = (yreal.l & 0x00ffffff);
  if (vorzeichen)
    return (-mantisse / 16777216.0 * pow(16.0, (double)exponent));
  else
    return (mantisse / 16777216.0 * pow(16.0, (double)exponent));
}


x86 assembly (clang, -O0):
<real2float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0x4,-0x38(%rbp)
jge    1153 <real2float+0x43>
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x38(%rbp),%rax
mov    %cl,-0x18(%rbp,%rax,1)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1124 <real2float+0x14>
movabs $0x80000000,%rax
and    -0x18(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
and    $0x7f000000,%rax
shr    $0x18,%rax
sub    $0x40,%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
and    $0xffffff,%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11ed <real2float+0xdd>
xor    %eax,%eax
sub    -0x30(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  0xe53(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdq -0x28(%rbp),%xmm1
movsd  0xe34(%rip),%xmm0
call   1030 <pow@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    122e <real2float+0x11e>
cvtsi2sdq -0x30(%rbp),%xmm0
movsd  0xe0d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
cvtsi2sdq -0x28(%rbp),%xmm1
movsd  0xdee(%rip),%xmm0
call   1030 <pow@plt>
movsd  -0x48(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<real2float>:
push   %rax
mov    (%rdi),%eax
mov    %eax,%ecx
shr    $0x18,%ecx
and    $0x7f,%ecx
add    $0xffffffc0,%ecx
mov    %eax,%edx
and    $0xffffff,%edx
mov    %edx,%esi
neg    %esi
test   $0x80000000,%eax
cmove  %edx,%esi
cvtsi2sd %esi,%xmm0
mulsd  0xec2(%rip),%xmm0
movsd  %xmm0,(%rsp)
cvtsi2sd %ecx,%xmm1
movsd  0xeb9(%rip),%xmm0
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mulsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%union.anon = type { i64 }
define float @real2float(i8* %0) {
%2 = alloca float
%3 = alloca i8*
%4 = alloca %union.anon
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %3
store i64 0, i64* %8
br label %9
9: ; preds = %20, %1
%10 = load i64, i64* %8
%11 = icmp slt i64 %10, 4
br i1 %11, label %12, label %23
12: ; preds = %9
%13 = load i8*, i8** %3
%14 = load i64, i64* %8
%15 = getelementptr inbounds i8, i8* %13, i64 %14
%16 = load i8, i8* %15
%17 = bitcast %union.anon* %4 to [4 x i8]*
%18 = load i64, i64* %8
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %17, i64 0, i64 %18
store i8 %16, i8* %19
br label %20
20: ; preds = %12
%21 = load i64, i64* %8
%22 = add nsw i64 %21, 1
store i64 %22, i64* %8
br label %9
23: ; preds = %9
%24 = bitcast %union.anon* %4 to i64*
%25 = load i64, i64* %24
%26 = and i64 %25, 2147483648
%27 = icmp ne i64 %26, 0
%28 = zext i1 %27 to i32
%29 = sext i32 %28 to i64
store i64 %29, i64* %5
%30 = bitcast %union.anon* %4 to i64*
%31 = load i64, i64* %30
%32 = and i64 %31, 2130706432
%33 = lshr i64 %32, 24
%34 = sub i64 %33, 64
store i64 %34, i64* %6
%35 = bitcast %union.anon* %4 to i64*
%36 = load i64, i64* %35
%37 = and i64 %36, 16777215
store i64 %37, i64* %7
%38 = load i64, i64* %5
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %51
40: ; preds = %23
%41 = load i64, i64* %7
%42 = sub nsw i64 0, %41
%43 = sitofp i64 %42 to double
%44 = fdiv double %43, 0x4170000000000000
%45 = load i64, i64* %6
%46 = sitofp i64 %45 to double
%47 = call i64 @pow(double 1.600000e+01, double %46)
%48 = sitofp i64 %47 to double
%49 = fmul double %44, %48
%50 = fptrunc double %49 to float
store float %50, float* %2
br label %61
51: ; preds = %23
%52 = load i64, i64* %7
%53 = sitofp i64 %52 to double
%54 = fdiv double %53, 0x4170000000000000
%55 = load i64, i64* %6
%56 = sitofp i64 %55 to double
%57 = call i64 @pow(double 1.600000e+01, double %56)
%58 = sitofp i64 %57 to double
%59 = fmul double %54, %58
%60 = fptrunc double %59 to float
store float %60, float* %2
br label %61
61: ; preds = %51, %40
%62 = load float, float* %2
ret float %62
}

LLVM IR (-O2):
define float @real2float(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = and i64 %4, 2147483648
%6 = icmp eq i64 %5, 0
%7 = lshr i64 %4, 24
%8 = and i64 %7, 127
%9 = add nsw i64 %8, -64
%10 = and i64 %4, 16777215
%11 = sub nsw i64 0, %10
%12 = select i1 %6, i64 %10, i64 %11
%13 = sitofp i64 %12 to double
%14 = fmul double %13, 0x3E70000000000000
%15 = sitofp i64 %9 to double
%16 = tail call i64 @pow(double 1.600000e+01, double %15)
%17 = sitofp i64 %16 to double
%18 = fmul double %14, %17
%19 = fptrunc double %18 to float
ret float %19
}