; LLVM IR from devlinzhou/deterministic_physics :: UnrealDemo/Source/UnrealDemo/gphysics/src/math (glacier_matrix)

; 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.GMatrix3 = type { [3 x [3 x %class.GFloat]] }
%class.GFloat = type { i32 }
%class.GMatrix4 = type { [4 x [4 x %class.GFloat]] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8GMatrix3C2ERK8GMatrix4(ptr noundef nonnull align 4 dereferenceable(36) %0, ptr noundef nonnull align 4 dereferenceable(64) %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %7 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %6, i32 0, i32 0, i32 0
  %8 = getelementptr inbounds %class.GFloat, ptr %7, i64 9
  br label %9

9:                                                ; preds = %9, %2
  %10 = phi ptr [ %7, %2 ], [ %11, %9 ]
  call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %10)
  %11 = getelementptr inbounds %class.GFloat, ptr %10, i64 1
  %12 = icmp eq ptr %11, %8
  br i1 %12, label %13, label %9

13:                                               ; preds = %9
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %class.GMatrix4, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %15, i64 0, i64 0
  %17 = getelementptr inbounds [4 x %class.GFloat], ptr %16, i64 0, i64 0
  %18 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %19 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %18, i64 0, i64 0
  %20 = getelementptr inbounds [3 x %class.GFloat], ptr %19, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %17, i64 4, i1 false), !tbaa.struct !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %class.GMatrix4, ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %22, i64 0, i64 0
  %24 = getelementptr inbounds [4 x %class.GFloat], ptr %23, i64 0, i64 1
  %25 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %26 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %25, i64 0, i64 0
  %27 = getelementptr inbounds [3 x %class.GFloat], ptr %26, i64 0, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %24, i64 4, i1 false), !tbaa.struct !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %class.GMatrix4, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %29, i64 0, i64 0
  %31 = getelementptr inbounds [4 x %class.GFloat], ptr %30, i64 0, i64 2
  %32 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %33 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %32, i64 0, i64 0
  %34 = getelementptr inbounds [3 x %class.GFloat], ptr %33, i64 0, i64 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %31, i64 4, i1 false), !tbaa.struct !9
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.GMatrix4, ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %36, i64 0, i64 1
  %38 = getelementptr inbounds [4 x %class.GFloat], ptr %37, i64 0, i64 0
  %39 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %40 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %39, i64 0, i64 1
  %41 = getelementptr inbounds [3 x %class.GFloat], ptr %40, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 4 %38, i64 4, i1 false), !tbaa.struct !9
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %class.GMatrix4, ptr %42, i32 0, i32 0
  %44 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %43, i64 0, i64 1
  %45 = getelementptr inbounds [4 x %class.GFloat], ptr %44, i64 0, i64 1
  %46 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %47 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %46, i64 0, i64 1
  %48 = getelementptr inbounds [3 x %class.GFloat], ptr %47, i64 0, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 %45, i64 4, i1 false), !tbaa.struct !9
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %class.GMatrix4, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %50, i64 0, i64 1
  %52 = getelementptr inbounds [4 x %class.GFloat], ptr %51, i64 0, i64 2
  %53 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %54 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %53, i64 0, i64 1
  %55 = getelementptr inbounds [3 x %class.GFloat], ptr %54, i64 0, i64 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %55, ptr align 4 %52, i64 4, i1 false), !tbaa.struct !9
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %class.GMatrix4, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %57, i64 0, i64 2
  %59 = getelementptr inbounds [4 x %class.GFloat], ptr %58, i64 0, i64 0
  %60 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %61 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %60, i64 0, i64 2
  %62 = getelementptr inbounds [3 x %class.GFloat], ptr %61, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %62, ptr align 4 %59, i64 4, i1 false), !tbaa.struct !9
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %class.GMatrix4, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %64, i64 0, i64 2
  %66 = getelementptr inbounds [4 x %class.GFloat], ptr %65, i64 0, i64 1
  %67 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %68 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %67, i64 0, i64 2
  %69 = getelementptr inbounds [3 x %class.GFloat], ptr %68, i64 0, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %69, ptr align 4 %66, i64 4, i1 false), !tbaa.struct !9
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %class.GMatrix4, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds [4 x [4 x %class.GFloat]], ptr %71, i64 0, i64 2
  %73 = getelementptr inbounds [4 x %class.GFloat], ptr %72, i64 0, i64 2
  %74 = getelementptr inbounds %class.GMatrix3, ptr %5, i32 0, i32 0
  %75 = getelementptr inbounds [3 x [3 x %class.GFloat]], ptr %74, i64 0, i64 2
  %76 = getelementptr inbounds [3 x %class.GFloat], ptr %75, i64 0, i64 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %76, ptr align 4 %73, i64 4, i1 false), !tbaa.struct !9
  ret void
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }

!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 = !{i64 0, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !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 nounwind uwtable
define dso_local void @_ZN8GMatrix3C2ERK8GMatrix4(ptr noundef nonnull align 4 dereferenceable(36) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(64) %1) unnamed_addr #0 align 2 {
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %0)
  %.ptr.1 = getelementptr inbounds i8, ptr %0, i64 4
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %0, i64 12
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %0, i64 20
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.5)
  %.ptr.6 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.6)
  %.ptr.7 = getelementptr inbounds i8, ptr %0, i64 28
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.7)
  %.ptr.8 = getelementptr inbounds i8, ptr %0, i64 32
  tail call void @_ZN6GFloatC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %.ptr.8)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %3, ptr %0, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 4
  %5 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %5, ptr %.ptr.1, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %7, ptr %.ptr.2, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %9, ptr %.ptr.3, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %1, i64 20
  %11 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %11, ptr %.ptr.4, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 24
  %13 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %13, ptr %.ptr.5, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %1, i64 32
  %15 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %15, ptr %.ptr.6, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 36
  %17 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %17, ptr %.ptr.7, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %1, i64 40
  %19 = load i32, ptr %18, align 4, !tbaa !5
  store i32 %19, ptr %.ptr.8, align 4, !tbaa !5
  ret void
}

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass