; LLVM IR from paroj/gltut :: glsdk/glimg/source (ImageCreator)

; 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.glimg::ImageFormat" = type { %"struct.glimg::UncheckedImageFormat" }
%"struct.glimg::UncheckedImageFormat" = type { i32, i32, i32, i32, i32 }
%"struct.glimg::Dimensions" = type { i32, i32, i32, i32 }
%"class.std::allocator" = type { i8 }
%"class.std::allocator.2" = type { i8 }
%"class.glimg::ImageCreator" = type { %"class.glimg::ImageFormat", %"struct.glimg::Dimensions", i32, i32, i32, %"class.std::vector", %"class.std::vector.0" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<unsigned char>, std::allocator<std::vector<unsigned char>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned long, std::allocator<unsigned long>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTIN5glimg21BadFaceCountExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg25CubemapsMustBe2DExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg25No3DTextureArrayExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg26NoImagesSpecifiedExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5glimg12ImageCreatorC2ENS_11ImageFormatENS_10DimensionsEiii(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef byval(%"class.glimg::ImageFormat") align 8 %1, i64 %2, i64 %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"struct.glimg::Dimensions", align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %"class.std::allocator", align 1
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca %"class.std::allocator.2", align 1
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"struct.glimg::Dimensions", align 4
  %20 = alloca %"struct.glimg::Dimensions", align 4
  %21 = alloca i64, align 8
  %22 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  store i64 %2, ptr %22, align 4
  %23 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  store i64 %3, ptr %23, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  store i32 %5, ptr %11, align 4, !tbaa !9
  store i32 %6, ptr %12, align 4, !tbaa !9
  %24 = load ptr, ptr %9, align 8
  %25 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %25, ptr align 8 %1, i64 20, i1 false), !tbaa.struct !11
  %26 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %8, i64 16, i1 false), !tbaa.struct !20
  %27 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 2
  %28 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %28, ptr %27, align 4, !tbaa !21
  %29 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 3
  %30 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %30, ptr %29, align 8, !tbaa !34
  %31 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 4
  %32 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %32, ptr %31, align 4, !tbaa !35
  %33 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 5
  %34 = load i32, ptr %10, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #5
  call void @_ZNSaISt6vectorIhSaIhEEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #5
  invoke void @_ZNSt6vectorIS_IhSaIhEESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %35, ptr noundef nonnull align 1 dereferenceable(1) %13)
          to label %36 unwind label %51

36:                                               ; preds = %7
  call void @_ZNSt15__new_allocatorISt6vectorIhSaIhEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #5
  %37 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 6
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #5
  call void @_ZNSaImEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #5
  invoke void @_ZNSt6vectorImSaImEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %37, i64 noundef %39, ptr noundef nonnull align 1 dereferenceable(1) %16)
          to label %40 unwind label %55

40:                                               ; preds = %36
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #5
  %41 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 4
  %42 = load i32, ptr %41, align 4, !tbaa !35
  %43 = icmp ne i32 %42, 6
  br i1 %43, label %44, label %67

44:                                               ; preds = %40
  %45 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 4
  %46 = load i32, ptr %45, align 4, !tbaa !35
  %47 = icmp ne i32 %46, 1
  br i1 %47, label %48, label %67

48:                                               ; preds = %44
  %49 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg21BadFaceCountExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %49)
          to label %50 unwind label %59

50:                                               ; preds = %48
  invoke void @__cxa_throw(ptr %49, ptr @_ZTIN5glimg21BadFaceCountExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #6
          to label %184 unwind label %63

51:                                               ; preds = %7
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %14, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %15, align 4
  call void @_ZNSt15__new_allocatorISt6vectorIhSaIhEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %13) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #5
  br label %179

55:                                               ; preds = %36
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %14, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %15, align 4
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #5
  br label %178

59:                                               ; preds = %48
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %14, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %15, align 4
  call void @__cxa_free_exception(ptr %49) #5
  br label %177

63:                                               ; preds = %109, %94, %78, %50
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %14, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %15, align 4
  br label %177

67:                                               ; preds = %44, %40
  %68 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 4
  %69 = load i32, ptr %68, align 4, !tbaa !35
  %70 = icmp eq i32 %69, 6
  br i1 %70, label %71, label %83

71:                                               ; preds = %67
  %72 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 1
  %73 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 4, !tbaa !36
  %75 = icmp ne i32 %74, 2
  br i1 %75, label %76, label %83

76:                                               ; preds = %71
  %77 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg25CubemapsMustBe2DExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %77)
          to label %78 unwind label %79

78:                                               ; preds = %76
  invoke void @__cxa_throw(ptr %77, ptr @_ZTIN5glimg25CubemapsMustBe2DExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #6
          to label %184 unwind label %63

79:                                               ; preds = %76
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %14, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %15, align 4
  call void @__cxa_free_exception(ptr %77) #5
  br label %177

83:                                               ; preds = %71, %67
  %84 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 1
  %85 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 4, !tbaa !36
  %87 = icmp eq i32 %86, 3
  br i1 %87, label %88, label %99

88:                                               ; preds = %83
  %89 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 3
  %90 = load i32, ptr %89, align 8, !tbaa !34
  %91 = icmp ne i32 %90, 1
  br i1 %91, label %92, label %99

92:                                               ; preds = %88
  %93 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg25No3DTextureArrayExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %93)
          to label %94 unwind label %95

94:                                               ; preds = %92
  invoke void @__cxa_throw(ptr %93, ptr @_ZTIN5glimg25No3DTextureArrayExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #6
          to label %184 unwind label %63

95:                                               ; preds = %92
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %14, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %15, align 4
  call void @__cxa_free_exception(ptr %93) #5
  br label %177

99:                                               ; preds = %88, %83
  %100 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 2
  %101 = load i32, ptr %100, align 4, !tbaa !21
  %102 = icmp sle i32 %101, 0
  br i1 %102, label %107, label %103

103:                                              ; preds = %99
  %104 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 3
  %105 = load i32, ptr %104, align 8, !tbaa !34
  %106 = icmp sle i32 %105, 0
  br i1 %106, label %107, label %114

107:                                              ; preds = %103, %99
  %108 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg26NoImagesSpecifiedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %108)
          to label %109 unwind label %110

109:                                              ; preds = %107
  invoke void @__cxa_throw(ptr %108, ptr @_ZTIN5glimg26NoImagesSpecifiedExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #6
          to label %184 unwind label %63

110:                                              ; preds = %107
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %14, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %15, align 4
  call void @__cxa_free_exception(ptr %108) #5
  br label %177

114:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %115 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 0
  %116 = invoke noundef i64 @_ZN5glimg17CalcBytesPerPixelERKNS_11ImageFormatE(ptr noundef nonnull align 4 dereferenceable(20) %115)
          to label %117 unwind label %124

117:                                              ; preds = %114
  %118 = trunc i64 %116 to i32
  store i32 %118, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %119

119:                                              ; preds = %163, %117
  %120 = load i32, ptr %18, align 4, !tbaa !9
  %121 = load i32, ptr %10, align 4, !tbaa !9
  %122 = icmp slt i32 %120, %121
  br i1 %122, label %128, label %123

123:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %175

124:                                              ; preds = %114
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %14, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %15, align 4
  br label %176

128:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #5
  %129 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %129, i64 16, i1 false), !tbaa.struct !20
  %130 = load i32, ptr %18, align 4, !tbaa !9
  %131 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 0
  %132 = load i64, ptr %131, align 4
  %133 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 1
  %134 = load i64, ptr %133, align 4
  %135 = invoke { i64, i64 } @_ZN5glimg19ModifySizeForMipmapENS_10DimensionsEi(i64 %132, i64 %134, i32 noundef %130)
          to label %136 unwind label %166

136:                                              ; preds = %128
  %137 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 0
  %138 = extractvalue { i64, i64 } %135, 0
  store i64 %138, ptr %137, align 4
  %139 = getelementptr inbounds { i64, i64 }, ptr %19, i32 0, i32 1
  %140 = extractvalue { i64, i64 } %135, 1
  store i64 %140, ptr %139, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %141 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 0
  %142 = invoke noundef i64 @_ZN5glimg17CalcImageByteSizeERKNS_11ImageFormatERKNS_10DimensionsE(ptr noundef nonnull align 4 dereferenceable(20) %141, ptr noundef nonnull align 4 dereferenceable(16) %19)
          to label %143 unwind label %170

143:                                              ; preds = %136
  store i64 %142, ptr %21, align 8, !tbaa !37
  %144 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 5
  %145 = load i32, ptr %18, align 4, !tbaa !9
  %146 = sext i32 %145 to i64
  %147 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IhSaIhEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %144, i64 noundef %146) #5
  %148 = load i64, ptr %21, align 8, !tbaa !37
  %149 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 4
  %150 = load i32, ptr %149, align 4, !tbaa !35
  %151 = sext i32 %150 to i64
  %152 = mul i64 %148, %151
  %153 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 3
  %154 = load i32, ptr %153, align 8, !tbaa !34
  %155 = sext i32 %154 to i64
  %156 = mul i64 %152, %155
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %147, i64 noundef %156)
          to label %157 unwind label %170

157:                                              ; preds = %143
  %158 = load i64, ptr %21, align 8, !tbaa !37
  %159 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %24, i32 0, i32 6
  %160 = load i32, ptr %18, align 4, !tbaa !9
  %161 = sext i32 %160 to i64
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %159, i64 noundef %161) #5
  store i64 %158, ptr %162, align 8, !tbaa !37
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #5
  br label %163

163:                                              ; preds = %157
  %164 = load i32, ptr %18, align 4, !tbaa !9
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %18, align 4, !tbaa !9
  br label %119, !llvm.loop !39

166:                                              ; preds = %128
  %167 = landingpad { ptr, i32 }
          cleanup
  %168 = extractvalue { ptr, i32 } %167, 0
  store ptr %168, ptr %14, align 8
  %169 = extractvalue { ptr, i32 } %167, 1
  store i32 %169, ptr %15, align 4
  br label %174

170:                                              ; preds = %143, %136
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %14, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %174

174:                                              ; preds = %170, %166
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %176

175:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  ret void

176:                                              ; preds = %174, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %177

177:                                              ; preds = %176, %110, %95, %79, %63, %59
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %37) #5
  br label %178

178:                                              ; preds = %177, %55
  call void @_ZNSt6vectorIS_IhSaIhEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %33) #5
  br label %179

179:                                              ; preds = %178, %51
  %180 = load ptr, ptr %14, align 8
  %181 = load i32, ptr %15, align 4
  %182 = insertvalue { ptr, i32 } poison, ptr %180, 0
  %183 = insertvalue { ptr, i32 } %182, i32 %181, 1
  resume { ptr, i32 } %183

184:                                              ; preds = %109, %94, %78, %50
  unreachable
}

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIS_IhSaIhEESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorImSaImEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare ptr @__cxa_allocate_exception(i64)

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

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

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

declare noundef i64 @_ZN5glimg17CalcBytesPerPixelERKNS_11ImageFormatE(ptr noundef nonnull align 4 dereferenceable(20)) #4

declare { i64, i64 } @_ZN5glimg19ModifySizeForMipmapENS_10DimensionsEi(i64, i64, i32 noundef) #4

declare noundef i64 @_ZN5glimg17CalcImageByteSizeERKNS_11ImageFormatERKNS_10DimensionsE(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(16)) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

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

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

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn }

!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 = !{i64 0, i64 4, !12, i64 4, i64 4, !14, i64 8, i64 4, !16, i64 12, i64 4, !18, i64 16, i64 4, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"_ZTSN5glimg13PixelDataTypeE", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTSN5glimg15PixelComponentsE", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_ZTSN5glimg14ComponentOrderE", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"_ZTSN5glimg8BitdepthE", !7, i64 0}
!20 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9, i64 12, i64 4, !9}
!21 = !{!22, !10, i64 36}
!22 = !{!"_ZTSN5glimg12ImageCreatorE", !23, i64 0, !25, i64 20, !10, i64 36, !10, i64 40, !10, i64 44, !26, i64 48, !30, i64 72}
!23 = !{!"_ZTSN5glimg11ImageFormatE", !24, i64 0}
!24 = !{!"_ZTSN5glimg20UncheckedImageFormatE", !13, i64 0, !15, i64 4, !17, i64 8, !19, i64 12, !10, i64 16}
!25 = !{!"_ZTSN5glimg10DimensionsE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!26 = !{!"_ZTSSt6vectorIS_IhSaIhEESaIS1_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!"_ZTSSt6vectorImSaImEE", !31, i64 0}
!31 = !{!"_ZTSSt12_Vector_baseImSaImEE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseImSaImEE12_Vector_implE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseImSaImEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!22, !10, i64 40}
!35 = !{!22, !10, i64 44}
!36 = !{!22, !10, i64 20}
!37 = !{!38, !38, i64 0}
!38 = !{!"long", !7, i64 0}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}


; 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.glimg::ImageFormat" = type { %"struct.glimg::UncheckedImageFormat" }
%"struct.glimg::UncheckedImageFormat" = type { i32, i32, i32, i32, i32 }
%"class.std::allocator" = type { i8 }
%"class.std::allocator.2" = type { i8 }
%"struct.glimg::Dimensions" = type { i32, i32, i32, i32 }

@_ZTIN5glimg21BadFaceCountExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg25CubemapsMustBe2DExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg25No3DTextureArrayExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg26NoImagesSpecifiedExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5glimg12ImageCreatorC2ENS_11ImageFormatENS_10DimensionsEiii(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr nocapture noundef readonly byval(%"class.glimg::ImageFormat") align 8 %1, i64 %2, i64 %3, i32 noundef %4, i32 noundef %5, i32 noundef %6) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca %"class.std::allocator", align 1
  %9 = alloca %"class.std::allocator.2", align 1
  %10 = alloca %"struct.glimg::Dimensions", align 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(20) %0, ptr noundef nonnull align 8 dereferenceable(20) %1, i64 20, i1 false), !tbaa.struct !5
  %11 = getelementptr inbounds i8, ptr %0, i64 20
  store i64 %2, ptr %11, align 4
  %.sroa.216.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 28
  store i64 %3, ptr %.sroa.216.0..sroa_idx, align 4
  %12 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %4, ptr %12, align 4, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %5, ptr %13, align 8, !tbaa !32
  %14 = getelementptr inbounds i8, ptr %0, i64 44
  store i32 %6, ptr %14, align 4, !tbaa !33
  %15 = getelementptr inbounds i8, ptr %0, i64 48
  %16 = sext i32 %4 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #5
  call void @_ZNSaISt6vectorIhSaIhEEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  invoke void @_ZNSt6vectorIS_IhSaIhEESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %16, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %17 unwind label %23

17:                                               ; preds = %7
  call void @_ZNSt15__new_allocatorISt6vectorIhSaIhEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #5
  %18 = getelementptr inbounds i8, ptr %0, i64 72
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #5
  call void @_ZNSaImEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  invoke void @_ZNSt6vectorImSaImEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %16, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %19 unwind label %25

19:                                               ; preds = %17
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #5
  %20 = load i32, ptr %14, align 4, !tbaa !33
  switch i32 %20, label %21 [
    i32 6, label %31
    i32 1, label %31
  ]

21:                                               ; preds = %19
  %22 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg21BadFaceCountExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %22)
          to label %.invoke unwind label %27

23:                                               ; preds = %7
  %24 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorISt6vectorIhSaIhEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #5
  br label %85

25:                                               ; preds = %17
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorImED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #5
  br label %84

27:                                               ; preds = %21
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %22) #5
  br label %83

29:                                               ; preds = %.invoke
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %83

31:                                               ; preds = %19, %19
  %32 = icmp ne i32 %20, 6
  %33 = load i32, ptr %11, align 4
  %.not25 = icmp eq i32 %33, 2
  %or.cond = select i1 %32, i1 true, i1 %.not25
  br i1 %or.cond, label %38, label %34

34:                                               ; preds = %31
  %35 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg25CubemapsMustBe2DExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %35)
          to label %.invoke unwind label %36

36:                                               ; preds = %34
  %37 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %35) #5
  br label %83

38:                                               ; preds = %31
  %39 = icmp ne i32 %33, 3
  %40 = load i32, ptr %13, align 8
  %.not26 = icmp eq i32 %40, 1
  %or.cond33 = select i1 %39, i1 true, i1 %.not26
  br i1 %or.cond33, label %45, label %41

41:                                               ; preds = %38
  %42 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg25No3DTextureArrayExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %42)
          to label %.invoke unwind label %43

43:                                               ; preds = %41
  %44 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %42) #5
  br label %83

45:                                               ; preds = %38
  %46 = load i32, ptr %12, align 4, !tbaa !18
  %47 = icmp slt i32 %46, 1
  %48 = icmp slt i32 %40, 1
  %or.cond35 = select i1 %47, i1 true, i1 %48
  br i1 %or.cond35, label %49, label %55

49:                                               ; preds = %45
  %50 = call ptr @__cxa_allocate_exception(i64 40) #5
  invoke void @_ZN5glimg26NoImagesSpecifiedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %50)
          to label %.invoke unwind label %53

.invoke:                                          ; preds = %21, %49, %41, %34
  %51 = phi ptr [ %35, %34 ], [ %42, %41 ], [ %50, %49 ], [ %22, %21 ]
  %52 = phi ptr [ @_ZTIN5glimg25CubemapsMustBe2DExceptionE, %34 ], [ @_ZTIN5glimg25No3DTextureArrayExceptionE, %41 ], [ @_ZTIN5glimg26NoImagesSpecifiedExceptionE, %49 ], [ @_ZTIN5glimg21BadFaceCountExceptionE, %21 ]
  invoke void @__cxa_throw(ptr nonnull %51, ptr nonnull %52, ptr nonnull @_ZN5glimg22ImageCreationExceptionD2Ev) #6
          to label %.cont unwind label %29

.cont:                                            ; preds = %.invoke
  unreachable

53:                                               ; preds = %49
  %54 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %50) #5
  br label %83

55:                                               ; preds = %45
  %56 = invoke noundef i64 @_ZN5glimg17CalcBytesPerPixelERKNS_11ImageFormatE(ptr noundef nonnull align 4 dereferenceable(20) %0)
          to label %.preheader unwind label %59

.preheader:                                       ; preds = %55
  %57 = icmp sgt i32 %4, 0
  br i1 %57, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %58 = getelementptr inbounds i8, ptr %10, i64 8
  %wide.trip.count = zext nneg i32 %4 to i64
  br label %61

._crit_edge:                                      ; preds = %76, %.preheader
  ret void

59:                                               ; preds = %55
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %83

61:                                               ; preds = %.lr.ph, %76
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %76 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #5
  %.sroa.0.0.copyload = load i64, ptr %11, align 4
  %.sroa.2.0.copyload = load i64, ptr %.sroa.216.0..sroa_idx, align 4
  %62 = trunc nuw nsw i64 %indvars.iv to i32
  %63 = invoke { i64, i64 } @_ZN5glimg19ModifySizeForMipmapENS_10DimensionsEi(i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload, i32 noundef %62)
          to label %64 unwind label %78

64:                                               ; preds = %61
  %65 = extractvalue { i64, i64 } %63, 0
  store i64 %65, ptr %10, align 8
  %66 = extractvalue { i64, i64 } %63, 1
  store i64 %66, ptr %58, align 8
  %67 = invoke noundef i64 @_ZN5glimg17CalcImageByteSizeERKNS_11ImageFormatERKNS_10DimensionsE(ptr noundef nonnull align 4 dereferenceable(20) %0, ptr noundef nonnull align 4 dereferenceable(16) %10)
          to label %68 unwind label %80

68:                                               ; preds = %64
  %69 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IhSaIhEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %indvars.iv) #5
  %70 = load i32, ptr %14, align 4, !tbaa !33
  %71 = sext i32 %70 to i64
  %72 = mul i64 %67, %71
  %73 = load i32, ptr %13, align 8, !tbaa !32
  %74 = sext i32 %73 to i64
  %75 = mul i64 %72, %74
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef %75)
          to label %76 unwind label %80

76:                                               ; preds = %68
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %indvars.iv) #5
  store i64 %67, ptr %77, align 8, !tbaa !34
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %61, !llvm.loop !36

78:                                               ; preds = %61
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %82

80:                                               ; preds = %68, %64
  %81 = landingpad { ptr, i32 }
          cleanup
  br label %82

82:                                               ; preds = %80, %78
  %.pn = phi { ptr, i32 } [ %81, %80 ], [ %79, %78 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #5
  br label %83

83:                                               ; preds = %59, %82, %53, %43, %36, %29, %27
  %.pn29 = phi { ptr, i32 } [ %30, %29 ], [ %28, %27 ], [ %37, %36 ], [ %44, %43 ], [ %54, %53 ], [ %.pn, %82 ], [ %60, %59 ]
  call void @_ZNSt6vectorImSaImEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #5
  br label %84

84:                                               ; preds = %83, %25
  %.pn29.pn = phi { ptr, i32 } [ %.pn29, %83 ], [ %26, %25 ]
  call void @_ZNSt6vectorIS_IhSaIhEESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #5
  br label %85

85:                                               ; preds = %84, %23
  %.pn29.pn.pn = phi { ptr, i32 } [ %.pn29.pn, %84 ], [ %24, %23 ]
  resume { ptr, i32 } %.pn29.pn.pn
}

; Function Attrs: mustprogress 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIS_IhSaIhEESaIS1_EEC2EmRKS2_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorImSaImEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

declare void @__cxa_free_exception(ptr) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

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

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

declare noundef i64 @_ZN5glimg17CalcBytesPerPixelERKNS_11ImageFormatE(ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #4

declare { i64, i64 } @_ZN5glimg19ModifySizeForMipmapENS_10DimensionsEi(i64, i64, i32 noundef) local_unnamed_addr #4

declare noundef i64 @_ZN5glimg17CalcImageByteSizeERKNS_11ImageFormatERKNS_10DimensionsE(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn }

!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 = !{i64 0, i64 4, !6, i64 4, i64 4, !10, i64 8, i64 4, !12, i64 12, i64 4, !14, i64 16, i64 4, !16}
!6 = !{!7, !7, i64 0}
!7 = !{!"_ZTSN5glimg13PixelDataTypeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"_ZTSN5glimg15PixelComponentsE", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"_ZTSN5glimg14ComponentOrderE", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTSN5glimg8BitdepthE", !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !8, i64 0}
!18 = !{!19, !17, i64 36}
!19 = !{!"_ZTSN5glimg12ImageCreatorE", !20, i64 0, !22, i64 20, !17, i64 36, !17, i64 40, !17, i64 44, !23, i64 48, !28, i64 72}
!20 = !{!"_ZTSN5glimg11ImageFormatE", !21, i64 0}
!21 = !{!"_ZTSN5glimg20UncheckedImageFormatE", !7, i64 0, !11, i64 4, !13, i64 8, !15, i64 12, !17, i64 16}
!22 = !{!"_ZTSN5glimg10DimensionsE", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12}
!23 = !{!"_ZTSSt6vectorIS_IhSaIhEESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE17_Vector_impl_dataE", !27, i64 0, !27, i64 8, !27, i64 16}
!27 = !{!"any pointer", !8, i64 0}
!28 = !{!"_ZTSSt6vectorImSaImEE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseImSaImEE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseImSaImEE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseImSaImEE17_Vector_impl_dataE", !27, i64 0, !27, i64 8, !27, i64 16}
!32 = !{!19, !17, i64 40}
!33 = !{!19, !17, i64 44}
!34 = !{!35, !35, i64 0}
!35 = !{!"long", !8, i64 0}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass