#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 */
float u2f(unsigned int);
float fpwr2(int x) {
  unsigned exp, frac;
  unsigned u;
  if (x < -149) {
    exp = 0;
    frac = 0;
  } else if (x < -126) {
    exp = 0;
    frac = 1 << (x + 149);
  } else if (x < 128) {
    exp = 127 + x;
    frac = 0;
  } else {
    exp = 0xFF;
    frac = 0;
  }
  u = exp << 23 | frac;
  return u2f(u);
}


x86 assembly (clang, -O0):
<fpwr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffff6b,-0x4(%rbp)
jge    113b <fpwr2+0x2b>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    119e <fpwr2+0x8e>
cmpl   $0xffffff82,-0x4(%rbp)
jge    1164 <fpwr2+0x54>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%ecx
add    $0x95,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
jmp    1199 <fpwr2+0x89>
cmpl   $0x80,-0x4(%rbp)
jge    1186 <fpwr2+0x76>
mov    -0x4(%rbp),%eax
add    $0x7f,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1194 <fpwr2+0x84>
movl   $0xff,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1199 <fpwr2+0x89>
jmp    119e <fpwr2+0x8e>
mov    -0x8(%rbp),%eax
shl    $0x17,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <u2f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpwr2>:
xor    %edx,%edx
cmp    $0xffffff6b,%edi
jl     1147 <fpwr2+0x37>
cmp    $0xffffff81,%edi
jg     112e <fpwr2+0x1e>
add    $0x95,%dil
mov    $0x1,%eax
mov    %edi,%ecx
shl    %cl,%eax
jmp    1149 <fpwr2+0x39>
mov    $0x7f800000,%edx
cmp    $0x7f,%edi
jg     1147 <fpwr2+0x37>
shl    $0x17,%edi
add    $0x3f800000,%edi
xor    %eax,%eax
mov    %edi,%edx
jmp    1149 <fpwr2+0x39>
xor    %eax,%eax
or     %edx,%eax
mov    %eax,%edi
jmp    1030 <u2f@plt>

LLVM IR (-O0):
define float @fpwr2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, -149
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %25
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, -126
br i1 %11, label %12, label %16
12: ; preds = %9
store i32 0, i32* %3
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 149
%15 = shl i32 1, %14
store i32 %15, i32* %4
br label %24
16: ; preds = %9
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 128
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = add nsw i32 127, %20
store i32 %21, i32* %3
store i32 0, i32* %4
br label %23
22: ; preds = %16
store i32 255, i32* %3
store i32 0, i32* %4
br label %23
23: ; preds = %22, %19
br label %24
24: ; preds = %23, %12
br label %25
25: ; preds = %24, %8
%26 = load i32, i32* %3
%27 = shl i32 %26, 23
%28 = load i32, i32* %4
%29 = or i32 %27, %28
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = call float @u2f(i32 %30)
ret float %31
}

LLVM IR (-O2):
define float @fpwr2(i32 %0) {
%2 = icmp slt i32 %0, -149
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = icmp slt i32 %0, -126
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = add nsw i32 %0, 149
%7 = shl nuw nsw i32 1, %6
br label %13
8: ; preds = %3
%9 = icmp slt i32 %0, 128
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = shl nsw i32 %0, 23
%12 = add i32 %11, 1065353216
br label %13
13: ; preds = %8, %1, %5, %10
%14 = phi i32 [ %7, %5 ], [ 0, %10 ], [ 0, %1 ], [ 0, %8 ]
%15 = phi i32 [ 0, %5 ], [ %12, %10 ], [ 0, %1 ], [ 2139095040, %8 ]
%16 = or i32 %15, %14
%17 = tail call float @u2f(i32 %16)
ret float %17
}