; LLVM IR from romerojosh/zefr :: src/funcs.ll (ZN4QuatmlERKSt5arrayIdLm3EE)

; 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"

%struct.Quat = type { [4 x double] }

; 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 void @_ZN4QuatC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4QuatmlERKSt5arrayIdLm3EE(ptr dead_on_unwind noalias writable sret(%struct.Quat) align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store ptr %2, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8
  call void @_ZN4QuatC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %7 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %8 = getelementptr inbounds [4 x double], ptr %7, i64 0, i64 1
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = fneg double %9
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %11, i64 noundef 1) #3
  %13 = load double, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %15 = getelementptr inbounds [4 x double], ptr %14, i64 0, i64 2
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef 2) #3
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = fmul double %16, %19
  %21 = fneg double %20
  %22 = call double @llvm.fmuladd.f64(double %10, double %13, double %21)
  %23 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %24 = getelementptr inbounds [4 x double], ptr %23, i64 0, i64 3
  %25 = load double, ptr %24, align 8, !tbaa !9
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef 3) #3
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = fneg double %25
  %30 = call double @llvm.fmuladd.f64(double %29, double %28, double %22)
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 0)
  store double %30, ptr %31, align 8, !tbaa !9
  %32 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %33 = getelementptr inbounds [4 x double], ptr %32, i64 0, i64 0
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %35, i64 noundef 1) #3
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %39 = getelementptr inbounds [4 x double], ptr %38, i64 0, i64 2
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef 3) #3
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = fmul double %40, %43
  %45 = call double @llvm.fmuladd.f64(double %34, double %37, double %44)
  %46 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %47 = getelementptr inbounds [4 x double], ptr %46, i64 0, i64 3
  %48 = load double, ptr %47, align 8, !tbaa !9
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef 2) #3
  %51 = load double, ptr %50, align 8, !tbaa !9
  %52 = fneg double %48
  %53 = call double @llvm.fmuladd.f64(double %52, double %51, double %45)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 1)
  store double %53, ptr %54, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %56 = getelementptr inbounds [4 x double], ptr %55, i64 0, i64 0
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %58, i64 noundef 2) #3
  %60 = load double, ptr %59, align 8, !tbaa !9
  %61 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %62 = getelementptr inbounds [4 x double], ptr %61, i64 0, i64 3
  %63 = load double, ptr %62, align 8, !tbaa !9
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef 1) #3
  %66 = load double, ptr %65, align 8, !tbaa !9
  %67 = fmul double %63, %66
  %68 = call double @llvm.fmuladd.f64(double %57, double %60, double %67)
  %69 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %70 = getelementptr inbounds [4 x double], ptr %69, i64 0, i64 1
  %71 = load double, ptr %70, align 8, !tbaa !9
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %72, i64 noundef 3) #3
  %74 = load double, ptr %73, align 8, !tbaa !9
  %75 = fneg double %71
  %76 = call double @llvm.fmuladd.f64(double %75, double %74, double %68)
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 2)
  store double %76, ptr %77, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %79 = getelementptr inbounds [4 x double], ptr %78, i64 0, i64 0
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %81, i64 noundef 3) #3
  %83 = load double, ptr %82, align 8, !tbaa !9
  %84 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %85 = getelementptr inbounds [4 x double], ptr %84, i64 0, i64 1
  %86 = load double, ptr %85, align 8, !tbaa !9
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %87, i64 noundef 2) #3
  %89 = load double, ptr %88, align 8, !tbaa !9
  %90 = fmul double %86, %89
  %91 = call double @llvm.fmuladd.f64(double %80, double %83, double %90)
  %92 = getelementptr inbounds %struct.Quat, ptr %6, i32 0, i32 0
  %93 = getelementptr inbounds [4 x double], ptr %92, i64 0, i64 2
  %94 = load double, ptr %93, align 8, !tbaa !9
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %95, i64 noundef 1) #3
  %97 = load double, ptr %96, align 8, !tbaa !9
  %98 = fneg double %94
  %99 = call double @llvm.fmuladd.f64(double %98, double %97, double %91)
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 3)
  store double %99, ptr %100, align 8, !tbaa !9
  ret void
}

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

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 = { mustprogress 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 #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"

%struct.Quat = type { [4 x double] }

; Function Attrs: mustprogress 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 void @_ZN4QuatC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4QuatmlERKSt5arrayIdLm3EE(ptr dead_on_unwind noalias nonnull writable sret(%struct.Quat) align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #1 align 2 {
  tail call void @_ZN4QuatC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  %5 = load double, ptr %4, align 8, !tbaa !5
  %6 = fneg double %5
  %7 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1) #2
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2) #2
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fneg double %10
  %14 = fmul double %12, %13
  %15 = tail call double @llvm.fmuladd.f64(double %6, double %8, double %14)
  %16 = getelementptr inbounds i8, ptr %1, i64 24
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 3) #2
  %19 = load double, ptr %18, align 8, !tbaa !5
  %20 = fneg double %17
  %21 = tail call double @llvm.fmuladd.f64(double %20, double %19, double %15)
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 0)
  store double %21, ptr %22, align 8, !tbaa !5
  %23 = load double, ptr %1, align 8, !tbaa !5
  %24 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1) #2
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = load double, ptr %9, align 8, !tbaa !5
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 3) #2
  %28 = load double, ptr %27, align 8, !tbaa !5
  %29 = fmul double %26, %28
  %30 = tail call double @llvm.fmuladd.f64(double %23, double %25, double %29)
  %31 = load double, ptr %16, align 8, !tbaa !5
  %32 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2) #2
  %33 = load double, ptr %32, align 8, !tbaa !5
  %34 = fneg double %31
  %35 = tail call double @llvm.fmuladd.f64(double %34, double %33, double %30)
  %36 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 1)
  store double %35, ptr %36, align 8, !tbaa !5
  %37 = load double, ptr %1, align 8, !tbaa !5
  %38 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2) #2
  %39 = load double, ptr %38, align 8, !tbaa !5
  %40 = load double, ptr %16, align 8, !tbaa !5
  %41 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1) #2
  %42 = load double, ptr %41, align 8, !tbaa !5
  %43 = fmul double %40, %42
  %44 = tail call double @llvm.fmuladd.f64(double %37, double %39, double %43)
  %45 = load double, ptr %4, align 8, !tbaa !5
  %46 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 3) #2
  %47 = load double, ptr %46, align 8, !tbaa !5
  %48 = fneg double %45
  %49 = tail call double @llvm.fmuladd.f64(double %48, double %47, double %44)
  %50 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 2)
  store double %49, ptr %50, align 8, !tbaa !5
  %51 = load double, ptr %1, align 8, !tbaa !5
  %52 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 3) #2
  %53 = load double, ptr %52, align 8, !tbaa !5
  %54 = load double, ptr %4, align 8, !tbaa !5
  %55 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 2) #2
  %56 = load double, ptr %55, align 8, !tbaa !5
  %57 = fmul double %54, %56
  %58 = tail call double @llvm.fmuladd.f64(double %51, double %53, double %57)
  %59 = load double, ptr %9, align 8, !tbaa !5
  %60 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt5arrayIdLm3EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef 1) #2
  %61 = load double, ptr %60, align 8, !tbaa !5
  %62 = fneg double %59
  %63 = tail call double @llvm.fmuladd.f64(double %62, double %61, double %58)
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN4QuatixEj(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef 3)
  store double %63, ptr %64, align 8, !tbaa !5
  ret void
}

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

attributes #0 = { mustprogress 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 }

!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,SROAPass,TailCallElimPass