; LLVM IR from achilles288/robot-monitor-graphics :: src/window/window.ll (ZNK3rmg6Window13getWindowSizeEv)

; 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::Window" = type { %"class.rmg::Context", ptr }
%"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.3", [4 x i8] }
%"class.rmg::LinkedList.base.3" = type <{ ptr, ptr, i32 }>
%"class.rmg::MaterialList" = type { %"class.rmg::LinkedList.base.5", [4 x i8] }
%"class.rmg::LinkedList.base.5" = type <{ ptr, ptr, i32 }>
%"class.rmg::FontList" = type { %"class.rmg::LinkedList.base.7", [4 x i8] }
%"class.rmg::LinkedList.base.7" = 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local i32 @_ZNK3rmg6Window13getWindowSizeEv(ptr noundef nonnull align 8 dereferenceable(1448) %0) #1 align 2 {
  %2 = alloca %"struct.rmg::Rect", align 2
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %7 = getelementptr inbounds %"class.rmg::Window", ptr %6, i32 0, i32 1
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  call void @glfwGetWindowSize(ptr noundef %8, ptr noundef %4, ptr noundef %5)
  %9 = load i32, ptr %4, align 4, !tbaa !40
  %10 = trunc i32 %9 to i16
  %11 = load i32, ptr %5, align 4, !tbaa !40
  %12 = trunc i32 %11 to i16
  call void @_ZN3rmg4RectC2Ett(ptr noundef nonnull align 2 dereferenceable(4) %2, i16 noundef zeroext %10, i16 noundef zeroext %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %13 = load i32, ptr %2, align 2
  ret i32 %13
}

declare void @glfwGetWindowSize(ptr noundef, ptr noundef, ptr noundef) #2

; 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 #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { 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, !6, i64 1440}
!10 = !{!"_ZTSN3rmg6WindowE", !11, i64 0, !6, i64 1440}
!11 = !{!"_ZTSN3rmg7ContextE", !12, i64 8, !13, i64 12, !13, i64 14, !14, i64 16, !16, i64 32, !17, i64 296, !17, i64 308, !14, i64 320, !21, i64 336, !21, i64 360, !21, i64 384, !21, i64 408, !21, i64 432, !23, i64 456, !25, i64 480, !27, i64 504, !29, i64 568, !30, i64 904, !33, i64 1016, !34, i64 1056, !35, i64 1088, !38, i64 1120, !39, i64 1424, !15, i64 1428, !39, i64 1432, !12, i64 1436}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_ZTSN3rmg9ColorRGBAE", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTSN3rmg6CameraE", !17, i64 0, !18, i64 12, !19, i64 48, !19, i64 112, !19, i64 176, !15, i64 240, !15, i64 244, !15, i64 248, !15, i64 252, !15, i64 256, !20, i64 260}
!17 = !{!"_ZTSN3rmg4Vec3E", !7, i64 0}
!18 = !{!"_ZTSN3rmg4Mat3E", !7, i64 0}
!19 = !{!"_ZTSN3rmg4Mat4E", !7, i64 0}
!20 = !{!"_ZTSN3rmg14ProjectionModeE", !7, i64 0}
!21 = !{!"_ZTSN3rmg10ObjectListE", !22, i64 0}
!22 = !{!"_ZTSN3rmg10LinkedListINS_6ObjectEEE", !6, i64 0, !6, i64 8, !12, i64 16}
!23 = !{!"_ZTSN3rmg12MaterialListE", !24, i64 0}
!24 = !{!"_ZTSN3rmg10LinkedListINS_8MaterialEEE", !6, i64 0, !6, i64 8, !12, i64 16}
!25 = !{!"_ZTSN3rmg8FontListE", !26, i64 0}
!26 = !{!"_ZTSN3rmg10LinkedListINS_4FontEEE", !6, i64 0, !6, i64 8, !12, i64 16}
!27 = !{!"_ZTSN3rmg8internal13GeneralShaderE", !28, i64 0, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56}
!28 = !{!"_ZTSN3rmg8internal6ShaderE", !12, i64 8}
!29 = !{!"_ZTSN3rmg8internal15ShadowMapShaderE", !28, i64 0, !16, i64 12, !17, i64 276, !17, i64 288, !17, i64 300, !15, i64 312, !15, i64 316, !15, i64 320, !12, i64 324, !12, i64 328, !12, i64 332}
!30 = !{!"_ZTSN3rmg8internal14Object2DShaderE", !31, i64 0, !32, i64 32, !18, i64 72, !13, i64 108, !13, i64 110}
!31 = !{!"_ZTSN3rmg8internal12SpriteShaderE", !28, i64 0, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28}
!32 = !{!"_ZTSN3rmg8internal12Text2DShaderE", !28, i64 0, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36}
!33 = !{!"_ZTSN3rmg8internal14ParticleShaderE", !28, i64 0, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36}
!34 = !{!"_ZTSN3rmg8internal12Line3DShaderE", !28, i64 0, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28}
!35 = !{!"_ZTSN3rmg8internal13ContextLoaderE", !36, i64 0}
!36 = !{!"_ZTSN3rmg8internal12PendingStackE", !6, i64 0, !37, i64 8, !12, i64 24}
!37 = !{!"_ZTSN3rmg8internal7PendingE", !6, i64 0, !6, i64 8}
!38 = !{!"_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}
!39 = !{!"bool", !7, i64 0}
!40 = !{!12, !12, 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"

%"struct.rmg::Rect" = type { i16, i16 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local i32 @_ZNK3rmg6Window13getWindowSizeEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(1448) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %"struct.rmg::Rect", align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 1440
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  call void @glfwGetWindowSize(ptr noundef %6, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %7 = load i32, ptr %3, align 4, !tbaa !39
  %8 = trunc i32 %7 to i16
  %9 = load i32, ptr %4, align 4, !tbaa !39
  %10 = trunc i32 %9 to i16
  call void @_ZN3rmg4RectC2Ett(ptr noundef nonnull align 2 dereferenceable(4) %2, i16 noundef zeroext %8, i16 noundef zeroext %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %11 = load i32, ptr %2, align 4
  ret i32 %11
}

declare void @glfwGetWindowSize(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; 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 #3 align 2

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


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