; LLVM IR from Angelo1211/HybridRenderingEngine :: src/camera.ll (ZN6Camera11resetCameraEv)

; 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.Camera = type <{ %"struct.glm::mat", %"struct.glm::mat", %struct.Frustum, %"class.std::set", %"struct.glm::vec.2", %"struct.glm::vec.2", %"struct.glm::vec.2", %"struct.glm::vec.2", float, float, %"struct.glm::vec.2", %"struct.glm::vec.2", %"struct.glm::vec.2", %"struct.glm::vec.2", %"struct.glm::vec.2", float, float, float, float, float, i32, [4 x i8] }>
%"struct.glm::mat" = type { [4 x %"struct.glm::vec"] }
%"struct.glm::vec" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float, float, float }
%struct.Frustum = type { [6 x %struct.Plane], float, float, float, float, float, float }
%struct.Plane = type { %"struct.glm::vec.2", float }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, char, std::_Identity<char>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.glm::vec.2" = type { %union.anon.3 }
%union.anon.3 = type { %struct.anon.4 }
%struct.anon.4 = type { float, float, float }

; 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) #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6Camera11resetCameraEv(ptr noundef nonnull align 8 dereferenceable(436) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 4
  %5 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 10
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 %4, i64 12, i1 false), !tbaa.struct !9
  %6 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 5
  %7 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !9
  %8 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 6
  %9 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 12
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %8, i64 12, i1 false), !tbaa.struct !9
  %10 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 7
  %11 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %10, i64 12, i1 false), !tbaa.struct !9
  %12 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 8
  %13 = load float, ptr %12, align 8, !tbaa !11
  %14 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 15
  store float %13, ptr %14, align 4, !tbaa !27
  %15 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 9
  %16 = load float, ptr %15, align 4, !tbaa !28
  %17 = getelementptr inbounds %struct.Camera, ptr %3, i32 0, i32 16
  store float %16, ptr %17, align 8, !tbaa !29
  ret void
}

attributes #0 = { nocallback nofree 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" }

!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 12, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !15, i64 344}
!12 = !{!"_ZTS6Camera", !13, i64 0, !13, i64 64, !14, i64 128, !16, i64 248, !25, i64 296, !25, i64 308, !25, i64 320, !25, i64 332, !15, i64 344, !15, i64 348, !25, i64 352, !25, i64 364, !25, i64 376, !25, i64 388, !25, i64 400, !15, i64 412, !15, i64 416, !15, i64 420, !15, i64 424, !15, i64 428, !26, i64 432}
!13 = !{!"_ZTSN3glm3matILi4ELi4EfLNS_9qualifierE0EEE", !7, i64 0}
!14 = !{!"_ZTS7Frustum", !7, i64 0, !15, i64 96, !15, i64 100, !15, i64 104, !15, i64 108, !15, i64 112, !15, i64 116}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTSSt3setIcSt4lessIcESaIcEE", !17, i64 0}
!17 = !{!"_ZTSSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE", !18, i64 0}
!18 = !{!"_ZTSNSt8_Rb_treeIccSt9_IdentityIcESt4lessIcESaIcEE13_Rb_tree_implIS3_Lb1EEE", !19, i64 0, !21, i64 8}
!19 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIcEE", !20, i64 0}
!20 = !{!"_ZTSSt4lessIcE"}
!21 = !{!"_ZTSSt15_Rb_tree_header", !22, i64 0, !24, i64 32}
!22 = !{!"_ZTSSt18_Rb_tree_node_base", !23, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!23 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!"_ZTSN3glm3vecILi3EfLNS_9qualifierE0EEE", !7, i64 0}
!26 = !{!"int", !7, i64 0}
!27 = !{!12, !15, i64 412}
!28 = !{!12, !15, i64 348}
!29 = !{!12, !15, i64 416}


; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN6Camera11resetCameraEv(ptr nocapture noundef nonnull align 8 dereferenceable(436) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 296
  %3 = getelementptr inbounds i8, ptr %0, i64 352
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %3, ptr noundef nonnull align 8 dereferenceable(12) %2, i64 12, i1 false), !tbaa.struct !5
  %4 = getelementptr inbounds i8, ptr %0, i64 308
  %5 = getelementptr inbounds i8, ptr %0, i64 388
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %4, i64 12, i1 false), !tbaa.struct !5
  %6 = getelementptr inbounds i8, ptr %0, i64 320
  %7 = getelementptr inbounds i8, ptr %0, i64 376
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %7, ptr noundef nonnull align 8 dereferenceable(12) %6, i64 12, i1 false), !tbaa.struct !5
  %8 = getelementptr inbounds i8, ptr %0, i64 332
  %9 = getelementptr inbounds i8, ptr %0, i64 364
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %8, i64 12, i1 false), !tbaa.struct !5
  %10 = getelementptr inbounds i8, ptr %0, i64 344
  %11 = getelementptr inbounds i8, ptr %0, i64 412
  %12 = load <2 x float>, ptr %10, align 8, !tbaa !9
  store <2 x float> %12, ptr %11, align 4, !tbaa !9
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = !{i64 0, i64 12, !6}
!6 = !{!7, !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: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,TailCallElimPass