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


x86 assembly (clang, -O0):
<cubic_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
movss  -0xc(%rbp),%xmm1
movss  0xecb(%rip),%xmm2
divss  %xmm2,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xeb2(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    1194 <cubic_io+0x84>
movss  -0x10(%rbp),%xmm0
movss  0xe9f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <powf@plt>
movss  -0x18(%rbp),%xmm0
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11da <cubic_io+0xca>
movss  -0x10(%rbp),%xmm0
movss  0xe63(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe4d(%rip),%xmm1
subss  %xmm1,%xmm0
mov    $0x3,%edi
call   1030 <powf@plt>
movss  -0x1c(%rbp),%xmm0
add    $0x2,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cubic_io>:
push   %rax
movss  %xmm2,0x4(%rsp)
mulss  0xee1(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xed9(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    113c <cubic_io+0x2c>
mov    $0x3,%edi
call   1030 <powf@plt>
jmp    1151 <cubic_io+0x41>
addss  0xec4(%rip),%xmm0
mov    $0x3,%edi
call   1030 <powf@plt>
add    $0x2,%eax
movss  0x4(%rsp),%xmm1
mulss  0xea1(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @cubic_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 = load float, float* %6
%11 = fdiv float %10, 2.000000e+00
%12 = fdiv float %9, %11
store float %12, float* %8
%13 = load float, float* %8
%14 = fcmp olt float %13, 1.000000e+00
br i1 %14, label %15, label %22
15: ; preds = %3
%16 = load float, float* %7
%17 = fdiv float %16, 2.000000e+00
%18 = load float, float* %8
%19 = call i32 @powf(float %18, i32 3)
%20 = sitofp i32 %19 to float
%21 = fmul float %17, %20
store float %21, float* %4
br label %31
22: ; preds = %3
%23 = load float, float* %7
%24 = fdiv float %23, 2.000000e+00
%25 = load float, float* %8
%26 = fsub float %25, 2.000000e+00
%27 = call i32 @powf(float %26, i32 3)
%28 = add nsw i32 %27, 2
%29 = sitofp i32 %28 to float
%30 = fmul float %24, %29
store float %30, float* %4
br label %31
31: ; preds = %22, %15
%32 = load float, float* %4
ret float %32
}

LLVM IR (-O2):
define float @cubic_io(float %0, float %1, float %2) {
%4 = fmul float %1, 5.000000e-01
%5 = fdiv float %0, %4
%6 = fcmp olt float %5, 1.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @powf(float %5, i32 3)
br label %13
9: ; preds = %3
%10 = fadd float %5, -2.000000e+00
%11 = tail call i32 @powf(float %10, i32 3)
%12 = add nsw i32 %11, 2
br label %13
13: ; preds = %9, %7
%14 = phi i32 [ %12, %9 ], [ %8, %7 ]
%15 = fmul float %2, 5.000000e-01
%16 = sitofp i32 %14 to float
%17 = fmul float %15, %16
ret float %17
}