#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 */
float binaryToFloat(int, int, char *);
float pow(int, long);
long reverseExcess(int, char *);
int strncmp(char *, char *, int);
float fromIEEESingle(char binaryIn[32]) {
  int negative = binaryIn[0] == '1' ? 1 : 0;
  int denormalised = strncmp(&binaryIn[1], "00000000", 8);
  long exponent = reverseExcess(8, &binaryIn[1]);
  float significand = binaryToFloat(9, 23, binaryIn);
  if (denormalised)
    significand += 1;
  float result = significand * pow(2, exponent);
  if (negative)
    result *= -1;
  return result;
}


x86 assembly (clang, -O0):
<fromIEEESingle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x31,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
lea    0xe96(%rip),%rsi
mov    $0x8,%edx
call   1030 <strncmp@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
mov    $0x8,%edi
call   1050 <reverseExcess@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x9,%edi
mov    $0x17,%esi
call   1040 <binaryToFloat@plt>
movss  %xmm0,-0x1c(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11c9 <fromIEEESingle+0x89>
movss  0xe41(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x2,%edi
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     120e <fromIEEESingle+0xce>
movss  0xe00(%rip),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fromIEEESingle>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r15b
lea    0x1(%rdi),%r14
lea    0xec8(%rip),%rsi
mov    %r14,%rdi
mov    $0x8,%edx
call   1030 <strncmp@plt>
mov    %eax,%ebp
mov    $0x8,%edi
mov    %r14,%rsi
call   1050 <reverseExcess@plt>
mov    %rax,%r14
mov    $0x9,%edi
mov    $0x17,%esi
mov    %rbx,%rdx
call   1040 <binaryToFloat@plt>
test   %ebp,%ebp
je     1195 <fromIEEESingle+0x55>
addss  0xe6b(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
mov    $0x2,%edi
mov    %r14,%rsi
call   1060 <pow@plt>
mulss  0x4(%rsp),%xmm0
cmp    $0x31,%r15b
jne    11bb <fromIEEESingle+0x7b>
xorps  0xe55(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"00000000\00"
define float @fromIEEESingle(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca float
%7 = alloca float
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 49
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
store i32 %14, i32* %3
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = call i32 @strncmp(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
store i32 %17, i32* %4
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = call i64 @reverseExcess(i32 8, i8* %19)
store i64 %20, i64* %5
%21 = load i8*, i8** %2
%22 = call float @binaryToFloat(i32 9, i32 23, i8* %21)
store float %22, float* %6
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %1
%26 = load float, float* %6
%27 = fadd float %26, 1.000000e+00
store float %27, float* %6
br label %28
28: ; preds = %25, %1
%29 = load float, float* %6
%30 = load i64, i64* %5
%31 = call float @pow(i32 2, i64 %30)
%32 = fmul float %29, %31
store float %32, float* %7
%33 = load i32, i32* %3
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %28
%36 = load float, float* %7
%37 = fmul float %36, -1.000000e+00
store float %37, float* %7
br label %38
38: ; preds = %35, %28
%39 = load float, float* %7
ret float %39
}

LLVM IR (-O2):
@.str = [9 x i8] c"00000000\00"
define float @fromIEEESingle(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 49
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = tail call i32 @strncmp(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
%6 = tail call i64 @reverseExcess(i32 8, i8* %4)
%7 = tail call float @binaryToFloat(i32 9, i32 23, i8* %0)
%8 = icmp eq i32 %5, 0
%9 = fadd float %7, 1.000000e+00
%10 = select i1 %8, float %7, float %9
%11 = tail call float @pow(i32 2, i64 %6)
%12 = fmul float %11, %10
%13 = fneg float %12
%14 = select i1 %3, float %13, float %12
ret float %14
}