#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 pow2(int);
double from_1750eflt(short *input) {
  int int_mant_hi, int_mant_lo;
  double expr_hi, expr_lo;
  signed char int_exp;
  int_exp = (signed char)(input[1] & 0xFF);
  int_mant_hi = ((int)input[0] << 8) | (((int)input[1] & 0xFF00) >> 8);
  int_mant_lo = ((int)input[2] & 0xFFFF);
  expr_hi = (double)int_mant_hi * pow2((int)int_exp - 23);
  expr_lo = (double)int_mant_lo * pow2((int)int_exp - 39);
  return expr_hi + expr_lo;
}


x86 assembly (clang, -O0):
<from_1750eflt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl 0x2(%rax),%eax
and    $0xff,%eax
mov    %al,-0x21(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movswl 0x2(%rcx),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movswl 0x4(%rax),%eax
and    $0xffff,%eax
mov    %eax,-0x10(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsbl -0x21(%rbp),%edi
sub    $0x17,%edi
call   1030 <pow2@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsbl -0x21(%rbp),%edi
sub    $0x27,%edi
call   1030 <pow2@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<from_1750eflt>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movzwl 0x2(%rdi),%eax
movswl (%rdi),%ecx
shl    $0x8,%ecx
movsbl %al,%ebx
shr    $0x8,%eax
or     %ecx,%eax
movzwl 0x4(%rdi),%ebp
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
lea    -0x17(%rbx),%edi
call   1030 <pow2@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,0x10(%rsp)
add    $0xffffffd9,%ebx
mov    %ebx,%edi
call   1030 <pow2@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @from_1750eflt(i16* %0) {
%2 = alloca i16*
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i8
store i16* %0, i16** %2
%8 = load i16*, i16** %2
%9 = getelementptr inbounds i16, i16* %8, i64 1
%10 = load i16, i16* %9
%11 = sext i16 %10 to i32
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i16*, i16** %2
%15 = getelementptr inbounds i16, i16* %14, i64 0
%16 = load i16, i16* %15
%17 = sext i16 %16 to i32
%18 = shl i32 %17, 8
%19 = load i16*, i16** %2
%20 = getelementptr inbounds i16, i16* %19, i64 1
%21 = load i16, i16* %20
%22 = sext i16 %21 to i32
%23 = and i32 %22, 65280
%24 = ashr i32 %23, 8
%25 = or i32 %18, %24
store i32 %25, i32* %3
%26 = load i16*, i16** %2
%27 = getelementptr inbounds i16, i16* %26, i64 2
%28 = load i16, i16* %27
%29 = sext i16 %28 to i32
%30 = and i32 %29, 65535
store i32 %30, i32* %4
%31 = load i32, i32* %3
%32 = sitofp i32 %31 to double
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 23
%36 = call double @pow2(i32 %35)
%37 = fmul double %32, %36
store double %37, double* %5
%38 = load i32, i32* %4
%39 = sitofp i32 %38 to double
%40 = load i8, i8* %7
%41 = sext i8 %40 to i32
%42 = sub nsw i32 %41, 39
%43 = call double @pow2(i32 %42)
%44 = fmul double %39, %43
store double %44, double* %6
%45 = load double, double* %5
%46 = load double, double* %6
%47 = fadd double %45, %46
ret double %47
}

LLVM IR (-O2):
define double @from_1750eflt(i16* nocapture %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 1
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = load i16, i16* %0
%6 = sext i16 %5 to i32
%7 = shl nsw i32 %6, 8
%8 = lshr i16 %3, 8
%9 = zext i16 %8 to i32
%10 = or i32 %7, %9
%11 = getelementptr inbounds i16, i16* %0, i64 2
%12 = load i16, i16* %11
%13 = sitofp i32 %10 to double
%14 = shl i32 %4, 24
%15 = ashr exact i32 %14, 24
%16 = add nsw i32 %15, -23
%17 = tail call double @pow2(i32 %16)
%18 = fmul double %17, %13
%19 = uitofp i16 %12 to double
%20 = add nsw i32 %15, -39
%21 = tail call double @pow2(i32 %20)
%22 = fmul double %21, %19
%23 = fadd double %22, %18
ret double %23
}