; LLVM IR from paroj/gltut :: Tut 16 Gamma and Textures/GammaRamp.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 }
%"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 }
%"struct.glimg::OpenGLPixelTransferParams" = type { i32, i32, i32 }
%"class.glimg::ImageFormat" = type { %"struct.glimg::UncheckedImageFormat" }
%"struct.glimg::UncheckedImageFormat" = type { i32, i32, i32, i32, i32 }

@g_textures = external dso_local global [2 x i32], align 4
@g_samplerObj = external dso_local global i32, align 4
@_funcptr_glGenTextures = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@_ZTISt9exception = external constant ptr
@_funcptr_glBindTexture = external global ptr, align 8
@_funcptr_glTexImage2D = external global ptr, align 8
@_funcptr_glTexParameteri = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@_funcptr_glGenSamplers = external global ptr, align 8
@_funcptr_glSamplerParameteri = external global ptr, align 8

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.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

declare i32 @__gxx_personality_v0(...)

; 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: 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() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator.0", align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::unique_ptr", align 8
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca %"class.std::allocator.0", align 1
  %8 = alloca %"class.glimg::SingleImage", align 8
  %9 = alloca %"struct.glimg::Dimensions", align 4
  %10 = alloca %"struct.glimg::OpenGLPixelTransferParams", align 4
  %11 = alloca %"class.glimg::ImageFormat", align 4
  %12 = alloca { i64, i32 }, align 8
  %13 = alloca ptr, align 8
  %14 = load ptr, ptr @_funcptr_glGenTextures, align 8, !tbaa !5
  call void %14(i32 noundef 2, ptr noundef @g_textures)
  call void @llvm.lifetime.start.p0(i64 32, ptr %1) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef @.str.5, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %15 unwind label %82

15:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #8
  %16 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef @.str.6)
          to label %17 unwind label %86

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #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 %7) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef %18, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %19 unwind label %90

19:                                               ; preds = %17
  %20 = invoke noundef ptr @_ZN5glimg7loaders3stb12LoadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %6)
          to label %21 unwind label %94

21:                                               ; preds = %19
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %20) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #8
  %22 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind writable sret(%"class.glimg::SingleImage") align 8 %8, ptr noundef nonnull align 8 dereferenceable(16) %22, i32 noundef 0, i32 noundef 0, i32 noundef 0)
          to label %23 unwind label %99

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #8
  %24 = invoke { i64, i64 } @_ZNK5glimg11SingleImage13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %25 unwind label %103

25:                                               ; preds = %23
  %26 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  %27 = extractvalue { i64, i64 } %24, 0
  store i64 %27, ptr %26, align 4
  %28 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  %29 = extractvalue { i64, i64 } %24, 1
  store i64 %29, ptr %28, align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 20, ptr %11) #8
  %30 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  invoke void @_ZNK5glimg8ImageSet9GetFormatEv(ptr dead_on_unwind writable sret(%"class.glimg::ImageFormat") align 4 %11, ptr noundef nonnull align 8 dereferenceable(16) %30)
          to label %31 unwind label %107

31:                                               ; preds = %25
  %32 = invoke { i64, i32 } @_ZN5glimg19GetUploadFormatTypeERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20) %11, i32 noundef 0)
          to label %33 unwind label %107

33:                                               ; preds = %31
  store { i64, i32 } %32, ptr %12, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 8 %12, i64 12, i1 false)
  call void @llvm.lifetime.end.p0(i64 20, ptr %11) #8
  %34 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %35 = load i32, ptr @g_textures, align 4, !tbaa !9
  invoke void %34(i32 noundef 3553, i32 noundef %35)
          to label %36 unwind label %111

36:                                               ; preds = %33
  %37 = load ptr, ptr @_funcptr_glTexImage2D, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %9, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %9, i32 0, i32 2
  %41 = load i32, ptr %40, align 4, !tbaa !13
  %42 = getelementptr inbounds %"struct.glimg::OpenGLPixelTransferParams", ptr %10, i32 0, i32 0
  %43 = load i32, ptr %42, align 4, !tbaa !14
  %44 = getelementptr inbounds %"struct.glimg::OpenGLPixelTransferParams", ptr %10, i32 0, i32 1
  %45 = load i32, ptr %44, align 4, !tbaa !16
  %46 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %47 unwind label %111

47:                                               ; preds = %36
  invoke void %37(i32 noundef 3553, i32 noundef 0, i32 noundef 32849, i32 noundef %39, i32 noundef %41, i32 noundef 0, i32 noundef %43, i32 noundef %45, ptr noundef %46)
          to label %48 unwind label %111

48:                                               ; preds = %47
  %49 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %49(i32 noundef 3553, i32 noundef 33084, i32 noundef 0)
          to label %50 unwind label %111

50:                                               ; preds = %48
  %51 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  %52 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  %53 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %52)
          to label %54 unwind label %111

54:                                               ; preds = %50
  %55 = sub nsw i32 %53, 1
  invoke void %51(i32 noundef 3553, i32 noundef 33085, i32 noundef %55)
          to label %56 unwind label %111

56:                                               ; preds = %54
  %57 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %58 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @g_textures, i64 0, i64 1), align 4, !tbaa !9
  invoke void %57(i32 noundef 3553, i32 noundef %58)
          to label %59 unwind label %111

59:                                               ; preds = %56
  %60 = load ptr, ptr @_funcptr_glTexImage2D, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %9, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !11
  %63 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %9, i32 0, i32 2
  %64 = load i32, ptr %63, align 4, !tbaa !13
  %65 = getelementptr inbounds %"struct.glimg::OpenGLPixelTransferParams", ptr %10, i32 0, i32 0
  %66 = load i32, ptr %65, align 4, !tbaa !14
  %67 = getelementptr inbounds %"struct.glimg::OpenGLPixelTransferParams", ptr %10, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !16
  %69 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %8)
          to label %70 unwind label %111

70:                                               ; preds = %59
  invoke void %60(i32 noundef 3553, i32 noundef 0, i32 noundef 35905, i32 noundef %62, i32 noundef %64, i32 noundef 0, i32 noundef %66, i32 noundef %68, ptr noundef %69)
          to label %71 unwind label %111

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

73:                                               ; preds = %71
  %74 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  %75 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  %76 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %75)
          to label %77 unwind label %111

77:                                               ; preds = %73
  %78 = sub nsw i32 %76, 1
  invoke void %74(i32 noundef 3553, i32 noundef 33085, i32 noundef %78)
          to label %79 unwind label %111

79:                                               ; preds = %77
  %80 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  invoke void %80(i32 noundef 3553, i32 noundef 0)
          to label %81 unwind label %111

81:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #8
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %138

82:                                               ; preds = %0
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %3, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %4, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #8
  br label %154

86:                                               ; preds = %149, %146, %143, %140, %138, %15
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %3, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %4, align 4
  br label %153

90:                                               ; preds = %17
  %91 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %3, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %4, align 4
  br label %98

94:                                               ; preds = %19
  %95 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %3, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %4, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #8
  br label %98

98:                                               ; preds = %94, %90
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #8
  br label %118

99:                                               ; preds = %21
  %100 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %3, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %4, align 4
  br label %117

103:                                              ; preds = %23
  %104 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %3, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %4, align 4
  br label %116

107:                                              ; preds = %31, %25
  %108 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %3, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 20, ptr %11) #8
  br label %115

111:                                              ; preds = %79, %77, %73, %71, %70, %59, %56, %54, %50, %48, %47, %36, %33
  %112 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %3, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %4, align 4
  br label %115

115:                                              ; preds = %111, %107
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #8
  br label %116

116:                                              ; preds = %115, %103
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #8
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %8) #8
  br label %117

117:                                              ; preds = %116, %99
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #8
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #8
  br label %118

118:                                              ; preds = %117, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %4, align 4
  %121 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #8
  %122 = icmp eq i32 %120, %121
  br i1 %122, label %123, label %153

123:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %124 = load ptr, ptr %3, align 8
  %125 = call ptr @__cxa_begin_catch(ptr %124) #8
  store ptr %125, ptr %13, align 8
  %126 = load ptr, ptr %13, align 8, !tbaa !5
  %127 = load ptr, ptr %126, align 8, !tbaa !17
  %128 = getelementptr inbounds ptr, ptr %127, i64 2
  %129 = load ptr, ptr %128, align 8
  %130 = call noundef ptr %129(ptr noundef nonnull align 8 dereferenceable(8) %126) #8
  %131 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef %130)
          to label %132 unwind label %133

132:                                              ; preds = %123
  invoke void @__cxa_rethrow() #9
          to label %163 unwind label %133

133:                                              ; preds = %132, %123
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %3, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %4, align 4
  invoke void @__cxa_end_catch()
          to label %137 unwind label %160

137:                                              ; preds = %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %153

138:                                              ; preds = %81
  %139 = load ptr, ptr @_funcptr_glGenSamplers, align 8, !tbaa !5
  invoke void %139(i32 noundef 1, ptr noundef @g_samplerObj)
          to label %140 unwind label %86

140:                                              ; preds = %138
  %141 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %142 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %141(i32 noundef %142, i32 noundef 10242, i32 noundef 33071)
          to label %143 unwind label %86

143:                                              ; preds = %140
  %144 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %145 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %144(i32 noundef %145, i32 noundef 10243, i32 noundef 33071)
          to label %146 unwind label %86

146:                                              ; preds = %143
  %147 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %148 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %147(i32 noundef %148, i32 noundef 10240, i32 noundef 9728)
          to label %149 unwind label %86

149:                                              ; preds = %146
  %150 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %151 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %150(i32 noundef %151, i32 noundef 10241, i32 noundef 9728)
          to label %152 unwind label %86

152:                                              ; preds = %149
  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
  ret void

153:                                              ; preds = %137, %119, %86
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  br label %154

154:                                              ; preds = %153, %82
  call void @llvm.lifetime.end.p0(i64 32, ptr %1) #8
  br label %155

155:                                              ; preds = %154
  %156 = load ptr, ptr %3, align 8
  %157 = load i32, ptr %4, align 4
  %158 = insertvalue { ptr, i32 } poison, ptr %156, 0
  %159 = insertvalue { ptr, i32 } %158, i32 %157, 1
  resume { ptr, i32 } %159

160:                                              ; preds = %133
  %161 = landingpad { ptr, i32 }
          catch ptr null
  %162 = extractvalue { ptr, i32 } %161, 0
  call void @__clang_call_terminate(ptr %162) #10
  unreachable

163:                                              ; preds = %132
  unreachable
}

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #2 align 2

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

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

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

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

attributes #0 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!18, !18, i64 0}
!18 = !{!"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::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 }
%"class.glimg::ImageFormat" = type { %"struct.glimg::UncheckedImageFormat" }
%"struct.glimg::UncheckedImageFormat" = type { i32, i32, i32, i32, i32 }

@g_textures = external dso_local global [2 x i32], align 4
@g_samplerObj = external dso_local global i32, align 4
@_funcptr_glGenTextures = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@_ZTISt9exception = external constant ptr
@_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.7 = external hidden unnamed_addr constant [4 x i8], align 1
@_funcptr_glGenSamplers = external local_unnamed_addr global ptr, align 8
@_funcptr_glSamplerParameteri = external local_unnamed_addr global ptr, align 8

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

declare i32 @__gxx_personality_v0(...)

; 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 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 #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator.0", align 1
  %3 = alloca %"class.std::unique_ptr", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca %"class.glimg::SingleImage", align 8
  %7 = alloca %"class.glimg::ImageFormat", align 4
  %8 = load ptr, ptr @_funcptr_glGenTextures, align 8, !tbaa !5
  tail call void %8(i32 noundef 2, ptr noundef nonnull @g_textures)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.5, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %9 unwind label %59

9:                                                ; preds = %0
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  %10 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.6)
          to label %11 unwind label %63

11:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #8
  %12 = 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 %5) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef %12, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %13 unwind label %67

13:                                               ; preds = %11
  %14 = invoke noundef ptr @_ZN5glimg7loaders3stb12LoadFromFileERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %15 unwind label %69

15:                                               ; preds = %13
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEC2IS3_vEEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef %14) #8
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #8
  %16 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  invoke void @_ZNK5glimg8ImageSet8GetImageEiii(ptr dead_on_unwind nonnull writable sret(%"class.glimg::SingleImage") align 8 %6, ptr noundef nonnull align 8 dereferenceable(16) %16, i32 noundef 0, i32 noundef 0, i32 noundef 0)
          to label %17 unwind label %72

17:                                               ; preds = %15
  %18 = invoke { i64, i64 } @_ZNK5glimg11SingleImage13GetDimensionsEv(ptr noundef nonnull align 8 dereferenceable(28) %6)
          to label %19 unwind label %74

19:                                               ; preds = %17
  %20 = extractvalue { i64, i64 } %18, 0
  %21 = extractvalue { i64, i64 } %18, 1
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %7) #8
  %22 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  invoke void @_ZNK5glimg8ImageSet9GetFormatEv(ptr dead_on_unwind nonnull writable sret(%"class.glimg::ImageFormat") align 4 %7, ptr noundef nonnull align 8 dereferenceable(16) %22)
          to label %23 unwind label %76

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

25:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %7) #8
  %26 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %27 = load i32, ptr @g_textures, align 4, !tbaa !9
  invoke void %26(i32 noundef 3553, i32 noundef %27)
          to label %28 unwind label %78

28:                                               ; preds = %25
  %.fca.0.extract = extractvalue { i64, i32 } %24, 0
  %29 = load ptr, ptr @_funcptr_glTexImage2D, align 8, !tbaa !5
  %.sroa.07.4.extract.shift = lshr i64 %20, 32
  %.sroa.07.4.extract.trunc = trunc nuw i64 %.sroa.07.4.extract.shift to i32
  %.sroa.6.8.extract.trunc = trunc i64 %21 to i32
  %.sroa.01.0.extract.trunc = trunc i64 %.fca.0.extract to i32
  %.sroa.01.4.extract.shift = lshr i64 %.fca.0.extract, 32
  %.sroa.01.4.extract.trunc = trunc nuw i64 %.sroa.01.4.extract.shift to i32
  %30 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %6)
          to label %31 unwind label %78

31:                                               ; preds = %28
  invoke void %29(i32 noundef 3553, i32 noundef 0, i32 noundef 32849, i32 noundef %.sroa.07.4.extract.trunc, i32 noundef %.sroa.6.8.extract.trunc, i32 noundef 0, i32 noundef %.sroa.01.0.extract.trunc, i32 noundef %.sroa.01.4.extract.trunc, ptr noundef %30)
          to label %32 unwind label %78

32:                                               ; preds = %31
  %33 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %33(i32 noundef 3553, i32 noundef 33084, i32 noundef 0)
          to label %34 unwind label %78

34:                                               ; preds = %32
  %35 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  %36 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  %37 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %36)
          to label %38 unwind label %78

38:                                               ; preds = %34
  %39 = add nsw i32 %37, -1
  invoke void %35(i32 noundef 3553, i32 noundef 33085, i32 noundef %39)
          to label %40 unwind label %78

40:                                               ; preds = %38
  %41 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  %42 = load i32, ptr getelementptr inbounds (i8, ptr @g_textures, i64 4), align 4, !tbaa !9
  invoke void %41(i32 noundef 3553, i32 noundef %42)
          to label %43 unwind label %78

43:                                               ; preds = %40
  %44 = load ptr, ptr @_funcptr_glTexImage2D, align 8, !tbaa !5
  %45 = invoke noundef ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28) %6)
          to label %46 unwind label %78

46:                                               ; preds = %43
  invoke void %44(i32 noundef 3553, i32 noundef 0, i32 noundef 35905, i32 noundef %.sroa.07.4.extract.trunc, i32 noundef %.sroa.6.8.extract.trunc, i32 noundef 0, i32 noundef %.sroa.01.0.extract.trunc, i32 noundef %.sroa.01.4.extract.trunc, ptr noundef %45)
          to label %47 unwind label %78

47:                                               ; preds = %46
  %48 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  invoke void %48(i32 noundef 3553, i32 noundef 33084, i32 noundef 0)
          to label %49 unwind label %78

49:                                               ; preds = %47
  %50 = load ptr, ptr @_funcptr_glTexParameteri, align 8, !tbaa !5
  %51 = call noundef ptr @_ZNKSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  %52 = invoke noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16) %51)
          to label %53 unwind label %78

53:                                               ; preds = %49
  %54 = add nsw i32 %52, -1
  invoke void %50(i32 noundef 3553, i32 noundef 33085, i32 noundef %54)
          to label %55 unwind label %78

55:                                               ; preds = %53
  %56 = load ptr, ptr @_funcptr_glBindTexture, align 8, !tbaa !5
  invoke void %56(i32 noundef 3553, i32 noundef 0)
          to label %57 unwind label %78

57:                                               ; preds = %55
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %6) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #8
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %58 = load ptr, ptr @_funcptr_glGenSamplers, align 8, !tbaa !5
  invoke void %58(i32 noundef 1, ptr noundef nonnull @g_samplerObj)
          to label %97 unwind label %63

59:                                               ; preds = %0
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  %62 = extractvalue { ptr, i32 } %60, 1
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  br label %111

63:                                               ; preds = %106, %103, %100, %97, %57, %9
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  %66 = extractvalue { ptr, i32 } %64, 1
  br label %110

67:                                               ; preds = %11
  %68 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %71

69:                                               ; preds = %13
  %70 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  br label %71

71:                                               ; preds = %69, %67
  %.pn = phi { ptr, i32 } [ %70, %69 ], [ %68, %67 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  br label %82

72:                                               ; preds = %15
  %73 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %81

74:                                               ; preds = %17
  %75 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %80

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

78:                                               ; preds = %55, %53, %49, %47, %46, %43, %40, %38, %34, %32, %31, %28, %25
  %79 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  br label %80

80:                                               ; preds = %76, %78, %74
  %.pn24.pn = phi { ptr, i32 } [ %75, %74 ], [ %79, %78 ], [ %77, %76 ]
  call void @_ZN5glimg11SingleImageD2Ev(ptr noundef nonnull align 8 dereferenceable(28) %6) #8
  br label %81

81:                                               ; preds = %80, %72
  %.pn24.pn.pn = phi { ptr, i32 } [ %.pn24.pn, %80 ], [ %73, %72 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #8
  call void @_ZNSt10unique_ptrIN5glimg8ImageSetESt14default_deleteIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #8
  br label %82

82:                                               ; preds = %81, %71
  %.pn24.pn.pn.pn = phi { ptr, i32 } [ %.pn24.pn.pn, %81 ], [ %.pn, %71 ]
  %.4 = extractvalue { ptr, i32 } %.pn24.pn.pn.pn, 0
  %.420 = extractvalue { ptr, i32 } %.pn24.pn.pn.pn, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  %83 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #8
  %84 = icmp eq i32 %.420, %83
  br i1 %84, label %85, label %110

85:                                               ; preds = %82
  %86 = call ptr @__cxa_begin_catch(ptr %.4) #8
  %87 = load ptr, ptr %86, align 8, !tbaa !11
  %88 = getelementptr inbounds i8, ptr %87, i64 16
  %89 = load ptr, ptr %88, align 8
  %90 = call noundef ptr %89(ptr noundef nonnull align 8 dereferenceable(8) %86) #8
  %91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef %90)
  invoke void @__cxa_rethrow() #9
          to label %117 unwind label %92

92:                                               ; preds = %85
  %93 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %94 unwind label %114

94:                                               ; preds = %92
  %95 = extractvalue { ptr, i32 } %93, 1
  %96 = extractvalue { ptr, i32 } %93, 0
  br label %110

97:                                               ; preds = %57
  %98 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %99 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %98(i32 noundef %99, i32 noundef 10242, i32 noundef 33071)
          to label %100 unwind label %63

100:                                              ; preds = %97
  %101 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %102 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %101(i32 noundef %102, i32 noundef 10243, i32 noundef 33071)
          to label %103 unwind label %63

103:                                              ; preds = %100
  %104 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %105 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %104(i32 noundef %105, i32 noundef 10240, i32 noundef 9728)
          to label %106 unwind label %63

106:                                              ; preds = %103
  %107 = load ptr, ptr @_funcptr_glSamplerParameteri, align 8, !tbaa !5
  %108 = load i32, ptr @g_samplerObj, align 4, !tbaa !9
  invoke void %107(i32 noundef %108, i32 noundef 10241, i32 noundef 9728)
          to label %109 unwind label %63

109:                                              ; preds = %106
  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

110:                                              ; preds = %94, %82, %63
  %.521 = phi i32 [ %66, %63 ], [ %95, %94 ], [ %.420, %82 ]
  %.5 = phi ptr [ %65, %63 ], [ %96, %94 ], [ %.4, %82 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #8
  br label %111

111:                                              ; preds = %110, %59
  %.622 = phi i32 [ %.521, %110 ], [ %62, %59 ]
  %.6 = phi ptr [ %.5, %110 ], [ %61, %59 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #8
  %112 = insertvalue { ptr, i32 } poison, ptr %.6, 0
  %113 = insertvalue { ptr, i32 } %112, i32 %.622, 1
  resume { ptr, i32 } %113

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

117:                                              ; preds = %85
  unreachable
}

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

declare noundef ptr @_ZN5glimg7loaders3stb12LoadFromFileERKNSt7__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

; 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 @_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 { i64, i32 } @_ZN5glimg19GetUploadFormatTypeERKNS_11ImageFormatEj(ptr noundef nonnull align 4 dereferenceable(20), i32 noundef) local_unnamed_addr #3

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 ptr @_ZNK5glimg11SingleImage12GetImageDataEv(ptr noundef nonnull align 8 dereferenceable(28)) local_unnamed_addr #3

declare noundef i32 @_ZNK5glimg8ImageSet14GetMipmapCountEv(ptr noundef nonnull align 8 dereferenceable(16)) 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 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}


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