#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 analogRead(int /*<<< orphan*/);
float pow(double, int);
int distanceRead(float raw) {
  raw = analogRead(0);
  float val = 0.0049 * raw;
  int distance = 1 * pow(10, -14) * pow(val, 6) - pow(2, -11) * pow(val, 5) +
                 pow(1, -18) * pow(val, 4) - pow(4, -6) * pow(val, 3) +
                 pow(8, -4) * pow(val, 2) + pow(-8.77, -2) * val + 4.97;
  return distance;
}


x86 assembly (clang, -O0):
<distanceRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <analogRead@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeee(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movsd  0xed1(%rip),%xmm0
mov    $0xfffffff2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movss  0xecc(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x6,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x30(%rbp)
movsd  0xe8b(%rip),%xmm0
mov    $0xfffffff5,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x5,%edi
call   1030 <pow@plt>
movss  -0x34(%rbp),%xmm1
movss  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x2c(%rbp),%xmm0
mulss  %xmm3,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movsd  0xe29(%rip),%xmm0
mov    $0xffffffee,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
movss  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x24(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movsd  0xddd(%rip),%xmm0
mov    $0xfffffffa,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
movss  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movsd  0xd84(%rip),%xmm0
mov    $0xfffffffc,%edi
call   1030 <pow@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movss  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x14(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movsd  0xd38(%rip),%xmm0
mov    $0xfffffffe,%edi
call   1030 <pow@plt>
movss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd08(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distanceRead>:
sub    $0x18,%rsp
xor    %edi,%edi
call   1040 <analogRead@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0xec9(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
movsd  0xebf(%rip),%xmm0
mov    $0xfffffff2,%edi
call   1030 <pow@plt>
movss  %xmm0,(%rsp)
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x6,%edi
call   1030 <pow@plt>
movss  %xmm0,0x4(%rsp)
movsd  0xe90(%rip),%xmm0
mov    $0xfffffff5,%edi
call   1030 <pow@plt>
movss  %xmm0,0x14(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x5,%edi
call   1030 <pow@plt>
mulss  0x14(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mulss  (%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movsd  0xe55(%rip),%xmm0
mov    $0xffffffee,%edi
call   1030 <pow@plt>
movss  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
movsd  0xe25(%rip),%xmm0
mov    $0xfffffffa,%edi
call   1030 <pow@plt>
movss  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
mulss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
movsd  0xdf1(%rip),%xmm0
mov    $0xfffffffc,%edi
call   1030 <pow@plt>
movss  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
movsd  0xdc1(%rip),%xmm0
mov    $0xfffffffe,%edi
call   1030 <pow@plt>
mulss  0x10(%rsp),%xmm0
addss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xda7(%rip),%xmm0
cvttsd2si %xmm0,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @distanceRead(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store float %0, float* %2
%5 = call float @analogRead(i32 0)
store float %5, float* %2
%6 = load float, float* %2
%7 = fpext float %6 to double
%8 = fmul double 4.900000e-03, %7
%9 = fptrunc double %8 to float
store float %9, float* %3
%10 = call float @pow(double 1.000000e+01, i32 -14)
%11 = fmul float 1.000000e+00, %10
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = call float @pow(double %13, i32 6)
%15 = call float @pow(double 2.000000e+00, i32 -11)
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call float @pow(double %17, i32 5)
%19 = fmul float %15, %18
%20 = fneg float %19
%21 = call float @llvm.fmuladd.f32(float %11, float %14, float %20)
%22 = call float @pow(double 1.000000e+00, i32 -18)
%23 = load float, float* %3
%24 = fpext float %23 to double
%25 = call float @pow(double %24, i32 4)
%26 = call float @llvm.fmuladd.f32(float %22, float %25, float %21)
%27 = call float @pow(double 4.000000e+00, i32 -6)
%28 = load float, float* %3
%29 = fpext float %28 to double
%30 = call float @pow(double %29, i32 3)
%31 = fneg float %27
%32 = call float @llvm.fmuladd.f32(float %31, float %30, float %26)
%33 = call float @pow(double 8.000000e+00, i32 -4)
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = call float @pow(double %35, i32 2)
%37 = call float @llvm.fmuladd.f32(float %33, float %36, float %32)
%38 = call float @pow(double 0xC0218A3D70A3D70A, i32 -2)
%39 = load float, float* %3
%40 = call float @llvm.fmuladd.f32(float %38, float %39, float %37)
%41 = fpext float %40 to double
%42 = fadd double %41, 4.970000e+00
%43 = fptosi double %42 to i32
store i32 %43, i32* %4
%44 = load i32, i32* %4
ret i32 %44
}

LLVM IR (-O2):
define i32 @distanceRead(float %0) {
%2 = tail call float @analogRead(i32 0)
%3 = fpext float %2 to double
%4 = fmul double %3, 4.900000e-03
%5 = fptrunc double %4 to float
%6 = tail call float @pow(double 1.000000e+01, i32 -14)
%7 = fpext float %5 to double
%8 = tail call float @pow(double %7, i32 6)
%9 = tail call float @pow(double 2.000000e+00, i32 -11)
%10 = tail call float @pow(double %7, i32 5)
%11 = fneg float %9
%12 = fmul float %10, %11
%13 = tail call float @llvm.fmuladd.f32(float %6, float %8, float %12)
%14 = tail call float @pow(double 1.000000e+00, i32 -18)
%15 = tail call float @pow(double %7, i32 4)
%16 = tail call float @llvm.fmuladd.f32(float %14, float %15, float %13)
%17 = tail call float @pow(double 4.000000e+00, i32 -6)
%18 = tail call float @pow(double %7, i32 3)
%19 = fneg float %17
%20 = tail call float @llvm.fmuladd.f32(float %19, float %18, float %16)
%21 = tail call float @pow(double 8.000000e+00, i32 -4)
%22 = tail call float @pow(double %7, i32 2)
%23 = tail call float @llvm.fmuladd.f32(float %21, float %22, float %20)
%24 = tail call float @pow(double 0xC0218A3D70A3D70A, i32 -2)
%25 = tail call float @llvm.fmuladd.f32(float %24, float %5, float %23)
%26 = fpext float %25 to double
%27 = fadd double %26, 4.970000e+00
%28 = fptosi double %27 to i32
ret i32 %28
}