; LLVM IR from sejja/3D-Software-Rasterizer :: Rasterizer/Engine/Math/Matrix4.ll (ZN7Matrix4dVEf)

; 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.Matrix4 = type { %union.anon }
%union.anon = type { [4 x [4 x float]] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN7Matrix4dVEf(ptr noundef nonnull align 4 dereferenceable(64) %0, float noundef %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8
  %6 = load float, ptr %4, align 4, !tbaa !9
  %7 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %8 = getelementptr inbounds [16 x float], ptr %7, i64 0, i64 0
  %9 = load float, ptr %8, align 4, !tbaa !11
  %10 = fdiv float %9, %6
  store float %10, ptr %8, align 4, !tbaa !11
  %11 = load float, ptr %4, align 4, !tbaa !9
  %12 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %13 = getelementptr inbounds [16 x float], ptr %12, i64 0, i64 1
  %14 = load float, ptr %13, align 4, !tbaa !11
  %15 = fdiv float %14, %11
  store float %15, ptr %13, align 4, !tbaa !11
  %16 = load float, ptr %4, align 4, !tbaa !9
  %17 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %18 = getelementptr inbounds [16 x float], ptr %17, i64 0, i64 2
  %19 = load float, ptr %18, align 4, !tbaa !11
  %20 = fdiv float %19, %16
  store float %20, ptr %18, align 4, !tbaa !11
  %21 = load float, ptr %4, align 4, !tbaa !9
  %22 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %23 = getelementptr inbounds [16 x float], ptr %22, i64 0, i64 3
  %24 = load float, ptr %23, align 4, !tbaa !11
  %25 = fdiv float %24, %21
  store float %25, ptr %23, align 4, !tbaa !11
  %26 = load float, ptr %4, align 4, !tbaa !9
  %27 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %28 = getelementptr inbounds [16 x float], ptr %27, i64 0, i64 4
  %29 = load float, ptr %28, align 4, !tbaa !11
  %30 = fdiv float %29, %26
  store float %30, ptr %28, align 4, !tbaa !11
  %31 = load float, ptr %4, align 4, !tbaa !9
  %32 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %33 = getelementptr inbounds [16 x float], ptr %32, i64 0, i64 5
  %34 = load float, ptr %33, align 4, !tbaa !11
  %35 = fdiv float %34, %31
  store float %35, ptr %33, align 4, !tbaa !11
  %36 = load float, ptr %4, align 4, !tbaa !9
  %37 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %38 = getelementptr inbounds [16 x float], ptr %37, i64 0, i64 6
  %39 = load float, ptr %38, align 4, !tbaa !11
  %40 = fdiv float %39, %36
  store float %40, ptr %38, align 4, !tbaa !11
  %41 = load float, ptr %4, align 4, !tbaa !9
  %42 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %43 = getelementptr inbounds [16 x float], ptr %42, i64 0, i64 7
  %44 = load float, ptr %43, align 4, !tbaa !11
  %45 = fdiv float %44, %41
  store float %45, ptr %43, align 4, !tbaa !11
  %46 = load float, ptr %4, align 4, !tbaa !9
  %47 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %48 = getelementptr inbounds [16 x float], ptr %47, i64 0, i64 8
  %49 = load float, ptr %48, align 4, !tbaa !11
  %50 = fdiv float %49, %46
  store float %50, ptr %48, align 4, !tbaa !11
  %51 = load float, ptr %4, align 4, !tbaa !9
  %52 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %53 = getelementptr inbounds [16 x float], ptr %52, i64 0, i64 9
  %54 = load float, ptr %53, align 4, !tbaa !11
  %55 = fdiv float %54, %51
  store float %55, ptr %53, align 4, !tbaa !11
  %56 = load float, ptr %4, align 4, !tbaa !9
  %57 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %58 = getelementptr inbounds [16 x float], ptr %57, i64 0, i64 10
  %59 = load float, ptr %58, align 4, !tbaa !11
  %60 = fdiv float %59, %56
  store float %60, ptr %58, align 4, !tbaa !11
  %61 = load float, ptr %4, align 4, !tbaa !9
  %62 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %63 = getelementptr inbounds [16 x float], ptr %62, i64 0, i64 11
  %64 = load float, ptr %63, align 4, !tbaa !11
  %65 = fdiv float %64, %61
  store float %65, ptr %63, align 4, !tbaa !11
  %66 = load float, ptr %4, align 4, !tbaa !9
  %67 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %68 = getelementptr inbounds [16 x float], ptr %67, i64 0, i64 12
  %69 = load float, ptr %68, align 4, !tbaa !11
  %70 = fdiv float %69, %66
  store float %70, ptr %68, align 4, !tbaa !11
  %71 = load float, ptr %4, align 4, !tbaa !9
  %72 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %73 = getelementptr inbounds [16 x float], ptr %72, i64 0, i64 13
  %74 = load float, ptr %73, align 4, !tbaa !11
  %75 = fdiv float %74, %71
  store float %75, ptr %73, align 4, !tbaa !11
  %76 = load float, ptr %4, align 4, !tbaa !9
  %77 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %78 = getelementptr inbounds [16 x float], ptr %77, i64 0, i64 14
  %79 = load float, ptr %78, align 4, !tbaa !11
  %80 = fdiv float %79, %76
  store float %80, ptr %78, align 4, !tbaa !11
  %81 = load float, ptr %4, align 4, !tbaa !9
  %82 = getelementptr inbounds %class.Matrix4, ptr %5, i32 0, i32 0
  %83 = getelementptr inbounds [16 x float], ptr %82, i64 0, i64 15
  %84 = load float, ptr %83, align 4, !tbaa !11
  %85 = fdiv float %84, %81
  store float %85, ptr %83, align 4, !tbaa !11
  ret ptr %5
}

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

!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 = !{!"float", !7, i64 0}
!11 = !{!7, !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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local noundef nonnull align 4 dereferenceable(64) ptr @_ZN7Matrix4dVEf(ptr noundef nonnull returned align 4 dereferenceable(64) %0, float noundef %1) local_unnamed_addr #0 align 2 {
  %3 = load <4 x float>, ptr %0, align 4, !tbaa !5
  %4 = insertelement <4 x float> poison, float %1, i64 0
  %5 = shufflevector <4 x float> %4, <4 x float> poison, <4 x i32> zeroinitializer
  %6 = fdiv <4 x float> %3, %5
  store <4 x float> %6, ptr %0, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load <4 x float>, ptr %7, align 4, !tbaa !5
  %9 = fdiv <4 x float> %8, %5
  store <4 x float> %9, ptr %7, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load <4 x float>, ptr %10, align 4, !tbaa !5
  %12 = fdiv <4 x float> %11, %5
  store <4 x float> %12, ptr %10, align 4, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  %14 = load <4 x float>, ptr %13, align 4, !tbaa !5
  %15 = fdiv <4 x float> %14, %5
  store <4 x float> %15, ptr %13, align 4, !tbaa !5
  ret ptr %0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass