; LLVM IR from thuhcsi/Crystal.TTVS :: Xface/XFace/src/XMath/Matrix4.ll (ZNK5XMath7Matrix4mlEf)

; 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.XMath::Matrix4" = type { [16 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5XMath7Matrix4D2Ev(ptr noundef nonnull align 4 dereferenceable(64)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK5XMath7Matrix4mlEf(ptr dead_on_unwind noalias writable sret(%"class.XMath::Matrix4") align 4 %0, ptr noundef nonnull align 4 dereferenceable(64) %1, float noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca i1, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  %11 = load ptr, ptr %5, align 8
  store i1 false, ptr %7, align 1
  call void @_ZN5XMath7Matrix4C1Ev(ptr noundef nonnull align 4 dereferenceable(64) %0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %12

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

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %34

16:                                               ; preds = %12
  %17 = getelementptr inbounds %"class.XMath::Matrix4", ptr %11, i32 0, i32 0
  %18 = load i32, ptr %8, align 4, !tbaa !11
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [16 x float], ptr %17, i64 0, i64 %19
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = load float, ptr %6, align 4, !tbaa !9
  %23 = fmul float %21, %22
  %24 = load i32, ptr %8, align 4, !tbaa !11
  %25 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN5XMath7Matrix4ixEi(ptr noundef nonnull align 4 dereferenceable(64) %0, i32 noundef %24)
          to label %26 unwind label %30

26:                                               ; preds = %16
  store float %23, ptr %25, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %26
  %28 = load i32, ptr %8, align 4, !tbaa !11
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %8, align 4, !tbaa !11
  br label %12, !llvm.loop !13

30:                                               ; preds = %16
  %31 = landingpad { ptr, i32 }
          cleanup
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %9, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @_ZN5XMath7Matrix4D2Ev(ptr noundef nonnull align 4 dereferenceable(64) %0) #3
  br label %38

34:                                               ; preds = %15
  store i1 true, ptr %7, align 1
  %35 = load i1, ptr %7, align 1
  br i1 %35, label %37, label %36

36:                                               ; preds = %34
  call void @_ZN5XMath7Matrix4D2Ev(ptr noundef nonnull align 4 dereferenceable(64) %0) #3
  br label %37

37:                                               ; preds = %36, %34
  ret void

38:                                               ; preds = %30
  %39 = load ptr, ptr %9, align 8
  %40 = load i32, ptr %10, align 4
  %41 = insertvalue { ptr, i32 } poison, ptr %39, 0
  %42 = insertvalue { ptr, i32 } %41, i32 %40, 1
  resume { ptr, i32 } %42
}

declare void @_ZN5XMath7Matrix4C1Ev(ptr)

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


; 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.XMath::Matrix4" = type { [16 x float] }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN5XMath7Matrix4ixEi(ptr noundef nonnull align 4 dereferenceable(64), i32 noundef) local_unnamed_addr #0 align 2

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

declare void @_ZN5XMath7Matrix4C1Ev(ptr) local_unnamed_addr

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 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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass