#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 */
double pow(int, double);
double dconvert(void *buf) {
  unsigned char *fnum = (unsigned char *)buf;
  double sign, exponent, mantissa, result;
  sign = (double)((fnum[3] & 0x80) ? (-1) : (1));
  exponent = (double)((fnum[3] & 0x7f) << 1 | ((fnum[2] & 0x80) ? 1 : 0));
  mantissa = 1.0 + ((double)((fnum[2] & 0x7f) << 16 | fnum[1] << 8 | fnum[0]) /
                    pow(2, 23));
  result = sign * (double)pow(2, (exponent - 127.0)) * mantissa;
  return result;
}


x86 assembly (clang, -O0):
<dconvert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%edx
and    $0x80,%edx
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x3(%rax),%eax
and    $0x7f,%eax
shl    $0x1,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x2(%rcx),%esi
and    $0x80,%esi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
or     %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
and    $0x7f,%eax
shl    $0x10,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
or     %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    $0x2,%edi
movsd  0xe57(%rip),%xmm0
call   1030 <pow@plt>
movsd  -0x40(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  0xe39(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe11(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dconvert>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movzbl 0x3(%rdi),%ebx
mov    %ebx,%eax
and    $0xffffff80,%eax
neg    %eax
sbb    %eax,%eax
or     $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
and    $0x7f,%ebx
movzbl 0x2(%rdi),%eax
mov    %eax,%r14d
shr    $0x7,%r14d
and    $0x7f,%eax
shl    $0x10,%eax
movzbl 0x1(%rdi),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movzbl (%rdi),%eax
or     %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe98(%rip),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
addsd  0xe84(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
lea    -0x7f(%r14,%rbx,2),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @dconvert(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %2
%8 = load i8*, i8** %2
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 3
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = and i32 %12, 128
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 -1, i32 1
%17 = sitofp i32 %16 to double
store double %17, double* %4
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 3
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = and i32 %21, 127
%23 = shl i32 %22, 1
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 2
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = and i32 %27, 128
%29 = icmp ne i32 %28, 0
%30 = zext i1 %29 to i64
%31 = select i1 %29, i32 1, i32 0
%32 = or i32 %23, %31
%33 = sitofp i32 %32 to double
store double %33, double* %5
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i64 2
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = and i32 %37, 127
%39 = shl i32 %38, 16
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = load i8, i8* %41
%43 = zext i8 %42 to i32
%44 = shl i32 %43, 8
%45 = or i32 %39, %44
%46 = load i8*, i8** %3
%47 = getelementptr inbounds i8, i8* %46, i64 0
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = or i32 %45, %49
%51 = sitofp i32 %50 to double
%52 = call double @pow(i32 2, double 2.300000e+01)
%53 = fdiv double %51, %52
%54 = fadd double 1.000000e+00, %53
store double %54, double* %6
%55 = load double, double* %4
%56 = load double, double* %5
%57 = fsub double %56, 1.270000e+02
%58 = call double @pow(i32 2, double %57)
%59 = fmul double %55, %58
%60 = load double, double* %6
%61 = fmul double %59, %60
store double %61, double* %7
%62 = load double, double* %7
ret double %62
}

LLVM IR (-O2):
define double @dconvert(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 128
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 1, i32 -1
%8 = sitofp i32 %7 to double
%9 = shl nuw nsw i32 %4, 1
%10 = and i32 %9, 254
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = lshr i32 %13, 7
%15 = shl nuw nsw i32 %13, 16
%16 = and i32 %15, 8323072
%17 = getelementptr inbounds i8, i8* %0, i64 1
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl nuw nsw i32 %19, 8
%21 = or i32 %16, %20
%22 = load i8, i8* %0
%23 = zext i8 %22 to i32
%24 = or i32 %21, %23
%25 = sitofp i32 %24 to double
%26 = tail call double @pow(i32 2, double 2.300000e+01)
%27 = fdiv double %25, %26
%28 = fadd double %27, 1.000000e+00
%29 = add nuw nsw i32 %14, -127
%30 = add nsw i32 %29, %10
%31 = sitofp i32 %30 to double
%32 = tail call double @pow(i32 2, double %31)
%33 = fmul double %32, %8
%34 = fmul double %33, %28
ret double %34
}