; LLVM IR from venumb/ZSPACE :: cpp/depends/spa (spa)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
declare dso_local double @limit_zero2one(double noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

; Function Attrs: nounwind uwtable
define dso_local double @rts_alpha_delta_prime(ptr noundef %0, double noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds double, ptr %7, i64 1
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds double, ptr %10, i64 0
  %12 = load double, ptr %11, align 8, !tbaa !9
  %13 = fsub double %9, %12
  store double %13, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds double, ptr %14, i64 2
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds double, ptr %17, i64 1
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = fsub double %16, %19
  store double %20, ptr %6, align 8, !tbaa !9
  %21 = load double, ptr %5, align 8, !tbaa !9
  %22 = call double @llvm.fabs.f64(double %21)
  %23 = fcmp oge double %22, 2.000000e+00
  br i1 %23, label %24, label %27

24:                                               ; preds = %2
  %25 = load double, ptr %5, align 8, !tbaa !9
  %26 = call double @limit_zero2one(double noundef %25)
  store double %26, ptr %5, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %24, %2
  %28 = load double, ptr %6, align 8, !tbaa !9
  %29 = call double @llvm.fabs.f64(double %28)
  %30 = fcmp oge double %29, 2.000000e+00
  br i1 %30, label %31, label %34

31:                                               ; preds = %27
  %32 = load double, ptr %6, align 8, !tbaa !9
  %33 = call double @limit_zero2one(double noundef %32)
  store double %33, ptr %6, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %31, %27
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds double, ptr %35, i64 1
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = load double, ptr %4, align 8, !tbaa !9
  %39 = load double, ptr %5, align 8, !tbaa !9
  %40 = load double, ptr %6, align 8, !tbaa !9
  %41 = fadd double %39, %40
  %42 = load double, ptr %6, align 8, !tbaa !9
  %43 = load double, ptr %5, align 8, !tbaa !9
  %44 = fsub double %42, %43
  %45 = load double, ptr %4, align 8, !tbaa !9
  %46 = call double @llvm.fmuladd.f64(double %44, double %45, double %41)
  %47 = fmul double %38, %46
  %48 = fdiv double %47, 2.000000e+00
  %49 = fadd double %37, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret double %49
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
declare dso_local double @limit_zero2one(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

; Function Attrs: nounwind uwtable
define dso_local double @rts_alpha_delta_prime(ptr nocapture noundef readonly %0, double noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load double, ptr %3, align 8, !tbaa !5
  %5 = load double, ptr %0, align 8, !tbaa !5
  %6 = fsub double %4, %5
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = fsub double %8, %4
  %10 = tail call double @llvm.fabs.f64(double %6)
  %11 = fcmp ult double %10, 2.000000e+00
  br i1 %11, label %14, label %12

12:                                               ; preds = %2
  %13 = tail call double @limit_zero2one(double noundef %6)
  br label %14

14:                                               ; preds = %12, %2
  %.015 = phi double [ %13, %12 ], [ %6, %2 ]
  %15 = tail call double @llvm.fabs.f64(double %9)
  %16 = fcmp ult double %15, 2.000000e+00
  br i1 %16, label %19, label %17

17:                                               ; preds = %14
  %18 = tail call double @limit_zero2one(double noundef %9)
  br label %19

19:                                               ; preds = %17, %14
  %.0 = phi double [ %18, %17 ], [ %9, %14 ]
  %20 = load double, ptr %3, align 8, !tbaa !5
  %21 = fadd double %.015, %.0
  %22 = fsub double %.0, %.015
  %23 = tail call double @llvm.fmuladd.f64(double %22, double %1, double %21)
  %24 = fmul double %23, %1
  %25 = fmul double %24, 5.000000e-01
  %26 = fadd double %20, %25
  ret double %26
}

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass