#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 pow(float, int);
float quintic_io(float step, float max_steps, float max_val) {
  float ratio = step / (max_steps / 2.0);
  if (ratio < 1)
    return max_val / 2 * pow(ratio, 5);
  ratio -= 2;
  return max_val + max_val / 2 * pow(ratio, 5);
}


x86 assembly (clang, -O0):
<quintic_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xec7(%rip),%xmm2
divsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xea6(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    119f <quintic_io+0x8f>
movss  -0x10(%rbp),%xmm0
movss  0xe93(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x5,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11fe <quintic_io+0xee>
movss  -0x14(%rbp),%xmm0
movss  0xe58(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe38(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x5,%edi
call   1030 <pow@plt>
movss  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x1c(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quintic_io>:
push   %rax
cvtss2sd %xmm1,%xmm1
mulsd  0xee3(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xed7(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1154 <quintic_io+0x44>
mulss  0xed2(%rip),%xmm2
movss  %xmm2,(%rsp)
mov    $0x5,%edi
call   1030 <pow@plt>
mulss  (%rsp),%xmm0
pop    %rax
ret
addss  0xeb0(%rip),%xmm0
movss  0xeac(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0x4(%rsp)
mov    $0x5,%edi
movss  %xmm2,(%rsp)
call   1030 <pow@plt>
mulss  0x4(%rsp),%xmm0
addss  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @quintic_io(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = load float, float* %6
%12 = fpext float %11 to double
%13 = fdiv double %12, 2.000000e+00
%14 = fdiv double %10, %13
%15 = fptrunc double %14 to float
store float %15, float* %8
%16 = load float, float* %8
%17 = fcmp olt float %16, 1.000000e+00
br i1 %17, label %18, label %24
18: ; preds = %3
%19 = load float, float* %7
%20 = fdiv float %19, 2.000000e+00
%21 = load float, float* %8
%22 = call float @pow(float %21, i32 5)
%23 = fmul float %20, %22
store float %23, float* %4
br label %33
24: ; preds = %3
%25 = load float, float* %8
%26 = fsub float %25, 2.000000e+00
store float %26, float* %8
%27 = load float, float* %7
%28 = load float, float* %7
%29 = fdiv float %28, 2.000000e+00
%30 = load float, float* %8
%31 = call float @pow(float %30, i32 5)
%32 = call float @llvm.fmuladd.f32(float %29, float %31, float %27)
store float %32, float* %4
br label %33
33: ; preds = %24, %18
%34 = load float, float* %4
ret float %34
}

LLVM IR (-O2):
define float @quintic_io(float %0, float %1, float %2) {
%4 = fpext float %0 to double
%5 = fpext float %1 to double
%6 = fmul double %5, 5.000000e-01
%7 = fdiv double %4, %6
%8 = fptrunc double %7 to float
%9 = fcmp olt float %8, 1.000000e+00
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = fmul float %2, 5.000000e-01
%12 = tail call float @pow(float %8, i32 5)
%13 = fmul float %11, %12
br label %19
14: ; preds = %3
%15 = fadd float %8, -2.000000e+00
%16 = fmul float %2, 5.000000e-01
%17 = tail call float @pow(float %15, i32 5)
%18 = tail call float @llvm.fmuladd.f32(float %16, float %17, float %2)
br label %19
19: ; preds = %14, %10
%20 = phi float [ %13, %10 ], [ %18, %14 ]
ret float %20
}