#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 */
double inBounce(float, int /*<<< orphan*/, float, float);
double outBounce(float, int /*<<< orphan*/, float, float);
float inOutBounce(float t, float b, float c, float d) {
  if (t < d / 2)
    return inBounce(t * 2, 0, c, d) * 0.5 + b;
  return outBounce(t * 2 - d, 0, c, d) * 0.5 + c * .5 + b;
}


x86 assembly (clang, -O0):
<inOutBounce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  %xmm3,-0x14(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xeb2(%rip),%xmm2
divss  %xmm2,%xmm0
ucomiss %xmm1,%xmm0
jbe    11a0 <inOutBounce+0x80>
movss  0xe9d(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
xor    %edi,%edi
call   1030 <inBounce@plt>
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe7e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    120b <inOutBounce+0xeb>
movss  -0x8(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
xor    %edi,%edi
call   1040 <outBounce@plt>
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe27(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe1b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inOutBounce>:
push   %rax
movss  %xmm1,(%rsp)
movss  0xed2(%rip),%xmm1
mulss  %xmm3,%xmm1
ucomiss %xmm0,%xmm1
jbe    115b <inOutBounce+0x3b>
addss  %xmm0,%xmm0
xor    %edi,%edi
movaps %xmm2,%xmm1
movaps %xmm3,%xmm2
call   1030 <inBounce@plt>
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xeaf(%rip),%xmm0
jmp    11a0 <inOutBounce+0x80>
addss  %xmm0,%xmm0
subss  %xmm3,%xmm0
xor    %edi,%edi
movaps %xmm2,%xmm1
movss  %xmm2,0x4(%rsp)
movaps %xmm3,%xmm2
call   1040 <outBounce@plt>
movaps %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7d(%rip),%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

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

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