#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 */
int abs(int);
float fabs(double);
double pow(int, int);
float unpackf(int jb1, int jb2) {
  float f1;
  char *ibyte, *jbyte;
  int i, ib1, ib2, iexp;
  double r1;
  ibyte = (char *)&ib1;
  jbyte = (char *)&ib2;
  if (jb1 == 0 && jb2 == 0)
    return 0.0;
  ib1 = jb1;
  ib2 = jb2;
  iexp = ib2 / 8192;
  ib2 = ib2 - iexp * 8192;
  if (iexp >= 1024)
    iexp -= 2048;
  ib2 = ib2 / 32 + ib1 * 256;
  ib1 = iexp;
  r1 = (double)ib2;
  iexp -= 31;
  if (iexp > 30) {
    f1 = r1;
    return ((f1) < 0 ? -fabs(1.E38) : fabs(1.E38));
  } else if (iexp >= 0)
    return r1 * pow(2, iexp);
  else if (iexp < -60) {
    f1 = r1;
    return ((f1) < 0 ? -fabs(1.E-37) : fabs(1.E-37));
  } else if (iexp < -30)
    return r1 * pow(2.0, iexp);
  return r1 / pow(2, abs(iexp));
}


x86 assembly (clang, -O0):
<unpackf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x2c(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    116f <unpackf+0x3f>
cmpl   $0x0,-0xc(%rbp)
jne    116f <unpackf+0x3f>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    136a <unpackf+0x23a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x2000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
shl    $0xd,%ecx
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x400,-0x30(%rbp)
jl     11af <unpackf+0x7f>
mov    -0x30(%rbp),%eax
sub    $0x800,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x28(%rbp)
cvtsi2sdl -0x2c(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x30(%rbp),%eax
sub    $0x1f,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x1e,-0x30(%rbp)
jle    1248 <unpackf+0x118>
movsd  -0x38(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1227 <unpackf+0xf7>
movsd  0xdfd(%rip),%xmm0
call   1040 <fabs@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x3c(%rbp)
jmp    1239 <unpackf+0x109>
movsd  0xdd9(%rip),%xmm0
call   1040 <fabs@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    136a <unpackf+0x23a>
cmpl   $0x0,-0x30(%rbp)
jl     1283 <unpackf+0x153>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x30(%rbp),%esi
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    136a <unpackf+0x23a>
cmpl   $0xffffffc4,-0x30(%rbp)
jge    12ed <unpackf+0x1bd>
movsd  -0x38(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    12cc <unpackf+0x19c>
movsd  0xd50(%rip),%xmm0
call   1040 <fabs@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4c(%rbp)
jmp    12de <unpackf+0x1ae>
movsd  0xd2c(%rip),%xmm0
call   1040 <fabs@plt>
movss  %xmm0,-0x4c(%rbp)
movss  -0x4c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    136a <unpackf+0x23a>
cmpl   $0xffffffe2,-0x30(%rbp)
jge    1328 <unpackf+0x1f8>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x30(%rbp),%esi
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    136a <unpackf+0x23a>
jmp    132d <unpackf+0x1fd>
jmp    1332 <unpackf+0x202>
jmp    1337 <unpackf+0x207>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x30(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%esi
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unpackf>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%eax
or     %edi,%eax
je     1189 <unpackf+0x69>
mov    %edi,%ebx
lea    0x1fff(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
mov    %ecx,%edx
sar    $0xd,%edx
and    $0xffffe000,%ecx
mov    %esi,%edi
sub    %ecx,%edi
lea    -0x800(%rdx),%eax
cmp    $0x800000,%esi
cmovl  %edx,%eax
neg    %ecx
add    %esi,%ecx
add    $0x1f,%ecx
test   %edi,%edi
cmovns %edi,%ecx
sar    $0x5,%ecx
shl    $0x8,%ebx
add    %ecx,%ebx
cmp    $0x3e,%eax
jl     118e <unpackf+0x6e>
movsd  0xe91(%rip),%xmm0
call   1030 <fabs@plt>
test   %ebx,%ebx
jns    11f1 <unpackf+0xd1>
xorps  0xe89(%rip),%xmm0
jmp    11f1 <unpackf+0xd1>
xorps  %xmm0,%xmm0
jmp    11f1 <unpackf+0xd1>
cvtsi2sd %ebx,%xmm0
lea    -0x1f(%rax),%esi
cmp    $0x1f,%eax
jl     11b6 <unpackf+0x96>
mov    $0x2,%edi
movsd  %xmm0,0x8(%rsp)
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
jmp    11f1 <unpackf+0xd1>
cmp    $0xffffffe2,%eax
jg     11c5 <unpackf+0xa5>
movsd  0xe3d(%rip),%xmm0
jmp    1177 <unpackf+0x57>
test   %eax,%eax
movsd  %xmm0,0x8(%rsp)
jle    11f7 <unpackf+0xd7>
mov    $0x1f,%esi
sub    %eax,%esi
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret
mov    $0x2,%edi
jmp    11a5 <unpackf+0x85>

LLVM IR (-O0):
define float @unpackf(i32 %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
%14 = bitcast i32* %10 to i8*
store i8* %14, i8** %7
%15 = bitcast i32* %11 to i8*
store i8* %15, i8** %8
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %18
store float 0.000000e+00, float* %3
br label %104
22: ; preds = %18, %2
%23 = load i32, i32* %4
store i32 %23, i32* %10
%24 = load i32, i32* %5
store i32 %24, i32* %11
%25 = load i32, i32* %11
%26 = sdiv i32 %25, 8192
store i32 %26, i32* %12
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = mul nsw i32 %28, 8192
%30 = sub nsw i32 %27, %29
store i32 %30, i32* %11
%31 = load i32, i32* %12
%32 = icmp sge i32 %31, 1024
br i1 %32, label %33, label %36
33: ; preds = %22
%34 = load i32, i32* %12
%35 = sub nsw i32 %34, 2048
store i32 %35, i32* %12
br label %36
36: ; preds = %33, %22
%37 = load i32, i32* %11
%38 = sdiv i32 %37, 32
%39 = load i32, i32* %10
%40 = mul nsw i32 %39, 256
%41 = add nsw i32 %38, %40
store i32 %41, i32* %11
%42 = load i32, i32* %12
store i32 %42, i32* %10
%43 = load i32, i32* %11
%44 = sitofp i32 %43 to double
store double %44, double* %13
%45 = load i32, i32* %12
%46 = sub nsw i32 %45, 31
store i32 %46, i32* %12
%47 = load i32, i32* %12
%48 = icmp sgt i32 %47, 30
br i1 %48, label %49, label %61
49: ; preds = %36
%50 = load double, double* %13
%51 = fptrunc double %50 to float
store float %51, float* %6
%52 = load float, float* %6
%53 = fcmp olt float %52, 0.000000e+00
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = call float @fabs(double 0x47D2CED32A16A1B1)
%56 = fneg float %55
br label %59
57: ; preds = %49
%58 = call float @fabs(double 0x47D2CED32A16A1B1)
br label %59
59: ; preds = %57, %54
%60 = phi float [ %56, %54 ], [ %58, %57 ]
store float %60, float* %3
br label %104
61: ; preds = %36
%62 = load i32, i32* %12
%63 = icmp sge i32 %62, 0
br i1 %63, label %64, label %70
64: ; preds = %61
%65 = load double, double* %13
%66 = load i32, i32* %12
%67 = call double @pow(i32 2, i32 %66)
%68 = fmul double %65, %67
%69 = fptrunc double %68 to float
store float %69, float* %3
br label %104
70: ; preds = %61
%71 = load i32, i32* %12
%72 = icmp slt i32 %71, -60
br i1 %72, label %73, label %85
73: ; preds = %70
%74 = load double, double* %13
%75 = fptrunc double %74 to float
store float %75, float* %6
%76 = load float, float* %6
%77 = fcmp olt float %76, 0.000000e+00
br i1 %77, label %78, label %81
78: ; preds = %73
%79 = call float @fabs(double 1.000000e-37)
%80 = fneg float %79
br label %83
81: ; preds = %73
%82 = call float @fabs(double 1.000000e-37)
br label %83
83: ; preds = %81, %78
%84 = phi float [ %80, %78 ], [ %82, %81 ]
store float %84, float* %3
br label %104
85: ; preds = %70
%86 = load i32, i32* %12
%87 = icmp slt i32 %86, -30
br i1 %87, label %88, label %94
88: ; preds = %85
%89 = load double, double* %13
%90 = load i32, i32* %12
%91 = call double @pow(i32 2, i32 %90)
%92 = fmul double %89, %91
%93 = fptrunc double %92 to float
store float %93, float* %3
br label %104
94: ; preds = %85
br label %95
95: ; preds = %94
br label %96
96: ; preds = %95
br label %97
97: ; preds = %96
%98 = load double, double* %13
%99 = load i32, i32* %12
%100 = call i32 @abs(i32 %99)
%101 = call double @pow(i32 2, i32 %100)
%102 = fdiv double %98, %101
%103 = fptrunc double %102 to float
store float %103, float* %3
br label %104
104: ; preds = %97, %88, %83, %64, %59, %21
%105 = load float, float* %3
ret float %105
}

LLVM IR (-O2):
define float @unpackf(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %47, label %5
5: ; preds = %2
%6 = sdiv i32 %1, 8192
%7 = mul i32 %6, -8192
%8 = add i32 %7, %1
%9 = icmp sgt i32 %1, 8388607
%10 = add nsw i32 %6, -2048
%11 = select i1 %9, i32 %10, i32 %6
%12 = sdiv i32 %8, 32
%13 = shl nsw i32 %0, 8
%14 = add nsw i32 %12, %13
%15 = sitofp i32 %14 to double
%16 = add nsw i32 %11, -31
%17 = icmp sgt i32 %11, 61
br i1 %17, label %18, label %23
18: ; preds = %5
%19 = icmp slt i32 %14, 0
%20 = tail call float @fabs(double 0x47D2CED32A16A1B1)
%21 = fneg float %20
%22 = select i1 %19, float %21, float %20
br label %47
23: ; preds = %5
%24 = icmp sgt i32 %11, 30
br i1 %24, label %25, label %29
25: ; preds = %23
%26 = tail call double @pow(i32 2, i32 %16)
%27 = fmul double %26, %15
%28 = fptrunc double %27 to float
br label %47
29: ; preds = %23
%30 = icmp slt i32 %11, -29
br i1 %30, label %31, label %36
31: ; preds = %29
%32 = icmp slt i32 %14, 0
%33 = tail call float @fabs(double 1.000000e-37)
%34 = fneg float %33
%35 = select i1 %32, float %34, float %33
br label %47
36: ; preds = %29
%37 = icmp slt i32 %11, 1
br i1 %37, label %38, label %42
38: ; preds = %36
%39 = tail call double @pow(i32 2, i32 %16)
%40 = fmul double %39, %15
%41 = fptrunc double %40 to float
br label %47
42: ; preds = %36
%43 = sub nuw nsw i32 31, %11
%44 = tail call double @pow(i32 2, i32 %43)
%45 = fdiv double %15, %44
%46 = fptrunc double %45 to float
br label %47
47: ; preds = %31, %18, %2, %42, %38, %25
%48 = phi float [ %28, %25 ], [ %41, %38 ], [ %46, %42 ], [ 0.000000e+00, %2 ], [ %22, %18 ], [ %35, %31 ]
ret float %48
}