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

; 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
@_ZTIN5glimg25ArrayOutOfBoundsExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg29FaceIndexOutOfBoundsExceptionE = 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 uwtable
define dso_local void @_ZN5glimg12ImageCreator12SetImageDataEPKvbiii(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, i1 noundef zeroext %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) #3 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  %17 = zext i1 %2 to i8
  store i8 %17, ptr %9, align 1, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !11
  store i32 %4, ptr %11, align 4, !tbaa !11
  store i32 %5, ptr %12, align 4, !tbaa !11
  %18 = load ptr, ptr %7, align 8
  %19 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 5
  %20 = call noundef zeroext i1 @_ZNKSt6vectorIS_IhSaIhEESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #4
  br i1 %20, label %21, label %28

21:                                               ; preds = %6
  %22 = call ptr @__cxa_allocate_exception(i64 40) #4
  invoke void @_ZN5glimg31ImageSetAlreadyCreatedExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %22)
          to label %23 unwind label %24

23:                                               ; preds = %21
  call void @__cxa_throw(ptr %22, ptr @_ZTIN5glimg31ImageSetAlreadyCreatedExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #5
  unreachable

24:                                               ; preds = %21
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %13, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %14, align 4
  call void @__cxa_free_exception(ptr %22) #4
  br label %110

28:                                               ; preds = %6
  %29 = load i32, ptr %11, align 4, !tbaa !11
  %30 = icmp slt i32 %29, 0
  br i1 %30, label %36, label %31

31:                                               ; preds = %28
  %32 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 3
  %33 = load i32, ptr %32, align 8, !tbaa !13
  %34 = load i32, ptr %11, align 4, !tbaa !11
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %36, label %43

36:                                               ; preds = %31, %28
  %37 = call ptr @__cxa_allocate_exception(i64 40) #4
  invoke void @_ZN5glimg25ArrayOutOfBoundsExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %37)
          to label %38 unwind label %39

38:                                               ; preds = %36
  call void @__cxa_throw(ptr %37, ptr @_ZTIN5glimg25ArrayOutOfBoundsExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #5
  unreachable

39:                                               ; preds = %36
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %13, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %14, align 4
  call void @__cxa_free_exception(ptr %37) #4
  br label %110

43:                                               ; preds = %31
  %44 = load i32, ptr %10, align 4, !tbaa !11
  %45 = icmp slt i32 %44, 0
  br i1 %45, label %51, label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 2
  %48 = load i32, ptr %47, align 4, !tbaa !30
  %49 = load i32, ptr %10, align 4, !tbaa !11
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %51, label %58

51:                                               ; preds = %46, %43
  %52 = call ptr @__cxa_allocate_exception(i64 40) #4
  invoke void @_ZN5glimg31MipmapLayerOutOfBoundsExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %52)
          to label %53 unwind label %54

53:                                               ; preds = %51
  call void @__cxa_throw(ptr %52, ptr @_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #5
  unreachable

54:                                               ; preds = %51
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %13, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %14, align 4
  call void @__cxa_free_exception(ptr %52) #4
  br label %110

58:                                               ; preds = %46
  %59 = load i32, ptr %12, align 4, !tbaa !11
  %60 = icmp slt i32 %59, 0
  br i1 %60, label %66, label %61

61:                                               ; preds = %58
  %62 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 4
  %63 = load i32, ptr %62, align 4, !tbaa !31
  %64 = load i32, ptr %12, align 4, !tbaa !11
  %65 = icmp sle i32 %63, %64
  br i1 %65, label %66, label %73

66:                                               ; preds = %61, %58
  %67 = call ptr @__cxa_allocate_exception(i64 40) #4
  invoke void @_ZN5glimg29FaceIndexOutOfBoundsExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %67)
          to label %68 unwind label %69

68:                                               ; preds = %66
  call void @__cxa_throw(ptr %67, ptr @_ZTIN5glimg29FaceIndexOutOfBoundsExceptionE, ptr @_ZN5glimg22ImageCreationExceptionD2Ev) #5
  unreachable

69:                                               ; preds = %66
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %13, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %14, align 4
  call void @__cxa_free_exception(ptr %67) #4
  br label %110

73:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %74 = load i32, ptr %11, align 4, !tbaa !11
  %75 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 4
  %76 = load i32, ptr %75, align 4, !tbaa !31
  %77 = mul nsw i32 %74, %76
  %78 = load i32, ptr %12, align 4, !tbaa !11
  %79 = add nsw i32 %77, %78
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 6
  %82 = load i32, ptr %10, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %81, i64 noundef %83) #4
  %85 = load i64, ptr %84, align 8, !tbaa !32
  %86 = mul i64 %80, %85
  store i64 %86, ptr %15, align 8, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %87 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 5
  %88 = load i32, ptr %10, align 4, !tbaa !11
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IhSaIhEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %87, i64 noundef %89) #4
  %91 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %90, i64 noundef 0) #4
  store ptr %91, ptr %16, align 8, !tbaa !5
  %92 = load i64, ptr %15, align 8, !tbaa !32
  %93 = load ptr, ptr %16, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %93, i64 %92
  store ptr %94, ptr %16, align 8, !tbaa !5
  %95 = load i8, ptr %9, align 1, !tbaa !9, !range !34, !noundef !35
  %96 = trunc i8 %95 to i1
  br i1 %96, label %105, label %97

97:                                               ; preds = %73
  %98 = load ptr, ptr %16, align 8, !tbaa !5
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %"class.glimg::ImageCreator", ptr %18, i32 0, i32 6
  %101 = load i32, ptr %10, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %100, i64 noundef %102) #4
  %104 = load i64, ptr %103, align 8, !tbaa !32
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %98, ptr align 1 %99, i64 %104, i1 false)
  br label %109

105:                                              ; preds = %73
  %106 = load ptr, ptr %8, align 8, !tbaa !5
  %107 = load ptr, ptr %16, align 8, !tbaa !5
  %108 = load i32, ptr %10, align 4, !tbaa !11
  call void @_ZN5glimg12ImageCreator16CopyImageFlippedEPKvPhi(ptr noundef nonnull align 8 dereferenceable(96) %18, ptr noundef %106, ptr noundef %107, i32 noundef %108)
  br label %109

109:                                              ; preds = %105, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  ret void

110:                                              ; preds = %69, %54, %39, %24
  %111 = load ptr, ptr %13, align 8
  %112 = load i32, ptr %14, align 4
  %113 = insertvalue { ptr, i32 } poison, ptr %111, 0
  %114 = insertvalue { ptr, i32 } %113, i32 %112, 1
  resume { ptr, i32 } %114
}

; 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 @_ZN5glimg25ArrayOutOfBoundsExceptionC2Ev(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 uwtable
declare dso_local void @_ZN5glimg29FaceIndexOutOfBoundsExceptionC2Ev(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

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 40}
!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 = !{!14, !12, i64 36}
!31 = !{!14, !12, i64 44}
!32 = !{!33, !33, i64 0}
!33 = !{!"long", !7, i64 0}
!34 = !{i8 0, i8 2}
!35 = !{}


; 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
@_ZTIN5glimg25ArrayOutOfBoundsExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN5glimg29FaceIndexOutOfBoundsExceptionE = 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 uwtable
define dso_local void @_ZN5glimg12ImageCreator12SetImageDataEPKvbiii(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, i1 noundef zeroext %2, i32 noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = tail call noundef zeroext i1 @_ZNKSt6vectorIS_IhSaIhEESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #3
  br i1 %8, label %9, label %14

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

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

12:                                               ; preds = %9
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %59

14:                                               ; preds = %6
  %15 = icmp sgt i32 %4, -1
  %16 = getelementptr inbounds i8, ptr %0, i64 40
  %17 = load i32, ptr %16, align 8
  %.not = icmp sgt i32 %17, %4
  %or.cond = select i1 %15, i1 %.not, i1 false
  br i1 %or.cond, label %23, label %18

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

20:                                               ; preds = %18
  tail call void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTIN5glimg25ArrayOutOfBoundsExceptionE, ptr nonnull @_ZN5glimg22ImageCreationExceptionD2Ev) #4
  unreachable

21:                                               ; preds = %18
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %59

23:                                               ; preds = %14
  %24 = icmp sgt i32 %3, -1
  %25 = getelementptr inbounds i8, ptr %0, i64 36
  %26 = load i32, ptr %25, align 4
  %.not26 = icmp sgt i32 %26, %3
  %or.cond31 = select i1 %24, i1 %.not26, i1 false
  br i1 %or.cond31, label %32, label %27

27:                                               ; preds = %23
  %28 = tail call ptr @__cxa_allocate_exception(i64 40) #3
  invoke void @_ZN5glimg31MipmapLayerOutOfBoundsExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %28)
          to label %29 unwind label %30

29:                                               ; preds = %27
  tail call void @__cxa_throw(ptr nonnull %28, ptr nonnull @_ZTIN5glimg31MipmapLayerOutOfBoundsExceptionE, ptr nonnull @_ZN5glimg22ImageCreationExceptionD2Ev) #4
  unreachable

30:                                               ; preds = %27
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %59

32:                                               ; preds = %23
  %33 = icmp slt i32 %5, 0
  br i1 %33, label %37, label %34

34:                                               ; preds = %32
  %35 = getelementptr inbounds i8, ptr %0, i64 44
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %.not27 = icmp sgt i32 %36, %5
  br i1 %.not27, label %42, label %37

37:                                               ; preds = %34, %32
  %38 = tail call ptr @__cxa_allocate_exception(i64 40) #3
  invoke void @_ZN5glimg29FaceIndexOutOfBoundsExceptionC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %38)
          to label %39 unwind label %40

39:                                               ; preds = %37
  tail call void @__cxa_throw(ptr nonnull %38, ptr nonnull @_ZTIN5glimg29FaceIndexOutOfBoundsExceptionE, ptr nonnull @_ZN5glimg22ImageCreationExceptionD2Ev) #4
  unreachable

40:                                               ; preds = %37
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %59

42:                                               ; preds = %34
  %43 = mul nsw i32 %36, %4
  %44 = add nuw nsw i32 %43, %5
  %45 = zext nneg i32 %44 to i64
  %46 = getelementptr inbounds i8, ptr %0, i64 72
  %47 = zext nneg i32 %3 to i64
  %48 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #3
  %49 = load i64, ptr %48, align 8, !tbaa !26
  %50 = mul i64 %49, %45
  %51 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IhSaIhEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %47) #3
  %52 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef 0) #3
  %53 = getelementptr inbounds i8, ptr %52, i64 %50
  br i1 %2, label %57, label %54

54:                                               ; preds = %42
  %55 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorImSaImEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #3
  %56 = load i64, ptr %55, align 8, !tbaa !26
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %53, ptr align 1 %1, i64 %56, i1 false)
  br label %58

57:                                               ; preds = %42
  tail call void @_ZN5glimg12ImageCreator16CopyImageFlippedEPKvPhi(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1, ptr noundef nonnull %53, i32 noundef %3)
  br label %58

58:                                               ; preds = %57, %54
  ret void

59:                                               ; preds = %40, %30, %21, %12
  %.sink = phi ptr [ %38, %40 ], [ %28, %30 ], [ %19, %21 ], [ %10, %12 ]
  %.pn = phi { ptr, i32 } [ %41, %40 ], [ %31, %30 ], [ %22, %21 ], [ %13, %12 ]
  tail call void @__cxa_free_exception(ptr %.sink) #3
  resume { ptr, i32 } %.pn
}

; 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 @_ZN5glimg25ArrayOutOfBoundsExceptionC2Ev(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 uwtable
declare dso_local void @_ZN5glimg29FaceIndexOutOfBoundsExceptionC2Ev(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

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 44}
!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 = !{!27, !27, i64 0}
!27 = !{!"long", !10, i64 0}


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