#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 */
typedef int int32_t;

/* Variables and functions */
float intBitsToFloat(int);
float ldexpkf(float x, int q) {
  float u;
  int m;
  m = q >> 31;
  m = (((m + q) >> 6) - m) << 4;
  q = q - (m << 2);
  m += 127;
  m = m < 0 ? 0 : m;
  m = m > 255 ? 255 : m;
  u = intBitsToFloat(((int32_t)m) << 23);
  x = x * u * u * u * u;
  u = intBitsToFloat(((int32_t)(q + 0x7f)) << 23);
  return x * u;
}


x86 assembly (clang, -O0):
<ldexpkf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
sar    $0x6,%eax
sub    -0x10(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x2,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x7f,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1166 <ldexpkf+0x56>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    116c <ldexpkf+0x5c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0xff,-0x10(%rbp)
jle    118c <ldexpkf+0x7c>
mov    $0xff,%eax
mov    %eax,-0x18(%rbp)
jmp    1192 <ldexpkf+0x82>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
shl    $0x17,%edi
call   1030 <intBitsToFloat@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
mov    -0x8(%rbp),%edi
add    $0x7f,%edi
shl    $0x17,%edi
call   1030 <intBitsToFloat@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldexpkf>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
movss  %xmm0,0xc(%rsp)
mov    %edi,%eax
sar    $0x1f,%eax
lea    (%rax,%rbx,1),%ecx
sar    $0x6,%ecx
sub    %eax,%ecx
mov    %ecx,%eax
shl    $0x4,%eax
shl    $0x6,%ecx
sub    %ecx,%ebx
cmp    $0xffffff82,%eax
mov    $0xffffff81,%ecx
cmovge %eax,%ecx
cmp    $0x80,%ecx
mov    $0x80,%edi
cmovl  %ecx,%edi
shl    $0x17,%edi
add    $0x3f800000,%edi
call   1030 <intBitsToFloat@plt>
movaps %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
shl    $0x17,%ebx
add    $0x3f800000,%ebx
mov    %ebx,%edi
call   1030 <intBitsToFloat@plt>
mulss  0xc(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @ldexpkf(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = ashr i32 %7, 31
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
%12 = ashr i32 %11, 6
%13 = load i32, i32* %6
%14 = sub nsw i32 %12, %13
%15 = shl i32 %14, 4
store i32 %15, i32* %6
%16 = load i32, i32* %4
%17 = load i32, i32* %6
%18 = shl i32 %17, 2
%19 = sub nsw i32 %16, %18
store i32 %19, i32* %4
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 127
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %2
br label %27
25: ; preds = %2
%26 = load i32, i32* %6
br label %27
27: ; preds = %25, %24
%28 = phi i32 [ 0, %24 ], [ %26, %25 ]
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp sgt i32 %29, 255
br i1 %30, label %31, label %32
31: ; preds = %27
br label %34
32: ; preds = %27
%33 = load i32, i32* %6
br label %34
34: ; preds = %32, %31
%35 = phi i32 [ 255, %31 ], [ %33, %32 ]
store i32 %35, i32* %6
%36 = load i32, i32* %6
%37 = shl i32 %36, 23
%38 = call float @intBitsToFloat(i32 %37)
store float %38, float* %5
%39 = load float, float* %3
%40 = load float, float* %5
%41 = fmul float %39, %40
%42 = load float, float* %5
%43 = fmul float %41, %42
%44 = load float, float* %5
%45 = fmul float %43, %44
%46 = load float, float* %5
%47 = fmul float %45, %46
store float %47, float* %3
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 127
%50 = shl i32 %49, 23
%51 = call float @intBitsToFloat(i32 %50)
store float %51, float* %5
%52 = load float, float* %3
%53 = load float, float* %5
%54 = fmul float %52, %53
ret float %54
}

LLVM IR (-O2):
define float @ldexpkf(float %0, i32 %1) {
%3 = ashr i32 %1, 31
%4 = add nsw i32 %3, %1
%5 = ashr i32 %4, 6
%6 = sub nsw i32 %5, %3
%7 = shl nsw i32 %6, 4
%8 = mul i32 %6, -64
%9 = add i32 %8, %1
%10 = icmp sgt i32 %7, -127
%11 = select i1 %10, i32 %7, i32 -127
%12 = icmp slt i32 %11, 128
%13 = select i1 %12, i32 %11, i32 128
%14 = shl nsw i32 %13, 23
%15 = add i32 %14, 1065353216
%16 = tail call float @intBitsToFloat(i32 %15)
%17 = fmul float %16, %0
%18 = fmul float %16, %17
%19 = fmul float %16, %18
%20 = fmul float %16, %19
%21 = shl i32 %9, 23
%22 = add i32 %21, 1065353216
%23 = tail call float @intBitsToFloat(i32 %22)
%24 = fmul float %23, %20
ret float %24
}