#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 */
scalar_t__ FP_Cmp(float, float);
float __addsf3(float, float);
float __divsf3(float, float);
float __floatsisf(int);
float __mulsf3(float, float const);
float FP_Exp(float x) {
  const float e2 = (float)7.389056099;
  const float inv_e2 = (float)0.135335283;
  float answer, top, bottom, mult;
  int n;
  mult = 1.0;
  while (FP_Cmp(x, (float)2.0) > 0) {
    mult = __mulsf3(mult, e2);
    x = __addsf3(x, (float)-2.0);
  }
  while (FP_Cmp(x, (float)-2.0) < 0) {
    mult = __mulsf3(mult, inv_e2);
    x = __addsf3(x, (float)2.0);
  }
  answer = __addsf3((float)1.0, x);
  top = x;
  bottom = 1.0;
  for (n = 2; n < 15; ++n) {
    top = __mulsf3(top, x);
    bottom = __mulsf3(bottom, __floatsisf(n));
    answer = __addsf3(answer, __divsf3(top, bottom));
  }
  return __mulsf3(answer, mult);
}


x86 assembly (clang, -O0):
<FP_Exp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xea3(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xe92(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe81(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe7b(%rip),%xmm1
call   1060 <FP_Cmp@plt>
cmp    $0x0,%rax
jle    11d3 <FP_Exp+0x83>
movss  -0x1c(%rbp),%xmm0
movss  0xe5b(%rip),%xmm1
call   1050 <__mulsf3@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe4c(%rip),%xmm1
call   1070 <__addsf3@plt>
movss  %xmm0,-0x4(%rbp)
jmp    1184 <FP_Exp+0x34>
jmp    11d8 <FP_Exp+0x88>
movss  -0x4(%rbp),%xmm0
movss  0xe2b(%rip),%xmm1
call   1060 <FP_Cmp@plt>
cmp    $0x0,%rax
jge    1227 <FP_Exp+0xd7>
movss  -0x1c(%rbp),%xmm0
movss  0xe03(%rip),%xmm1
call   1050 <__mulsf3@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xdf4(%rip),%xmm1
call   1070 <__addsf3@plt>
movss  %xmm0,-0x4(%rbp)
jmp    11d8 <FP_Exp+0x88>
movss  -0x4(%rbp),%xmm1
movss  0xdcc(%rip),%xmm0
call   1070 <__addsf3@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xdb0(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movl   $0x2,-0x20(%rbp)
cmpl   $0xf,-0x20(%rbp)
jge    12d7 <FP_Exp+0x187>
movss  -0x14(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
call   1050 <__mulsf3@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  -0x28(%rbp),%xmm0
call   1050 <__mulsf3@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
call   1070 <__addsf3@plt>
movss  %xmm0,-0x10(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    125c <FP_Exp+0x10c>
movss  -0x10(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
call   1050 <__mulsf3@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FP_Exp>:
push   %rbx
sub    $0x20,%rsp
movss  0xea3(%rip),%xmm1
movss  %xmm0,0xc(%rsp)
call   1060 <FP_Cmp@plt>
movss  0xe94(%rip),%xmm0
test   %rax,%rax
jle    11c4 <FP_Exp+0x74>
cs nopw 0x0(%rax,%rax,1)
nop
movss  0xe80(%rip),%xmm1
call   1050 <__mulsf3@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
movss  0xe6b(%rip),%xmm1
call   1070 <__addsf3@plt>
movss  %xmm0,0xc(%rsp)
movss  0xe4c(%rip),%xmm1
call   1060 <FP_Cmp@plt>
movss  0x10(%rsp),%xmm0
test   %rax,%rax
jg     1180 <FP_Exp+0x30>
movss  %xmm0,0x10(%rsp)
movss  0xe3a(%rip),%xmm1
movss  0xc(%rsp),%xmm0
call   1060 <FP_Cmp@plt>
test   %rax,%rax
js     11ea <FP_Exp+0x9a>
movss  0x10(%rsp),%xmm0
jmp    1234 <FP_Exp+0xe4>
movss  0x10(%rsp),%xmm0
movss  0xe18(%rip),%xmm1
call   1050 <__mulsf3@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
movss  0xdef(%rip),%xmm1
call   1070 <__addsf3@plt>
movss  %xmm0,0xc(%rsp)
movss  0xde8(%rip),%xmm1
call   1060 <FP_Cmp@plt>
movss  0x10(%rsp),%xmm0
test   %rax,%rax
js     11f0 <FP_Exp+0xa0>
movss  %xmm0,0x10(%rsp)
movss  0xdc2(%rip),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsp),%xmm1
call   1070 <__addsf3@plt>
mov    $0x2,%ebx
movss  0xc(%rsp),%xmm1
movaps %xmm1,%xmm2
movss  %xmm1,0xc(%rsp)
nopw   0x0(%rax,%rax,1)
movss  %xmm0,0x1c(%rsp)
movaps %xmm2,%xmm0
movss  0xc(%rsp),%xmm1
call   1050 <__mulsf3@plt>
movss  %xmm0,0x18(%rsp)
mov    %ebx,%edi
call   1040 <__floatsisf@plt>
movaps %xmm0,%xmm1
movss  0x14(%rsp),%xmm0
call   1050 <__mulsf3@plt>
movaps %xmm0,%xmm1
movss  0x18(%rsp),%xmm0
movss  %xmm1,0x14(%rsp)
call   1030 <__divsf3@plt>
movaps %xmm0,%xmm1
movss  0x1c(%rsp),%xmm0
call   1070 <__addsf3@plt>
movss  0x18(%rsp),%xmm2
add    $0x1,%ebx
cmp    $0xf,%ebx
jne    1270 <FP_Exp+0x120>
movss  0x10(%rsp),%xmm1
add    $0x20,%rsp
pop    %rbx
jmp    1050 <__mulsf3@plt>

LLVM IR (-O0):
define float @FP_Exp(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
store float %0, float* %2
store float 0x401D8E64C0000000, float* %3
store float 0x3FC152AAA0000000, float* %4
store float 1.000000e+00, float* %8
br label %10
10: ; preds = %14, %1
%11 = load float, float* %2
%12 = call i64 @FP_Cmp(float %11, float 2.000000e+00)
%13 = icmp sgt i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load float, float* %8
%16 = call float @__mulsf3(float %15, float 0x401D8E64C0000000)
store float %16, float* %8
%17 = load float, float* %2
%18 = call float @__addsf3(float %17, float -2.000000e+00)
store float %18, float* %2
br label %10
19: ; preds = %10
br label %20
20: ; preds = %24, %19
%21 = load float, float* %2
%22 = call i64 @FP_Cmp(float %21, float -2.000000e+00)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load float, float* %8
%26 = call float @__mulsf3(float %25, float 0x3FC152AAA0000000)
store float %26, float* %8
%27 = load float, float* %2
%28 = call float @__addsf3(float %27, float 2.000000e+00)
store float %28, float* %2
br label %20
29: ; preds = %20
%30 = load float, float* %2
%31 = call float @__addsf3(float 1.000000e+00, float %30)
store float %31, float* %5
%32 = load float, float* %2
store float %32, float* %6
store float 1.000000e+00, float* %7
store i32 2, i32* %9
br label %33
33: ; preds = %49, %29
%34 = load i32, i32* %9
%35 = icmp slt i32 %34, 15
br i1 %35, label %36, label %52
36: ; preds = %33
%37 = load float, float* %6
%38 = load float, float* %2
%39 = call float @__mulsf3(float %37, float %38)
store float %39, float* %6
%40 = load float, float* %7
%41 = load i32, i32* %9
%42 = call float @__floatsisf(i32 %41)
%43 = call float @__mulsf3(float %40, float %42)
store float %43, float* %7
%44 = load float, float* %5
%45 = load float, float* %6
%46 = load float, float* %7
%47 = call float @__divsf3(float %45, float %46)
%48 = call float @__addsf3(float %44, float %47)
store float %48, float* %5
br label %49
49: ; preds = %36
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
store i32 %51, i32* %9
br label %33
52: ; preds = %33
%53 = load float, float* %5
%54 = load float, float* %8
%55 = call float @__mulsf3(float %53, float %54)
ret float %55
}

LLVM IR (-O2):
define float @FP_Exp(float %0) {
%2 = tail call i64 @FP_Cmp(float %0, float 2.000000e+00)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %9, %1
%5 = phi float [ %0, %1 ], [ %13, %9 ]
%6 = phi float [ 1.000000e+00, %1 ], [ %12, %9 ]
%7 = tail call i64 @FP_Cmp(float %5, float -2.000000e+00)
%8 = icmp slt i64 %7, 0
br i1 %8, label %16, label %23
9: ; preds = %1, %9
%10 = phi float [ %12, %9 ], [ 1.000000e+00, %1 ]
%11 = phi float [ %13, %9 ], [ %0, %1 ]
%12 = tail call float @__mulsf3(float %10, float 0x401D8E64C0000000)
%13 = tail call float @__addsf3(float %11, float -2.000000e+00)
%14 = tail call i64 @FP_Cmp(float %13, float 2.000000e+00)
%15 = icmp sgt i64 %14, 0
br i1 %15, label %9, label %4
16: ; preds = %4, %16
%17 = phi float [ %19, %16 ], [ %6, %4 ]
%18 = phi float [ %20, %16 ], [ %5, %4 ]
%19 = tail call float @__mulsf3(float %17, float 0x3FC152AAA0000000)
%20 = tail call float @__addsf3(float %18, float 2.000000e+00)
%21 = tail call i64 @FP_Cmp(float %20, float -2.000000e+00)
%22 = icmp slt i64 %21, 0
br i1 %22, label %16, label %23
23: ; preds = %16, %4
%24 = phi float [ %5, %4 ], [ %20, %16 ]
%25 = phi float [ %6, %4 ], [ %19, %16 ]
%26 = tail call float @__addsf3(float 1.000000e+00, float %24)
br label %27
27: ; preds = %23, %27
%28 = phi i32 [ 2, %23 ], [ %37, %27 ]
%29 = phi float [ 1.000000e+00, %23 ], [ %34, %27 ]
%30 = phi float [ %24, %23 ], [ %32, %27 ]
%31 = phi float [ %26, %23 ], [ %36, %27 ]
%32 = tail call float @__mulsf3(float %30, float %24)
%33 = tail call float @__floatsisf(i32 %28)
%34 = tail call float @__mulsf3(float %29, float %33)
%35 = tail call float @__divsf3(float %32, float %34)
%36 = tail call float @__addsf3(float %31, float %35)
%37 = add nuw nsw i32 %28, 1
%38 = icmp eq i32 %37, 15
br i1 %38, label %39, label %27
39: ; preds = %27
%40 = tail call float @__mulsf3(float %36, float %25)
ret float %40
}