; LLVM IR from achilles288/robot-monitor-graphics :: src/base/camera.ll (ZN3rmg6CameraC2Ev)

; 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.rmg::Mat4" = type { %union.anon }
%union.anon = type { [4 x [4 x float]] }
%"class.rmg::Camera" = type { %"struct.rmg::Vec3", %"struct.rmg::Mat3", %"struct.rmg::Mat4", %"struct.rmg::Mat4", %"struct.rmg::Mat4", float, float, float, float, float, i32 }
%"struct.rmg::Vec3" = type { %union.anon.0 }
%union.anon.0 = type { %struct.anon }
%struct.anon = type { float, float, float }
%"struct.rmg::Mat3" = type { %union.anon.1 }
%union.anon.1 = type { [3 x [3 x float]] }

@_ZN3rmgL7adjust1E = external hidden global %"struct.rmg::Mat4", align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg6CameraC2Ev(ptr noundef nonnull align 4 dereferenceable(264) %0) unnamed_addr #0 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 %"class.rmg::Camera", ptr %3, i32 0, i32 0
  call void @_ZN3rmg4Vec3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4)
  %5 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 1
  call void @_ZN3rmg4Mat3C1Ev(ptr noundef nonnull align 4 dereferenceable(36) %5)
  %6 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 2
  call void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64) %6)
  %7 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 3
  call void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64) %7)
  %8 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 4
  call void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64) %8)
  %9 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 @_ZN3rmgL7adjust1E, i64 64, i1 false), !tbaa.struct !9
  %10 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 5
  store float 1.000000e+00, ptr %10, align 4, !tbaa !11
  %11 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 6
  store float 0x3FE921FB00000000, ptr %11, align 4, !tbaa !18
  %12 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 7
  store float 1.000000e+01, ptr %12, align 4, !tbaa !19
  %13 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 8
  store float 1.000000e+00, ptr %13, align 4, !tbaa !20
  %14 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 9
  store float 1.000000e+02, ptr %14, align 4, !tbaa !21
  %15 = getelementptr inbounds %"class.rmg::Camera", ptr %3, i32 0, i32 10
  store i32 2, ptr %15, align 4, !tbaa !22
  call void @_ZN3rmg6Camera25setOrthographicProjectionEv(ptr noundef nonnull align 4 dereferenceable(264) %3)
  ret void
}

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

declare void @_ZN3rmg4Mat3C1Ev(ptr noundef nonnull align 4 dereferenceable(36)) unnamed_addr #2

declare void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64)) unnamed_addr #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) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg6Camera25setOrthographicProjectionEv(ptr noundef nonnull align 4 dereferenceable(264)) #0 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 = { inlinehint 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 = { "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 = { 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 64, !10}
!10 = !{!7, !7, i64 0}
!11 = !{!12, !16, i64 240}
!12 = !{!"_ZTSN3rmg6CameraE", !13, i64 0, !14, i64 12, !15, i64 48, !15, i64 112, !15, i64 176, !16, i64 240, !16, i64 244, !16, i64 248, !16, i64 252, !16, i64 256, !17, i64 260}
!13 = !{!"_ZTSN3rmg4Vec3E", !7, i64 0}
!14 = !{!"_ZTSN3rmg4Mat3E", !7, i64 0}
!15 = !{!"_ZTSN3rmg4Mat4E", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTSN3rmg14ProjectionModeE", !7, i64 0}
!18 = !{!12, !16, i64 244}
!19 = !{!12, !16, i64 248}
!20 = !{!12, !16, i64 252}
!21 = !{!12, !16, i64 256}
!22 = !{!12, !17, i64 260}


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

%"struct.rmg::Mat4" = type { %union.anon }
%union.anon = type { [4 x [4 x float]] }

@_ZN3rmgL7adjust1E = external hidden local_unnamed_addr global %"struct.rmg::Mat4", align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg6CameraC2Ev(ptr noundef nonnull align 4 dereferenceable(264) %0) unnamed_addr #0 align 2 {
  tail call void @_ZN3rmg4Vec3C2Ev(ptr noundef nonnull align 4 dereferenceable(12) %0)
  %2 = getelementptr inbounds i8, ptr %0, i64 12
  tail call void @_ZN3rmg4Mat3C1Ev(ptr noundef nonnull align 4 dereferenceable(36) %2)
  %3 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64) %3)
  %4 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64) %4)
  %5 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64) %5)
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(64) %3, ptr noundef nonnull align 4 dereferenceable(64) @_ZN3rmgL7adjust1E, i64 64, i1 false), !tbaa.struct !5
  %6 = getelementptr inbounds i8, ptr %0, i64 240
  store <4 x float> <float 1.000000e+00, float 0x3FE921FB00000000, float 1.000000e+01, float 1.000000e+00>, ptr %6, align 4, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %0, i64 256
  store float 1.000000e+02, ptr %7, align 4, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %0, i64 260
  store i32 2, ptr %8, align 4, !tbaa !17
  tail call void @_ZN3rmg6Camera25setOrthographicProjectionEv(ptr noundef nonnull align 4 dereferenceable(264) %0)
  ret void
}

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

declare void @_ZN3rmg4Mat3C1Ev(ptr noundef nonnull align 4 dereferenceable(36)) unnamed_addr #2

declare void @_ZN3rmg4Mat4C1Ev(ptr noundef nonnull align 4 dereferenceable(64)) unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg6Camera25setOrthographicProjectionEv(ptr noundef nonnull align 4 dereferenceable(264)) local_unnamed_addr #0 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 = { inlinehint 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 = { "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 = { mustprogress 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 = !{i64 0, i64 64, !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}
!11 = !{!12, !10, i64 256}
!12 = !{!"_ZTSN3rmg6CameraE", !13, i64 0, !14, i64 12, !15, i64 48, !15, i64 112, !15, i64 176, !10, i64 240, !10, i64 244, !10, i64 248, !10, i64 252, !10, i64 256, !16, i64 260}
!13 = !{!"_ZTSN3rmg4Vec3E", !7, i64 0}
!14 = !{!"_ZTSN3rmg4Mat3E", !7, i64 0}
!15 = !{!"_ZTSN3rmg4Mat4E", !7, i64 0}
!16 = !{!"_ZTSN3rmg14ProjectionModeE", !7, i64 0}
!17 = !{!12, !16, i64 260}


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