; LLVM IR from Sonryle/JoePhys :: testbed/src/WindowManager.ll (ZN13WindowManager11KeyCallbackEP10GLFWwindowiiii)

; 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.Settings = type <{ i32, i32, i32, i32, i8, [3 x i8], float, float, i8, [3 x i8], %struct.vec2, i8, i8, i8, i8, i8, [3 x i8], float, float, float, float, i32, i32, i32, float, i8, [3 x i8] }>
%struct.vec2 = type { float, float }
%struct.Camera = type { %struct.vec2, float, i32, i32 }
%struct.WindowManager = type <{ %struct.vec2, i32, i32, ptr, ptr, ptr, i8, i8, i8, i8, [4 x i8] }>
%struct.GUIManager = type { i8, i8, i8, i8 }
%struct.SceneManager = type <{ ptr, i32, [4 x i8] }>
%struct.Particle = type { i8, %struct.vec2, %struct.vec2, float, float, float, %struct.vec2, [2 x %struct.vec2] }

@settings = external global %struct.Settings, align 4
@camera = external global %struct.Camera, align 4
@window_mgr = external dso_local global %struct.WindowManager, align 8
@gui_manager = external global %struct.GUIManager, align 1
@scene_manager = external global %struct.SceneManager, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13WindowManager11KeyCallbackEP10GLFWwindowiiii(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca %struct.vec2, align 4
  %13 = alloca %struct.vec2, align 4
  %14 = alloca %struct.vec2, align 4
  %15 = alloca %struct.vec2, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !9
  %16 = load i32, ptr %7, align 4, !tbaa !9
  switch i32 %16, label %171 [
    i32 256, label %17
    i32 32, label %19
    i32 65, label %31
    i32 83, label %44
    i32 79, label %84
    i32 82, label %96
    i32 80, label %107
    i32 70, label %130
    i32 263, label %143
    i32 262, label %157
  ]

17:                                               ; preds = %5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  call void @glfwSetWindowShouldClose(ptr noundef %18, i32 noundef 1)
  br label %171

19:                                               ; preds = %5
  %20 = load i32, ptr %9, align 4, !tbaa !9
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %30

22:                                               ; preds = %19
  %23 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %24 = trunc i8 %23 to i1
  br i1 %24, label %25, label %30

25:                                               ; preds = %22
  %26 = load i8, ptr getelementptr inbounds (%struct.Settings, ptr @settings, i32 0, i32 4), align 4, !tbaa !18, !range !16, !noundef !17
  %27 = trunc i8 %26 to i1
  %28 = xor i1 %27, true
  %29 = zext i1 %28 to i8
  store i8 %29, ptr getelementptr inbounds (%struct.Settings, ptr @settings, i32 0, i32 4), align 4, !tbaa !18
  call void @_ZN13WindowManager13SetFullscreenEb(ptr noundef nonnull align 8 dereferenceable(44) @window_mgr, i1 noundef zeroext %28)
  br label %30

30:                                               ; preds = %25, %22, %19
  br label %171

31:                                               ; preds = %5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = call i32 @glfwGetKey(ptr noundef %32, i32 noundef 341)
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %43

35:                                               ; preds = %31
  %36 = load i32, ptr %9, align 4, !tbaa !9
  %37 = icmp eq i32 %36, 1
  br i1 %37, label %38, label %43

38:                                               ; preds = %35
  %39 = load i8, ptr @gui_manager, align 1, !tbaa !20, !range !16, !noundef !17
  %40 = trunc i8 %39 to i1
  %41 = xor i1 %40, true
  %42 = zext i1 %41 to i8
  store i8 %42, ptr @gui_manager, align 1, !tbaa !20
  br label %43

43:                                               ; preds = %38, %35, %31
  br label %171

44:                                               ; preds = %5
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %55

47:                                               ; preds = %44
  %48 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %49 = trunc i8 %48 to i1
  br i1 %49, label %50, label %55

50:                                               ; preds = %47
  %51 = load i8, ptr getelementptr inbounds (%struct.GUIManager, ptr @gui_manager, i32 0, i32 1), align 1, !tbaa !22, !range !16, !noundef !17
  %52 = trunc i8 %51 to i1
  %53 = xor i1 %52, true
  %54 = zext i1 %53 to i8
  store i8 %54, ptr getelementptr inbounds (%struct.GUIManager, ptr @gui_manager, i32 0, i32 1), align 1, !tbaa !22
  br label %83

55:                                               ; preds = %47, %44
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = icmp eq i32 %56, 1
  br i1 %57, label %58, label %82

58:                                               ; preds = %55
  %59 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 9), align 1, !tbaa !23, !range !16, !noundef !17
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %82

61:                                               ; preds = %58
  %62 = load ptr, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 3), align 8, !tbaa !24
  %63 = call i32 @glfwGetMouseButton(ptr noundef %62, i32 noundef 0)
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %82, label %65

65:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %66 = load ptr, ptr @scene_manager, align 8, !tbaa !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 @window_mgr, i64 8, i1 false), !tbaa.struct !27
  %67 = load <2 x float>, ptr %13, align 4
  %68 = call <2 x float> @_ZN6Camera23ScreenSpaceToWorldSpaceE4vec2(ptr noundef nonnull align 4 dereferenceable(20) @camera, <2 x float> %67)
  store <2 x float> %68, ptr %12, align 4
  %69 = load <2 x float>, ptr %12, align 4
  %70 = call noundef ptr @_ZN5Scene18GetNearestParticleE4vec2(ptr noundef nonnull align 8 dereferenceable(52) %66, <2 x float> %69)
  store ptr %70, ptr %11, align 8, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.Particle, ptr %71, i32 0, i32 0
  %73 = load i8, ptr %72, align 4, !tbaa !29, !range !16, !noundef !17
  %74 = trunc i8 %73 to i1
  %75 = xor i1 %74, true
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.Particle, ptr %76, i32 0, i32 0
  %78 = zext i1 %75 to i8
  store i8 %78, ptr %77, align 4, !tbaa !29
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.Particle, ptr %79, i32 0, i32 2
  call void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8) %80, float noundef 0.000000e+00, float noundef 0.000000e+00)
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN8Particle17ResetAccelerationEv(ptr noundef nonnull align 4 dereferenceable(56) %81)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %82

82:                                               ; preds = %65, %61, %58, %55
  br label %83

83:                                               ; preds = %82, %50
  br label %171

84:                                               ; preds = %5
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = icmp eq i32 %85, 1
  br i1 %86, label %87, label %95

87:                                               ; preds = %84
  %88 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %89 = trunc i8 %88 to i1
  br i1 %89, label %90, label %95

90:                                               ; preds = %87
  %91 = load i8, ptr getelementptr inbounds (%struct.GUIManager, ptr @gui_manager, i32 0, i32 2), align 1, !tbaa !31, !range !16, !noundef !17
  %92 = trunc i8 %91 to i1
  %93 = xor i1 %92, true
  %94 = zext i1 %93 to i8
  store i8 %94, ptr getelementptr inbounds (%struct.GUIManager, ptr @gui_manager, i32 0, i32 2), align 1, !tbaa !31
  br label %95

95:                                               ; preds = %90, %87, %84
  br label %171

96:                                               ; preds = %5
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = icmp eq i32 %97, 1
  br i1 %98, label %99, label %106

99:                                               ; preds = %96
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = call i32 @glfwGetKey(ptr noundef %100, i32 noundef 341)
  %102 = icmp eq i32 %101, 1
  br i1 %102, label %103, label %105

103:                                              ; preds = %99
  %104 = load i32, ptr getelementptr inbounds (%struct.SceneManager, ptr @scene_manager, i32 0, i32 1), align 8, !tbaa !32
  call void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12) @scene_manager, i32 noundef %104)
  br label %105

105:                                              ; preds = %103, %99
  br label %106

106:                                              ; preds = %105, %96
  br label %171

107:                                              ; preds = %5
  %108 = load i32, ptr %9, align 4, !tbaa !9
  %109 = icmp ne i32 %108, 0
  br i1 %109, label %110, label %118

110:                                              ; preds = %107
  %111 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %112 = trunc i8 %111 to i1
  br i1 %112, label %118, label %113

113:                                              ; preds = %110
  %114 = load ptr, ptr @scene_manager, align 8, !tbaa !25
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 8 @window_mgr, i64 8, i1 false), !tbaa.struct !27
  %115 = load <2 x float>, ptr %15, align 4
  %116 = call <2 x float> @_ZN6Camera23ScreenSpaceToWorldSpaceE4vec2(ptr noundef nonnull align 4 dereferenceable(20) @camera, <2 x float> %115)
  store <2 x float> %116, ptr %14, align 4
  %117 = load <2 x float>, ptr %14, align 4
  call void @_ZN5Scene17AddStaticParticleE4vec2f(ptr noundef nonnull align 8 dereferenceable(52) %114, <2 x float> %117, float noundef 0x3FB99999A0000000)
  br label %118

118:                                              ; preds = %113, %110, %107
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = icmp eq i32 %119, 1
  br i1 %120, label %121, label %129

121:                                              ; preds = %118
  %122 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %123 = trunc i8 %122 to i1
  br i1 %123, label %124, label %129

124:                                              ; preds = %121
  %125 = load i8, ptr getelementptr inbounds (%struct.Settings, ptr @settings, i32 0, i32 8), align 4, !tbaa !33, !range !16, !noundef !17
  %126 = trunc i8 %125 to i1
  %127 = xor i1 %126, true
  %128 = zext i1 %127 to i8
  store i8 %128, ptr getelementptr inbounds (%struct.Settings, ptr @settings, i32 0, i32 8), align 4, !tbaa !33
  br label %129

129:                                              ; preds = %124, %121, %118
  br label %171

130:                                              ; preds = %5
  %131 = load i32, ptr %9, align 4, !tbaa !9
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %142

133:                                              ; preds = %130
  %134 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %135 = trunc i8 %134 to i1
  br i1 %135, label %136, label %142

136:                                              ; preds = %133
  %137 = load i8, ptr getelementptr inbounds (%struct.Settings, ptr @settings, i32 0, i32 8), align 4, !tbaa !33, !range !16, !noundef !17
  %138 = trunc i8 %137 to i1
  br i1 %138, label %139, label %141

139:                                              ; preds = %136
  %140 = load ptr, ptr @scene_manager, align 8, !tbaa !25
  call void @_ZN5Scene4StepEv(ptr noundef nonnull align 8 dereferenceable(52) %140)
  br label %141

141:                                              ; preds = %139, %136
  br label %142

142:                                              ; preds = %141, %133, %130
  br label %171

143:                                              ; preds = %5
  %144 = load i32, ptr %9, align 4, !tbaa !9
  %145 = icmp eq i32 %144, 1
  br i1 %145, label %146, label %156

146:                                              ; preds = %143
  %147 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %148 = trunc i8 %147 to i1
  br i1 %148, label %149, label %156

149:                                              ; preds = %146
  %150 = load i32, ptr getelementptr inbounds (%struct.SceneManager, ptr @scene_manager, i32 0, i32 1), align 8, !tbaa !32
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %152, label %155

152:                                              ; preds = %149
  %153 = load i32, ptr getelementptr inbounds (%struct.SceneManager, ptr @scene_manager, i32 0, i32 1), align 8, !tbaa !32
  %154 = sub i32 %153, 1
  call void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12) @scene_manager, i32 noundef %154)
  br label %155

155:                                              ; preds = %152, %149
  br label %156

156:                                              ; preds = %155, %146, %143
  br label %171

157:                                              ; preds = %5
  %158 = load i32, ptr %9, align 4, !tbaa !9
  %159 = icmp eq i32 %158, 1
  br i1 %159, label %160, label %170

160:                                              ; preds = %157
  %161 = load i8, ptr getelementptr inbounds (%struct.WindowManager, ptr @window_mgr, i32 0, i32 8), align 2, !tbaa !11, !range !16, !noundef !17
  %162 = trunc i8 %161 to i1
  br i1 %162, label %163, label %170

163:                                              ; preds = %160
  %164 = load i32, ptr getelementptr inbounds (%struct.SceneManager, ptr @scene_manager, i32 0, i32 1), align 8, !tbaa !32
  %165 = icmp ult i32 %164, 8
  br i1 %165, label %166, label %169

166:                                              ; preds = %163
  %167 = load i32, ptr getelementptr inbounds (%struct.SceneManager, ptr @scene_manager, i32 0, i32 1), align 8, !tbaa !32
  %168 = add i32 %167, 1
  call void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12) @scene_manager, i32 noundef %168)
  br label %169

169:                                              ; preds = %166, %163
  br label %170

170:                                              ; preds = %169, %160, %157
  br label %171

171:                                              ; preds = %170, %156, %142, %129, %106, %95, %83, %43, %30, %17, %5
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13WindowManager13SetFullscreenEb(ptr noundef nonnull align 8 dereferenceable(44), i1 noundef zeroext) #2 align 2

declare void @glfwSetWindowShouldClose(ptr noundef, i32 noundef) #3

declare i32 @glfwGetKey(ptr noundef, i32 noundef) #3

declare i32 @glfwGetMouseButton(ptr noundef, i32 noundef) #3

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

declare noundef ptr @_ZN5Scene18GetNearestParticleE4vec2(ptr noundef nonnull align 8 dereferenceable(52), <2 x float>) #3

declare <2 x float> @_ZN6Camera23ScreenSpaceToWorldSpaceE4vec2(ptr noundef nonnull align 4 dereferenceable(20), <2 x float>) #3

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

declare void @_ZN8Particle17ResetAccelerationEv(ptr noundef nonnull align 4 dereferenceable(56)) #3

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

declare void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) #3

declare void @_ZN5Scene17AddStaticParticleE4vec2f(ptr noundef nonnull align 8 dereferenceable(52), <2 x float>, float noundef) #3

declare void @_ZN5Scene4StepEv(ptr noundef nonnull align 8 dereferenceable(52)) #3

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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { 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 #3 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !15, i64 42}
!12 = !{!"_ZTS13WindowManager", !13, i64 0, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !15, i64 40, !15, i64 41, !15, i64 42, !15, i64 43}
!13 = !{!"_ZTS4vec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !15, i64 16}
!19 = !{!"_ZTS8Settings", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !15, i64 16, !14, i64 20, !14, i64 24, !15, i64 28, !13, i64 32, !15, i64 40, !15, i64 41, !15, i64 42, !15, i64 43, !15, i64 44, !14, i64 48, !14, i64 52, !14, i64 56, !14, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !14, i64 76, !15, i64 80}
!20 = !{!21, !15, i64 0}
!21 = !{!"_ZTS10GUIManager", !15, i64 0, !15, i64 1, !15, i64 2, !15, i64 3}
!22 = !{!21, !15, i64 1}
!23 = !{!12, !15, i64 43}
!24 = !{!12, !6, i64 16}
!25 = !{!26, !6, i64 0}
!26 = !{!"_ZTS12SceneManager", !6, i64 0, !10, i64 8}
!27 = !{i64 0, i64 4, !28, i64 4, i64 4, !28}
!28 = !{!14, !14, i64 0}
!29 = !{!30, !15, i64 0}
!30 = !{!"_ZTS8Particle", !15, i64 0, !13, i64 4, !13, i64 12, !14, i64 20, !14, i64 24, !14, i64 28, !13, i64 32, !7, i64 40}
!31 = !{!21, !15, i64 2}
!32 = !{!26, !10, i64 8}
!33 = !{!19, !15, i64 28}


; 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.Settings = type <{ i32, i32, i32, i32, i8, [3 x i8], float, float, i8, [3 x i8], %struct.vec2, i8, i8, i8, i8, i8, [3 x i8], float, float, float, float, i32, i32, i32, float, i8, [3 x i8] }>
%struct.vec2 = type { float, float }
%struct.Camera = type { %struct.vec2, float, i32, i32 }
%struct.WindowManager = type <{ %struct.vec2, i32, i32, ptr, ptr, ptr, i8, i8, i8, i8, [4 x i8] }>
%struct.GUIManager = type { i8, i8, i8, i8 }
%struct.SceneManager = type <{ ptr, i32, [4 x i8] }>

@settings = external local_unnamed_addr global %struct.Settings, align 4
@camera = external global %struct.Camera, align 4
@window_mgr = external dso_local global %struct.WindowManager, align 8
@gui_manager = external local_unnamed_addr global %struct.GUIManager, align 1
@scene_manager = external global %struct.SceneManager, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN13WindowManager11KeyCallbackEP10GLFWwindowiiii(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #1 align 2 {
  switch i32 %1, label %.critedge [
    i32 256, label %6
    i32 32, label %7
    i32 65, label %17
    i32 83, label %24
    i32 79, label %45
    i32 82, label %53
    i32 80, label %60
    i32 70, label %75
    i32 263, label %84
    i32 262, label %93
  ]

6:                                                ; preds = %5
  tail call void @glfwSetWindowShouldClose(ptr noundef %0, i32 noundef 1)
  br label %.critedge

7:                                                ; preds = %5
  %8 = icmp eq i32 %3, 1
  br i1 %8, label %9, label %.critedge

9:                                                ; preds = %7
  %10 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %11 = trunc nuw i8 %10 to i1
  br i1 %11, label %12, label %.critedge

12:                                               ; preds = %9
  %13 = load i8, ptr getelementptr inbounds (i8, ptr @settings, i64 16), align 4, !tbaa !16, !range !14, !noundef !15
  %14 = trunc nuw i8 %13 to i1
  %15 = xor i1 %14, true
  %16 = zext i1 %15 to i8
  store i8 %16, ptr getelementptr inbounds (i8, ptr @settings, i64 16), align 4, !tbaa !16
  tail call void @_ZN13WindowManager13SetFullscreenEb(ptr noundef nonnull align 8 dereferenceable(44) @window_mgr, i1 noundef zeroext %15)
  br label %.critedge

17:                                               ; preds = %5
  %18 = tail call i32 @glfwGetKey(ptr noundef %0, i32 noundef 341)
  %19 = icmp ne i32 %18, 0
  %20 = icmp eq i32 %3, 1
  %or.cond = and i1 %20, %19
  br i1 %or.cond, label %21, label %.critedge

21:                                               ; preds = %17
  %22 = load i8, ptr @gui_manager, align 1, !tbaa !18, !range !14, !noundef !15
  %23 = xor i8 %22, 1
  store i8 %23, ptr @gui_manager, align 1, !tbaa !18
  br label %.critedge

24:                                               ; preds = %5
  %25 = icmp eq i32 %3, 1
  br i1 %25, label %26, label %.critedge

26:                                               ; preds = %24
  %27 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %28 = trunc nuw i8 %27 to i1
  br i1 %28, label %29, label %32

29:                                               ; preds = %26
  %30 = load i8, ptr getelementptr inbounds (i8, ptr @gui_manager, i64 1), align 1, !tbaa !20, !range !14, !noundef !15
  %31 = xor i8 %30, 1
  store i8 %31, ptr getelementptr inbounds (i8, ptr @gui_manager, i64 1), align 1, !tbaa !20
  br label %.critedge

32:                                               ; preds = %26
  %33 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 43), align 1, !tbaa !21, !range !14, !noundef !15
  %34 = trunc nuw i8 %33 to i1
  br i1 %34, label %35, label %.critedge

35:                                               ; preds = %32
  %36 = load ptr, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 16), align 8, !tbaa !22
  %37 = tail call i32 @glfwGetMouseButton(ptr noundef %36, i32 noundef 0)
  %.not28 = icmp eq i32 %37, 0
  br i1 %.not28, label %38, label %.critedge

38:                                               ; preds = %35
  %39 = load ptr, ptr @scene_manager, align 8, !tbaa !23
  %.sroa.07.0.copyload = load <2 x float>, ptr @window_mgr, align 8
  %40 = tail call <2 x float> @_ZN6Camera23ScreenSpaceToWorldSpaceE4vec2(ptr noundef nonnull align 4 dereferenceable(20) @camera, <2 x float> %.sroa.07.0.copyload)
  %41 = tail call noundef ptr @_ZN5Scene18GetNearestParticleE4vec2(ptr noundef nonnull align 8 dereferenceable(52) %39, <2 x float> %40)
  %42 = load i8, ptr %41, align 4, !tbaa !25, !range !14, !noundef !15
  %43 = xor i8 %42, 1
  store i8 %43, ptr %41, align 4, !tbaa !25
  %44 = getelementptr inbounds i8, ptr %41, i64 12
  tail call void @_ZN4vec23SetEff(ptr noundef nonnull align 4 dereferenceable(8) %44, float noundef 0.000000e+00, float noundef 0.000000e+00)
  tail call void @_ZN8Particle17ResetAccelerationEv(ptr noundef nonnull align 4 dereferenceable(56) %41)
  br label %.critedge

45:                                               ; preds = %5
  %46 = icmp eq i32 %3, 1
  br i1 %46, label %47, label %.critedge

47:                                               ; preds = %45
  %48 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %49 = trunc nuw i8 %48 to i1
  br i1 %49, label %50, label %.critedge

50:                                               ; preds = %47
  %51 = load i8, ptr getelementptr inbounds (i8, ptr @gui_manager, i64 2), align 1, !tbaa !27, !range !14, !noundef !15
  %52 = xor i8 %51, 1
  store i8 %52, ptr getelementptr inbounds (i8, ptr @gui_manager, i64 2), align 1, !tbaa !27
  br label %.critedge

53:                                               ; preds = %5
  %54 = icmp eq i32 %3, 1
  br i1 %54, label %55, label %.critedge

55:                                               ; preds = %53
  %56 = tail call i32 @glfwGetKey(ptr noundef %0, i32 noundef 341)
  %57 = icmp eq i32 %56, 1
  br i1 %57, label %58, label %.critedge

58:                                               ; preds = %55
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @scene_manager, i64 8), align 8, !tbaa !28
  tail call void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12) @scene_manager, i32 noundef %59)
  br label %.critedge

60:                                               ; preds = %5
  %cond = icmp eq i32 %3, 0
  br i1 %cond, label %.critedge, label %61

61:                                               ; preds = %60
  %62 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %63 = trunc nuw i8 %62 to i1
  br i1 %63, label %67, label %64

64:                                               ; preds = %61
  %65 = load ptr, ptr @scene_manager, align 8, !tbaa !23
  %.sroa.0.0.copyload = load <2 x float>, ptr @window_mgr, align 8
  %66 = tail call <2 x float> @_ZN6Camera23ScreenSpaceToWorldSpaceE4vec2(ptr noundef nonnull align 4 dereferenceable(20) @camera, <2 x float> %.sroa.0.0.copyload)
  tail call void @_ZN5Scene17AddStaticParticleE4vec2f(ptr noundef nonnull align 8 dereferenceable(52) %65, <2 x float> %66, float noundef 0x3FB99999A0000000)
  br label %67

67:                                               ; preds = %64, %61
  %68 = icmp eq i32 %3, 1
  br i1 %68, label %69, label %.critedge

69:                                               ; preds = %67
  %70 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %71 = trunc nuw i8 %70 to i1
  br i1 %71, label %72, label %.critedge

72:                                               ; preds = %69
  %73 = load i8, ptr getelementptr inbounds (i8, ptr @settings, i64 28), align 4, !tbaa !29, !range !14, !noundef !15
  %74 = xor i8 %73, 1
  store i8 %74, ptr getelementptr inbounds (i8, ptr @settings, i64 28), align 4, !tbaa !29
  br label %.critedge

75:                                               ; preds = %5
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %.critedge, label %76

76:                                               ; preds = %75
  %77 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %78 = trunc nuw i8 %77 to i1
  br i1 %78, label %79, label %.critedge

79:                                               ; preds = %76
  %80 = load i8, ptr getelementptr inbounds (i8, ptr @settings, i64 28), align 4, !tbaa !29, !range !14, !noundef !15
  %81 = trunc nuw i8 %80 to i1
  br i1 %81, label %82, label %.critedge

82:                                               ; preds = %79
  %83 = load ptr, ptr @scene_manager, align 8, !tbaa !23
  tail call void @_ZN5Scene4StepEv(ptr noundef nonnull align 8 dereferenceable(52) %83)
  br label %.critedge

84:                                               ; preds = %5
  %85 = icmp eq i32 %3, 1
  br i1 %85, label %86, label %.critedge

86:                                               ; preds = %84
  %87 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %88 = trunc nuw i8 %87 to i1
  %89 = load i32, ptr getelementptr inbounds (i8, ptr @scene_manager, i64 8), align 8
  %90 = icmp ne i32 %89, 0
  %or.cond3 = select i1 %88, i1 %90, i1 false
  br i1 %or.cond3, label %91, label %.critedge

91:                                               ; preds = %86
  %92 = add i32 %89, -1
  tail call void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12) @scene_manager, i32 noundef %92)
  br label %.critedge

93:                                               ; preds = %5
  %94 = icmp eq i32 %3, 1
  br i1 %94, label %95, label %.critedge

95:                                               ; preds = %93
  %96 = load i8, ptr getelementptr inbounds (i8, ptr @window_mgr, i64 42), align 2, !tbaa !5, !range !14, !noundef !15
  %97 = trunc nuw i8 %96 to i1
  %98 = load i32, ptr getelementptr inbounds (i8, ptr @scene_manager, i64 8), align 8
  %99 = icmp ult i32 %98, 8
  %or.cond5 = select i1 %97, i1 %99, i1 false
  br i1 %or.cond5, label %100, label %.critedge

100:                                              ; preds = %95
  %101 = add nuw nsw i32 %98, 1
  tail call void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12) @scene_manager, i32 noundef %101)
  br label %.critedge

.critedge:                                        ; preds = %60, %24, %93, %95, %100, %84, %86, %91, %75, %76, %82, %79, %67, %69, %72, %53, %58, %55, %45, %47, %50, %29, %38, %35, %32, %17, %21, %7, %9, %12, %6, %5
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN13WindowManager13SetFullscreenEb(ptr noundef nonnull align 8 dereferenceable(44), i1 noundef zeroext) local_unnamed_addr #2 align 2

declare void @glfwSetWindowShouldClose(ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @glfwGetKey(ptr noundef, i32 noundef) local_unnamed_addr #3

declare i32 @glfwGetMouseButton(ptr noundef, i32 noundef) local_unnamed_addr #3

declare noundef ptr @_ZN5Scene18GetNearestParticleE4vec2(ptr noundef nonnull align 8 dereferenceable(52), <2 x float>) local_unnamed_addr #3

declare <2 x float> @_ZN6Camera23ScreenSpaceToWorldSpaceE4vec2(ptr noundef nonnull align 4 dereferenceable(20), <2 x float>) local_unnamed_addr #3

declare void @_ZN8Particle17ResetAccelerationEv(ptr noundef nonnull align 4 dereferenceable(56)) local_unnamed_addr #3

declare void @_ZN12SceneManager11SwitchSceneEi(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) local_unnamed_addr #3

declare void @_ZN5Scene17AddStaticParticleE4vec2f(ptr noundef nonnull align 8 dereferenceable(52), <2 x float>, float noundef) local_unnamed_addr #3

declare void @_ZN5Scene4StepEv(ptr noundef nonnull align 8 dereferenceable(52)) local_unnamed_addr #3

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 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { 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 #3 = { "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, !13, i64 42}
!6 = !{!"_ZTS13WindowManager", !7, i64 0, !11, i64 8, !11, i64 12, !12, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 41, !13, i64 42, !13, i64 43}
!7 = !{!"_ZTS4vec2", !8, i64 0, !8, i64 4}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{!"bool", !9, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!17, !13, i64 16}
!17 = !{!"_ZTS8Settings", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !13, i64 16, !8, i64 20, !8, i64 24, !13, i64 28, !7, i64 32, !13, i64 40, !13, i64 41, !13, i64 42, !13, i64 43, !13, i64 44, !8, i64 48, !8, i64 52, !8, i64 56, !8, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !8, i64 76, !13, i64 80}
!18 = !{!19, !13, i64 0}
!19 = !{!"_ZTS10GUIManager", !13, i64 0, !13, i64 1, !13, i64 2, !13, i64 3}
!20 = !{!19, !13, i64 1}
!21 = !{!6, !13, i64 43}
!22 = !{!6, !12, i64 16}
!23 = !{!24, !12, i64 0}
!24 = !{!"_ZTS12SceneManager", !12, i64 0, !11, i64 8}
!25 = !{!26, !13, i64 0}
!26 = !{!"_ZTS8Particle", !13, i64 0, !7, i64 4, !7, i64 12, !8, i64 20, !8, i64 24, !8, i64 28, !7, i64 32, !9, i64 40}
!27 = !{!19, !13, i64 2}
!28 = !{!24, !11, i64 8}
!29 = !{!17, !13, i64 28}


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