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

; 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::Rect" = type { i16, i16 }
%"class.rmg::Context" = type { ptr, i32, i16, i16, %"struct.rmg::ColorRGBA", %"class.rmg::Camera", %"struct.rmg::Vec3", %"struct.rmg::Vec3", %"struct.rmg::ColorRGBA", %"class.rmg::ObjectList", %"class.rmg::ObjectList", %"class.rmg::ObjectList", %"class.rmg::ObjectList", %"class.rmg::ObjectList", %"class.rmg::MaterialList", %"class.rmg::FontList", %"class.rmg::internal::GeneralShader", %"class.rmg::internal::ShadowMapShader", %"class.rmg::internal::Object2DShader", %"class.rmg::internal::ParticleShader", %"class.rmg::internal::Line3DShader", %"class.rmg::internal::ContextLoader", %"class.rmg::internal::GLContext", i8, float, i8, i32 }
%"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::Mat3" = type { %union.anon.0 }
%union.anon.0 = type { [3 x [3 x float]] }
%"struct.rmg::Mat4" = type { %union.anon.1 }
%union.anon.1 = type { [4 x [4 x float]] }
%"struct.rmg::Vec3" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float, float }
%"struct.rmg::ColorRGBA" = type { float, float, float, float }
%"class.rmg::ObjectList" = type { %"class.rmg::LinkedList.base", [4 x i8] }
%"class.rmg::LinkedList.base" = type <{ ptr, ptr, i32 }>
%"class.rmg::MaterialList" = type { %"class.rmg::LinkedList.base.3", [4 x i8] }
%"class.rmg::LinkedList.base.3" = type <{ ptr, ptr, i32 }>
%"class.rmg::FontList" = type { %"class.rmg::LinkedList.base.5", [4 x i8] }
%"class.rmg::LinkedList.base.5" = type <{ ptr, ptr, i32 }>
%"class.rmg::internal::GeneralShader" = type { %"class.rmg::internal::Shader.base", i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }
%"class.rmg::internal::Shader.base" = type <{ ptr, i32 }>
%"class.rmg::internal::ShadowMapShader" = type { %"class.rmg::internal::Shader.base", %"class.rmg::Camera", %"struct.rmg::Vec3", %"struct.rmg::Vec3", %"struct.rmg::Vec3", float, float, float, i32, i32, i32 }
%"class.rmg::internal::Object2DShader" = type { %"class.rmg::internal::SpriteShader", %"class.rmg::internal::Text2DShader", %"struct.rmg::Mat3", i16, i16 }
%"class.rmg::internal::SpriteShader" = type { %"class.rmg::internal::Shader.base", i32, i32, i32, i32, i32 }
%"class.rmg::internal::Text2DShader" = type { %"class.rmg::internal::Shader.base", i32, i32, i32, i32, i32, i32, i32 }
%"class.rmg::internal::ParticleShader" = type { %"class.rmg::internal::Shader.base", i32, i32, i32, i32, i32, i32, i32 }
%"class.rmg::internal::Line3DShader" = type { %"class.rmg::internal::Shader.base", i32, i32, i32, i32, i32 }
%"class.rmg::internal::ContextLoader" = type { %"class.rmg::internal::PendingStack" }
%"class.rmg::internal::PendingStack" = type <{ ptr, %"class.rmg::internal::Pending", i32, [4 x i8] }>
%"class.rmg::internal::Pending" = type { ptr, ptr }
%"class.rmg::internal::GLContext" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local i32 @_ZNK3rmg7Context14getContextSizeEv(ptr noundef nonnull align 8 dereferenceable(1440) %0) #0 align 2 {
  %2 = alloca %"struct.rmg::Rect", align 2
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  %5 = getelementptr inbounds %"class.rmg::Context", ptr %4, i32 0, i32 2
  %6 = load i16, ptr %5, align 4, !tbaa !9
  %7 = getelementptr inbounds %"class.rmg::Context", ptr %4, i32 0, i32 3
  %8 = load i16, ptr %7, align 2, !tbaa !39
  call void @_ZN3rmg4RectC2Ett(ptr noundef nonnull align 2 dereferenceable(4) %2, i16 noundef zeroext %6, i16 noundef zeroext %8)
  %9 = load i32, ptr %2, align 2
  ret i32 %9
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3rmg4RectC2Ett(ptr noundef nonnull align 2 dereferenceable(4), i16 noundef zeroext, i16 noundef zeroext) unnamed_addr #1 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" }

!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, !12, i64 12}
!10 = !{!"_ZTSN3rmg7ContextE", !11, i64 8, !12, i64 12, !12, i64 14, !13, i64 16, !15, i64 32, !16, i64 296, !16, i64 308, !13, i64 320, !20, i64 336, !20, i64 360, !20, i64 384, !20, i64 408, !20, i64 432, !22, i64 456, !24, i64 480, !26, i64 504, !28, i64 568, !29, i64 904, !32, i64 1016, !33, i64 1056, !34, i64 1088, !37, i64 1120, !38, i64 1424, !14, i64 1428, !38, i64 1432, !11, i64 1436}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"_ZTSN3rmg9ColorRGBAE", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTSN3rmg6CameraE", !16, i64 0, !17, i64 12, !18, i64 48, !18, i64 112, !18, i64 176, !14, i64 240, !14, i64 244, !14, i64 248, !14, i64 252, !14, i64 256, !19, i64 260}
!16 = !{!"_ZTSN3rmg4Vec3E", !7, i64 0}
!17 = !{!"_ZTSN3rmg4Mat3E", !7, i64 0}
!18 = !{!"_ZTSN3rmg4Mat4E", !7, i64 0}
!19 = !{!"_ZTSN3rmg14ProjectionModeE", !7, i64 0}
!20 = !{!"_ZTSN3rmg10ObjectListE", !21, i64 0}
!21 = !{!"_ZTSN3rmg10LinkedListINS_6ObjectEEE", !6, i64 0, !6, i64 8, !11, i64 16}
!22 = !{!"_ZTSN3rmg12MaterialListE", !23, i64 0}
!23 = !{!"_ZTSN3rmg10LinkedListINS_8MaterialEEE", !6, i64 0, !6, i64 8, !11, i64 16}
!24 = !{!"_ZTSN3rmg8FontListE", !25, i64 0}
!25 = !{!"_ZTSN3rmg10LinkedListINS_4FontEEE", !6, i64 0, !6, i64 8, !11, i64 16}
!26 = !{!"_ZTSN3rmg8internal13GeneralShaderE", !27, i64 0, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56}
!27 = !{!"_ZTSN3rmg8internal6ShaderE", !11, i64 8}
!28 = !{!"_ZTSN3rmg8internal15ShadowMapShaderE", !27, i64 0, !15, i64 12, !16, i64 276, !16, i64 288, !16, i64 300, !14, i64 312, !14, i64 316, !14, i64 320, !11, i64 324, !11, i64 328, !11, i64 332}
!29 = !{!"_ZTSN3rmg8internal14Object2DShaderE", !30, i64 0, !31, i64 32, !17, i64 72, !12, i64 108, !12, i64 110}
!30 = !{!"_ZTSN3rmg8internal12SpriteShaderE", !27, i64 0, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!31 = !{!"_ZTSN3rmg8internal12Text2DShaderE", !27, i64 0, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36}
!32 = !{!"_ZTSN3rmg8internal14ParticleShaderE", !27, i64 0, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36}
!33 = !{!"_ZTSN3rmg8internal12Line3DShaderE", !27, i64 0, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!34 = !{!"_ZTSN3rmg8internal13ContextLoaderE", !35, i64 0}
!35 = !{!"_ZTSN3rmg8internal12PendingStackE", !6, i64 0, !36, i64 8, !11, i64 24}
!36 = !{!"_ZTSN3rmg8internal7PendingE", !6, i64 0, !6, i64 8}
!37 = !{!"_ZTSN3rmg8internal9GLContextE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296}
!38 = !{!"bool", !7, i64 0}
!39 = !{!10, !12, i64 14}


; 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::Rect" = type { i16, i16 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local i32 @_ZNK3rmg7Context14getContextSizeEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(1440) %0) local_unnamed_addr #0 align 2 {
  %2 = alloca %"struct.rmg::Rect", align 4
  %3 = getelementptr inbounds i8, ptr %0, i64 12
  %4 = load i16, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 14
  %6 = load i16, ptr %5, align 2, !tbaa !38
  call void @_ZN3rmg4RectC2Ett(ptr noundef nonnull align 2 dereferenceable(4) %2, i16 noundef zeroext %4, i16 noundef zeroext %6)
  %7 = load i32, ptr %2, align 4
  ret i32 %7
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3rmg4RectC2Ett(ptr noundef nonnull align 2 dereferenceable(4), i16 noundef zeroext, i16 noundef zeroext) unnamed_addr #1 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" }
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" }

!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, !10, i64 12}
!6 = !{!"_ZTSN3rmg7ContextE", !7, i64 8, !10, i64 12, !10, i64 14, !11, i64 16, !13, i64 32, !14, i64 296, !14, i64 308, !11, i64 320, !18, i64 336, !18, i64 360, !18, i64 384, !18, i64 408, !18, i64 432, !21, i64 456, !23, i64 480, !25, i64 504, !27, i64 568, !28, i64 904, !31, i64 1016, !32, i64 1056, !33, i64 1088, !36, i64 1120, !37, i64 1424, !12, i64 1428, !37, i64 1432, !7, i64 1436}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"short", !8, i64 0}
!11 = !{!"_ZTSN3rmg9ColorRGBAE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!12 = !{!"float", !8, i64 0}
!13 = !{!"_ZTSN3rmg6CameraE", !14, i64 0, !15, i64 12, !16, i64 48, !16, i64 112, !16, i64 176, !12, i64 240, !12, i64 244, !12, i64 248, !12, i64 252, !12, i64 256, !17, i64 260}
!14 = !{!"_ZTSN3rmg4Vec3E", !8, i64 0}
!15 = !{!"_ZTSN3rmg4Mat3E", !8, i64 0}
!16 = !{!"_ZTSN3rmg4Mat4E", !8, i64 0}
!17 = !{!"_ZTSN3rmg14ProjectionModeE", !8, i64 0}
!18 = !{!"_ZTSN3rmg10ObjectListE", !19, i64 0}
!19 = !{!"_ZTSN3rmg10LinkedListINS_6ObjectEEE", !20, i64 0, !20, i64 8, !7, i64 16}
!20 = !{!"any pointer", !8, i64 0}
!21 = !{!"_ZTSN3rmg12MaterialListE", !22, i64 0}
!22 = !{!"_ZTSN3rmg10LinkedListINS_8MaterialEEE", !20, i64 0, !20, i64 8, !7, i64 16}
!23 = !{!"_ZTSN3rmg8FontListE", !24, i64 0}
!24 = !{!"_ZTSN3rmg10LinkedListINS_4FontEEE", !20, i64 0, !20, i64 8, !7, i64 16}
!25 = !{!"_ZTSN3rmg8internal13GeneralShaderE", !26, i64 0, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56}
!26 = !{!"_ZTSN3rmg8internal6ShaderE", !7, i64 8}
!27 = !{!"_ZTSN3rmg8internal15ShadowMapShaderE", !26, i64 0, !13, i64 12, !14, i64 276, !14, i64 288, !14, i64 300, !12, i64 312, !12, i64 316, !12, i64 320, !7, i64 324, !7, i64 328, !7, i64 332}
!28 = !{!"_ZTSN3rmg8internal14Object2DShaderE", !29, i64 0, !30, i64 32, !15, i64 72, !10, i64 108, !10, i64 110}
!29 = !{!"_ZTSN3rmg8internal12SpriteShaderE", !26, i64 0, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28}
!30 = !{!"_ZTSN3rmg8internal12Text2DShaderE", !26, i64 0, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36}
!31 = !{!"_ZTSN3rmg8internal14ParticleShaderE", !26, i64 0, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36}
!32 = !{!"_ZTSN3rmg8internal12Line3DShaderE", !26, i64 0, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28}
!33 = !{!"_ZTSN3rmg8internal13ContextLoaderE", !34, i64 0}
!34 = !{!"_ZTSN3rmg8internal12PendingStackE", !20, i64 0, !35, i64 8, !7, i64 24}
!35 = !{!"_ZTSN3rmg8internal7PendingE", !20, i64 0, !20, i64 8}
!36 = !{!"_ZTSN3rmg8internal9GLContextE", !20, i64 0, !20, i64 8, !20, i64 16, !20, i64 24, !20, i64 32, !20, i64 40, !20, i64 48, !20, i64 56, !20, i64 64, !20, i64 72, !20, i64 80, !20, i64 88, !20, i64 96, !20, i64 104, !20, i64 112, !20, i64 120, !20, i64 128, !20, i64 136, !20, i64 144, !20, i64 152, !20, i64 160, !20, i64 168, !20, i64 176, !20, i64 184, !20, i64 192, !20, i64 200, !20, i64 208, !20, i64 216, !20, i64 224, !20, i64 232, !20, i64 240, !20, i64 248, !20, i64 256, !20, i64 264, !20, i64 272, !20, i64 280, !20, i64 288, !20, i64 296}
!37 = !{!"bool", !8, i64 0}
!38 = !{!6, !10, i64 14}


; Effective O3 passes: GlobalOptPass,InferAlignmentPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass