#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 pow(int, int);
float u2f(unsigned int);
float fpwr2(int x) {
  unsigned exp, frac;
  unsigned u;
  if (x < 2 - pow(2, 7) - 23) {
    exp = 0;
    frac = 0;
  } else if (x < 2 - pow(2, 7)) {
    exp = 0;
    frac = 1 << (unsigned)(x - (2 - pow(2, 7) - 23));
  } else if (x < pow(2, 7) - 1 + 1) {
    exp = pow(2, 7) - 1 + 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    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
mov    %eax,%edx
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
sub    %edx,%ecx
sub    $0x17,%ecx
cmp    %ecx,%eax
jge    116a <fpwr2+0x4a>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1233 <fpwr2+0x113>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
jge    11cf <fpwr2+0xaf>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
mov    -0x1c(%rbp),%ecx
mov    %eax,%edx
mov    $0x2,%eax
sub    %edx,%eax
sub    $0x17,%eax
sub    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
jmp    122e <fpwr2+0x10e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    $0x1,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    121b <fpwr2+0xfb>
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
sub    $0x1,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    1229 <fpwr2+0x109>
movl   $0xff,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
jmp    122e <fpwr2+0x10e>
jmp    1233 <fpwr2+0x113>
mov    -0x8(%rbp),%eax
shl    $0x17,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <u2f@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpwr2>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x2,%ebp
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
mov    $0xffffffeb,%ecx
sub    %eax,%ecx
xor    %r14d,%r14d
cmp    %ebx,%ecx
jg     11a7 <fpwr2+0x87>
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
sub    %eax,%ebp
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
cmp    %ebx,%ebp
jle    117c <fpwr2+0x5c>
add    %eax,%ebx
add    $0x15,%bl
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%edi
jmp    11a9 <fpwr2+0x89>
mov    $0x7f800000,%r14d
cmp    %ebx,%eax
jle    11a7 <fpwr2+0x87>
mov    $0x2,%edi
mov    $0x7,%esi
call   1040 <pow@plt>
add    %eax,%ebx
shl    $0x17,%ebx
add    $0xff800000,%ebx
xor    %edi,%edi
mov    %ebx,%r14d
jmp    11a9 <fpwr2+0x89>
xor    %edi,%edi
or     %r14d,%edi
pop    %rbx
pop    %r14
pop    %rbp
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 = call i32 @pow(i32 2, i32 7)
%8 = sub nsw i32 2, %7
%9 = sub nsw i32 %8, 23
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %38
12: ; preds = %1
%13 = load i32, i32* %2
%14 = call i32 @pow(i32 2, i32 7)
%15 = sub nsw i32 2, %14
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %24
17: ; preds = %12
store i32 0, i32* %3
%18 = load i32, i32* %2
%19 = call i32 @pow(i32 2, i32 7)
%20 = sub nsw i32 2, %19
%21 = sub nsw i32 %20, 23
%22 = sub nsw i32 %18, %21
%23 = shl i32 1, %22
store i32 %23, i32* %4
br label %37
24: ; preds = %12
%25 = load i32, i32* %2
%26 = call i32 @pow(i32 2, i32 7)
%27 = sub nsw i32 %26, 1
%28 = add nsw i32 %27, 1
%29 = icmp slt i32 %25, %28
br i1 %29, label %30, label %35
30: ; preds = %24
%31 = call i32 @pow(i32 2, i32 7)
%32 = sub nsw i32 %31, 1
%33 = load i32, i32* %2
%34 = add nsw i32 %32, %33
store i32 %34, i32* %3
store i32 0, i32* %4
br label %36
35: ; preds = %24
store i32 255, i32* %3
store i32 0, i32* %4
br label %36
36: ; preds = %35, %30
br label %37
37: ; preds = %36, %17
br label %38
38: ; preds = %37, %11
%39 = load i32, i32* %3
%40 = shl i32 %39, 23
%41 = load i32, i32* %4
%42 = or i32 %40, %41
store i32 %42, i32* %5
%43 = load i32, i32* %5
%44 = call float @u2f(i32 %43)
ret float %44
}

LLVM IR (-O2):
define float @fpwr2(i32 %0) {
%2 = tail call i32 @pow(i32 2, i32 7)
%3 = sub i32 -21, %2
%4 = icmp sgt i32 %3, %0
br i1 %4, label %21, label %5
5: ; preds = %1
%6 = tail call i32 @pow(i32 2, i32 7)
%7 = sub nsw i32 2, %6
%8 = icmp sgt i32 %7, %0
%9 = tail call i32 @pow(i32 2, i32 7)
br i1 %8, label %10, label %14
10: ; preds = %5
%11 = add i32 %0, 21
%12 = add i32 %11, %9
%13 = shl nuw i32 1, %12
br label %21
14: ; preds = %5
%15 = icmp sgt i32 %9, %0
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = tail call i32 @pow(i32 2, i32 7)
%18 = add i32 %0, 511
%19 = add i32 %18, %17
%20 = shl i32 %19, 23
br label %21
21: ; preds = %14, %1, %10, %16
%22 = phi i32 [ %13, %10 ], [ 0, %16 ], [ 0, %1 ], [ 0, %14 ]
%23 = phi i32 [ 0, %10 ], [ %20, %16 ], [ 0, %1 ], [ 2139095040, %14 ]
%24 = or i32 %23, %22
%25 = tail call float @u2f(i32 %24)
ret float %25
}