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


x86 assembly (clang, -O0):
<quartic_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    1193 <quartic_io+0x83>
movss  -0x10(%rbp),%xmm0
movss  0xe9f(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
mov    $0x4,%edi
call   1030 <powf@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e8 <quartic_io+0xd8>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe5a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe44(%rip),%xmm1
subss  %xmm1,%xmm0
mov    $0x5,%edi
call   1030 <powf@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):
<quartic_io>:
push   %rax
movss  0xee7(%rip),%xmm3
mulss  %xmm3,%xmm1
divss  %xmm1,%xmm0
movss  0xedb(%rip),%xmm1
ucomiss %xmm0,%xmm1
mulss  %xmm2,%xmm3
movss  %xmm3,(%rsp)
jbe    1148 <quartic_io+0x38>
mov    $0x4,%edi
call   1030 <powf@plt>
mulss  (%rsp),%xmm0
pop    %rax
ret
addss  0xeb8(%rip),%xmm0
mov    $0x5,%edi
movss  %xmm2,0x4(%rsp)
call   1030 <powf@plt>
mulss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @quartic_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 %21
15: ; preds = %3
%16 = load float, float* %7
%17 = fdiv float %16, 2.000000e+00
%18 = load float, float* %8
%19 = call float @powf(float %18, i32 4)
%20 = fmul float %17, %19
store float %20, float* %4
br label %29
21: ; preds = %3
%22 = load float, float* %7
%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 float @powf(float %26, i32 5)
%28 = call float @llvm.fmuladd.f32(float %24, float %27, float %22)
store float %28, float* %4
br label %29
29: ; preds = %21, %15
%30 = load float, float* %4
ret float %30
}

LLVM IR (-O2):
define float @quartic_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
%7 = fmul float %2, 5.000000e-01
br i1 %6, label %8, label %11
8: ; preds = %3
%9 = tail call float @powf(float %5, i32 4)
%10 = fmul float %7, %9
br label %15
11: ; preds = %3
%12 = fadd float %5, -2.000000e+00
%13 = tail call float @powf(float %12, i32 5)
%14 = tail call float @llvm.fmuladd.f32(float %7, float %13, float %2)
br label %15
15: ; preds = %11, %8
%16 = phi float [ %10, %8 ], [ %14, %11 ]
ret float %16
}