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

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

%"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 }

@_ZN3rmg6Window10windowListE = external dso_local global { ptr, ptr, i32 }, align 8
@_ZTVN3rmg6WindowE = external dso_local unnamed_addr constant { [19 x ptr] }, align 8
@_ZL12glfwInitDone = external hidden global i8, align 1
@.str = external hidden unnamed_addr constant [47 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg6WindowC2Ev(ptr noundef nonnull align 8 dereferenceable(1448) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @_ZN3rmg7ContextC2Ev(ptr noundef nonnull align 8 dereferenceable(1440) %5)
  store ptr getelementptr inbounds inrange(-16, 136) ({ [19 x ptr] }, ptr @_ZTVN3rmg6WindowE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  store ptr null, ptr %6, align 8, !tbaa !11
  %7 = load i8, ptr @_ZL12glfwInitDone, align 1, !tbaa !42, !range !43, !noundef !44
  %8 = trunc i8 %7 to i1
  br i1 %8, label %26, label %9

9:                                                ; preds = %1
  %10 = invoke i32 @glfwInit()
          to label %11 unwind label %21

11:                                               ; preds = %9
  %12 = icmp ne i32 %10, 0
  br i1 %12, label %25, label %13

13:                                               ; preds = %11
  invoke void @_ZN3rmg7Context12setErrorCodeEi(ptr noundef nonnull align 8 dereferenceable(1440) %5, i32 noundef 503)
          to label %14 unwind label %21

14:                                               ; preds = %13
  %15 = invoke i32 (ptr, ...) @printf(ptr noundef @.str)
          to label %16 unwind label %21

16:                                               ; preds = %14
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 16
  %19 = load ptr, ptr %18, align 8
  invoke void %19(ptr noundef nonnull align 8 dereferenceable(1448) %5)
          to label %20 unwind label %21

20:                                               ; preds = %16
  br label %67

21:                                               ; preds = %66, %65, %62, %58, %54, %50, %46, %42, %37, %35, %34, %27, %26, %16, %14, %13, %9
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %3, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %4, align 4
  call void @_ZN3rmg7ContextD2Ev(ptr noundef nonnull align 8 dereferenceable(1440) %5) #3
  br label %68

25:                                               ; preds = %11
  store i8 1, ptr @_ZL12glfwInitDone, align 1, !tbaa !42
  br label %26

26:                                               ; preds = %25, %1
  invoke void @glfwWindowHint(i32 noundef 135181, i32 noundef 4)
          to label %27 unwind label %21

27:                                               ; preds = %26
  %28 = invoke ptr @glfwCreateWindow(i32 noundef 768, i32 noundef 432, ptr noundef @.str.1, ptr noundef null, ptr noundef null)
          to label %29 unwind label %21

29:                                               ; preds = %27
  %30 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  store ptr %28, ptr %30, align 8, !tbaa !11
  %31 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !11
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %42

34:                                               ; preds = %29
  invoke void @_ZN3rmg7Context12setErrorCodeEi(ptr noundef nonnull align 8 dereferenceable(1440) %5, i32 noundef 503)
          to label %35 unwind label %21

35:                                               ; preds = %34
  %36 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2)
          to label %37 unwind label %21

37:                                               ; preds = %35
  %38 = load ptr, ptr %5, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 16
  %40 = load ptr, ptr %39, align 8
  invoke void %40(ptr noundef nonnull align 8 dereferenceable(1448) %5)
          to label %41 unwind label %21

41:                                               ; preds = %37
  br label %67

42:                                               ; preds = %29
  %43 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = invoke ptr @glfwSetMouseButtonCallback(ptr noundef %44, ptr noundef @_ZN3rmg28window_mouse_button_callbackEP10GLFWwindowiii)
          to label %46 unwind label %21

46:                                               ; preds = %42
  %47 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  %48 = load ptr, ptr %47, align 8, !tbaa !11
  %49 = invoke ptr @glfwSetCursorPosCallback(ptr noundef %48, ptr noundef @_ZN3rmg31window_cursor_position_callbackEP10GLFWwindowdd)
          to label %50 unwind label %21

50:                                               ; preds = %46
  %51 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  %53 = invoke ptr @glfwSetCursorEnterCallback(ptr noundef %52, ptr noundef @_ZN3rmg28window_cursor_enter_callbackEP10GLFWwindowi)
          to label %54 unwind label %21

54:                                               ; preds = %50
  %55 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !11
  %57 = invoke ptr @glfwSetScrollCallback(ptr noundef %56, ptr noundef @_ZN3rmg22window_scroll_callbackEP10GLFWwindowdd)
          to label %58 unwind label %21

58:                                               ; preds = %54
  %59 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !11
  %61 = invoke ptr @glfwSetKeyCallback(ptr noundef %60, ptr noundef @_ZN3rmg19window_key_callbackEP10GLFWwindowiiii)
          to label %62 unwind label %21

62:                                               ; preds = %58
  %63 = getelementptr inbounds %"class.rmg::Window", ptr %5, i32 0, i32 1
  %64 = load ptr, ptr %63, align 8, !tbaa !11
  invoke void @glfwSetWindowUserPointer(ptr noundef %64, ptr noundef %5)
          to label %65 unwind label %21

65:                                               ; preds = %62
  invoke void @_ZN3rmg10LinkedListINS_7ContextEE10push_frontEPS1_(ptr noundef nonnull align 8 dereferenceable(20) @_ZN3rmg6Window10windowListE, ptr noundef %5)
          to label %66 unwind label %21

66:                                               ; preds = %65
  invoke void @_ZN3rmg6Window13setWindowIconEPKc(ptr noundef nonnull align 8 dereferenceable(1448) %5, ptr noundef @.str.3)
          to label %67 unwind label %21

67:                                               ; preds = %66, %41, %20
  ret void

68:                                               ; preds = %21
  %69 = load ptr, ptr %3, align 8
  %70 = load i32, ptr %4, align 4
  %71 = insertvalue { ptr, i32 } poison, ptr %69, 0
  %72 = insertvalue { ptr, i32 } %71, i32 %70, 1
  resume { ptr, i32 } %72
}

declare void @_ZN3rmg7ContextC2Ev(ptr noundef nonnull align 8 dereferenceable(1440)) unnamed_addr #1

declare i32 @glfwInit() #1

declare i32 @__gxx_personality_v0(...)

declare void @_ZN3rmg7Context12setErrorCodeEi(ptr noundef nonnull align 8 dereferenceable(1440), i32 noundef) #1

declare i32 @printf(ptr noundef, ...) #1

declare void @glfwWindowHint(i32 noundef, i32 noundef) #1

declare ptr @glfwCreateWindow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare ptr @glfwSetMouseButtonCallback(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg28window_mouse_button_callbackEP10GLFWwindowiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

declare ptr @glfwSetCursorPosCallback(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg31window_cursor_position_callbackEP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

declare ptr @glfwSetCursorEnterCallback(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg28window_cursor_enter_callbackEP10GLFWwindowi(ptr noundef, i32 noundef) #0

declare ptr @glfwSetScrollCallback(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg22window_scroll_callbackEP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg19window_key_callbackEP10GLFWwindowiiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

declare void @glfwSetWindowUserPointer(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg10LinkedListINS_7ContextEE10push_frontEPS1_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg6Window13setWindowIconEPKc(ptr noundef nonnull align 8 dereferenceable(1448), ptr noundef) #0 align 2

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


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

@_ZN3rmg6Window10windowListE = external dso_local global { ptr, ptr, i32 }, align 8
@_ZTVN3rmg6WindowE = external dso_local unnamed_addr constant { [19 x ptr] }, align 8
@_ZL12glfwInitDone = external hidden local_unnamed_addr global i8, align 1
@.str = external hidden unnamed_addr constant [47 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3rmg6WindowC2Ev(ptr noundef nonnull align 8 dereferenceable(1448) %0) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN3rmg7ContextC2Ev(ptr noundef nonnull align 8 dereferenceable(1440) %0)
  store ptr getelementptr inbounds inrange(-16, 136) (i8, ptr @_ZTVN3rmg6WindowE, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 1440
  store ptr null, ptr %2, align 8, !tbaa !8
  %3 = load i8, ptr @_ZL12glfwInitDone, align 1, !tbaa !41, !range !42, !noundef !43
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %12, label %5

5:                                                ; preds = %1
  %6 = invoke i32 @glfwInit()
          to label %7 unwind label %9

7:                                                ; preds = %5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %8, label %11

8:                                                ; preds = %7
  invoke void @_ZN3rmg7Context12setErrorCodeEi(ptr noundef nonnull align 8 dereferenceable(1440) %0, i32 noundef 503)
          to label %.invoke unwind label %9

9:                                                ; preds = %.invoke, %39, %38, %36, %33, %30, %27, %24, %22, %17, %13, %12, %8, %5
  %10 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN3rmg7ContextD2Ev(ptr noundef nonnull align 8 dereferenceable(1440) %0) #4
  resume { ptr, i32 } %10

11:                                               ; preds = %7
  store i8 1, ptr @_ZL12glfwInitDone, align 1, !tbaa !41
  br label %12

12:                                               ; preds = %11, %1
  invoke void @glfwWindowHint(i32 noundef 135181, i32 noundef 4)
          to label %13 unwind label %9

13:                                               ; preds = %12
  %14 = invoke ptr @glfwCreateWindow(i32 noundef 768, i32 noundef 432, ptr noundef nonnull @.str.1, ptr noundef null, ptr noundef null)
          to label %15 unwind label %9

15:                                               ; preds = %13
  store ptr %14, ptr %2, align 8, !tbaa !8
  %16 = icmp eq ptr %14, null
  br i1 %16, label %17, label %22

17:                                               ; preds = %15
  invoke void @_ZN3rmg7Context12setErrorCodeEi(ptr noundef nonnull align 8 dereferenceable(1440) %0, i32 noundef 503)
          to label %.invoke unwind label %9

.invoke:                                          ; preds = %17, %8
  %.str.sink = phi ptr [ @.str, %8 ], [ @.str.2, %17 ]
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.sink)
  %19 = load ptr, ptr %0, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 128
  %21 = load ptr, ptr %20, align 8
  invoke void %21(ptr noundef nonnull align 8 dereferenceable(1448) %0)
          to label %40 unwind label %9

22:                                               ; preds = %15
  %23 = invoke ptr @glfwSetMouseButtonCallback(ptr noundef nonnull %14, ptr noundef nonnull @_ZN3rmg28window_mouse_button_callbackEP10GLFWwindowiii)
          to label %24 unwind label %9

24:                                               ; preds = %22
  %25 = load ptr, ptr %2, align 8, !tbaa !8
  %26 = invoke ptr @glfwSetCursorPosCallback(ptr noundef %25, ptr noundef nonnull @_ZN3rmg31window_cursor_position_callbackEP10GLFWwindowdd)
          to label %27 unwind label %9

27:                                               ; preds = %24
  %28 = load ptr, ptr %2, align 8, !tbaa !8
  %29 = invoke ptr @glfwSetCursorEnterCallback(ptr noundef %28, ptr noundef nonnull @_ZN3rmg28window_cursor_enter_callbackEP10GLFWwindowi)
          to label %30 unwind label %9

30:                                               ; preds = %27
  %31 = load ptr, ptr %2, align 8, !tbaa !8
  %32 = invoke ptr @glfwSetScrollCallback(ptr noundef %31, ptr noundef nonnull @_ZN3rmg22window_scroll_callbackEP10GLFWwindowdd)
          to label %33 unwind label %9

33:                                               ; preds = %30
  %34 = load ptr, ptr %2, align 8, !tbaa !8
  %35 = invoke ptr @glfwSetKeyCallback(ptr noundef %34, ptr noundef nonnull @_ZN3rmg19window_key_callbackEP10GLFWwindowiiii)
          to label %36 unwind label %9

36:                                               ; preds = %33
  %37 = load ptr, ptr %2, align 8, !tbaa !8
  invoke void @glfwSetWindowUserPointer(ptr noundef %37, ptr noundef nonnull %0)
          to label %38 unwind label %9

38:                                               ; preds = %36
  invoke void @_ZN3rmg10LinkedListINS_7ContextEE10push_frontEPS1_(ptr noundef nonnull align 8 dereferenceable(20) @_ZN3rmg6Window10windowListE, ptr noundef nonnull %0)
          to label %39 unwind label %9

39:                                               ; preds = %38
  invoke void @_ZN3rmg6Window13setWindowIconEPKc(ptr noundef nonnull align 8 dereferenceable(1448) %0, ptr noundef nonnull @.str.3)
          to label %40 unwind label %9

40:                                               ; preds = %.invoke, %39
  ret void
}

declare void @_ZN3rmg7ContextC2Ev(ptr noundef nonnull align 8 dereferenceable(1440)) unnamed_addr #1

declare i32 @glfwInit() local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

declare void @_ZN3rmg7Context12setErrorCodeEi(ptr noundef nonnull align 8 dereferenceable(1440), i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare void @glfwWindowHint(i32 noundef, i32 noundef) local_unnamed_addr #1

declare ptr @glfwCreateWindow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @glfwSetMouseButtonCallback(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg28window_mouse_button_callbackEP10GLFWwindowiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

declare ptr @glfwSetCursorPosCallback(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg31window_cursor_position_callbackEP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

declare ptr @glfwSetCursorEnterCallback(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg28window_cursor_enter_callbackEP10GLFWwindowi(ptr noundef, i32 noundef) #0

declare ptr @glfwSetScrollCallback(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg22window_scroll_callbackEP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg19window_key_callbackEP10GLFWwindowiiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

declare void @glfwSetWindowUserPointer(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg10LinkedListINS_7ContextEE10push_frontEPS1_(ptr noundef nonnull align 8 dereferenceable(20), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3rmg6Window13setWindowIconEPKc(ptr noundef nonnull align 8 dereferenceable(1448), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZN3rmg7ContextD2Ev(ptr noundef nonnull align 8 dereferenceable(1440)) unnamed_addr #3

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


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