; LLVM IR from paroj/gltut :: Tut 17 Spotlight on Textures/ProjectedLight.ll (Z8keyboardhii)

; 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.TexDef = type { ptr, ptr }
%"class.glutil::ViewPole" = type <{ %"class.glutil::ViewProvider", %"struct.glutil::ViewData", %"struct.glutil::ViewScale", %"struct.glutil::ViewData", i32, i8, i8, [2 x i8], i32, float, %"struct.glm::detail::tvec2", %"struct.glm::detail::tquat", [4 x i8] }>
%"class.glutil::ViewProvider" = type { ptr }
%"struct.glutil::ViewScale" = type { float, float, float, float, float, float, float }
%"struct.glutil::ViewData" = type { %"struct.glm::detail::tvec3", %"struct.glm::detail::tquat", float, float }
%"struct.glm::detail::tvec3" = type { %union.anon.2 }
%union.anon.2 = type { %struct.anon }
%struct.anon = type { float, float, float }
%"struct.glm::detail::tvec2" = type { %union.anon.5 }
%union.anon.5 = type { %struct.anon.6 }
%struct.anon.6 = type { i32, i32 }
%"struct.glm::detail::tquat" = type { float, float, float, float }
%"class.Framework::Timer" = type { i32, float, i8, i8, float, float }

@g_texDefs = external dso_local global [3 x %struct.TexDef], align 16
@g_currTextureIndex = external dso_local global i32, align 4
@_ZTISt9exception = external constant ptr
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@g_viewPole = external dso_local global %"class.glutil::ViewPole", align 8
@g_lightViewPole = external dso_local global %"class.glutil::ViewPole", align 8
@g_pScene = external dso_local global ptr, align 8
@g_timer = external dso_local global %"class.Framework::Timer", align 4
@g_currSampler = external dso_local global i32, align 4
@g_currFOVIndex = external dso_local global i32, align 4
@g_bDrawCameraPos = external dso_local global i8, align 1
@g_bShowOtherLights = external dso_local global i8, align 1
@_ZL11g_lightFOVs = external hidden constant [8 x float], align 16
@.str.34 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [14 x i8], align 1

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #1

declare ptr @__cxa_begin_catch(ptr)

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

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17LoadAndSetupScenev() #4

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8keyboardhii(i8 noundef zeroext %0, i32 noundef %1, i32 noundef %2) #6 personality ptr @__gxx_personality_v0 {
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i8 %0, ptr %4, align 1, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !8
  store i32 %2, ptr %6, align 4, !tbaa !8
  %15 = load i8, ptr %4, align 1, !tbaa !5
  %16 = zext i8 %15 to i32
  switch i32 %16, label %87 [
    i32 27, label %17
    i32 32, label %22
    i32 116, label %23
    i32 103, label %28
    i32 104, label %33
    i32 112, label %37
    i32 13, label %39
    i32 121, label %65
    i32 110, label %76
  ]

17:                                               ; preds = %3
  %18 = load ptr, ptr @g_pScene, align 8, !tbaa !10
  %19 = icmp eq ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void @_ZN9Framework5SceneD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %18) #9
  call void @_ZdlPvm(ptr noundef %18, i64 noundef 8) #10
  br label %21

21:                                               ; preds = %20, %17
  store ptr null, ptr @g_pScene, align 8, !tbaa !10
  call void @glutLeaveMainLoop()
  br label %109

22:                                               ; preds = %3
  call void @_ZN6glutil8ViewPole5ResetEv(ptr noundef nonnull align 8 dereferenceable(148) @g_lightViewPole)
  br label %87

23:                                               ; preds = %3
  %24 = load i8, ptr @g_bDrawCameraPos, align 1, !tbaa !12, !range !14, !noundef !15
  %25 = trunc i8 %24 to i1
  %26 = xor i1 %25, true
  %27 = zext i1 %26 to i8
  store i8 %27, ptr @g_bDrawCameraPos, align 1, !tbaa !12
  br label %87

28:                                               ; preds = %3
  %29 = load i8, ptr @g_bShowOtherLights, align 1, !tbaa !12, !range !14, !noundef !15
  %30 = trunc i8 %29 to i1
  %31 = xor i1 %30, true
  %32 = zext i1 %31 to i8
  store i8 %32, ptr @g_bShowOtherLights, align 1, !tbaa !12
  br label %87

33:                                               ; preds = %3
  %34 = load i32, ptr @g_currSampler, align 4, !tbaa !8
  %35 = add nsw i32 %34, 1
  %36 = srem i32 %35, 2
  store i32 %36, ptr @g_currSampler, align 4, !tbaa !8
  br label %87

37:                                               ; preds = %3
  %38 = call noundef zeroext i1 @_ZN9Framework5Timer11TogglePauseEv(ptr noundef nonnull align 4 dereferenceable(20) @g_timer)
  br label %87

39:                                               ; preds = %3
  invoke void @_Z17LoadAndSetupScenev()
          to label %40 unwind label %41

40:                                               ; preds = %39
  br label %64

41:                                               ; preds = %39
  %42 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %7, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %8, align 4
  br label %45

45:                                               ; preds = %41
  %46 = load i32, ptr %8, align 4
  %47 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #9
  %48 = icmp eq i32 %46, %47
  br i1 %48, label %49, label %110

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %50 = load ptr, ptr %7, align 8
  %51 = call ptr @__cxa_begin_catch(ptr %50) #9
  store ptr %51, ptr %9, align 8
  %52 = load ptr, ptr %9, align 8, !tbaa !10
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = getelementptr inbounds ptr, ptr %53, i64 2
  %55 = load ptr, ptr %54, align 8
  %56 = call noundef ptr %55(ptr noundef nonnull align 8 dereferenceable(8) %52) #9
  %57 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.34, ptr noundef %56)
          to label %58 unwind label %59

58:                                               ; preds = %49
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %109

59:                                               ; preds = %49
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %7, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %8, align 4
  invoke void @__cxa_end_catch()
          to label %63 unwind label %115

63:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %110

64:                                               ; preds = %40
  br label %87

65:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  %66 = load i32, ptr @g_currFOVIndex, align 4, !tbaa !8
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 7, ptr %11, align 4, !tbaa !8
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %69 = load i32, ptr %68, align 4, !tbaa !8
  store i32 %69, ptr @g_currFOVIndex, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  %70 = load i32, ptr @g_currFOVIndex, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [8 x float], ptr @_ZL11g_lightFOVs, i64 0, i64 %71
  %73 = load float, ptr %72, align 4, !tbaa !18
  %74 = fpext float %73 to double
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.35, double noundef %74)
  br label %87

76:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  %77 = load i32, ptr @g_currFOVIndex, align 4, !tbaa !8
  %78 = sub nsw i32 %77, 1
  store i32 %78, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 0, ptr %13, align 4, !tbaa !8
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %80 = load i32, ptr %79, align 4, !tbaa !8
  store i32 %80, ptr @g_currFOVIndex, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  %81 = load i32, ptr @g_currFOVIndex, align 4, !tbaa !8
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [8 x float], ptr @_ZL11g_lightFOVs, i64 0, i64 %82
  %84 = load float, ptr %83, align 4, !tbaa !18
  %85 = fpext float %84 to double
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.35, double noundef %85)
  br label %87

87:                                               ; preds = %76, %65, %64, %37, %33, %28, %23, %22, %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  %88 = load i8, ptr %4, align 1, !tbaa !5
  %89 = zext i8 %88 to i32
  %90 = sub nsw i32 %89, 49
  store i32 %90, ptr %14, align 4, !tbaa !8
  %91 = load i32, ptr %14, align 4, !tbaa !8
  %92 = icmp sle i32 0, %91
  br i1 %92, label %93, label %106

93:                                               ; preds = %87
  %94 = load i32, ptr %14, align 4, !tbaa !8
  %95 = icmp slt i32 %94, 3
  br i1 %95, label %96, label %106

96:                                               ; preds = %93
  %97 = load i8, ptr %4, align 1, !tbaa !5
  %98 = zext i8 %97 to i32
  %99 = sub nsw i32 %98, 49
  store i32 %99, ptr @g_currTextureIndex, align 4, !tbaa !8
  %100 = load i32, ptr @g_currTextureIndex, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [3 x %struct.TexDef], ptr @g_texDefs, i64 0, i64 %101
  %103 = getelementptr inbounds %struct.TexDef, ptr %102, i32 0, i32 1
  %104 = load ptr, ptr %103, align 8, !tbaa !20
  %105 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %104)
  br label %106

106:                                              ; preds = %96, %93, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  %107 = load i8, ptr %4, align 1, !tbaa !5
  call void @_ZN6glutil8ViewPole9CharPressEc(ptr noundef nonnull align 8 dereferenceable(148) @g_viewPole, i8 noundef signext %107)
  %108 = load i8, ptr %4, align 1, !tbaa !5
  call void @_ZN6glutil8ViewPole9CharPressEc(ptr noundef nonnull align 8 dereferenceable(148) @g_lightViewPole, i8 noundef signext %108)
  br label %109

109:                                              ; preds = %106, %58, %21
  ret void

110:                                              ; preds = %63, %45
  %111 = load ptr, ptr %7, align 8
  %112 = load i32, ptr %8, align 4
  %113 = insertvalue { ptr, i32 } poison, ptr %111, 0
  %114 = insertvalue { ptr, i32 } %113, i32 %112, 1
  resume { ptr, i32 } %114

115:                                              ; preds = %59
  %116 = landingpad { ptr, i32 }
          catch ptr null
  %117 = extractvalue { ptr, i32 } %116, 0
  call void @__clang_call_terminate(ptr %117) #11
  unreachable
}

; Function Attrs: nounwind
declare void @_ZN9Framework5SceneD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #7

declare void @glutLeaveMainLoop() #2

declare void @_ZN6glutil8ViewPole5ResetEv(ptr noundef nonnull align 8 dereferenceable(148)) #2

declare noundef zeroext i1 @_ZN9Framework5Timer11TogglePauseEv(ptr noundef nonnull align 4 dereferenceable(20)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #8

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #8

declare void @_ZN6glutil8ViewPole9CharPressEc(ptr noundef nonnull align 8 dereferenceable(148), i8 noundef signext) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind memory(none) }
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 = { noinline noreturn nounwind uwtable "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 = { 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 #5 = { nobuiltin 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 #6 = { 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 #7 = { 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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin nounwind }
attributes #11 = { noreturn 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !6, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"float", !6, i64 0}
!20 = !{!21, !11, i64 8}
!21 = !{!"_ZTS6TexDef", !11, i64 0, !11, i64 8}


; 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.TexDef = type { ptr, ptr }
%"class.glutil::ViewPole" = type <{ %"class.glutil::ViewProvider", %"struct.glutil::ViewData", %"struct.glutil::ViewScale", %"struct.glutil::ViewData", i32, i8, i8, [2 x i8], i32, float, %"struct.glm::detail::tvec2", %"struct.glm::detail::tquat", [4 x i8] }>
%"class.glutil::ViewProvider" = type { ptr }
%"struct.glutil::ViewScale" = type { float, float, float, float, float, float, float }
%"struct.glutil::ViewData" = type { %"struct.glm::detail::tvec3", %"struct.glm::detail::tquat", float, float }
%"struct.glm::detail::tvec3" = type { %union.anon.2 }
%union.anon.2 = type { %struct.anon }
%struct.anon = type { float, float, float }
%"struct.glm::detail::tvec2" = type { %union.anon.5 }
%union.anon.5 = type { %struct.anon.6 }
%struct.anon.6 = type { i32, i32 }
%"struct.glm::detail::tquat" = type { float, float, float, float }
%"class.Framework::Timer" = type { i32, float, i8, i8, float, float }

@g_texDefs = external dso_local local_unnamed_addr global [3 x %struct.TexDef], align 16
@g_currTextureIndex = external dso_local local_unnamed_addr global i32, align 4
@_ZTISt9exception = external constant ptr
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@g_viewPole = external dso_local global %"class.glutil::ViewPole", align 8
@g_lightViewPole = external dso_local global %"class.glutil::ViewPole", align 8
@g_pScene = external dso_local local_unnamed_addr global ptr, align 8
@g_timer = external dso_local global %"class.Framework::Timer", align 4
@g_currSampler = external dso_local local_unnamed_addr global i32, align 4
@g_currFOVIndex = external dso_local local_unnamed_addr global i32, align 4
@g_bDrawCameraPos = external dso_local local_unnamed_addr global i8, align 1
@g_bShowOtherLights = external dso_local local_unnamed_addr global i8, align 1
@_ZL11g_lightFOVs = external hidden local_unnamed_addr constant [8 x float], align 16
@.str.34 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [14 x i8], align 1

; 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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #1

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

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

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z17LoadAndSetupScenev() local_unnamed_addr #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8keyboardhii(i8 noundef zeroext %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #5 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = zext i8 %0 to i32
  switch i8 %0, label %61 [
    i8 27, label %9
    i8 32, label %14
    i8 116, label %15
    i8 103, label %18
    i8 104, label %21
    i8 112, label %25
    i8 13, label %27
    i8 121, label %41
    i8 110, label %51
  ]

9:                                                ; preds = %3
  %10 = load ptr, ptr @g_pScene, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  tail call void @_ZN9Framework5SceneD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #9
  tail call void @_ZdlPvm(ptr noundef nonnull %10, i64 noundef 8) #10
  br label %13

13:                                               ; preds = %12, %9
  store ptr null, ptr @g_pScene, align 8, !tbaa !5
  tail call void @glutLeaveMainLoop()
  br label %69

14:                                               ; preds = %3
  tail call void @_ZN6glutil8ViewPole5ResetEv(ptr noundef nonnull align 8 dereferenceable(148) @g_lightViewPole)
  br label %.thread

15:                                               ; preds = %3
  %16 = load i8, ptr @g_bDrawCameraPos, align 1, !tbaa !9, !range !11, !noundef !12
  %17 = xor i8 %16, 1
  store i8 %17, ptr @g_bDrawCameraPos, align 1, !tbaa !9
  br label %.thread

18:                                               ; preds = %3
  %19 = load i8, ptr @g_bShowOtherLights, align 1, !tbaa !9, !range !11, !noundef !12
  %20 = xor i8 %19, 1
  store i8 %20, ptr @g_bShowOtherLights, align 1, !tbaa !9
  br label %.thread

21:                                               ; preds = %3
  %22 = load i32, ptr @g_currSampler, align 4, !tbaa !13
  %23 = add nsw i32 %22, 1
  %24 = srem i32 %23, 2
  store i32 %24, ptr @g_currSampler, align 4, !tbaa !13
  br label %.thread

25:                                               ; preds = %3
  %26 = tail call noundef zeroext i1 @_ZN9Framework5Timer11TogglePauseEv(ptr noundef nonnull align 4 dereferenceable(20) @g_timer)
  br label %.thread

27:                                               ; preds = %3
  invoke void @_Z17LoadAndSetupScenev()
          to label %.thread unwind label %28

28:                                               ; preds = %27
  %29 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
  %30 = extractvalue { ptr, i32 } %29, 1
  %31 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #9
  %32 = icmp eq i32 %30, %31
  br i1 %32, label %33, label %70

33:                                               ; preds = %28
  %34 = extractvalue { ptr, i32 } %29, 0
  %35 = tail call ptr @__cxa_begin_catch(ptr %34) #9
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %38 = load ptr, ptr %37, align 8
  %39 = tail call noundef ptr %38(ptr noundef nonnull align 8 dereferenceable(8) %35) #9
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, ptr noundef %39)
  tail call void @__cxa_end_catch()
  br label %69

41:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  %42 = load i32, ptr @g_currFOVIndex, align 4, !tbaa !13
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %4, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #9
  store i32 7, ptr %5, align 4, !tbaa !13
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %45 = load i32, ptr %44, align 4, !tbaa !13
  store i32 %45, ptr @g_currFOVIndex, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [8 x float], ptr @_ZL11g_lightFOVs, i64 0, i64 %46
  %48 = load float, ptr %47, align 4, !tbaa !17
  %49 = fpext float %48 to double
  %50 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.35, double noundef %49)
  br label %.thread

51:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #9
  %52 = load i32, ptr @g_currFOVIndex, align 4, !tbaa !13
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr %6, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  store i32 0, ptr %7, align 4, !tbaa !13
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %55 = load i32, ptr %54, align 4, !tbaa !13
  store i32 %55, ptr @g_currFOVIndex, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [8 x float], ptr @_ZL11g_lightFOVs, i64 0, i64 %56
  %58 = load float, ptr %57, align 4, !tbaa !17
  %59 = fpext float %58 to double
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.35, double noundef %59)
  br label %.thread

61:                                               ; preds = %3
  %62 = add i8 %0, -49
  %or.cond = icmp ult i8 %62, 3
  br i1 %or.cond, label %63, label %.thread

63:                                               ; preds = %61
  %64 = add nsw i32 %8, -49
  store i32 %64, ptr @g_currTextureIndex, align 4, !tbaa !13
  %65 = zext nneg i32 %64 to i64
  %66 = getelementptr inbounds [3 x %struct.TexDef], ptr @g_texDefs, i64 0, i64 %65, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !19
  %68 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef %67)
  br label %.thread

.thread:                                          ; preds = %14, %15, %18, %21, %25, %41, %51, %27, %63, %61
  call void @_ZN6glutil8ViewPole9CharPressEc(ptr noundef nonnull align 8 dereferenceable(148) @g_viewPole, i8 noundef signext %0)
  call void @_ZN6glutil8ViewPole9CharPressEc(ptr noundef nonnull align 8 dereferenceable(148) @g_lightViewPole, i8 noundef signext %0)
  br label %69

69:                                               ; preds = %.thread, %33, %13
  ret void

70:                                               ; preds = %28
  resume { ptr, i32 } %29
}

; Function Attrs: nounwind
declare void @_ZN9Framework5SceneD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #6

declare void @glutLeaveMainLoop() local_unnamed_addr #7

declare void @_ZN6glutil8ViewPole5ResetEv(ptr noundef nonnull align 8 dereferenceable(148)) local_unnamed_addr #7

declare noundef zeroext i1 @_ZN9Framework5Timer11TogglePauseEv(ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #8

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #8

declare void @_ZN6glutil8ViewPole9CharPressEc(ptr noundef nonnull align 8 dereferenceable(148), i8 noundef signext) local_unnamed_addr #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nosync nounwind memory(none) }
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 = { 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 #4 = { nobuiltin 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 #5 = { 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 #6 = { 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 #7 = { "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 #8 = { 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 #9 = { nounwind }
attributes #10 = { builtin 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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!20, !6, i64 8}
!20 = !{!"_ZTS6TexDef", !6, i64 0, !6, i64 8}


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