#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(int, float);
float fastBounceIn(float fraction, float start, float delta, int bounces,
                   float growth, float damping) {
  if (fraction == 0 || delta == 0)
    return start;
  if (fraction == 1)
    return start + delta;
  float w0;
  if (growth == 1.0)
    w0 = 1 / (bounces + 0.25);
  else {
    float gN = pow(growth, bounces);
    w0 = 1 / ((gN - 1) / (growth - 1) + gN / 4);
  }
  float bounceStart = 0;
  int i;
  float w = w0;
  for (i = 0; i <= bounces; i++) {
    float bounceEnd = bounceStart + w;
    if (fraction >= bounceStart && fraction < bounceEnd) {
      float half = (bounceEnd + bounceStart) / 2;
      float top = delta / 0.75 / pow(2, damping * ((bounces - i)));
      fraction -= half;
      fraction /= (w / 2);
      return (1 - fraction * fraction) * top + start;
    }
    bounceStart = bounceEnd;
    w = w * growth;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fastBounceIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movss  %xmm4,-0x1c(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1150 <fastBounceIn+0x40>
jp     1150 <fastBounceIn+0x40>
jmp    1167 <fastBounceIn+0x57>
movss  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1176 <fastBounceIn+0x66>
jp     1176 <fastBounceIn+0x66>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13b7 <fastBounceIn+0x2a7>
movss  -0x8(%rbp),%xmm0
movss  0xe7d(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11a6 <fastBounceIn+0x96>
jp     11a6 <fastBounceIn+0x96>
movss  -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13b7 <fastBounceIn+0x2a7>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe59(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11f2 <fastBounceIn+0xe2>
jp     11f2 <fastBounceIn+0xe2>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe44(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe30(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    1252 <fastBounceIn+0x142>
cvttss2si -0x18(%rbp),%edi
cvtsi2ssl -0x14(%rbp),%xmm0
call   1030 <pow@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm1
movss  0xded(%rip),%xmm0
subss  %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
movss  0xddc(%rip),%xmm2
subss  %xmm2,%xmm0
divss  %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
movss  0xdcb(%rip),%xmm2
divss  %xmm2,%xmm0
addss  %xmm0,%xmm1
movss  0xdb7(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     13af <fastBounceIn+0x29f>
movss  -0x28(%rbp),%xmm0
addss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0x28(%rbp),%xmm0
jb     1388 <fastBounceIn+0x278>
movss  -0x8(%rbp),%xmm1
movss  -0x34(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1388 <fastBounceIn+0x278>
movss  -0x34(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  0xd4e(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd4c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movss  -0x1c(%rbp),%xmm0
mov    -0x14(%rbp),%eax
sub    -0x2c(%rbp),%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x38(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x30(%rbp),%xmm1
movss  0xcd5(%rip),%xmm0
divss  %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm1,%xmm0
movss  0xc98(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x3c(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    13b7 <fastBounceIn+0x2a7>
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x30(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    126b <fastBounceIn+0x15b>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastBounceIn>:
push   %rbx
sub    $0x20,%rsp
movaps %xmm0,%xmm5
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm5
jne    1126 <fastBounceIn+0x16>
jnp    12cd <fastBounceIn+0x1bd>
ucomiss %xmm0,%xmm2
jne    1131 <fastBounceIn+0x21>
jnp    12cd <fastBounceIn+0x1bd>
ucomiss 0xec8(%rip),%xmm5
jne    1145 <fastBounceIn+0x35>
jp     1145 <fastBounceIn+0x35>
addss  %xmm2,%xmm1
jmp    12cd <fastBounceIn+0x1bd>
mov    %edi,%ebx
ucomiss 0xeb2(%rip),%xmm3
movss  %xmm1,0x1c(%rsp)
jne    1180 <fastBounceIn+0x70>
jp     1180 <fastBounceIn+0x70>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  0xea9(%rip),%xmm0
movsd  0xea9(%rip),%xmm1
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
test   %ebx,%ebx
jns    11f7 <fastBounceIn+0xe7>
jmp    12ca <fastBounceIn+0x1ba>
cvttss2si %xmm3,%edi
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
movss  %xmm5,0xc(%rsp)
movss  %xmm4,0x10(%rsp)
movss  %xmm2,0x8(%rsp)
movss  %xmm3,0x4(%rsp)
call   1030 <pow@plt>
movss  0x4(%rsp),%xmm3
movss  0x8(%rsp),%xmm2
movss  0x10(%rsp),%xmm4
movss  0xe42(%rip),%xmm1
movaps %xmm0,%xmm5
addss  %xmm1,%xmm5
addss  %xmm3,%xmm1
mulss  0xe33(%rip),%xmm0
divss  %xmm1,%xmm5
addss  %xmm5,%xmm0
movss  0xc(%rsp),%xmm5
movss  0xe15(%rip),%xmm1
divss  %xmm0,%xmm1
test   %ebx,%ebx
js     12ca <fastBounceIn+0x1ba>
neg    %ebx
xorps  %xmm6,%xmm6
xorps  %xmm0,%xmm0
jmp    1223 <fastBounceIn+0x113>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mulss  %xmm3,%xmm1
add    $0x1,%ebx
movaps %xmm0,%xmm6
cmp    $0x1,%ebx
je     12ca <fastBounceIn+0x1ba>
addss  %xmm1,%xmm0
ucomiss %xmm6,%xmm5
jb     1210 <fastBounceIn+0x100>
ucomiss %xmm5,%xmm0
jbe    1210 <fastBounceIn+0x100>
addss  %xmm0,%xmm6
mulss  0xdcf(%rip),%xmm6
movss  %xmm6,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
divsd  0xdce(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
neg    %ebx
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
mulss  %xmm4,%xmm0
mov    $0x2,%edi
movss  %xmm5,0xc(%rsp)
movss  %xmm1,0x8(%rsp)
call   1030 <pow@plt>
cvtss2sd %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0xc(%rsp),%xmm0
subss  0x4(%rsp),%xmm0
movss  0x8(%rsp),%xmm2
mulss  0xd65(%rip),%xmm2
divss  %xmm2,%xmm0
mulss  %xmm0,%xmm0
movaps %xmm0,%xmm2
movss  0xd46(%rip),%xmm0
subss  %xmm2,%xmm0
mulss  %xmm1,%xmm0
addss  0x1c(%rsp),%xmm0
jmp    12d0 <fastBounceIn+0x1c0>
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @fastBounceIn(float %0, float %1, float %2, i32 %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca i32
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store i32 %3, i32* %11
store float %4, float* %12
store float %5, float* %13
%22 = load float, float* %8
%23 = fcmp oeq float %22, 0.000000e+00
br i1 %23, label %27, label %24
24: ; preds = %6
%25 = load float, float* %10
%26 = fcmp oeq float %25, 0.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %24, %6
%28 = load float, float* %9
store float %28, float* %7
br label %119
29: ; preds = %24
%30 = load float, float* %8
%31 = fcmp oeq float %30, 1.000000e+00
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load float, float* %9
%34 = load float, float* %10
%35 = fadd float %33, %34
store float %35, float* %7
br label %119
36: ; preds = %29
%37 = load float, float* %12
%38 = fpext float %37 to double
%39 = fcmp oeq double %38, 1.000000e+00
br i1 %39, label %40, label %46
40: ; preds = %36
%41 = load i32, i32* %11
%42 = sitofp i32 %41 to double
%43 = fadd double %42, 2.500000e-01
%44 = fdiv double 1.000000e+00, %43
%45 = fptrunc double %44 to float
store float %45, float* %14
br label %61
46: ; preds = %36
%47 = load float, float* %12
%48 = fptosi float %47 to i32
%49 = load i32, i32* %11
%50 = sitofp i32 %49 to float
%51 = call float @pow(i32 %48, float %50)
store float %51, float* %15
%52 = load float, float* %15
%53 = fsub float %52, 1.000000e+00
%54 = load float, float* %12
%55 = fsub float %54, 1.000000e+00
%56 = fdiv float %53, %55
%57 = load float, float* %15
%58 = fdiv float %57, 4.000000e+00
%59 = fadd float %56, %58
%60 = fdiv float 1.000000e+00, %59
store float %60, float* %14
br label %61
61: ; preds = %46, %40
store float 0.000000e+00, float* %16
%62 = load float, float* %14
store float %62, float* %18
store i32 0, i32* %17
br label %63
63: ; preds = %115, %61
%64 = load i32, i32* %17
%65 = load i32, i32* %11
%66 = icmp sle i32 %64, %65
br i1 %66, label %67, label %118
67: ; preds = %63
%68 = load float, float* %16
%69 = load float, float* %18
%70 = fadd float %68, %69
store float %70, float* %19
%71 = load float, float* %8
%72 = load float, float* %16
%73 = fcmp oge float %71, %72
br i1 %73, label %74, label %110
74: ; preds = %67
%75 = load float, float* %8
%76 = load float, float* %19
%77 = fcmp olt float %75, %76
br i1 %77, label %78, label %110
78: ; preds = %74
%79 = load float, float* %19
%80 = load float, float* %16
%81 = fadd float %79, %80
%82 = fdiv float %81, 2.000000e+00
store float %82, float* %20
%83 = load float, float* %10
%84 = fpext float %83 to double
%85 = fdiv double %84, 7.500000e-01
%86 = load float, float* %13
%87 = load i32, i32* %11
%88 = load i32, i32* %17
%89 = sub nsw i32 %87, %88
%90 = sitofp i32 %89 to float
%91 = fmul float %86, %90
%92 = call float @pow(i32 2, float %91)
%93 = fpext float %92 to double
%94 = fdiv double %85, %93
%95 = fptrunc double %94 to float
store float %95, float* %21
%96 = load float, float* %20
%97 = load float, float* %8
%98 = fsub float %97, %96
store float %98, float* %8
%99 = load float, float* %18
%100 = fdiv float %99, 2.000000e+00
%101 = load float, float* %8
%102 = fdiv float %101, %100
store float %102, float* %8
%103 = load float, float* %8
%104 = load float, float* %8
%105 = fneg float %103
%106 = call float @llvm.fmuladd.f32(float %105, float %104, float 1.000000e+00)
%107 = load float, float* %21
%108 = load float, float* %9
%109 = call float @llvm.fmuladd.f32(float %106, float %107, float %108)
store float %109, float* %7
br label %119
110: ; preds = %74, %67
%111 = load float, float* %19
store float %111, float* %16
%112 = load float, float* %18
%113 = load float, float* %12
%114 = fmul float %112, %113
store float %114, float* %18
br label %115
115: ; preds = %110
%116 = load i32, i32* %17
%117 = add nsw i32 %116, 1
store i32 %117, i32* %17
br label %63
118: ; preds = %63
store float 0.000000e+00, float* %7
br label %119
119: ; preds = %118, %78, %32, %27
%120 = load float, float* %7
ret float %120
}

LLVM IR (-O2):
define float @fastBounceIn(float %0, float %1, float %2, i32 %3, float %4, float %5) {
%7 = fcmp oeq float %0, 0.000000e+00
%8 = fcmp oeq float %2, 0.000000e+00
%9 = or i1 %7, %8
br i1 %9, label %64, label %10
10: ; preds = %6
%11 = fcmp oeq float %0, 1.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = fadd float %1, %2
br label %64
14: ; preds = %10
%15 = fcmp oeq float %4, 1.000000e+00
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = sitofp i32 %3 to double
%18 = fadd double %17, 2.500000e-01
%19 = fdiv double 1.000000e+00, %18
%20 = fptrunc double %19 to float
br label %31
21: ; preds = %14
%22 = fptosi float %4 to i32
%23 = sitofp i32 %3 to float
%24 = tail call float @pow(i32 %22, float %23)
%25 = fadd float %24, -1.000000e+00
%26 = fadd float %4, -1.000000e+00
%27 = fdiv float %25, %26
%28 = fmul float %24, 2.500000e-01
%29 = fadd float %28, %27
%30 = fdiv float 1.000000e+00, %29
br label %31
31: ; preds = %21, %16
%32 = phi float [ %20, %16 ], [ %30, %21 ]
%33 = icmp slt i32 %3, 0
br i1 %33, label %64, label %34
34: ; preds = %31, %60
%35 = phi float [ %61, %60 ], [ %32, %31 ]
%36 = phi i32 [ %62, %60 ], [ 0, %31 ]
%37 = phi float [ %38, %60 ], [ 0.000000e+00, %31 ]
%38 = fadd float %37, %35
%39 = fcmp ole float %37, %0
%40 = fcmp ogt float %38, %0
%41 = select i1 %39, i1 %40, i1 false
br i1 %41, label %42, label %60
42: ; preds = %34
%43 = fadd float %37, %38
%44 = fmul float %43, 5.000000e-01
%45 = fpext float %2 to double
%46 = fdiv double %45, 7.500000e-01
%47 = sub nsw i32 %3, %36
%48 = sitofp i32 %47 to float
%49 = fmul float %48, %5
%50 = tail call float @pow(i32 2, float %49)
%51 = fpext float %50 to double
%52 = fdiv double %46, %51
%53 = fptrunc double %52 to float
%54 = fsub float %0, %44
%55 = fmul float %35, 5.000000e-01
%56 = fdiv float %54, %55
%57 = fneg float %56
%58 = tail call float @llvm.fmuladd.f32(float %57, float %56, float 1.000000e+00)
%59 = tail call float @llvm.fmuladd.f32(float %58, float %53, float %1)
br label %64
60: ; preds = %34
%61 = fmul float %35, %4
%62 = add nuw i32 %36, 1
%63 = icmp eq i32 %36, %3
br i1 %63, label %64, label %34
64: ; preds = %60, %31, %42, %6, %12
%65 = phi float [ %13, %12 ], [ %1, %6 ], [ %59, %42 ], [ 0.000000e+00, %31 ], [ 0.000000e+00, %60 ]
ret float %65
}