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

; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7maxiMix4quadEdRSt6vectorIdSaIdEEdd(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) #0 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store double %3, ptr %9, align 8, !tbaa !9
  store double %4, ptr %10, align 8, !tbaa !9
  %11 = load ptr, ptr %6, align 8
  %12 = load double, ptr %9, align 8, !tbaa !9
  %13 = fcmp ogt double %12, 1.000000e+00
  br i1 %13, label %14, label %15

14:                                               ; preds = %5
  store double 1.000000e+00, ptr %9, align 8, !tbaa !9
  br label %15

15:                                               ; preds = %14, %5
  %16 = load double, ptr %9, align 8, !tbaa !9
  %17 = fcmp olt double %16, 0.000000e+00
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  store double 0.000000e+00, ptr %9, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %18, %15
  %20 = load double, ptr %10, align 8, !tbaa !9
  %21 = fcmp ogt double %20, 1.000000e+00
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  store double 1.000000e+00, ptr %10, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %22, %19
  %24 = load double, ptr %10, align 8, !tbaa !9
  %25 = fcmp olt double %24, 0.000000e+00
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  store double 0.000000e+00, ptr %10, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %26, %23
  %28 = load double, ptr %7, align 8, !tbaa !9
  %29 = load double, ptr %9, align 8, !tbaa !9
  %30 = fsub double 1.000000e+00, %29
  %31 = load double, ptr %10, align 8, !tbaa !9
  %32 = fmul double %30, %31
  %33 = call double @sqrt(double noundef %32) #2
  %34 = fmul double %28, %33
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef 0) #2
  store double %34, ptr %36, align 8, !tbaa !9
  %37 = load double, ptr %7, align 8, !tbaa !9
  %38 = load double, ptr %9, align 8, !tbaa !9
  %39 = fsub double 1.000000e+00, %38
  %40 = load double, ptr %10, align 8, !tbaa !9
  %41 = fsub double 1.000000e+00, %40
  %42 = fmul double %39, %41
  %43 = call double @sqrt(double noundef %42) #2
  %44 = fmul double %37, %43
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef 1) #2
  store double %44, ptr %46, align 8, !tbaa !9
  %47 = load double, ptr %7, align 8, !tbaa !9
  %48 = load double, ptr %9, align 8, !tbaa !9
  %49 = load double, ptr %10, align 8, !tbaa !9
  %50 = fmul double %48, %49
  %51 = call double @sqrt(double noundef %50) #2
  %52 = fmul double %47, %51
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef 2) #2
  store double %52, ptr %54, align 8, !tbaa !9
  %55 = load double, ptr %7, align 8, !tbaa !9
  %56 = load double, ptr %9, align 8, !tbaa !9
  %57 = load double, ptr %10, align 8, !tbaa !9
  %58 = fsub double 1.000000e+00, %57
  %59 = fmul double %56, %58
  %60 = call double @sqrt(double noundef %59) #2
  %61 = fmul double %55, %60
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %62, i64 noundef 3) #2
  store double %61, ptr %63, align 8, !tbaa !9
  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 = { 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 #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 = !{!"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 @_ZN7maxiMix4quadEdRSt6vectorIdSaIdEEdd(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) local_unnamed_addr #0 align 2 {
  %6 = insertelement <2 x double> poison, double %3, i64 0
  %7 = insertelement <2 x double> %6, double %4, i64 1
  %8 = fcmp ogt <2 x double> %7, <double 1.000000e+00, double 1.000000e+00>
  %9 = select <2 x i1> %8, <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double> %7
  %10 = fcmp olt <2 x double> %9, zeroinitializer
  %11 = select <2 x i1> %10, <2 x double> zeroinitializer, <2 x double> %9
  %12 = fsub <2 x double> <double 1.000000e+00, double 1.000000e+00>, %11
  %13 = extractelement <2 x double> %12, i64 0
  %14 = extractelement <2 x double> %11, i64 1
  %15 = fmul double %13, %14
  %16 = tail call double @sqrt(double noundef %15) #2
  %17 = fmul double %16, %1
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 0) #2
  store double %17, ptr %18, align 8, !tbaa !5
  %19 = extractelement <2 x double> %12, i64 1
  %20 = fmul double %13, %19
  %21 = tail call double @sqrt(double noundef %20) #2
  %22 = fmul double %21, %1
  %23 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1) #2
  store double %22, ptr %23, align 8, !tbaa !5
  %24 = extractelement <2 x double> %11, i64 0
  %25 = fmul double %24, %14
  %26 = tail call double @sqrt(double noundef %25) #2
  %27 = fmul double %26, %1
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2) #2
  store double %27, ptr %28, align 8, !tbaa !5
  %29 = fmul double %24, %19
  %30 = tail call double @sqrt(double noundef %29) #2
  %31 = fmul double %30, %1
  %32 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIdSaIdEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 3) #2
  store double %31, ptr %32, 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