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

; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"struct.glimg::Dimensions" = type { i32, i32, i32, i32 }
%"class.glimg::ImageFormat" = type { %"struct.glimg::UncheckedImageFormat" }
%"struct.glimg::UncheckedImageFormat" = type { i32, i32, i32, i32, i32 }
%"class.glimg::SingleImage" = type <{ %"class.std::shared_ptr", i32, i32, i32, [4 x i8] }>
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@g_texDefs = external dso_local global [2 x %struct.TexDef], align 16
@g_lightTextures = external dso_local global [2 x i32], align 4
@_ZTISt9exception = external constant ptr
@_funcptr_glGenTextures = external global ptr, align 8
@_funcptr_glBindTexture = external global ptr, align 8
@_funcptr_glTexParameteri = external global ptr, align 8
@_funcptr_glCompressedTexImage2D = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [4 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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12LoadTexturesv() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator", align 1
  %8 = alloca %"class.std::unique_ptr", align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca %"struct.glimg::Dimensions", align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.glimg::ImageFormat", align 4
  %14 = alloca i32, align 4
  %15 = alloca %"class.glimg::SingleImage", align 8
  %16 = alloca ptr, align 8
  %17 = load ptr, ptr @_funcptr_glGenTextures, align 8, !tbaa !5
  invoke void %17(i32 noundef 2, ptr noundef @g_lightTextures)
          to label %18 unwind label %23

18:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %127, %18
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = icmp slt i32 %20, 2
  br i1 %21, label %27, label %22

22:                                               ; preds = %19
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %153

23:                                               ; preds = %0
  %24 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %1, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %2, align 4
  br label %139

27:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #7
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [2 x %struct.TexDef], ptr @g_texDefs, i64 0, i64 %29
  %31 = getelementptr inbounds %struct.TexDef, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef %32, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %33 unwind label %64

33:                                               ; preds = %27
  invoke void @_ZN9Framework15FindFileOrThrowERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %34 unwind label %68

34:                                               ; preds = %33
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #7
  %35 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef %35, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %36 unwind label %73

36:                                               ; preds = %34
  %37 = invoke noundef ptr @_ZN5glimg7loaders3dds12LoadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %38 unwind label %77

38:                                               ; preds = %36
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef %37) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #7
  %39 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %40 = load i32, ptr %3, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [2 x i32], ptr @g_lightTextures, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !9
  invoke void %39(i32 noundef 34067, i32 noundef %43)
          to label %44 unwind label %82

44:                                               ; preds = %38
  %45 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %45(i32 noundef 34067, i32 noundef 33084, i32 noundef 0)
          to label %46 unwind label %82

46:                                               ; preds = %44
  %47 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %47(i32 noundef 34067, i32 noundef 33085, i32 noundef 0)
          to label %48 unwind label %82

48:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  %49 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %50 = invoke { i64, i64 } @_ZNK5glimg8ImageSet13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(16) %49)
          to label %51 unwind label %86

51:                                               ; preds = %48
  %52 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 0
  %53 = extractvalue { i64, i64 } %50, 0
  store i64 %53, ptr %52, align 4
  %54 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 1
  %55 = extractvalue { i64, i64 } %50, 1
  store i64 %55, ptr %54, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 20, ptr %13) #7
  %56 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  invoke void @_ZNK5glimg8ImageSet9GetFormatEv(ptr dead_on_unwind writable sret(%"class.glimg::ImageFormat") align 4 %13, ptr noundef nonnull align 8 dereferenceable(16) %56)
          to label %57 unwind label %90

57:                                               ; preds = %51
  %58 = invoke noundef i32 @_ZN5glimg17GetInternalFormatERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20) %13, i32 noundef 0)
          to label %59 unwind label %90

59:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 20, ptr %13) #7
  store i32 %58, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %112, %59
  %61 = load i32, ptr %14, align 4, !tbaa !9
  %62 = icmp slt i32 %61, 6
  br i1 %62, label %94, label %63

63:                                               ; preds = %60
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %124

64:                                               ; preds = %27
  %65 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %1, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %2, align 4
  br label %72

68:                                               ; preds = %33
  %69 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %1, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %2, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #7
  br label %72

72:                                               ; preds = %68, %64
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #7
  br label %138

73:                                               ; preds = %34
  %74 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %1, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %2, align 4
  br label %81

77:                                               ; preds = %36
  %78 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %1, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %2, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #7
  br label %81

81:                                               ; preds = %77, %73
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #7
  br label %137

82:                                               ; preds = %46, %44, %38
  %83 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %1, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %2, align 4
  br label %136

86:                                               ; preds = %48
  %87 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %1, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %2, align 4
  br label %135

90:                                               ; preds = %57, %51
  %91 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %1, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 20, ptr %13) #7
  br label %134

94:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #7
  %95 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %96 = load i32, ptr %14, align 4, !tbaa !9
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind writable sret(%"class.glimg::SingleImage") align 8 %15, ptr noundef nonnull align 8 dereferenceable(16) %95, i32 noundef 0, i32 noundef 0, i32 noundef %96)
          to label %97 unwind label %115

97:                                               ; preds = %94
  %98 = load ptr, ptr @_funcptr_glCompressedTexImage2D, align 8, !tbaa !5
  %99 = load i32, ptr %14, align 4, !tbaa !9
  %100 = add nsw i32 34069, %99
  %101 = load i32, ptr %12, align 4, !tbaa !9
  %102 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %11, i32 0, i32 1
  %103 = load i32, ptr %102, align 4, !tbaa !13
  %104 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %11, i32 0, i32 2
  %105 = load i32, ptr %104, align 4, !tbaa !15
  %106 = invoke noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %15)
          to label %107 unwind label %119

107:                                              ; preds = %97
  %108 = trunc i64 %106 to i32
  %109 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %15)
          to label %110 unwind label %119

110:                                              ; preds = %107
  invoke void %98(i32 noundef %100, i32 noundef 0, i32 noundef %101, i32 noundef %103, i32 noundef %105, i32 noundef 0, i32 noundef %108, ptr noundef %109)
          to label %111 unwind label %119

111:                                              ; preds = %110
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %15) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #7
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %14, align 4, !tbaa !9
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %14, align 4, !tbaa !9
  br label %60, !llvm.loop !16

115:                                              ; preds = %94
  %116 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %1, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %2, align 4
  br label %123

119:                                              ; preds = %110, %107, %97
  %120 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %121 = extractvalue { ptr, i32 } %120, 0
  store ptr %121, ptr %1, align 8
  %122 = extractvalue { ptr, i32 } %120, 1
  store i32 %122, ptr %2, align 4
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %15) #7
  br label %123

123:                                              ; preds = %119, %115
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %134

124:                                              ; preds = %63
  %125 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  invoke void %125(i32 noundef 34067, i32 noundef 0)
          to label %126 unwind label %130

126:                                              ; preds = %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #7
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %3, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %3, align 4, !tbaa !9
  br label %19, !llvm.loop !18

130:                                              ; preds = %124
  %131 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %1, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %2, align 4
  br label %134

134:                                              ; preds = %130, %123, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %135

135:                                              ; preds = %134, %86
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  br label %136

136:                                              ; preds = %135, %82
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br label %137

137:                                              ; preds = %136, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  br label %138

138:                                              ; preds = %137, %72
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %139

139:                                              ; preds = %138, %23
  %140 = load i32, ptr %2, align 4
  %141 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #7
  %142 = icmp eq i32 %140, %141
  br i1 %142, label %143, label %160

143:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %144 = load ptr, ptr %1, align 8
  %145 = call ptr @__cxa_begin_catch(ptr %144) #7
  store ptr %145, ptr %16, align 8
  %146 = load ptr, ptr %16, align 8, !tbaa !5
  %147 = load ptr, ptr %146, align 8, !tbaa !19
  %148 = getelementptr inbounds ptr, ptr %147, i64 2
  %149 = load ptr, ptr %148, align 8
  %150 = call noundef ptr %149(ptr noundef nonnull align 8 dereferenceable(8) %146) #7
  %151 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %150)
          to label %152 unwind label %154

152:                                              ; preds = %143
  invoke void @__cxa_rethrow() #8
          to label %168 unwind label %154

153:                                              ; preds = %22
  br label %159

154:                                              ; preds = %152, %143
  %155 = landingpad { ptr, i32 }
          cleanup
  %156 = extractvalue { ptr, i32 } %155, 0
  store ptr %156, ptr %1, align 8
  %157 = extractvalue { ptr, i32 } %155, 1
  store i32 %157, ptr %2, align 4
  invoke void @__cxa_end_catch()
          to label %158 unwind label %165

158:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %160

159:                                              ; preds = %153
  ret void

160:                                              ; preds = %158, %139
  %161 = load ptr, ptr %1, align 8
  %162 = load i32, ptr %2, align 4
  %163 = insertvalue { ptr, i32 } poison, ptr %161, 0
  %164 = insertvalue { ptr, i32 } %163, i32 %162, 1
  resume { ptr, i32 } %164

165:                                              ; preds = %154
  %166 = landingpad { ptr, i32 }
          catch ptr null
  %167 = extractvalue { ptr, i32 } %166, 0
  call void @__clang_call_terminate(ptr %167) #9
  unreachable

168:                                              ; preds = %152
  unreachable
}

declare i32 @__gxx_personality_v0(...)

declare void @_ZN9Framework15FindFileOrThrowERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

declare noundef ptr @_ZN5glimg7loaders3dds12LoadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

declare { i64, i64 } @_ZNK5glimg8ImageSet13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(16)) #2

declare noundef i32 @_ZN5glimg17GetInternalFormatERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20), i32 noundef) #2

declare void @_ZNK5glimg8ImageSet9GetFormatEv(ptr dead_on_unwind writable sret(%"class.glimg::ImageFormat") align 4, ptr noundef nonnull align 8 dereferenceable(16)) #2

declare void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind writable sret(%"class.glimg::SingleImage") align 8, ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef, i32 noundef) #2

declare noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28)) #2

declare noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28)) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

declare ptr @__cxa_begin_catch(ptr)

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

declare void @__cxa_rethrow()

declare void @__cxa_end_catch()

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nounwind memory(none) }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn }
attributes #9 = { 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 = !{!"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, !6, i64 0}
!12 = !{!"_ZTS6TexDef", !6, i64 0, !6, i64 8}
!13 = !{!14, !10, i64 4}
!14 = !{!"_ZTSN5glimg10DimensionsE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!15 = !{!14, !10, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.TexDef = type { ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"class.glimg::ImageFormat" = type { %"struct.glimg::UncheckedImageFormat" }
%"struct.glimg::UncheckedImageFormat" = type { i32, i32, i32, i32, i32 }
%"class.glimg::SingleImage" = type <{ %"class.std::shared_ptr", i32, i32, i32, [4 x i8] }>
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@g_texDefs = external dso_local local_unnamed_addr global [2 x %struct.TexDef], align 16
@g_lightTextures = external dso_local global [2 x i32], align 4
@_ZTISt9exception = external constant ptr
@_funcptr_glGenTextures = external local_unnamed_addr global ptr, align 8
@_funcptr_glBindTexture = external local_unnamed_addr global ptr, align 8
@_funcptr_glTexParameteri = external local_unnamed_addr global ptr, align 8
@_funcptr_glCompressedTexImage2D = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [4 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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12LoadTexturesv() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca %"class.std::unique_ptr", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = alloca %"class.glimg::ImageFormat", align 4
  %8 = alloca %"class.glimg::SingleImage", align 8
  %9 = load ptr, ptr @_funcptr_glGenTextures, align 8, !tbaa !5
  invoke void %9(i32 noundef 2, ptr noundef nonnull @g_lightTextures)
          to label %.preheader unwind label %11

10:                                               ; preds = %115
  ret void

11:                                               ; preds = %0
  %12 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
  br label %121

.preheader:                                       ; preds = %0, %115
  %13 = phi i1 [ false, %115 ], [ true, %0 ]
  %indvars.iv = phi i64 [ 1, %115 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #8
  %14 = getelementptr inbounds [2 x %struct.TexDef], ptr @g_texDefs, i64 0, i64 %indvars.iv
  %15 = load ptr, ptr %14, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef %15, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %16 unwind label %40

16:                                               ; preds = %.preheader
  invoke void @_ZN9Framework15FindFileOrThrowERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %1, ptr noundef nonnull align 8 dereferenceable(32) %2)
          to label %17 unwind label %42

17:                                               ; preds = %16
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #8
  %18 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef %18, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %19 unwind label %45

19:                                               ; preds = %17
  %20 = invoke noundef ptr @_ZN5glimg7loaders3dds12LoadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %21 unwind label %47

21:                                               ; preds = %19
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %20) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  %22 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %23 = getelementptr inbounds [2 x i32], ptr @g_lightTextures, i64 0, i64 %indvars.iv
  %24 = load i32, ptr %23, align 4, !tbaa !11
  invoke void %22(i32 noundef 34067, i32 noundef %24)
          to label %25 unwind label %50

25:                                               ; preds = %21
  %26 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %26(i32 noundef 34067, i32 noundef 33084, i32 noundef 0)
          to label %27 unwind label %50

27:                                               ; preds = %25
  %28 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %28(i32 noundef 34067, i32 noundef 33085, i32 noundef 0)
          to label %29 unwind label %50

29:                                               ; preds = %27
  %30 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  %31 = invoke { i64, i64 } @_ZNK5glimg8ImageSet13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(16) %30)
          to label %32 unwind label %52

32:                                               ; preds = %29
  %33 = extractvalue { i64, i64 } %31, 0
  %34 = extractvalue { i64, i64 } %31, 1
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %7) #8
  %35 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  invoke void @_ZNK5glimg8ImageSet9GetFormatEv(ptr dead_on_unwind nonnull writable sret(%"class.glimg::ImageFormat") align 4 %7, ptr noundef nonnull align 8 dereferenceable(16) %35)
          to label %36 unwind label %54

36:                                               ; preds = %32
  %37 = invoke noundef i32 @_ZN5glimg17GetInternalFormatERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20) %7, i32 noundef 0)
          to label %38 unwind label %54

38:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #8
  %.sroa.0.4.extract.shift = lshr i64 %33, 32
  %.sroa.0.4.extract.trunc = trunc nuw i64 %.sroa.0.4.extract.shift to i32
  %.sroa.5.8.extract.trunc = trunc i64 %34 to i32
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %39 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind nonnull writable sret(%"class.glimg::SingleImage") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %39, i32 noundef 0, i32 noundef 0, i32 noundef 0)
          to label %56 unwind label %110

40:                                               ; preds = %.preheader
  %41 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %44

42:                                               ; preds = %16
  %43 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  br label %44

44:                                               ; preds = %42, %40
  %.pn = phi { ptr, i32 } [ %43, %42 ], [ %41, %40 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #8
  br label %120

45:                                               ; preds = %17
  %46 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %49

47:                                               ; preds = %19
  %48 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  br label %49

49:                                               ; preds = %47, %45
  %.pn26 = phi { ptr, i32 } [ %48, %47 ], [ %46, %45 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  br label %119

50:                                               ; preds = %27, %25, %21
  %51 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %118

52:                                               ; preds = %29
  %53 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %118

54:                                               ; preds = %36, %32
  %55 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #8
  br label %118

56:                                               ; preds = %38
  %57 = load ptr, ptr @_funcptr_glCompressedTexImage2D, align 8, !tbaa !5
  %58 = invoke noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %59 unwind label %112

59:                                               ; preds = %56
  %60 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %61 unwind label %112

61:                                               ; preds = %59
  %62 = trunc i64 %58 to i32
  invoke void %57(i32 noundef 34069, i32 noundef 0, i32 noundef %37, i32 noundef %.sroa.0.4.extract.trunc, i32 noundef %.sroa.5.8.extract.trunc, i32 noundef 0, i32 noundef %62, ptr noundef %60)
          to label %63 unwind label %112

63:                                               ; preds = %61
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %64 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind nonnull writable sret(%"class.glimg::SingleImage") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %64, i32 noundef 0, i32 noundef 0, i32 noundef 1)
          to label %65 unwind label %110

65:                                               ; preds = %63
  %66 = load ptr, ptr @_funcptr_glCompressedTexImage2D, align 8, !tbaa !5
  %67 = invoke noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %68 unwind label %112

68:                                               ; preds = %65
  %69 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %70 unwind label %112

70:                                               ; preds = %68
  %71 = trunc i64 %67 to i32
  invoke void %66(i32 noundef 34070, i32 noundef 0, i32 noundef %37, i32 noundef %.sroa.0.4.extract.trunc, i32 noundef %.sroa.5.8.extract.trunc, i32 noundef 0, i32 noundef %71, ptr noundef %69)
          to label %72 unwind label %112

72:                                               ; preds = %70
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %73 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind nonnull writable sret(%"class.glimg::SingleImage") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %73, i32 noundef 0, i32 noundef 0, i32 noundef 2)
          to label %74 unwind label %110

74:                                               ; preds = %72
  %75 = load ptr, ptr @_funcptr_glCompressedTexImage2D, align 8, !tbaa !5
  %76 = invoke noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %77 unwind label %112

77:                                               ; preds = %74
  %78 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %79 unwind label %112

79:                                               ; preds = %77
  %80 = trunc i64 %76 to i32
  invoke void %75(i32 noundef 34071, i32 noundef 0, i32 noundef %37, i32 noundef %.sroa.0.4.extract.trunc, i32 noundef %.sroa.5.8.extract.trunc, i32 noundef 0, i32 noundef %80, ptr noundef %78)
          to label %81 unwind label %112

81:                                               ; preds = %79
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %82 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind nonnull writable sret(%"class.glimg::SingleImage") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %82, i32 noundef 0, i32 noundef 0, i32 noundef 3)
          to label %83 unwind label %110

83:                                               ; preds = %81
  %84 = load ptr, ptr @_funcptr_glCompressedTexImage2D, align 8, !tbaa !5
  %85 = invoke noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %86 unwind label %112

86:                                               ; preds = %83
  %87 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %88 unwind label %112

88:                                               ; preds = %86
  %89 = trunc i64 %85 to i32
  invoke void %84(i32 noundef 34072, i32 noundef 0, i32 noundef %37, i32 noundef %.sroa.0.4.extract.trunc, i32 noundef %.sroa.5.8.extract.trunc, i32 noundef 0, i32 noundef %89, ptr noundef %87)
          to label %90 unwind label %112

90:                                               ; preds = %88
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %91 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind nonnull writable sret(%"class.glimg::SingleImage") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %91, i32 noundef 0, i32 noundef 0, i32 noundef 4)
          to label %92 unwind label %110

92:                                               ; preds = %90
  %93 = load ptr, ptr @_funcptr_glCompressedTexImage2D, align 8, !tbaa !5
  %94 = invoke noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %95 unwind label %112

95:                                               ; preds = %92
  %96 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %97 unwind label %112

97:                                               ; preds = %95
  %98 = trunc i64 %94 to i32
  invoke void %93(i32 noundef 34073, i32 noundef 0, i32 noundef %37, i32 noundef %.sroa.0.4.extract.trunc, i32 noundef %.sroa.5.8.extract.trunc, i32 noundef 0, i32 noundef %98, ptr noundef %96)
          to label %99 unwind label %112

99:                                               ; preds = %97
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %100 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind nonnull writable sret(%"class.glimg::SingleImage") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %100, i32 noundef 0, i32 noundef 0, i32 noundef 5)
          to label %101 unwind label %110

101:                                              ; preds = %99
  %102 = load ptr, ptr @_funcptr_glCompressedTexImage2D, align 8, !tbaa !5
  %103 = invoke noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %104 unwind label %112

104:                                              ; preds = %101
  %105 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %106 unwind label %112

106:                                              ; preds = %104
  %107 = trunc i64 %103 to i32
  invoke void %102(i32 noundef 34074, i32 noundef 0, i32 noundef %37, i32 noundef %.sroa.0.4.extract.trunc, i32 noundef %.sroa.5.8.extract.trunc, i32 noundef 0, i32 noundef %107, ptr noundef %105)
          to label %108 unwind label %112

108:                                              ; preds = %106
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  %109 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  invoke void %109(i32 noundef 34067, i32 noundef 0)
          to label %115 unwind label %116

110:                                              ; preds = %99, %90, %81, %72, %63, %38
  %111 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %114

112:                                              ; preds = %106, %104, %101, %97, %95, %92, %88, %86, %83, %79, %77, %74, %70, %68, %65, %61, %59, %56
  %113 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  br label %114

114:                                              ; preds = %112, %110
  %.pn28 = phi { ptr, i32 } [ %113, %112 ], [ %111, %110 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  br label %118

115:                                              ; preds = %108
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  br i1 %13, label %.preheader, label %10, !llvm.loop !13

116:                                              ; preds = %108
  %117 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %118

118:                                              ; preds = %52, %116, %114, %54, %50
  %.pn28.pn.pn.pn = phi { ptr, i32 } [ %51, %50 ], [ %53, %52 ], [ %.pn28, %114 ], [ %117, %116 ], [ %55, %54 ]
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  br label %119

119:                                              ; preds = %118, %49
  %.pn28.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn28.pn.pn.pn, %118 ], [ %.pn26, %49 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  br label %120

120:                                              ; preds = %119, %44
  %.pn28.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn28.pn.pn.pn.pn, %119 ], [ %.pn, %44 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  br label %121

121:                                              ; preds = %120, %11
  %.pn28.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn28.pn.pn.pn.pn.pn, %120 ], [ %12, %11 ]
  %.822 = extractvalue { ptr, i32 } %.pn28.pn.pn.pn.pn.pn.pn, 1
  %122 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #8
  %123 = icmp eq i32 %.822, %122
  br i1 %123, label %124, label %133

124:                                              ; preds = %121
  %.8 = extractvalue { ptr, i32 } %.pn28.pn.pn.pn.pn.pn.pn, 0
  %125 = call ptr @__cxa_begin_catch(ptr %.8) #8
  %126 = load ptr, ptr %125, align 8, !tbaa !15
  %127 = getelementptr inbounds i8, ptr %126, i64 16
  %128 = load ptr, ptr %127, align 8
  %129 = call noundef ptr %128(ptr noundef nonnull align 8 dereferenceable(8) %125) #8
  %130 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %129)
  invoke void @__cxa_rethrow() #9
          to label %137 unwind label %131

131:                                              ; preds = %124
  %132 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %133 unwind label %134

133:                                              ; preds = %131, %121
  %.merged = phi { ptr, i32 } [ %.pn28.pn.pn.pn.pn.pn.pn, %121 ], [ %132, %131 ]
  resume { ptr, i32 } %.merged

134:                                              ; preds = %131
  %135 = landingpad { ptr, i32 }
          catch ptr null
  %136 = extractvalue { ptr, i32 } %135, 0
  call void @__clang_call_terminate(ptr %136) #10
  unreachable

137:                                              ; preds = %124
  unreachable
}

declare i32 @__gxx_personality_v0(...)

declare void @_ZN9Framework15FindFileOrThrowERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

declare noundef ptr @_ZN5glimg7loaders3dds12LoadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

declare { i64, i64 } @_ZNK5glimg8ImageSet13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

declare noundef i32 @_ZN5glimg17GetInternalFormatERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20), i32 noundef) local_unnamed_addr #2

declare void @_ZNK5glimg8ImageSet9GetFormatEv(ptr dead_on_unwind writable sret(%"class.glimg::ImageFormat") align 4, ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

declare void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind writable sret(%"class.glimg::SingleImage") align 8, ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

declare noundef i64 @_ZNK5glimg11SingleImage16GetImageByteSizeEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #2

declare noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

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

declare void @__cxa_rethrow() local_unnamed_addr

declare void @__cxa_end_catch() local_unnamed_addr

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nofree nosync nounwind memory(none) }
attributes #6 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { noreturn }
attributes #10 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS6TexDef", !6, i64 0, !6, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"vtable pointer", !8, i64 0}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass