; LLVM IR from mateeeeeee/Adria-DX11 :: ThirdParty/tinygltf/examples/common/matrix.ll (ZN6Matrix4MultEPA4_fS1_S1_)

; 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 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6Matrix4MultEPA4_fS1_S1_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 align 2 {
  %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
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %11

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

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

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

16:                                               ; preds = %62, %15
  %17 = load i32, ptr %9, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 4
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %16
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [4 x float], ptr %21, i64 %23
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [4 x float], ptr %24, i64 0, i64 %26
  store float 0.000000e+00, ptr %27, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %58, %20
  %29 = load i32, ptr %10, align 4, !tbaa !9
  %30 = icmp slt i32 %29, 4
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %28
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [4 x float], ptr %33, i64 %35
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [4 x float], ptr %36, i64 0, i64 %38
  %40 = load float, ptr %39, align 4, !tbaa !11
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [4 x float], ptr %41, i64 %43
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [4 x float], ptr %44, i64 0, i64 %46
  %48 = load float, ptr %47, align 4, !tbaa !11
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load i32, ptr %7, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [4 x float], ptr %49, i64 %51
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [4 x float], ptr %52, i64 0, i64 %54
  %56 = load float, ptr %55, align 4, !tbaa !11
  %57 = call float @llvm.fmuladd.f32(float %40, float %48, float %56)
  store float %57, ptr %55, align 4, !tbaa !11
  br label %58

58:                                               ; preds = %32
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %10, align 4, !tbaa !9
  br label %28, !llvm.loop !13

61:                                               ; preds = %31
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %9, align 4, !tbaa !9
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %9, align 4, !tbaa !9
  br label %16, !llvm.loop !15

65:                                               ; preds = %19
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %7, align 4, !tbaa !9
  br label %11, !llvm.loop !16

69:                                               ; preds = %14
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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}
!16 = distinct !{!16, !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"

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
define dso_local void @_ZN6Matrix4MultEPA4_fS1_S1_(ptr nocapture noundef writeonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 align 2 {
  %4 = getelementptr inbounds i8, ptr %1, i64 12
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  %6 = getelementptr inbounds i8, ptr %1, i64 32
  %7 = getelementptr inbounds i8, ptr %1, i64 48
  %8 = getelementptr inbounds i8, ptr %1, i64 4
  %9 = getelementptr inbounds i8, ptr %1, i64 20
  %10 = getelementptr inbounds i8, ptr %1, i64 36
  %11 = getelementptr inbounds i8, ptr %1, i64 52
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = getelementptr inbounds i8, ptr %1, i64 24
  %14 = getelementptr inbounds i8, ptr %1, i64 40
  %15 = getelementptr inbounds i8, ptr %1, i64 56
  %16 = getelementptr inbounds i8, ptr %1, i64 28
  %17 = getelementptr inbounds i8, ptr %1, i64 44
  %18 = getelementptr inbounds i8, ptr %1, i64 60
  br label %.preheader

.preheader:                                       ; preds = %3, %.preheader
  %indvars.iv = phi i64 [ 0, %3 ], [ %indvars.iv.next, %.preheader ]
  %19 = getelementptr inbounds [4 x float], ptr %0, i64 %indvars.iv, i64 0
  store float 0.000000e+00, ptr %19, align 4, !tbaa !5
  %20 = load float, ptr %1, align 4, !tbaa !5
  %21 = getelementptr inbounds [4 x float], ptr %2, i64 %indvars.iv, i64 0
  %22 = load float, ptr %21, align 4, !tbaa !5
  %23 = tail call float @llvm.fmuladd.f32(float %20, float %22, float 0.000000e+00)
  store float %23, ptr %19, align 4, !tbaa !5
  %24 = load float, ptr %5, align 4, !tbaa !5
  %25 = getelementptr inbounds [4 x float], ptr %2, i64 %indvars.iv, i64 1
  %26 = load float, ptr %25, align 4, !tbaa !5
  %27 = tail call float @llvm.fmuladd.f32(float %24, float %26, float %23)
  store float %27, ptr %19, align 4, !tbaa !5
  %28 = load float, ptr %6, align 4, !tbaa !5
  %29 = getelementptr inbounds [4 x float], ptr %2, i64 %indvars.iv, i64 2
  %30 = load float, ptr %29, align 4, !tbaa !5
  %31 = tail call float @llvm.fmuladd.f32(float %28, float %30, float %27)
  store float %31, ptr %19, align 4, !tbaa !5
  %32 = load float, ptr %7, align 4, !tbaa !5
  %33 = getelementptr inbounds [4 x float], ptr %2, i64 %indvars.iv, i64 3
  %34 = load float, ptr %33, align 4, !tbaa !5
  %35 = tail call float @llvm.fmuladd.f32(float %32, float %34, float %31)
  store float %35, ptr %19, align 4, !tbaa !5
  %36 = getelementptr inbounds [4 x float], ptr %0, i64 %indvars.iv, i64 1
  store float 0.000000e+00, ptr %36, align 4, !tbaa !5
  %37 = load float, ptr %8, align 4, !tbaa !5
  %38 = load float, ptr %21, align 4, !tbaa !5
  %39 = tail call float @llvm.fmuladd.f32(float %37, float %38, float 0.000000e+00)
  store float %39, ptr %36, align 4, !tbaa !5
  %40 = load float, ptr %9, align 4, !tbaa !5
  %41 = load float, ptr %25, align 4, !tbaa !5
  %42 = tail call float @llvm.fmuladd.f32(float %40, float %41, float %39)
  store float %42, ptr %36, align 4, !tbaa !5
  %43 = load float, ptr %10, align 4, !tbaa !5
  %44 = load float, ptr %29, align 4, !tbaa !5
  %45 = tail call float @llvm.fmuladd.f32(float %43, float %44, float %42)
  store float %45, ptr %36, align 4, !tbaa !5
  %46 = load float, ptr %11, align 4, !tbaa !5
  %47 = load float, ptr %33, align 4, !tbaa !5
  %48 = tail call float @llvm.fmuladd.f32(float %46, float %47, float %45)
  store float %48, ptr %36, align 4, !tbaa !5
  %49 = getelementptr inbounds [4 x float], ptr %0, i64 %indvars.iv, i64 2
  store float 0.000000e+00, ptr %49, align 4, !tbaa !5
  %50 = load float, ptr %12, align 4, !tbaa !5
  %51 = load float, ptr %21, align 4, !tbaa !5
  %52 = tail call float @llvm.fmuladd.f32(float %50, float %51, float 0.000000e+00)
  store float %52, ptr %49, align 4, !tbaa !5
  %53 = load float, ptr %13, align 4, !tbaa !5
  %54 = load float, ptr %25, align 4, !tbaa !5
  %55 = tail call float @llvm.fmuladd.f32(float %53, float %54, float %52)
  store float %55, ptr %49, align 4, !tbaa !5
  %56 = load float, ptr %14, align 4, !tbaa !5
  %57 = load float, ptr %29, align 4, !tbaa !5
  %58 = tail call float @llvm.fmuladd.f32(float %56, float %57, float %55)
  store float %58, ptr %49, align 4, !tbaa !5
  %59 = load float, ptr %15, align 4, !tbaa !5
  %60 = load float, ptr %33, align 4, !tbaa !5
  %61 = tail call float @llvm.fmuladd.f32(float %59, float %60, float %58)
  store float %61, ptr %49, align 4, !tbaa !5
  %62 = getelementptr inbounds [4 x float], ptr %0, i64 %indvars.iv, i64 3
  store float 0.000000e+00, ptr %62, align 4, !tbaa !5
  %63 = load float, ptr %4, align 4, !tbaa !5
  %64 = load float, ptr %21, align 4, !tbaa !5
  %65 = tail call float @llvm.fmuladd.f32(float %63, float %64, float 0.000000e+00)
  store float %65, ptr %62, align 4, !tbaa !5
  %66 = load float, ptr %16, align 4, !tbaa !5
  %67 = load float, ptr %25, align 4, !tbaa !5
  %68 = tail call float @llvm.fmuladd.f32(float %66, float %67, float %65)
  store float %68, ptr %62, align 4, !tbaa !5
  %69 = load float, ptr %17, align 4, !tbaa !5
  %70 = load float, ptr %29, align 4, !tbaa !5
  %71 = tail call float @llvm.fmuladd.f32(float %69, float %70, float %68)
  store float %71, ptr %62, align 4, !tbaa !5
  %72 = load float, ptr %18, align 4, !tbaa !5
  %73 = load float, ptr %33, align 4, !tbaa !5
  %74 = tail call float @llvm.fmuladd.f32(float %72, float %73, float %71)
  store float %74, ptr %62, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 4
  br i1 %exitcond.not, label %75, label %.preheader, !llvm.loop !9

75:                                               ; preds = %.preheader
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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