; LLVM IR from Slingshot-Physics/slingshot-community :: common/math/src/matrix33.ll (Z12outerProductRK7Vector3S1_)

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

%class.Matrix33 = type { [9 x float] }

; 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: mustprogress uwtable
declare dso_local void @_ZN8Matrix33C2Efffffffff(ptr noundef nonnull align 4 dereferenceable(36), float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12outerProductRK7Vector3S1_(ptr dead_on_unwind noalias writable sret(%class.Matrix33) align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @_ZN8Matrix33C2Efffffffff(ptr noundef nonnull align 4 dereferenceable(36) %0, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %36, %3
  %11 = load i32, ptr %7, align 4, !tbaa !9
  %12 = icmp ult i32 %11, 3
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %39

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %32, %14
  %16 = load i32, ptr %9, align 4, !tbaa !9
  %17 = icmp ult i32 %16, 3
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %35

19:                                               ; preds = %15
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i32, ptr %7, align 4, !tbaa !9
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %20, i32 noundef %21)
  %23 = load float, ptr %22, align 4, !tbaa !11
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %24, i32 noundef %25)
  %27 = load float, ptr %26, align 4, !tbaa !11
  %28 = fmul float %23, %27
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef %29, i32 noundef %30)
  store float %28, ptr %31, align 4, !tbaa !11
  br label %32

32:                                               ; preds = %19
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = add i32 %33, 1
  store i32 %34, ptr %9, align 4, !tbaa !9
  br label %15, !llvm.loop !13

35:                                               ; preds = %18
  br label %36

36:                                               ; preds = %35
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = add i32 %37, 1
  store i32 %38, ptr %7, align 4, !tbaa !9
  br label %10, !llvm.loop !15

39:                                               ; preds = %13
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

%class.Matrix33 = type { [9 x float] }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Matrix33C2Efffffffff(ptr noundef nonnull align 4 dereferenceable(36), float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef, float noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12outerProductRK7Vector3S1_(ptr dead_on_unwind noalias nonnull writable sret(%class.Matrix33) align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) %2) local_unnamed_addr #0 {
.preheader:
  tail call void @_ZN8Matrix33C2Efffffffff(ptr noundef nonnull align 4 dereferenceable(36) %0, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %3 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 0)
  %4 = load float, ptr %3, align 4, !tbaa !5
  %5 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 0)
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = fmul float %4, %6
  %8 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 0, i32 noundef 0)
  store float %7, ptr %8, align 4, !tbaa !5
  %9 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 0)
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 1)
  %12 = load float, ptr %11, align 4, !tbaa !5
  %13 = fmul float %10, %12
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 0, i32 noundef 1)
  store float %13, ptr %14, align 4, !tbaa !5
  %15 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 0)
  %16 = load float, ptr %15, align 4, !tbaa !5
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 2)
  %18 = load float, ptr %17, align 4, !tbaa !5
  %19 = fmul float %16, %18
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 0, i32 noundef 2)
  store float %19, ptr %20, align 4, !tbaa !5
  %21 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 1)
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 0)
  %24 = load float, ptr %23, align 4, !tbaa !5
  %25 = fmul float %22, %24
  %26 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 1, i32 noundef 0)
  store float %25, ptr %26, align 4, !tbaa !5
  %27 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 1)
  %28 = load float, ptr %27, align 4, !tbaa !5
  %29 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 1)
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = fmul float %28, %30
  %32 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 1, i32 noundef 1)
  store float %31, ptr %32, align 4, !tbaa !5
  %33 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 1)
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 2)
  %36 = load float, ptr %35, align 4, !tbaa !5
  %37 = fmul float %34, %36
  %38 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 1, i32 noundef 2)
  store float %37, ptr %38, align 4, !tbaa !5
  %39 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 2)
  %40 = load float, ptr %39, align 4, !tbaa !5
  %41 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 0)
  %42 = load float, ptr %41, align 4, !tbaa !5
  %43 = fmul float %40, %42
  %44 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 2, i32 noundef 0)
  store float %43, ptr %44, align 4, !tbaa !5
  %45 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 2)
  %46 = load float, ptr %45, align 4, !tbaa !5
  %47 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 1)
  %48 = load float, ptr %47, align 4, !tbaa !5
  %49 = fmul float %46, %48
  %50 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 2, i32 noundef 1)
  store float %49, ptr %50, align 4, !tbaa !5
  %51 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %1, i32 noundef 2)
  %52 = load float, ptr %51, align 4, !tbaa !5
  %53 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK7Vector3ixEj(ptr noundef nonnull align 4 dereferenceable(12) %2, i32 noundef 2)
  %54 = load float, ptr %53, align 4, !tbaa !5
  %55 = fmul float %52, %54
  %56 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Matrix33clEjj(ptr noundef nonnull align 4 dereferenceable(36) %0, i32 noundef 2, i32 noundef 2)
  store float %55, ptr %56, align 4, !tbaa !5
  ret void
}

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass