; LLVM IR from chriskiefer/libcccrt :: benchmarks/maximilian.ll (ZN7maxiMix9ambisonicEdRSt6vectorIdSaIdEEddd)

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7maxiMix9ambisonicEdRSt6vectorIdSaIdEEddd(ptr noundef nonnull align 8 dereferenceable(120) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, double noundef %3, double noundef %4, double noundef %5) #1 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store double %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store double %3, ptr %10, align 8, !tbaa !9
  store double %4, ptr %11, align 8, !tbaa !9
  store double %5, ptr %12, align 8, !tbaa !9
  %13 = load ptr, ptr %7, align 8
  %14 = load double, ptr %10, align 8, !tbaa !9
  %15 = fcmp ogt double %14, 1.000000e+00
  br i1 %15, label %16, label %17

16:                                               ; preds = %6
  store double 1.000000e+00, ptr %10, align 8, !tbaa !9
  br label %17

17:                                               ; preds = %16, %6
  %18 = load double, ptr %10, align 8, !tbaa !9
  %19 = fcmp olt double %18, 0.000000e+00
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  store double 0.000000e+00, ptr %10, align 8, !tbaa !9
  br label %21

21:                                               ; preds = %20, %17
  %22 = load double, ptr %11, align 8, !tbaa !9
  %23 = fcmp ogt double %22, 1.000000e+00
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  store double 1.000000e+00, ptr %11, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %24, %21
  %26 = load double, ptr %11, align 8, !tbaa !9
  %27 = fcmp olt double %26, 0.000000e+00
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %28, %25
  %30 = load double, ptr %12, align 8, !tbaa !9
  %31 = fcmp ogt double %30, 1.000000e+00
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  store double 1.000000e+00, ptr %11, align 8, !tbaa !9
  br label %33

33:                                               ; preds = %32, %29
  %34 = load double, ptr %12, align 8, !tbaa !9
  %35 = fcmp olt double %34, 0.000000e+00
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %36, %33
  %38 = load double, ptr %8, align 8, !tbaa !9
  %39 = load double, ptr %10, align 8, !tbaa !9
  %40 = fsub double 1.000000e+00, %39
  %41 = load double, ptr %11, align 8, !tbaa !9
  %42 = fmul double %40, %41
  %43 = call double @sqrt(double noundef %42) #3
  %44 = load double, ptr %12, align 8, !tbaa !9
  %45 = fneg double %44
  %46 = call double @llvm.fmuladd.f64(double %43, double 1.000000e+00, double %45)
  %47 = fmul double %38, %46
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef 0) #3
  store double %47, ptr %49, align 8, !tbaa !9
  %50 = load double, ptr %8, align 8, !tbaa !9
  %51 = load double, ptr %10, align 8, !tbaa !9
  %52 = fsub double 1.000000e+00, %51
  %53 = load double, ptr %11, align 8, !tbaa !9
  %54 = fsub double 1.000000e+00, %53
  %55 = fmul double %52, %54
  %56 = call double @sqrt(double noundef %55) #3
  %57 = load double, ptr %12, align 8, !tbaa !9
  %58 = fneg double %57
  %59 = call double @llvm.fmuladd.f64(double %56, double 1.000000e+00, double %58)
  %60 = fmul double %50, %59
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef 1) #3
  store double %60, ptr %62, align 8, !tbaa !9
  %63 = load double, ptr %8, align 8, !tbaa !9
  %64 = load double, ptr %10, align 8, !tbaa !9
  %65 = load double, ptr %11, align 8, !tbaa !9
  %66 = fmul double %64, %65
  %67 = call double @sqrt(double noundef %66) #3
  %68 = load double, ptr %12, align 8, !tbaa !9
  %69 = fneg double %68
  %70 = call double @llvm.fmuladd.f64(double %67, double 1.000000e+00, double %69)
  %71 = fmul double %63, %70
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %72, i64 noundef 2) #3
  store double %71, ptr %73, align 8, !tbaa !9
  %74 = load double, ptr %8, align 8, !tbaa !9
  %75 = load double, ptr %10, align 8, !tbaa !9
  %76 = load double, ptr %11, align 8, !tbaa !9
  %77 = fsub double 1.000000e+00, %76
  %78 = fmul double %75, %77
  %79 = call double @sqrt(double noundef %78) #3
  %80 = load double, ptr %12, align 8, !tbaa !9
  %81 = fneg double %80
  %82 = call double @llvm.fmuladd.f64(double %79, double 1.000000e+00, double %81)
  %83 = fmul double %74, %82
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %84, i64 noundef 3) #3
  store double %83, ptr %85, align 8, !tbaa !9
  %86 = load double, ptr %8, align 8, !tbaa !9
  %87 = load double, ptr %10, align 8, !tbaa !9
  %88 = fsub double 1.000000e+00, %87
  %89 = load double, ptr %11, align 8, !tbaa !9
  %90 = fmul double %88, %89
  %91 = call double @sqrt(double noundef %90) #3
  %92 = load double, ptr %12, align 8, !tbaa !9
  %93 = fmul double %91, %92
  %94 = fmul double %86, %93
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %95, i64 noundef 4) #3
  store double %94, ptr %96, align 8, !tbaa !9
  %97 = load double, ptr %8, align 8, !tbaa !9
  %98 = load double, ptr %10, align 8, !tbaa !9
  %99 = fsub double 1.000000e+00, %98
  %100 = load double, ptr %11, align 8, !tbaa !9
  %101 = fsub double 1.000000e+00, %100
  %102 = fmul double %99, %101
  %103 = call double @sqrt(double noundef %102) #3
  %104 = load double, ptr %12, align 8, !tbaa !9
  %105 = fmul double %103, %104
  %106 = fmul double %97, %105
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %107, i64 noundef 5) #3
  store double %106, ptr %108, align 8, !tbaa !9
  %109 = load double, ptr %8, align 8, !tbaa !9
  %110 = load double, ptr %10, align 8, !tbaa !9
  %111 = load double, ptr %11, align 8, !tbaa !9
  %112 = fmul double %110, %111
  %113 = load double, ptr %12, align 8, !tbaa !9
  %114 = fmul double %112, %113
  %115 = call double @sqrt(double noundef %114) #3
  %116 = fmul double %109, %115
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %117, i64 noundef 6) #3
  store double %116, ptr %118, align 8, !tbaa !9
  %119 = load double, ptr %8, align 8, !tbaa !9
  %120 = load double, ptr %10, align 8, !tbaa !9
  %121 = load double, ptr %11, align 8, !tbaa !9
  %122 = fsub double 1.000000e+00, %121
  %123 = fmul double %120, %122
  %124 = load double, ptr %12, align 8, !tbaa !9
  %125 = fmul double %123, %124
  %126 = call double @sqrt(double noundef %125) #3
  %127 = fmul double %119, %126
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %128, i64 noundef 7) #3
  store double %127, ptr %129, align 8, !tbaa !9
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress 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 = { nounwind "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 #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++ 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7maxiMix9ambisonicEdRSt6vectorIdSaIdEEddd(ptr nocapture noundef nonnull readnone align 8 dereferenceable(120) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #0 align 2 {
  %7 = insertelement <2 x double> poison, double %3, i64 0
  %8 = insertelement <2 x double> %7, double %5, i64 1
  %9 = fcmp ogt <2 x double> %8, <double 1.000000e+00, double 1.000000e+00>
  %10 = fcmp ogt double %4, 1.000000e+00
  %.047 = select i1 %10, double 1.000000e+00, double %4
  %11 = fcmp olt double %.047, 0.000000e+00
  %.148 = select i1 %11, double 0.000000e+00, double %.047
  %12 = insertelement <2 x double> %8, double %.148, i64 1
  %13 = select <2 x i1> %9, <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double> %12
  %14 = insertelement <2 x double> %13, double %5, i64 1
  %15 = fcmp olt <2 x double> %14, zeroinitializer
  %16 = select <2 x i1> %15, <2 x double> zeroinitializer, <2 x double> %13
  %17 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %16
  %18 = extractelement <2 x double> %17, i64 0
  %19 = extractelement <2 x double> %16, i64 1
  %20 = fmul double %18, %19
  %21 = tail call double @sqrt(double noundef %20) #2
  %22 = fsub double %21, %5
  %23 = fmul double %22, %1
  %24 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 0) #2
  store double %23, ptr %24, align 8, !tbaa !5
  %25 = extractelement <2 x double> %17, i64 1
  %26 = fmul double %18, %25
  %27 = tail call double @sqrt(double noundef %26) #2
  %28 = fsub double %27, %5
  %29 = fmul double %28, %1
  %30 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1) #2
  store double %29, ptr %30, align 8, !tbaa !5
  %31 = extractelement <2 x double> %16, i64 0
  %32 = fmul double %31, %19
  %33 = tail call double @sqrt(double noundef %32) #2
  %34 = fsub double %33, %5
  %35 = fmul double %34, %1
  %36 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2) #2
  store double %35, ptr %36, align 8, !tbaa !5
  %37 = fmul double %31, %25
  %38 = tail call double @sqrt(double noundef %37) #2
  %39 = fsub double %38, %5
  %40 = fmul double %39, %1
  %41 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 3) #2
  store double %40, ptr %41, align 8, !tbaa !5
  %42 = tail call double @sqrt(double noundef %20) #2
  %43 = fmul double %42, %5
  %44 = fmul double %43, %1
  %45 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 4) #2
  store double %44, ptr %45, align 8, !tbaa !5
  %46 = tail call double @sqrt(double noundef %26) #2
  %47 = fmul double %46, %5
  %48 = fmul double %47, %1
  %49 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 5) #2
  store double %48, ptr %49, align 8, !tbaa !5
  %50 = fmul double %32, %5
  %51 = tail call double @sqrt(double noundef %50) #2
  %52 = fmul double %51, %1
  %53 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 6) #2
  store double %52, ptr %53, align 8, !tbaa !5
  %54 = fmul double %37, %5
  %55 = tail call double @sqrt(double noundef %54) #2
  %56 = fmul double %55, %1
  %57 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 7) #2
  store double %56, ptr %57, align 8, !tbaa !5
  ret void
}

attributes #0 = { mustprogress 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 nofree nounwind willreturn memory(write) "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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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