; LLVM IR from idmillington/cyclone-physics :: src/body.ll (ZNK7cyclone9RigidBody14getGLTransformEPf)

; 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.cyclone::RigidBody" = type { double, %"class.cyclone::Matrix3", double, double, %"class.cyclone::Vector3", %"class.cyclone::Quaternion", %"class.cyclone::Vector3", %"class.cyclone::Vector3", %"class.cyclone::Matrix3", double, i8, i8, %"class.cyclone::Matrix4", %"class.cyclone::Vector3", %"class.cyclone::Vector3", %"class.cyclone::Vector3", %"class.cyclone::Vector3" }
%"class.cyclone::Quaternion" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { double, double, double, double }
%"class.cyclone::Matrix3" = type { [9 x double] }
%"class.cyclone::Matrix4" = type { [12 x double] }
%"class.cyclone::Vector3" = type { double, double, double, double }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK7cyclone9RigidBody14getGLTransformEPf(ptr noundef nonnull align 8 dereferenceable(536) %0, ptr noundef %1) #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.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %7 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %6, i32 0, i32 0
  %8 = getelementptr inbounds [12 x double], ptr %7, i64 0, i64 0
  %9 = load double, ptr %8, align 8, !tbaa !9
  %10 = fptrunc double %9 to float
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds float, ptr %11, i64 0
  store float %10, ptr %12, align 4, !tbaa !11
  %13 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %14 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds [12 x double], ptr %14, i64 0, i64 4
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = fptrunc double %16 to float
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds float, ptr %18, i64 1
  store float %17, ptr %19, align 4, !tbaa !11
  %20 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %21 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds [12 x double], ptr %21, i64 0, i64 8
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = fptrunc double %23 to float
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds float, ptr %25, i64 2
  store float %24, ptr %26, align 4, !tbaa !11
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds float, ptr %27, i64 3
  store float 0.000000e+00, ptr %28, align 4, !tbaa !11
  %29 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %30 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds [12 x double], ptr %30, i64 0, i64 1
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = fptrunc double %32 to float
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds float, ptr %34, i64 4
  store float %33, ptr %35, align 4, !tbaa !11
  %36 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %37 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds [12 x double], ptr %37, i64 0, i64 5
  %39 = load double, ptr %38, align 8, !tbaa !9
  %40 = fptrunc double %39 to float
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds float, ptr %41, i64 5
  store float %40, ptr %42, align 4, !tbaa !11
  %43 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %44 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds [12 x double], ptr %44, i64 0, i64 9
  %46 = load double, ptr %45, align 8, !tbaa !9
  %47 = fptrunc double %46 to float
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds float, ptr %48, i64 6
  store float %47, ptr %49, align 4, !tbaa !11
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds float, ptr %50, i64 7
  store float 0.000000e+00, ptr %51, align 4, !tbaa !11
  %52 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %53 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds [12 x double], ptr %53, i64 0, i64 2
  %55 = load double, ptr %54, align 8, !tbaa !9
  %56 = fptrunc double %55 to float
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds float, ptr %57, i64 8
  store float %56, ptr %58, align 4, !tbaa !11
  %59 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %60 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds [12 x double], ptr %60, i64 0, i64 6
  %62 = load double, ptr %61, align 8, !tbaa !9
  %63 = fptrunc double %62 to float
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds float, ptr %64, i64 9
  store float %63, ptr %65, align 4, !tbaa !11
  %66 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %67 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %66, i32 0, i32 0
  %68 = getelementptr inbounds [12 x double], ptr %67, i64 0, i64 10
  %69 = load double, ptr %68, align 8, !tbaa !9
  %70 = fptrunc double %69 to float
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds float, ptr %71, i64 10
  store float %70, ptr %72, align 4, !tbaa !11
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds float, ptr %73, i64 11
  store float 0.000000e+00, ptr %74, align 4, !tbaa !11
  %75 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %76 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %75, i32 0, i32 0
  %77 = getelementptr inbounds [12 x double], ptr %76, i64 0, i64 3
  %78 = load double, ptr %77, align 8, !tbaa !9
  %79 = fptrunc double %78 to float
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = getelementptr inbounds float, ptr %80, i64 12
  store float %79, ptr %81, align 4, !tbaa !11
  %82 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %83 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %82, i32 0, i32 0
  %84 = getelementptr inbounds [12 x double], ptr %83, i64 0, i64 7
  %85 = load double, ptr %84, align 8, !tbaa !9
  %86 = fptrunc double %85 to float
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds float, ptr %87, i64 13
  store float %86, ptr %88, align 4, !tbaa !11
  %89 = getelementptr inbounds %"class.cyclone::RigidBody", ptr %5, i32 0, i32 12
  %90 = getelementptr inbounds %"class.cyclone::Matrix4", ptr %89, i32 0, i32 0
  %91 = getelementptr inbounds [12 x double], ptr %90, i64 0, i64 11
  %92 = load double, ptr %91, align 8, !tbaa !9
  %93 = fptrunc double %92 to float
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds float, ptr %94, i64 14
  store float %93, ptr %95, align 4, !tbaa !11
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds float, ptr %96, i64 15
  store float 1.000000e+00, ptr %97, align 4, !tbaa !11
  ret void
}

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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !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 void @_ZNK7cyclone9RigidBody14getGLTransformEPf(ptr nocapture noundef nonnull readonly align 8 dereferenceable(536) %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 312
  %4 = load <2 x double>, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 344
  %6 = load double, ptr %5, align 8, !tbaa !5
  %7 = insertelement <2 x double> %4, double %6, i64 1
  %8 = fptrunc <2 x double> %7 to <2 x float>
  store <2 x float> %8, ptr %1, align 4, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %0, i64 376
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = fptrunc double %10 to float
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  store float %11, ptr %12, align 4, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %1, i64 12
  store float 0.000000e+00, ptr %13, align 4, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %0, i64 320
  %15 = load <2 x double>, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = getelementptr inbounds i8, ptr %0, i64 352
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = insertelement <2 x double> %15, double %18, i64 1
  %20 = fptrunc <2 x double> %19 to <2 x float>
  store <2 x float> %20, ptr %16, align 4, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %0, i64 384
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = fptrunc double %22 to float
  %24 = getelementptr inbounds i8, ptr %1, i64 24
  store float %23, ptr %24, align 4, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %1, i64 28
  store float 0.000000e+00, ptr %25, align 4, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %0, i64 328
  %27 = load <2 x double>, ptr %26, align 8
  %28 = getelementptr inbounds i8, ptr %1, i64 32
  %29 = getelementptr inbounds i8, ptr %0, i64 360
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = insertelement <2 x double> %27, double %30, i64 1
  %32 = fptrunc <2 x double> %31 to <2 x float>
  store <2 x float> %32, ptr %28, align 4, !tbaa !9
  %33 = getelementptr inbounds i8, ptr %0, i64 392
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = fptrunc double %34 to float
  %36 = getelementptr inbounds i8, ptr %1, i64 40
  store float %35, ptr %36, align 4, !tbaa !9
  %37 = getelementptr inbounds i8, ptr %1, i64 44
  store float 0.000000e+00, ptr %37, align 4, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %0, i64 336
  %39 = load <2 x double>, ptr %38, align 8
  %40 = getelementptr inbounds i8, ptr %1, i64 48
  %41 = getelementptr inbounds i8, ptr %0, i64 368
  %42 = load double, ptr %41, align 8, !tbaa !5
  %43 = insertelement <2 x double> %39, double %42, i64 1
  %44 = fptrunc <2 x double> %43 to <2 x float>
  store <2 x float> %44, ptr %40, align 4, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %0, i64 400
  %46 = load double, ptr %45, align 8, !tbaa !5
  %47 = fptrunc double %46 to float
  %48 = getelementptr inbounds i8, ptr %1, i64 56
  store float %47, ptr %48, align 4, !tbaa !9
  %49 = getelementptr inbounds i8, ptr %1, i64 60
  store float 1.000000e+00, ptr %49, align 4, !tbaa !9
  ret void
}

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


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