; LLVM IR from ThePhysicsGuys/Physics3D :: application/view (camera)

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

%"struct.P3D::Application::Camera" = type { i8, double, double, %"struct.P3D::Vector", i8, double, double, %"struct.P3D::Vector", i8, i8, %"class.P3D::GlobalCFrame", double, double, i8, double, float, float, float, float, %"class.P3D::Matrix.0", %"class.P3D::Matrix.0", %"class.P3D::Matrix.0", %"class.P3D::Matrix.0", %"class.P3D::Matrix.0", ptr }
%"struct.P3D::Vector" = type { %union.anon }
%union.anon = type { [3 x double] }
%"class.P3D::GlobalCFrame" = type { %"struct.P3D::PositionTemplate", %"class.P3D::MatrixRotationTemplate" }
%"struct.P3D::PositionTemplate" = type { %"struct.P3D::Fix", %"struct.P3D::Fix", %"struct.P3D::Fix" }
%"struct.P3D::Fix" = type { i64 }
%"class.P3D::MatrixRotationTemplate" = type { %"class.P3D::Matrix" }
%"class.P3D::Matrix" = type { [9 x double] }
%"class.P3D::Matrix.0" = type { [16 x float] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3P3D11Application6CameraC2ERKNS_16PositionTemplateINS_3FixILl32EEEEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(576) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(72) %2) unnamed_addr #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  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
  %7 = load ptr, ptr %4, align 8
  %8 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 0
  store i8 0, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 1
  store double 5.000000e-01, ptr %9, align 8, !tbaa !22
  %10 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 2
  store double 0.000000e+00, ptr %10, align 8, !tbaa !23
  %11 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 3
  call void @_ZN3P3D6VectorIdLm3EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  %12 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 4
  store i8 0, ptr %12, align 8, !tbaa !24
  %13 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 5
  store double 5.000000e-01, ptr %13, align 8, !tbaa !25
  %14 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 6
  store double 0.000000e+00, ptr %14, align 8, !tbaa !26
  %15 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 7
  call void @_ZN3P3D6VectorIdLm3EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #3
  %16 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 8
  store i8 0, ptr %16, align 8, !tbaa !27
  %17 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 9
  store i8 0, ptr %17, align 1, !tbaa !28
  %18 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 10
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN3P3D12GlobalCFrameC2ERKNS_16PositionTemplateINS_3FixILl32EEEEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96) %18, ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(72) %20)
  %21 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 11
  store double 3.500000e-01, ptr %21, align 8, !tbaa !29
  %22 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 12
  store double 4.000000e-02, ptr %22, align 8, !tbaa !30
  %23 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 13
  store i8 1, ptr %23, align 8, !tbaa !31
  %24 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 14
  store double 6.000000e+00, ptr %24, align 8, !tbaa !32
  %25 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 19
  call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %25)
  %26 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 20
  call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %26)
  %27 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 21
  call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %27)
  %28 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 22
  call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %28)
  %29 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 23
  call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %29)
  %30 = getelementptr inbounds %"struct.P3D::Application::Camera", ptr %7, i32 0, i32 24
  store ptr null, ptr %30, align 8, !tbaa !33
  call void @_ZN3P3D11Application6Camera8onUpdateEv(ptr noundef nonnull align 8 dereferenceable(576) %7)
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D12GlobalCFrameC2ERKNS_16PositionTemplateINS_3FixILl32EEEEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3P3D11Application6Camera8onUpdateEv(ptr noundef nonnull align 8 dereferenceable(576)) #2 align 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 = { mustprogress uwtable "min-legal-vector-width"="64" "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, !7, i64 0}
!10 = !{!"_ZTSN3P3D11Application6CameraE", !7, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !13, i64 48, !11, i64 56, !11, i64 64, !12, i64 72, !13, i64 96, !13, i64 97, !14, i64 104, !11, i64 200, !11, i64 208, !13, i64 216, !11, i64 224, !20, i64 232, !20, i64 236, !20, i64 240, !20, i64 244, !21, i64 248, !21, i64 312, !21, i64 376, !21, i64 440, !21, i64 504, !6, i64 568}
!11 = !{!"double", !7, i64 0}
!12 = !{!"_ZTSN3P3D6VectorIdLm3EEE", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN3P3D12GlobalCFrameE", !15, i64 0, !18, i64 24}
!15 = !{!"_ZTSN3P3D16PositionTemplateINS_3FixILl32EEEEE", !16, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"_ZTSN3P3D3FixILl32EEE", !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSN3P3D22MatrixRotationTemplateIdEE", !19, i64 0}
!19 = !{!"_ZTSN3P3D6MatrixIdLm3ELm3EEE", !7, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = !{!"_ZTSN3P3D6MatrixIfLm4ELm4EEE", !7, i64 0}
!22 = !{!10, !11, i64 8}
!23 = !{!10, !11, i64 16}
!24 = !{!10, !13, i64 48}
!25 = !{!10, !11, i64 56}
!26 = !{!10, !11, i64 64}
!27 = !{!10, !13, i64 96}
!28 = !{!10, !13, i64 97}
!29 = !{!10, !11, i64 200}
!30 = !{!10, !11, i64 208}
!31 = !{!10, !13, i64 216}
!32 = !{!10, !11, i64 224}
!33 = !{!10, !6, i64 568}


; 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 uwtable
define dso_local void @_ZN3P3D11Application6CameraC2ERKNS_16PositionTemplateINS_3FixILl32EEEEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(576) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(72) %2) unnamed_addr #0 align 2 {
  store i8 0, ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  store <2 x double> <double 5.000000e-01, double 0.000000e+00>, ptr %4, align 8, !tbaa !21
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @_ZN3P3D6VectorIdLm3EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  store i8 0, ptr %6, align 8, !tbaa !22
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  store <2 x double> <double 5.000000e-01, double 0.000000e+00>, ptr %7, align 8, !tbaa !21
  %8 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @_ZN3P3D6VectorIdLm3EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  store i8 0, ptr %9, align 8, !tbaa !23
  %10 = getelementptr inbounds i8, ptr %0, i64 97
  store i8 0, ptr %10, align 1, !tbaa !24
  %11 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @_ZN3P3D12GlobalCFrameC2ERKNS_16PositionTemplateINS_3FixILl32EEEEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96) %11, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(72) %2)
  %12 = getelementptr inbounds i8, ptr %0, i64 200
  store <2 x double> <double 3.500000e-01, double 4.000000e-02>, ptr %12, align 8, !tbaa !21
  %13 = getelementptr inbounds i8, ptr %0, i64 216
  store i8 1, ptr %13, align 8, !tbaa !25
  %14 = getelementptr inbounds i8, ptr %0, i64 224
  store double 6.000000e+00, ptr %14, align 8, !tbaa !26
  %15 = getelementptr inbounds i8, ptr %0, i64 248
  tail call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %15)
  %16 = getelementptr inbounds i8, ptr %0, i64 312
  tail call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %16)
  %17 = getelementptr inbounds i8, ptr %0, i64 376
  tail call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %17)
  %18 = getelementptr inbounds i8, ptr %0, i64 440
  tail call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %18)
  %19 = getelementptr inbounds i8, ptr %0, i64 504
  tail call void @_ZN3P3D6MatrixIfLm4ELm4EEC2Ev(ptr noundef nonnull align 4 dereferenceable(64) %19)
  %20 = getelementptr inbounds i8, ptr %0, i64 568
  store ptr null, ptr %20, align 8, !tbaa !27
  tail call void @_ZN3P3D11Application6Camera8onUpdateEv(ptr noundef nonnull align 8 dereferenceable(576) %0)
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3P3D12GlobalCFrameC2ERKNS_16PositionTemplateINS_3FixILl32EEEEERKNS_22MatrixRotationTemplateIdEE(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(72)) unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3P3D11Application6Camera8onUpdateEv(ptr noundef nonnull align 8 dereferenceable(576)) local_unnamed_addr #2 align 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 = { mustprogress uwtable "min-legal-vector-width"="64" "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, !7, i64 0}
!6 = !{!"_ZTSN3P3D11Application6CameraE", !7, i64 0, !9, i64 8, !9, i64 16, !10, i64 24, !11, i64 48, !9, i64 56, !9, i64 64, !10, i64 72, !11, i64 96, !11, i64 97, !12, i64 104, !9, i64 200, !9, i64 208, !11, i64 216, !9, i64 224, !18, i64 232, !18, i64 236, !18, i64 240, !18, i64 244, !19, i64 248, !19, i64 312, !19, i64 376, !19, i64 440, !19, i64 504, !20, i64 568}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"double", !7, i64 0}
!10 = !{!"_ZTSN3P3D6VectorIdLm3EEE", !7, i64 0}
!11 = !{!"bool", !7, i64 0}
!12 = !{!"_ZTSN3P3D12GlobalCFrameE", !13, i64 0, !16, i64 24}
!13 = !{!"_ZTSN3P3D16PositionTemplateINS_3FixILl32EEEEE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"_ZTSN3P3D3FixILl32EEE", !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSN3P3D22MatrixRotationTemplateIdEE", !17, i64 0}
!17 = !{!"_ZTSN3P3D6MatrixIdLm3ELm3EEE", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTSN3P3D6MatrixIfLm4ELm4EEE", !7, i64 0}
!20 = !{!"any pointer", !7, i64 0}
!21 = !{!9, !9, i64 0}
!22 = !{!6, !11, i64 48}
!23 = !{!6, !11, i64 96}
!24 = !{!6, !11, i64 97}
!25 = !{!6, !11, i64 216}
!26 = !{!6, !9, i64 224}
!27 = !{!6, !20, i64 568}


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