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

; 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::ImageCreator" = type { %"class.glimg::ImageFormat", %"struct.glimg::Dimensions", i32, i32, i32, %"class.std::vector", %"class.std::vector.0" }
%"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" = 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 }

@_ZTIN5glimg31ImageSetAlreadyCreatedExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8

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

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

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

declare ptr @__cxa_allocate_exception(i64)

declare void @__cxa_free_exception(ptr)

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

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

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

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

; 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: mustprogress uwtable
declare dso_local void @_ZN5glimg12ImageCreator16CopyImageFlippedEPKvPhi(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, ptr noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5glimg12ImageCreator18SetFullMipmapLevelEPKvbi(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, i1 noundef zeroext %2, i32 noundef %3) #3 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  %14 = zext i1 %2 to i8
  store i8 %14, ptr %7, align 1, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  %15 = load ptr, ptr %5, align 8
  %16 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 5
  %17 = call noundef zeroext i1 @_ZNKSt6vectorIS_IhSaIhEESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #4
  br i1 %17, label %18, label %25

18:                                               ; preds = %4
  %19 = call ptr @__cxa_allocate_exception(i64 40) #4
  invoke void @_ZN5glimg31ImageSetAlreadyCreatedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %19)
          to label %20 unwind label %21

20:                                               ; preds = %18
  call void @__cxa_throw(ptr %19, ptr @_ZTIN5glimg31ImageSetAlreadyCreatedExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #5
  unreachable

21:                                               ; preds = %18
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %9, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %10, align 4
  call void @__cxa_free_exception(ptr %19) #4
  br label %98

25:                                               ; preds = %4
  %26 = load i32, ptr %8, align 4, !tbaa !11
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %33, label %28

28:                                               ; preds = %25
  %29 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 2
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = load i32, ptr %8, align 4, !tbaa !11
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %33, label %40

33:                                               ; preds = %28, %25
  %34 = call ptr @__cxa_allocate_exception(i64 40) #4
  invoke void @_ZN5glimg31MipmapLayerOutOfBoundsExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %34)
          to label %35 unwind label %36

35:                                               ; preds = %33
  call void @__cxa_throw(ptr %34, ptr @_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #5
  unreachable

36:                                               ; preds = %33
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %9, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %10, align 4
  call void @__cxa_free_exception(ptr %34) #4
  br label %98

40:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %41 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 5
  %42 = load i32, ptr %8, align 4, !tbaa !11
  %43 = sext i32 %42 to i64
  %44 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IhSaIhEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %43) #4
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef 0) #4
  store ptr %45, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %46, ptr %12, align 8, !tbaa !5
  %47 = load i8, ptr %7, align 1, !tbaa !9, !range !30, !noundef !31
  %48 = trunc i8 %47 to i1
  br i1 %48, label %65, label %49

49:                                               ; preds = %40
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 6
  %53 = load i32, ptr %8, align 4, !tbaa !11
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54) #4
  %56 = load i64, ptr %55, align 8, !tbaa !32
  %57 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 3
  %58 = load i32, ptr %57, align 8, !tbaa !34
  %59 = sext i32 %58 to i64
  %60 = mul i64 %56, %59
  %61 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 4
  %62 = load i32, ptr %61, align 4, !tbaa !35
  %63 = sext i32 %62 to i64
  %64 = mul i64 %60, %63
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %50, ptr align 1 %51, i64 %64, i1 false)
  br label %97

65:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %93, %65
  %67 = load i32, ptr %13, align 4, !tbaa !11
  %68 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 3
  %69 = load i32, ptr %68, align 8, !tbaa !34
  %70 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 4
  %71 = load i32, ptr %70, align 4, !tbaa !35
  %72 = mul nsw i32 %69, %71
  %73 = icmp slt i32 %67, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %96

75:                                               ; preds = %66
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !11
  call void @_ZN5glimg12ImageCreator16CopyImageFlippedEPKvPhi(ptr noundef nonnull align 8 dereferenceable(96) %15, ptr noundef %76, ptr noundef %77, i32 noundef %78)
  %79 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 6
  %80 = load i32, ptr %8, align 4, !tbaa !11
  %81 = sext i32 %80 to i64
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %79, i64 noundef %81) #4
  %83 = load i64, ptr %82, align 8, !tbaa !32
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i64 %83
  store ptr %85, ptr %12, align 8, !tbaa !5
  %86 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %15, i32 0, i32 6
  %87 = load i32, ptr %8, align 4, !tbaa !11
  %88 = sext i32 %87 to i64
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef %88) #4
  %90 = load i64, ptr %89, align 8, !tbaa !32
  %91 = load ptr, ptr %11, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %91, i64 %90
  store ptr %92, ptr %11, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %75
  %94 = load i32, ptr %13, align 4, !tbaa !11
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %13, align 4, !tbaa !11
  br label %66, !llvm.loop !36

96:                                               ; preds = %74
  br label %97

97:                                               ; preds = %96, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void

98:                                               ; preds = %36, %21
  %99 = load ptr, ptr %9, align 8
  %100 = load i32, ptr %10, align 4
  %101 = insertvalue { ptr, i32 } poison, ptr %99, 0
  %102 = insertvalue { ptr, i32 } %101, i32 %100, 1
  resume { ptr, i32 } %102
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 36}
!14 = !{!"_ZTSN5glimg12ImageCreatorE", !15, i64 0, !21, i64 20, !12, i64 36, !12, i64 40, !12, i64 44, !22, i64 48, !26, i64 72}
!15 = !{!"_ZTSN5glimg11ImageFormatE", !16, i64 0}
!16 = !{!"_ZTSN5glimg20UncheckedImageFormatE", !17, i64 0, !18, i64 4, !19, i64 8, !20, i64 12, !12, i64 16}
!17 = !{!"_ZTSN5glimg13PixelDataTypeE", !7, i64 0}
!18 = !{!"_ZTSN5glimg15PixelComponentsE", !7, i64 0}
!19 = !{!"_ZTSN5glimg14ComponentOrderE", !7, i64 0}
!20 = !{!"_ZTSN5glimg8BitdepthE", !7, i64 0}
!21 = !{!"_ZTSN5glimg10DimensionsE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!22 = !{!"_ZTSSt6vectorIS_IhSaIhEESaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseISt6vectorIhSaIhEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!"_ZTSSt6vectorImSaImEE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseImSaImEE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseImSaImEE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseImSaImEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{!33, !33, i64 0}
!33 = !{!"long", !7, i64 0}
!34 = !{!14, !12, i64 40}
!35 = !{!14, !12, i64 44}
!36 = distinct !{!36, !37}
!37 = !{!"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"

@_ZTIN5glimg31ImageSetAlreadyCreatedExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8

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

declare i32 @__gxx_personality_v0(...)

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIS_IhSaIhEESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5glimg12ImageCreator16CopyImageFlippedEPKvPhi(ptr noundef nonnull align 8 dereferenceable(96), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5glimg12ImageCreator18SetFullMipmapLevelEPKvbi(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, i1 noundef zeroext %2, i32 noundef %3) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  %6 = tail call noundef zeroext i1 @_ZNKSt6vectorIS_IhSaIhEESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  br i1 %6, label %7, label %12

7:                                                ; preds = %4
  %8 = tail call ptr @__cxa_allocate_exception(i64 40) #3
  invoke void @_ZN5glimg31ImageSetAlreadyCreatedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %9 unwind label %10

9:                                                ; preds = %7
  tail call void @__cxa_throw(ptr nonnull %8, ptr nonnull @_ZTIN5glimg31ImageSetAlreadyCreatedExceptionE, ptr nonnull @_ZN5glimg22ImageCreationExceptionD2Ev) #4
  unreachable

10:                                               ; preds = %7
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %56

12:                                               ; preds = %4
  %13 = icmp sgt i32 %3, -1
  %14 = getelementptr inbounds i8, ptr %0, i64 36
  %15 = load i32, ptr %14, align 4
  %.not = icmp sgt i32 %15, %3
  %or.cond = select i1 %13, i1 %.not, i1 false
  br i1 %or.cond, label %21, label %16

16:                                               ; preds = %12
  %17 = tail call ptr @__cxa_allocate_exception(i64 40) #3
  invoke void @_ZN5glimg31MipmapLayerOutOfBoundsExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %17)
          to label %18 unwind label %19

18:                                               ; preds = %16
  tail call void @__cxa_throw(ptr nonnull %17, ptr nonnull @_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE, ptr nonnull @_ZN5glimg22ImageCreationExceptionD2Ev) #4
  unreachable

19:                                               ; preds = %16
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %56

21:                                               ; preds = %12
  %22 = zext nneg i32 %3 to i64
  %23 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IhSaIhEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %22) #3
  %24 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef 0) #3
  br i1 %2, label %.preheader, label %32

.preheader:                                       ; preds = %21
  %25 = getelementptr inbounds i8, ptr %0, i64 40
  %26 = getelementptr inbounds i8, ptr %0, i64 44
  %27 = load i32, ptr %25, align 8, !tbaa !5
  %28 = load i32, ptr %26, align 4, !tbaa !26
  %29 = mul nsw i32 %28, %27
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %31 = getelementptr inbounds i8, ptr %0, i64 72
  br label %44

32:                                               ; preds = %21
  %33 = getelementptr inbounds i8, ptr %0, i64 72
  %34 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %22) #3
  %35 = load i64, ptr %34, align 8, !tbaa !27
  %36 = getelementptr inbounds i8, ptr %0, i64 40
  %37 = load i32, ptr %36, align 8, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = mul i64 %35, %38
  %40 = getelementptr inbounds i8, ptr %0, i64 44
  %41 = load i32, ptr %40, align 4, !tbaa !26
  %42 = sext i32 %41 to i64
  %43 = mul i64 %39, %42
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %24, ptr align 1 %1, i64 %43, i1 false)
  br label %.loopexit

44:                                               ; preds = %.lr.ph, %44
  %.028 = phi i32 [ 0, %.lr.ph ], [ %51, %44 ]
  %.01927 = phi ptr [ %1, %.lr.ph ], [ %47, %44 ]
  %.02026 = phi ptr [ %24, %.lr.ph ], [ %50, %44 ]
  tail call void @_ZN5glimg12ImageCreator16CopyImageFlippedEPKvPhi(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %.01927, ptr noundef %.02026, i32 noundef %3)
  %45 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %22) #3
  %46 = load i64, ptr %45, align 8, !tbaa !27
  %47 = getelementptr inbounds i8, ptr %.01927, i64 %46
  %48 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %22) #3
  %49 = load i64, ptr %48, align 8, !tbaa !27
  %50 = getelementptr inbounds i8, ptr %.02026, i64 %49
  %51 = add nuw nsw i32 %.028, 1
  %52 = load i32, ptr %25, align 8, !tbaa !5
  %53 = load i32, ptr %26, align 4, !tbaa !26
  %54 = mul nsw i32 %53, %52
  %55 = icmp slt i32 %51, %54
  br i1 %55, label %44, label %.loopexit, !llvm.loop !29

.loopexit:                                        ; preds = %44, %.preheader, %32
  ret void

56:                                               ; preds = %19, %10
  %.sink = phi ptr [ %17, %19 ], [ %8, %10 ]
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %11, %10 ]
  tail call void @__cxa_free_exception(ptr %.sink) #3
  resume { ptr, i32 } %.pn
}

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass