; LLVM IR from paroj/gltut :: Tut 16 Gamma and Textures/GammaLandscape.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"

%"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.0" = 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.4" }
%"struct.std::_Head_base.4" = type { ptr }
%"struct.glimg::OpenGLPixelTransferParams" = type { 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 }
%"struct.glimg::Dimensions" = type { i32, i32, i32, i32 }

@g_linearTexture = external dso_local global i32, align 4
@_ZTISt9exception = external constant ptr
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@_funcptr_glGenTextures = external global ptr, align 8
@_funcptr_glBindTexture = external global ptr, align 8
@_funcptr_glTexImage2D = external global ptr, align 8
@_funcptr_glTexParameteri = external global ptr, align 8
@.str.11 = 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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12LoadTexturesv() #3 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.0", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::unique_ptr", align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::allocator.0", align 1
  %9 = alloca %"struct.glimg::OpenGLPixelTransferParams", align 4
  %10 = alloca %"class.glimg::ImageFormat", align 4
  %11 = alloca { i64, i32 }, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.glimg::SingleImage", align 8
  %14 = alloca %"struct.glimg::Dimensions", align 4
  %15 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %1) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %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 @.str.10, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %16 unwind label %38

16:                                               ; preds = %0
  invoke void @_ZN9Framework15FindFileOrThrowERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind 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 %3) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #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 %8) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef %18, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %19 unwind label %47

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

21:                                               ; preds = %19
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef %20) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #8
  %22 = load ptr, ptr @_funcptr_glGenTextures, align 8, !tbaa !5
  invoke void %22(i32 noundef 1, ptr noundef @g_linearTexture)
          to label %23 unwind label %56

23:                                               ; preds = %21
  %24 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %25 = load i32, ptr @g_linearTexture, align 4, !tbaa !9
  invoke void %24(i32 noundef 3553, i32 noundef %25)
          to label %26 unwind label %56

26:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 20, ptr %10) #8
  %27 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  invoke void @_ZNK5glimg8ImageSet9GetFormatEv(ptr dead_on_unwind writable sret(%"class.glimg::ImageFormat") align 4 %10, ptr noundef nonnull align 8 dereferenceable(16) %27)
          to label %28 unwind label %60

28:                                               ; preds = %26
  %29 = invoke { i64, i32 } @_ZN5glimg19GetUploadFormatTypeERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20) %10, i32 noundef 0)
          to label %30 unwind label %60

30:                                               ; preds = %28
  store { i64, i32 } %29, ptr %11, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 8 %11, i64 12, i1 false)
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %91, %30
  %32 = load i32, ptr %12, align 4, !tbaa !9
  %33 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %34 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %33)
          to label %35 unwind label %64

35:                                               ; preds = %31
  %36 = icmp slt i32 %32, %34
  br i1 %36, label %68, label %37

37:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %104

38:                                               ; preds = %0
  %39 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %4, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %5, align 4
  br label %46

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

46:                                               ; preds = %42, %38
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #8
  br label %122

47:                                               ; preds = %17
  %48 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %4, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %5, align 4
  br label %55

51:                                               ; preds = %19
  %52 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %4, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  br label %55

55:                                               ; preds = %51, %47
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #8
  br label %121

56:                                               ; preds = %23, %21
  %57 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %4, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %5, align 4
  br label %120

60:                                               ; preds = %28, %26
  %61 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %4, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #8
  br label %119

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

68:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #8
  %69 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %70 = load i32, ptr %12, align 4, !tbaa !9
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind writable sret(%"class.glimg::SingleImage") align 8 %13, ptr noundef nonnull align 8 dereferenceable(16) %69, i32 noundef %70, i32 noundef 0, i32 noundef 0)
          to label %71 unwind label %94

71:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #8
  %72 = invoke { i64, i64 } @_ZNK5glimg11SingleImage13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(28) %13)
          to label %73 unwind label %98

73:                                               ; preds = %71
  %74 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %75 = extractvalue { i64, i64 } %72, 0
  store i64 %75, ptr %74, align 4
  %76 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %77 = extractvalue { i64, i64 } %72, 1
  store i64 %77, ptr %76, align 4
  %78 = load ptr, ptr @_funcptr_glTexImage2D, align 8, !tbaa !5
  %79 = load i32, ptr %12, align 4, !tbaa !9
  %80 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %14, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !11
  %82 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %14, i32 0, i32 2
  %83 = load i32, ptr %82, align 4, !tbaa !13
  %84 = getelementptr inbounds %"struct.glimg::OpenGLPixelTransferParams", ptr %9, i32 0, i32 0
  %85 = load i32, ptr %84, align 4, !tbaa !14
  %86 = getelementptr inbounds %"struct.glimg::OpenGLPixelTransferParams", ptr %9, i32 0, i32 1
  %87 = load i32, ptr %86, align 4, !tbaa !16
  %88 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %13)
          to label %89 unwind label %98

89:                                               ; preds = %73
  invoke void %78(i32 noundef 3553, i32 noundef %79, i32 noundef 35907, i32 noundef %81, i32 noundef %83, i32 noundef 0, i32 noundef %85, i32 noundef %87, ptr noundef %88)
          to label %90 unwind label %98

90:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %13) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #8
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %12, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %12, align 4, !tbaa !9
  br label %31, !llvm.loop !17

94:                                               ; preds = %68
  %95 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %4, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %5, align 4
  br label %102

98:                                               ; preds = %89, %73, %71
  %99 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %4, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #8
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %13) #8
  br label %102

102:                                              ; preds = %98, %94
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #8
  br label %103

103:                                              ; preds = %102, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %119

104:                                              ; preds = %37
  %105 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %105(i32 noundef 3553, i32 noundef 33084, i32 noundef 0)
          to label %106 unwind label %115

106:                                              ; preds = %104
  %107 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  %108 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %109 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %108)
          to label %110 unwind label %115

110:                                              ; preds = %106
  %111 = sub nsw i32 %109, 1
  invoke void %107(i32 noundef 3553, i32 noundef 33085, i32 noundef %111)
          to label %112 unwind label %115

112:                                              ; preds = %110
  %113 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  invoke void %113(i32 noundef 3553, i32 noundef 0)
          to label %114 unwind label %115

114:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #8
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #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 %1) #8
  br label %142

115:                                              ; preds = %112, %110, %106, %104
  %116 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %4, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %5, align 4
  br label %119

119:                                              ; preds = %115, %103, %60
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #8
  br label %120

120:                                              ; preds = %119, %56
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  br label %121

121:                                              ; preds = %120, %55
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  br label %122

122:                                              ; preds = %121, %46
  call void @llvm.lifetime.end.p0(i64 32, ptr %1) #8
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %5, align 4
  %125 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #8
  %126 = icmp eq i32 %124, %125
  br i1 %126, label %127, label %143

127:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %128 = load ptr, ptr %4, align 8
  %129 = call ptr @__cxa_begin_catch(ptr %128) #8
  store ptr %129, ptr %15, align 8
  %130 = load ptr, ptr %15, align 8, !tbaa !5
  %131 = load ptr, ptr %130, align 8, !tbaa !19
  %132 = getelementptr inbounds ptr, ptr %131, i64 2
  %133 = load ptr, ptr %132, align 8
  %134 = call noundef ptr %133(ptr noundef nonnull align 8 dereferenceable(8) %130) #8
  %135 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.11, ptr noundef %134)
          to label %136 unwind label %137

136:                                              ; preds = %127
  invoke void @__cxa_rethrow() #9
          to label %151 unwind label %137

137:                                              ; preds = %136, %127
  %138 = landingpad { ptr, i32 }
          cleanup
  %139 = extractvalue { ptr, i32 } %138, 0
  store ptr %139, ptr %4, align 8
  %140 = extractvalue { ptr, i32 } %138, 1
  store i32 %140, ptr %5, align 4
  invoke void @__cxa_end_catch()
          to label %141 unwind label %148

141:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %143

142:                                              ; preds = %114
  ret void

143:                                              ; preds = %141, %123
  %144 = load ptr, ptr %4, align 8
  %145 = load i32, ptr %5, align 4
  %146 = insertvalue { ptr, i32 } poison, ptr %144, 0
  %147 = insertvalue { ptr, i32 } %146, i32 %145, 1
  resume { ptr, i32 } %147

148:                                              ; preds = %137
  %149 = landingpad { ptr, i32 }
          catch ptr null
  %150 = extractvalue { ptr, i32 } %149, 0
  call void @__clang_call_terminate(ptr %150) #10
  unreachable

151:                                              ; preds = %136
  unreachable
}

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)) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 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 #2 align 2

declare { i64, i32 } @_ZN5glimg19GetUploadFormatTypeERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20), i32 noundef) #4

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

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

declare noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16)) #4

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) #4

declare { i64, i64 } @_ZNK5glimg11SingleImage13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(28)) #4

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

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

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

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

declare ptr @__cxa_begin_catch(ptr)

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

declare void @__cxa_rethrow()

declare void @__cxa_end_catch()

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { "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 = { 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 #6 = { nounwind memory(none) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"_ZTSN5glimg10DimensionsE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!13 = !{!12, !10, i64 8}
!14 = !{!15, !10, i64 0}
!15 = !{!"_ZTSN5glimg25OpenGLPixelTransferParamsE", !10, i64 0, !10, i64 4, !10, i64 8}
!16 = !{!15, !10, i64 4}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!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"

%"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.0" = 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.4" }
%"struct.std::_Head_base.4" = 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_linearTexture = external dso_local global i32, align 4
@_ZTISt9exception = external constant ptr
@.str.10 = external hidden unnamed_addr constant [16 x i8], align 1
@_funcptr_glGenTextures = external local_unnamed_addr global ptr, align 8
@_funcptr_glBindTexture = external local_unnamed_addr global ptr, align 8
@_funcptr_glTexImage2D = external local_unnamed_addr global ptr, align 8
@_funcptr_glTexParameteri = external local_unnamed_addr global ptr, align 8
@.str.11 = 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

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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 #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12LoadTexturesv() local_unnamed_addr #2 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.0", align 1
  %4 = alloca %"class.std::unique_ptr", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator.0", align 1
  %7 = alloca %"class.glimg::ImageFormat", align 4
  %8 = alloca %"class.glimg::SingleImage", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #8
  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 nonnull @.str.10, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %9 unwind label %31

9:                                                ; preds = %0
  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 %10 unwind label %33

10:                                               ; preds = %9
  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
  %11 = 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 %11, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %12 unwind label %36

12:                                               ; preds = %10
  %13 = invoke noundef ptr @_ZN5glimg7loaders3dds12LoadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %14 unwind label %38

14:                                               ; preds = %12
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %13) #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
  %15 = load ptr, ptr @_funcptr_glGenTextures, align 8, !tbaa !5
  invoke void %15(i32 noundef 1, ptr noundef nonnull @g_linearTexture)
          to label %16 unwind label %41

16:                                               ; preds = %14
  %17 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %18 = load i32, ptr @g_linearTexture, align 4, !tbaa !9
  invoke void %17(i32 noundef 3553, i32 noundef %18)
          to label %19 unwind label %41

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %7) #8
  %20 = 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) %20)
          to label %21 unwind label %43

21:                                               ; preds = %19
  %22 = invoke { i64, i32 } @_ZN5glimg19GetUploadFormatTypeERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20) %7, i32 noundef 0)
          to label %23 unwind label %43

23:                                               ; preds = %21
  %.fca.0.extract = extractvalue { i64, i32 } %22, 0
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #8
  %.sroa.05.4.extract.shift = lshr i64 %.fca.0.extract, 32
  %.sroa.05.4.extract.trunc = trunc nuw i64 %.sroa.05.4.extract.shift to i32
  %.sroa.05.0.extract.trunc = trunc i64 %.fca.0.extract to i32
  br label %24

24:                                               ; preds = %57, %23
  %.019 = phi i32 [ 0, %23 ], [ %58, %57 ]
  %25 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  %26 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %25)
          to label %27 unwind label %45

27:                                               ; preds = %24
  %28 = icmp slt i32 %.019, %26
  br i1 %28, label %47, label %29

29:                                               ; preds = %27
  %30 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %30(i32 noundef 3553, i32 noundef 33084, i32 noundef 0)
          to label %64 unwind label %73

31:                                               ; preds = %0
  %32 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %35

33:                                               ; preds = %9
  %34 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #8
  br label %35

35:                                               ; preds = %33, %31
  %.pn = phi { ptr, i32 } [ %34, %33 ], [ %32, %31 ]
  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 %77

36:                                               ; preds = %10
  %37 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %40

38:                                               ; preds = %12
  %39 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  br label %40

40:                                               ; preds = %38, %36
  %.pn21 = phi { ptr, i32 } [ %39, %38 ], [ %37, %36 ]
  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 %76

41:                                               ; preds = %16, %14
  %42 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %75

43:                                               ; preds = %21, %19
  %44 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #8
  br label %75

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

47:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #8
  %48 = 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) %48, i32 noundef %.019, i32 noundef 0, i32 noundef 0)
          to label %49 unwind label %59

49:                                               ; preds = %47
  %50 = invoke { i64, i64 } @_ZNK5glimg11SingleImage13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %51 unwind label %61

51:                                               ; preds = %49
  %52 = load ptr, ptr @_funcptr_glTexImage2D, align 8, !tbaa !5
  %53 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %54 unwind label %61

54:                                               ; preds = %51
  %55 = extractvalue { i64, i64 } %50, 1
  %.sroa.5.8.extract.trunc = trunc i64 %55 to i32
  %56 = extractvalue { i64, i64 } %50, 0
  %.sroa.0.4.extract.shift = lshr i64 %56, 32
  %.sroa.0.4.extract.trunc = trunc nuw i64 %.sroa.0.4.extract.shift to i32
  invoke void %52(i32 noundef 3553, i32 noundef %.019, i32 noundef 35907, i32 noundef %.sroa.0.4.extract.trunc, i32 noundef %.sroa.5.8.extract.trunc, i32 noundef 0, i32 noundef %.sroa.05.0.extract.trunc, i32 noundef %.sroa.05.4.extract.trunc, ptr noundef %53)
          to label %57 unwind label %61

57:                                               ; preds = %54
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  %58 = add nuw nsw i32 %.019, 1
  br label %24, !llvm.loop !11

59:                                               ; preds = %47
  %60 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %63

61:                                               ; preds = %54, %51, %49
  %62 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  br label %63

63:                                               ; preds = %61, %59
  %.pn23 = phi { ptr, i32 } [ %62, %61 ], [ %60, %59 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #8
  br label %75

64:                                               ; preds = %29
  %65 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  %66 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  %67 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %66)
          to label %68 unwind label %73

68:                                               ; preds = %64
  %69 = add nsw i32 %67, -1
  invoke void %65(i32 noundef 3553, i32 noundef 33085, i32 noundef %69)
          to label %70 unwind label %73

70:                                               ; preds = %68
  %71 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  invoke void %71(i32 noundef 3553, i32 noundef 0)
          to label %72 unwind label %73

72:                                               ; preds = %70
  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
  ret void

73:                                               ; preds = %70, %68, %64, %29
  %74 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %75

75:                                               ; preds = %43, %73, %63, %45, %41
  %.pn23.pn.pn.pn = phi { ptr, i32 } [ %42, %41 ], [ %74, %73 ], [ %44, %43 ], [ %.pn23, %63 ], [ %46, %45 ]
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #8
  br label %76

76:                                               ; preds = %75, %40
  %.pn23.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn23.pn.pn.pn, %75 ], [ %.pn21, %40 ]
  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 %77

77:                                               ; preds = %76, %35
  %.pn23.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn23.pn.pn.pn.pn, %76 ], [ %.pn, %35 ]
  %.717 = extractvalue { ptr, i32 } %.pn23.pn.pn.pn.pn.pn, 1
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  %78 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #8
  %79 = icmp eq i32 %.717, %78
  br i1 %79, label %80, label %89

80:                                               ; preds = %77
  %.7 = extractvalue { ptr, i32 } %.pn23.pn.pn.pn.pn.pn, 0
  %81 = call ptr @__cxa_begin_catch(ptr %.7) #8
  %82 = load ptr, ptr %81, align 8, !tbaa !13
  %83 = getelementptr inbounds i8, ptr %82, i64 16
  %84 = load ptr, ptr %83, align 8
  %85 = call noundef ptr %84(ptr noundef nonnull align 8 dereferenceable(8) %81) #8
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, ptr noundef %85)
  invoke void @__cxa_rethrow() #9
          to label %93 unwind label %87

87:                                               ; preds = %80
  %88 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %89 unwind label %90

89:                                               ; preds = %87, %77
  %.merged = phi { ptr, i32 } [ %.pn23.pn.pn.pn.pn.pn, %77 ], [ %88, %87 ]
  resume { ptr, i32 } %.merged

90:                                               ; preds = %87
  %91 = landingpad { ptr, i32 }
          catch ptr null
  %92 = extractvalue { ptr, i32 } %91, 0
  call void @__clang_call_terminate(ptr %92) #10
  unreachable

93:                                               ; preds = %80
  unreachable
}

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 #3

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 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 #1 align 2

declare { i64, i32 } @_ZN5glimg19GetUploadFormatTypeERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 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 #3

declare noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

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 #3

declare { i64, i64 } @_ZNK5glimg11SingleImage13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #3

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}


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