#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__ pow(double, float);
scalar_t__ round(float);
int RPMToMotor(float RPM) {
  RPM = 11.431 * ((float)pow(2.71828, (RPM * 0.0217)));
  RPM = (RPM > 127.0) ? 127.0 : ((RPM < -127.0) ? -127.0 : RPM);
  return ((int)round(RPM));
}


x86 assembly (clang, -O0):
<RPMToMotor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeda(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm1
movsd  0xec2(%rip),%xmm0
call   1030 <pow@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea4(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    119e <RPMToMotor+0x7e>
movsd  0xe6c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e3 <RPMToMotor+0xc3>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe71(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11cb <RPMToMotor+0xab>
movsd  0xe5f(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d9 <RPMToMotor+0xb9>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <round@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RPMToMotor>:
push   %rax
cvtss2sd %xmm0,%xmm0
mulsd  0xed3(%rip),%xmm0
cvtsd2ss %xmm0,%xmm1
movsd  0xecf(%rip),%xmm0
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xebe(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  0xeb7(%rip),%xmm2
maxss  %xmm1,%xmm2
movss  0xeaf(%rip),%xmm3
movaps %xmm3,%xmm0
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm1
andnps %xmm2,%xmm1
andps  %xmm3,%xmm0
orps   %xmm1,%xmm0
pop    %rax
jmp    1040 <round@plt>

LLVM IR (-O0):
define i32 @RPMToMotor(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 2.170000e-02
%6 = fptrunc double %5 to float
%7 = call i64 @pow(double 2.718280e+00, float %6)
%8 = sitofp i64 %7 to float
%9 = fpext float %8 to double
%10 = fmul double 1.143100e+01, %9
%11 = fptrunc double %10 to float
store float %11, float* %2
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = fcmp ogt double %13, 1.270000e+02
br i1 %14, label %15, label %16
15: ; preds = %1
br label %26
16: ; preds = %1
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = fcmp olt double %18, -1.270000e+02
br i1 %19, label %20, label %21
20: ; preds = %16
br label %24
21: ; preds = %16
%22 = load float, float* %2
%23 = fpext float %22 to double
br label %24
24: ; preds = %21, %20
%25 = phi double [ -1.270000e+02, %20 ], [ %23, %21 ]
br label %26
26: ; preds = %24, %15
%27 = phi double [ 1.270000e+02, %15 ], [ %25, %24 ]
%28 = fptrunc double %27 to float
store float %28, float* %2
%29 = load float, float* %2
%30 = call i64 @round(float %29)
%31 = trunc i64 %30 to i32
ret i32 %31
}

LLVM IR (-O2):
define i32 @RPMToMotor(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 2.170000e-02
%4 = fptrunc double %3 to float
%5 = tail call i64 @pow(double 2.718280e+00, float %4)
%6 = sitofp i64 %5 to float
%7 = fpext float %6 to double
%8 = fmul double %7, 1.143100e+01
%9 = fptrunc double %8 to float
%10 = fcmp ogt float %9, 1.270000e+02
%11 = fcmp olt float %9, -1.270000e+02
%12 = select i1 %11, float -1.270000e+02, float %9
%13 = select i1 %10, float 1.270000e+02, float %12
%14 = tail call i64 @round(float %13)
%15 = trunc i64 %14 to i32
ret i32 %15
}