float drmp3_L3_ldexp_q2(float y, int exp_q2) {
  static const float g_expfrac[4] = {9.31322575e-10f, 7.83145814e-10f,
                                     6.58544508e-10f, 5.53767716e-10f};
  int e;
  do {
    e = ((30 * 4) > (exp_q2) ? (exp_q2) : (30 * 4));
    y *= g_expfrac[e & 3] * (1 << 30 >> (e >> 2));
  } while ((exp_q2 -= e) > 0);
  return y;
}


x86 assembly (clang, -O0):
<drmp3_L3_ldexp_q2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    $0x78,%eax
cmp    -0x8(%rbp),%eax
jle    1125 <drmp3_L3_ldexp_q2+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1132 <drmp3_L3_ldexp_q2+0x32>
mov    $0x78,%eax
mov    %eax,-0x10(%rbp)
jmp    1132 <drmp3_L3_ldexp_q2+0x32>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x3,%eax
movslq %eax,%rcx
lea    0xeb8(%rip),%rax
movss  (%rax,%rcx,4),%xmm0
mov    -0xc(%rbp),%ecx
sar    $0x2,%ecx
mov    $0x40000000,%eax
sar    %cl,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jg     110c <drmp3_L3_ldexp_q2+0xc>
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drmp3_L3_ldexp_q2>:
lea    0xef9(%rip),%r8
nopw   0x0(%rax,%rax,1)
cmp    $0x78,%edi
mov    $0x78,%edx
cmovl  %edi,%edx
mov    %edx,%esi
mov    %edx,%ecx
shr    $0x2,%ecx
mov    $0x40000000,%eax
shr    %cl,%eax
and    $0x3,%esi
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
mulss  (%r8,%rsi,4),%xmm1
mulss  %xmm1,%xmm0
sub    %edx,%edi
jg     1110 <drmp3_L3_ldexp_q2+0x10>
ret

LLVM IR (-O0):
@drmp3_L3_ldexp_q2.g_expfrac = internal constant [4 x float] [float 0x3E10000000000000, float 0x3E0AE89FA0000000, float 0x3E06A09E60000000, float 0x3E0306FE00000000]
define float @drmp3_L3_ldexp_q2(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
br label %6
6: ; preds = %26, %2
%7 = load i32, i32* %4
%8 = icmp sgt i32 120, %7
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = load i32, i32* %4
br label %12
11: ; preds = %6
br label %12
12: ; preds = %11, %9
%13 = phi i32 [ %10, %9 ], [ 120, %11 ]
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = and i32 %14, 3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x float], [4 x float]* @drmp3_L3_ldexp_q2.g_expfrac, i64 0, i64 %16
%18 = load float, float* %17
%19 = load i32, i32* %5
%20 = ashr i32 %19, 2
%21 = ashr i32 1073741824, %20
%22 = sitofp i32 %21 to float
%23 = fmul float %18, %22
%24 = load float, float* %3
%25 = fmul float %24, %23
store float %25, float* %3
br label %26
26: ; preds = %12
%27 = load i32, i32* %5
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, %27
store i32 %29, i32* %4
%30 = icmp sgt i32 %29, 0
br i1 %30, label %6, label %31
31: ; preds = %26
%32 = load float, float* %3
ret float %32
}

LLVM IR (-O2):
@drmp3_L3_ldexp_q2.g_expfrac = internal unnamed_addr constant [4 x float] [float 0x3E10000000000000, float 0x3E0AE89FA0000000, float 0x3E06A09E60000000, float 0x3E0306FE00000000]
define float @drmp3_L3_ldexp_q2(float %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %1, %2 ], [ %17, %3 ]
%5 = phi float [ %0, %2 ], [ %16, %3 ]
%6 = icmp slt i32 %4, 120
%7 = select i1 %6, i32 %4, i32 120
%8 = and i32 %7, 3
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [4 x float], [4 x float]* @drmp3_L3_ldexp_q2.g_expfrac, i64 0, i64 %9
%11 = load float, float* %10
%12 = ashr i32 %7, 2
%13 = lshr i32 1073741824, %12
%14 = sitofp i32 %13 to float
%15 = fmul float %11, %14
%16 = fmul float %5, %15
%17 = sub nsw i32 %4, %7
%18 = icmp sgt i32 %17, 0
br i1 %18, label %3, label %19
19: ; preds = %3
ret float %16
}