; LLVM IR from paroj/gltut :: glsdk/glimg/source/TestLoader.ll (ZN5glimg7loaders4test11TestImage2DEv)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN5glimg7loaders4test11TestImage2DEv() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i8, align 1
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.glimg::Dimensions", align 4
  %11 = alloca %"struct.glimg::UncheckedImageFormat", align 4
  %12 = alloca %"class.glimg::ImageCreator", align 8
  %13 = alloca %"class.glimg::ImageFormat", align 8
  %14 = alloca %"struct.glimg::UncheckedImageFormat", align 8
  %15 = alloca %"struct.glimg::Dimensions", align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #6
  store i8 -128, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #6
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKhRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %2, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %16 unwind label %21

16:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %17

17:                                               ; preds = %123, %16
  %18 = load i32, ptr %6, align 4, !tbaa !8
  %19 = icmp slt i32 %18, 8
  br i1 %19, label %25, label %20

20:                                               ; preds = %17
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %126

21:                                               ; preds = %0
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %4, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %5, align 4
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #6
  br label %155

25:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !8
  br label %26

26:                                               ; preds = %119, %25
  %27 = load i32, ptr %8, align 4, !tbaa !8
  %28 = icmp slt i32 %27, 8
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %122

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %31 = load i32, ptr %8, align 4, !tbaa !8
  %32 = mul nsw i32 %31, 16
  %33 = load i32, ptr %6, align 4, !tbaa !8
  %34 = add nsw i32 %32, %33
  %35 = mul nsw i32 %34, 4
  store i32 %35, ptr %9, align 4, !tbaa !8
  %36 = load i32, ptr %9, align 4, !tbaa !8
  %37 = add nsw i32 %36, 0
  %38 = sext i32 %37 to i64
  %39 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %38) #6
  store i8 -1, ptr %39, align 1, !tbaa !5
  %40 = load i32, ptr %9, align 4, !tbaa !8
  %41 = add nsw i32 %40, 1
  %42 = sext i32 %41 to i64
  %43 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %42) #6
  store i8 0, ptr %43, align 1, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !8
  %45 = add nsw i32 %44, 2
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %46) #6
  store i8 0, ptr %47, align 1, !tbaa !5
  %48 = load i32, ptr %9, align 4, !tbaa !8
  %49 = add nsw i32 %48, 3
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %50) #6
  store i8 -1, ptr %51, align 1, !tbaa !5
  %52 = load i32, ptr %8, align 4, !tbaa !8
  %53 = mul nsw i32 %52, 16
  %54 = load i32, ptr %6, align 4, !tbaa !8
  %55 = add nsw i32 %54, 8
  %56 = add nsw i32 %53, %55
  %57 = mul nsw i32 %56, 4
  store i32 %57, ptr %9, align 4, !tbaa !8
  %58 = load i32, ptr %9, align 4, !tbaa !8
  %59 = add nsw i32 %58, 0
  %60 = sext i32 %59 to i64
  %61 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %60) #6
  store i8 0, ptr %61, align 1, !tbaa !5
  %62 = load i32, ptr %9, align 4, !tbaa !8
  %63 = add nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %64) #6
  store i8 -128, ptr %65, align 1, !tbaa !5
  %66 = load i32, ptr %9, align 4, !tbaa !8
  %67 = add nsw i32 %66, 2
  %68 = sext i32 %67 to i64
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %68) #6
  store i8 0, ptr %69, align 1, !tbaa !5
  %70 = load i32, ptr %9, align 4, !tbaa !8
  %71 = add nsw i32 %70, 3
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %72) #6
  store i8 -1, ptr %73, align 1, !tbaa !5
  %74 = load i32, ptr %8, align 4, !tbaa !8
  %75 = add nsw i32 %74, 8
  %76 = mul nsw i32 %75, 16
  %77 = load i32, ptr %6, align 4, !tbaa !8
  %78 = add nsw i32 %76, %77
  %79 = mul nsw i32 %78, 4
  store i32 %79, ptr %9, align 4, !tbaa !8
  %80 = load i32, ptr %9, align 4, !tbaa !8
  %81 = add nsw i32 %80, 0
  %82 = sext i32 %81 to i64
  %83 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %82) #6
  store i8 -128, ptr %83, align 1, !tbaa !5
  %84 = load i32, ptr %9, align 4, !tbaa !8
  %85 = add nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %86) #6
  store i8 -128, ptr %87, align 1, !tbaa !5
  %88 = load i32, ptr %9, align 4, !tbaa !8
  %89 = add nsw i32 %88, 2
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %90) #6
  store i8 -1, ptr %91, align 1, !tbaa !5
  %92 = load i32, ptr %9, align 4, !tbaa !8
  %93 = add nsw i32 %92, 3
  %94 = sext i32 %93 to i64
  %95 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %94) #6
  store i8 -1, ptr %95, align 1, !tbaa !5
  %96 = load i32, ptr %8, align 4, !tbaa !8
  %97 = add nsw i32 %96, 8
  %98 = mul nsw i32 %97, 16
  %99 = load i32, ptr %6, align 4, !tbaa !8
  %100 = add nsw i32 %99, 8
  %101 = add nsw i32 %98, %100
  %102 = mul nsw i32 %101, 4
  store i32 %102, ptr %9, align 4, !tbaa !8
  %103 = load i32, ptr %9, align 4, !tbaa !8
  %104 = add nsw i32 %103, 0
  %105 = sext i32 %104 to i64
  %106 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %105) #6
  store i8 -64, ptr %106, align 1, !tbaa !5
  %107 = load i32, ptr %9, align 4, !tbaa !8
  %108 = add nsw i32 %107, 1
  %109 = sext i32 %108 to i64
  %110 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %109) #6
  store i8 -64, ptr %110, align 1, !tbaa !5
  %111 = load i32, ptr %9, align 4, !tbaa !8
  %112 = add nsw i32 %111, 2
  %113 = sext i32 %112 to i64
  %114 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %113) #6
  store i8 -64, ptr %114, align 1, !tbaa !5
  %115 = load i32, ptr %9, align 4, !tbaa !8
  %116 = add nsw i32 %115, 3
  %117 = sext i32 %116 to i64
  %118 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %117) #6
  store i8 -1, ptr %118, align 1, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %119

119:                                              ; preds = %30
  %120 = load i32, ptr %8, align 4, !tbaa !8
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %8, align 4, !tbaa !8
  br label %26, !llvm.loop !10

122:                                              ; preds = %29
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %6, align 4, !tbaa !8
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !8
  br label %17, !llvm.loop !12

126:                                              ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %127 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %10, i32 0, i32 0
  store i32 2, ptr %127, align 4, !tbaa !13
  %128 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %10, i32 0, i32 3
  store i32 0, ptr %128, align 4, !tbaa !15
  %129 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %10, i32 0, i32 1
  store i32 16, ptr %129, align 4, !tbaa !16
  %130 = getelementptr inbounds %"struct.glimg::Dimensions", ptr %10, i32 0, i32 2
  store i32 16, ptr %130, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 20, ptr %11) #6
  %131 = getelementptr inbounds %"struct.glimg::UncheckedImageFormat", ptr %11, i32 0, i32 0
  store i32 0, ptr %131, align 4, !tbaa !18
  %132 = getelementptr inbounds %"struct.glimg::UncheckedImageFormat", ptr %11, i32 0, i32 1
  store i32 4, ptr %132, align 4, !tbaa !24
  %133 = getelementptr inbounds %"struct.glimg::UncheckedImageFormat", ptr %11, i32 0, i32 2
  store i32 0, ptr %133, align 4, !tbaa !25
  %134 = getelementptr inbounds %"struct.glimg::UncheckedImageFormat", ptr %11, i32 0, i32 3
  store i32 1, ptr %134, align 4, !tbaa !26
  %135 = getelementptr inbounds %"struct.glimg::UncheckedImageFormat", ptr %11, i32 0, i32 4
  store i32 1, ptr %135, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 96, ptr %12) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %11, i64 20, i1 false), !tbaa.struct !28
  invoke void @_ZN5glimg11ImageFormatC1ENS_20UncheckedImageFormatE(ptr noundef nonnull align 4 dereferenceable(20) %13, ptr noundef byval(%"struct.glimg::UncheckedImageFormat") align 8 %14)
          to label %136 unwind label %146

136:                                              ; preds = %126
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %10, i64 16, i1 false), !tbaa.struct !33
  %137 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %138 = load i64, ptr %137, align 4
  %139 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %140 = load i64, ptr %139, align 4
  invoke void @_ZN5glimg12ImageCreatorC1ENS_11ImageFormatENS_10DimensionsEiii(ptr noundef nonnull align 8 dereferenceable(96) %12, ptr noundef byval(%"class.glimg::ImageFormat") align 8 %13, i64 %138, i64 %140, i32 noundef 1, i32 noundef 1, i32 noundef 1)
          to label %141 unwind label %146

141:                                              ; preds = %136
  %142 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #6
  invoke void @_ZN5glimg12ImageCreator18SetFullMipmapLevelEPKvbi(ptr noundef nonnull align 8 dereferenceable(96) %12, ptr noundef %142, i1 noundef zeroext false, i32 noundef 0)
          to label %143 unwind label %150

143:                                              ; preds = %141
  %144 = invoke noundef ptr @_ZN5glimg12ImageCreator11CreateImageEv(ptr noundef nonnull align 8 dereferenceable(96) %12)
          to label %145 unwind label %150

145:                                              ; preds = %143
  store i32 1, ptr %7, align 4
  call void @_ZN5glimg12ImageCreatorD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %12) #6
  call void @llvm.lifetime.end.p0(i64 96, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %1) #6
  ret ptr %144

146:                                              ; preds = %136, %126
  %147 = landingpad { ptr, i32 }
          cleanup
  %148 = extractvalue { ptr, i32 } %147, 0
  store ptr %148, ptr %4, align 8
  %149 = extractvalue { ptr, i32 } %147, 1
  store i32 %149, ptr %5, align 4
  br label %154

150:                                              ; preds = %143, %141
  %151 = landingpad { ptr, i32 }
          cleanup
  %152 = extractvalue { ptr, i32 } %151, 0
  store ptr %152, ptr %4, align 8
  %153 = extractvalue { ptr, i32 } %151, 1
  store i32 %153, ptr %5, align 4
  call void @_ZN5glimg12ImageCreatorD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %12) #6
  br label %154

154:                                              ; preds = %150, %146
  call void @llvm.lifetime.end.p0(i64 96, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 20, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  br label %155

155:                                              ; preds = %154, %21
  call void @llvm.lifetime.end.p0(i64 24, ptr %1) #6
  br label %156

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2EmRKhRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1), 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) #1

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

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

declare void @_ZN5glimg11ImageFormatC1ENS_20UncheckedImageFormatE(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef byval(%"struct.glimg::UncheckedImageFormat") align 8) unnamed_addr #4

declare void @_ZN5glimg12ImageCreatorC1ENS_11ImageFormatENS_10DimensionsEiii(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef byval(%"class.glimg::ImageFormat") align 8, i64, i64, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #4

declare void @_ZN5glimg12ImageCreator18SetFullMipmapLevelEPKvbi(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, i1 noundef zeroext, i32 noundef) #4

declare noundef ptr @_ZN5glimg12ImageCreator11CreateImageEv(ptr noundef nonnull align 8 dereferenceable(96)) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !9, i64 0}
!14 = !{!"_ZTSN5glimg10DimensionsE", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12}
!15 = !{!14, !9, i64 12}
!16 = !{!14, !9, i64 4}
!17 = !{!14, !9, i64 8}
!18 = !{!19, !20, i64 0}
!19 = !{!"_ZTSN5glimg20UncheckedImageFormatE", !20, i64 0, !21, i64 4, !22, i64 8, !23, i64 12, !9, i64 16}
!20 = !{!"_ZTSN5glimg13PixelDataTypeE", !6, i64 0}
!21 = !{!"_ZTSN5glimg15PixelComponentsE", !6, i64 0}
!22 = !{!"_ZTSN5glimg14ComponentOrderE", !6, i64 0}
!23 = !{!"_ZTSN5glimg8BitdepthE", !6, i64 0}
!24 = !{!19, !21, i64 4}
!25 = !{!19, !22, i64 8}
!26 = !{!19, !23, i64 12}
!27 = !{!19, !9, i64 16}
!28 = !{i64 0, i64 4, !29, i64 4, i64 4, !30, i64 8, i64 4, !31, i64 12, i64 4, !32, i64 16, i64 4, !8}
!29 = !{!20, !20, i64 0}
!30 = !{!21, !21, i64 0}
!31 = !{!22, !22, i64 0}
!32 = !{!23, !23, i64 0}
!33 = !{i64 0, i64 4, !8, i64 4, i64 4, !8, i64 8, i64 4, !8, i64 12, i64 4, !8}


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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN5glimg7loaders4test11TestImage2DEv() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i8, align 1
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca %"class.glimg::ImageCreator", align 8
  %5 = alloca %"class.glimg::ImageFormat", align 8
  %6 = alloca %"struct.glimg::UncheckedImageFormat", align 16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  store i8 -128, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKhRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 1024, ptr noundef nonnull align 1 dereferenceable(1) %2, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %7 unwind label %10

7:                                                ; preds = %0
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  br label %.preheader

.preheader:                                       ; preds = %7, %12
  %indvars.iv41 = phi i64 [ 0, %7 ], [ %indvars.iv.next42, %12 ]
  %8 = or disjoint i64 %indvars.iv41, 8
  br label %13

9:                                                ; preds = %12
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %4) #5
  store <4 x i32> <i32 0, i32 4, i32 0, i32 1>, ptr %6, align 16, !tbaa !5
  %.sroa.8.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 16
  store i32 1, ptr %.sroa.8.0..sroa_idx, align 16, !tbaa !8
  invoke void @_ZN5glimg11ImageFormatC1ENS_20UncheckedImageFormatE(ptr noundef nonnull align 4 dereferenceable(20) %5, ptr noundef nonnull byval(%"struct.glimg::UncheckedImageFormat") align 8 %6)
          to label %52 unwind label %58

10:                                               ; preds = %0
  %11 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  br label %63

12:                                               ; preds = %13
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %exitcond44.not = icmp eq i64 %indvars.iv.next42, 8
  br i1 %exitcond44.not, label %9, label %.preheader, !llvm.loop !10

13:                                               ; preds = %.preheader, %13
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %13 ]
  %14 = shl nuw nsw i64 %indvars.iv, 4
  %15 = or disjoint i64 %14, %indvars.iv41
  %16 = shl nuw nsw i64 %15, 2
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %16) #5
  store i8 -1, ptr %17, align 1, !tbaa !5
  %18 = or disjoint i64 %16, 1
  %19 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %18) #5
  store i8 0, ptr %19, align 1, !tbaa !5
  %20 = or disjoint i64 %16, 2
  %21 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %20) #5
  store i8 0, ptr %21, align 1, !tbaa !5
  %22 = or disjoint i64 %16, 3
  %23 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %22) #5
  store i8 -1, ptr %23, align 1, !tbaa !5
  %24 = or disjoint i64 %14, %8
  %25 = shl nuw nsw i64 %24, 2
  %26 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %25) #5
  store i8 0, ptr %26, align 1, !tbaa !5
  %27 = or disjoint i64 %25, 1
  %28 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %27) #5
  store i8 -128, ptr %28, align 1, !tbaa !5
  %29 = or disjoint i64 %25, 2
  %30 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %29) #5
  store i8 0, ptr %30, align 1, !tbaa !5
  %31 = or disjoint i64 %25, 3
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %31) #5
  store i8 -1, ptr %32, align 1, !tbaa !5
  %33 = or disjoint i64 %14, 128
  %34 = or disjoint i64 %33, %indvars.iv41
  %35 = shl nuw nsw i64 %34, 2
  %36 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %35) #5
  store i8 -128, ptr %36, align 1, !tbaa !5
  %37 = or disjoint i64 %35, 1
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %37) #5
  store i8 -128, ptr %38, align 1, !tbaa !5
  %39 = or disjoint i64 %35, 2
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %39) #5
  store i8 -1, ptr %40, align 1, !tbaa !5
  %41 = or disjoint i64 %35, 3
  %42 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %41) #5
  store i8 -1, ptr %42, align 1, !tbaa !5
  %43 = or disjoint i64 %33, %8
  %44 = shl nuw nsw i64 %43, 2
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %44) #5
  store i8 -64, ptr %45, align 1, !tbaa !5
  %46 = or disjoint i64 %44, 1
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %46) #5
  store i8 -64, ptr %47, align 1, !tbaa !5
  %48 = or disjoint i64 %44, 2
  %49 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %48) #5
  store i8 -64, ptr %49, align 1, !tbaa !5
  %50 = or disjoint i64 %44, 3
  %51 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %50) #5
  store i8 -1, ptr %51, align 1, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 8
  br i1 %exitcond.not, label %12, label %13, !llvm.loop !12

52:                                               ; preds = %9
  invoke void @_ZN5glimg12ImageCreatorC1ENS_11ImageFormatENS_10DimensionsEiii(ptr noundef nonnull align 8 dereferenceable(96) %4, ptr noundef nonnull byval(%"class.glimg::ImageFormat") align 8 %5, i64 68719476738, i64 16, i32 noundef 1, i32 noundef 1, i32 noundef 1)
          to label %53 unwind label %58

53:                                               ; preds = %52
  %54 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #5
  invoke void @_ZN5glimg12ImageCreator18SetFullMipmapLevelEPKvbi(ptr noundef nonnull align 8 dereferenceable(96) %4, ptr noundef nonnull %54, i1 noundef zeroext false, i32 noundef 0)
          to label %55 unwind label %60

55:                                               ; preds = %53
  %56 = invoke noundef ptr @_ZN5glimg12ImageCreator11CreateImageEv(ptr noundef nonnull align 8 dereferenceable(96) %4)
          to label %57 unwind label %60

57:                                               ; preds = %55
  call void @_ZN5glimg12ImageCreatorD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %4) #5
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %4) #5
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #5
  ret ptr %56

58:                                               ; preds = %52, %9
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %62

60:                                               ; preds = %55, %53
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5glimg12ImageCreatorD2Ev(ptr noundef nonnull align 8 dereferenceable(96) %4) #5
  br label %62

62:                                               ; preds = %60, %58
  %.pn = phi { ptr, i32 } [ %61, %60 ], [ %59, %58 ]
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %4) #5
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  br label %63

63:                                               ; preds = %62, %10
  %.pn.pn = phi { ptr, i32 } [ %.pn, %62 ], [ %11, %10 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2EmRKhRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1), 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) #1

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

declare void @_ZN5glimg11ImageFormatC1ENS_20UncheckedImageFormatE(ptr noundef nonnull align 4 dereferenceable(20), ptr noundef byval(%"struct.glimg::UncheckedImageFormat") align 8) unnamed_addr #3

declare void @_ZN5glimg12ImageCreatorC1ENS_11ImageFormatENS_10DimensionsEiii(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef byval(%"class.glimg::ImageFormat") align 8, i64, i64, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3

declare void @_ZN5glimg12ImageCreator18SetFullMipmapLevelEPKvbi(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, i1 noundef zeroext, i32 noundef) local_unnamed_addr #3

declare noundef ptr @_ZN5glimg12ImageCreator11CreateImageEv(ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass