#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 fabs(float);
void parabolic_fit(float *amp, float *pos, float yy1, float yy2, float yy3) {
  float t3, t4;
  t4 = yy1 - yy3;
  t3 = 2 * (yy1 + yy3 - 2 * yy2);
  if (t3 < 0) {
    amp[0] = yy2 - 0.5F * t4 * t4 / t3;
    t4 = t4 / t3;
    if (fabs(t4) > 1)
      t4 /= (float)fabs(t4);
    pos[0] = t4;
  } else {
    if (yy1 > yy3) {
      amp[0] = yy1;
      pos[0] = -1;
    } else {
      amp[0] = yy3;
      pos[0] = 1;
    }
  }
}


x86 assembly (clang, -O0):
<parabolic_fit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm1
addss  -0x1c(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
addss  %xmm0,%xmm0
subss  %xmm0,%xmm1
movss  0xea3(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    11eb <parabolic_fit+0xdb>
movss  -0x18(%rbp),%xmm0
movss  0xe8c(%rip),%xmm1
mulss  -0x24(%rbp),%xmm1
mulss  -0x24(%rbp),%xmm1
divss  -0x20(%rbp),%xmm1
subss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x24(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
call   1030 <fabs@plt>
cmp    $0x1,%eax
jle    11d9 <parabolic_fit+0xc9>
movss  -0x24(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2ss %eax,%xmm1
movss  -0x24(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
jmp    123e <parabolic_fit+0x12e>
movss  -0x14(%rbp),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    121c <parabolic_fit+0x10c>
movss  -0x14(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0xdf5(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    1239 <parabolic_fit+0x129>
movss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0xdcf(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    123e <parabolic_fit+0x12e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parabolic_fit>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movaps %xmm0,%xmm4
addss  %xmm2,%xmm4
movaps %xmm1,%xmm3
addss  %xmm1,%xmm3
subss  %xmm3,%xmm4
addss  %xmm4,%xmm4
xorps  %xmm3,%xmm3
ucomiss %xmm4,%xmm3
jbe    118b <parabolic_fit+0x7b>
subss  %xmm2,%xmm0
movss  0xec6(%rip),%xmm2
mulss  %xmm0,%xmm2
mulss  %xmm0,%xmm2
divss  %xmm4,%xmm2
addss  %xmm2,%xmm1
movss  %xmm1,(%rdi)
divss  %xmm4,%xmm0
movss  %xmm0,0xc(%rsp)
call   1030 <fabs@plt>
cmp    $0x2,%eax
jl     119e <parabolic_fit+0x8e>
movss  0xc(%rsp),%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xc(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
jmp    11b2 <parabolic_fit+0xa2>
ucomiss %xmm2,%xmm0
jbe    11a6 <parabolic_fit+0x96>
movss  %xmm0,(%rdi)
movss  0xe68(%rip),%xmm0
jmp    11b2 <parabolic_fit+0xa2>
movss  0xc(%rsp),%xmm0
jmp    11b2 <parabolic_fit+0xa2>
movss  %xmm2,(%rdi)
movss  0xe4e(%rip),%xmm0
movss  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @parabolic_fit(float* %0, float* %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float*
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float* %0, float** %6
store float* %1, float** %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%13 = load float, float* %8
%14 = load float, float* %10
%15 = fsub float %13, %14
store float %15, float* %12
%16 = load float, float* %8
%17 = load float, float* %10
%18 = fadd float %16, %17
%19 = load float, float* %9
%20 = call float @llvm.fmuladd.f32(float -2.000000e+00, float %19, float %18)
%21 = fmul float 2.000000e+00, %20
store float %21, float* %11
%22 = load float, float* %11
%23 = fcmp olt float %22, 0.000000e+00
br i1 %23, label %24, label %51
24: ; preds = %5
%25 = load float, float* %9
%26 = load float, float* %12
%27 = fmul float 5.000000e-01, %26
%28 = load float, float* %12
%29 = fmul float %27, %28
%30 = load float, float* %11
%31 = fdiv float %29, %30
%32 = fsub float %25, %31
%33 = load float*, float** %6
%34 = getelementptr inbounds float, float* %33, i64 0
store float %32, float* %34
%35 = load float, float* %12
%36 = load float, float* %11
%37 = fdiv float %35, %36
store float %37, float* %12
%38 = load float, float* %12
%39 = call i32 @fabs(float %38)
%40 = icmp sgt i32 %39, 1
br i1 %40, label %41, label %47
41: ; preds = %24
%42 = load float, float* %12
%43 = call i32 @fabs(float %42)
%44 = sitofp i32 %43 to float
%45 = load float, float* %12
%46 = fdiv float %45, %44
store float %46, float* %12
br label %47
47: ; preds = %41, %24
%48 = load float, float* %12
%49 = load float*, float** %7
%50 = getelementptr inbounds float, float* %49, i64 0
store float %48, float* %50
br label %68
51: ; preds = %5
%52 = load float, float* %8
%53 = load float, float* %10
%54 = fcmp ogt float %52, %53
br i1 %54, label %55, label %61
55: ; preds = %51
%56 = load float, float* %8
%57 = load float*, float** %6
%58 = getelementptr inbounds float, float* %57, i64 0
store float %56, float* %58
%59 = load float*, float** %7
%60 = getelementptr inbounds float, float* %59, i64 0
store float -1.000000e+00, float* %60
br label %67
61: ; preds = %51
%62 = load float, float* %10
%63 = load float*, float** %6
%64 = getelementptr inbounds float, float* %63, i64 0
store float %62, float* %64
%65 = load float*, float** %7
%66 = getelementptr inbounds float, float* %65, i64 0
store float 1.000000e+00, float* %66
br label %67
67: ; preds = %61, %55
br label %68
68: ; preds = %67, %47
ret void
}

LLVM IR (-O2):
define void @parabolic_fit(float* nocapture writeonly %0, float* nocapture writeonly %1, float %2, float %3, float %4) {
%6 = fsub float %2, %4
%7 = fadd float %2, %4
%8 = tail call float @llvm.fmuladd.f32(float %3, float -2.000000e+00, float %7)
%9 = fmul float %8, 2.000000e+00
%10 = fcmp olt float %9, 0.000000e+00
br i1 %10, label %11, label %23
11: ; preds = %5
%12 = fmul float %6, 5.000000e-01
%13 = fmul float %6, %12
%14 = fdiv float %13, %9
%15 = fsub float %3, %14
store float %15, float* %0
%16 = fdiv float %6, %9
%17 = tail call i32 @fabs(float %16)
%18 = icmp sgt i32 %17, 1
br i1 %18, label %19, label %27
19: ; preds = %11
%20 = tail call i32 @fabs(float %16)
%21 = sitofp i32 %20 to float
%22 = fdiv float %16, %21
br label %27
23: ; preds = %5
%24 = fcmp ogt float %2, %4
br i1 %24, label %25, label %26
25: ; preds = %23
store float %2, float* %0
br label %27
26: ; preds = %23
store float %4, float* %0
br label %27
27: ; preds = %11, %19, %25, %26
%28 = phi float [ -1.000000e+00, %25 ], [ 1.000000e+00, %26 ], [ %22, %19 ], [ %16, %11 ]
store float %28, float* %1
ret void
}