; LLVM IR from filipwasil/fillwave :: ext/nv_helpers_gl/nv_dds.ll (ZN6nv_dds9CDDSImage16upload_texture3DEv)

; 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.nv_dds::CDDSImage" = type { i32, i32, i32, i32, i8, %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<nv_dds::CTexture, std::allocator<nv_dds::CTexture>>::_Deque_impl" }
%"struct.std::_Deque_base<nv_dds::CTexture, std::allocator<nv_dds::CTexture>>::_Deque_impl" = type { %"struct.std::_Deque_base<nv_dds::CTexture, std::allocator<nv_dds::CTexture>>::_Deque_impl_data" }
%"struct.std::_Deque_base<nv_dds::CTexture, std::allocator<nv_dds::CTexture>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv = external hidden unnamed_addr constant [43 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [27 x i8], align 1
@glad_glCompressedTexImage3D = external global ptr, align 8

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6nv_dds9CDDSImage13is_compressedEv(ptr noundef nonnull align 8 dereferenceable(104)) #1 align 2

; 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 noundef nonnull align 8 dereferenceable(112) ptr @_ZNSt5dequeIN6nv_dds8CTextureESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(80), i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CTexture15get_num_mipmapsEv(ptr noundef nonnull align 8 dereferenceable(112)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6nv_dds8CSurfacecvPhEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface8get_sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6nv_dds8CTexture10get_mipmapEj(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6nv_dds9CDDSImage16upload_texture3DEv(ptr noundef nonnull align 8 dereferenceable(104) %0) #4 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  %9 = getelementptr inbounds %"class.nv_dds::CDDSImage", ptr %8, i32 0, i32 4
  %10 = load i8, ptr %9, align 8, !tbaa !9, !range !20, !noundef !21
  %11 = trunc i8 %10 to i1
  br i1 %11, label %12, label %13

12:                                               ; preds = %1
  br label %15

13:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.1, i32 noundef 821, ptr noundef @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #5
  unreachable

14:                                               ; No predecessors!
  br label %15

15:                                               ; preds = %14, %12
  %16 = getelementptr inbounds %"class.nv_dds::CDDSImage", ptr %8, i32 0, i32 5
  %17 = call noundef zeroext i1 @_ZNKSt5dequeIN6nv_dds8CTextureESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %16) #6
  %18 = xor i1 %17, true
  br i1 %18, label %19, label %20

19:                                               ; preds = %15
  br label %22

20:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.1, i32 noundef 822, ptr noundef @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #5
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %19
  %23 = getelementptr inbounds %"class.nv_dds::CDDSImage", ptr %8, i32 0, i32 3
  %24 = load i32, ptr %23, align 4, !tbaa !22
  %25 = icmp eq i32 %24, 2
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  br label %29

27:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.31, ptr noundef @.str.1, i32 noundef 823, ptr noundef @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #5
  unreachable

28:                                               ; No predecessors!
  br label %29

29:                                               ; preds = %28, %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %30 = getelementptr inbounds %"class.nv_dds::CDDSImage", ptr %8, i32 0, i32 5
  %31 = call noundef nonnull align 8 dereferenceable(112) ptr @_ZNSt5dequeIN6nv_dds8CTextureESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(80) %30, i64 noundef 0) #6
  store ptr %31, ptr %4, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  %34 = icmp uge i32 %33, 1
  br i1 %34, label %35, label %36

35:                                               ; preds = %29
  br label %38

36:                                               ; preds = %29
  call void @__assert_fail(ptr noundef @.str.32, ptr noundef @.str.1, i32 noundef 827, ptr noundef @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #5
  unreachable

37:                                               ; No predecessors!
  br label %38

38:                                               ; preds = %37, %35
  %39 = call noundef zeroext i1 @_ZN6nv_dds9CDDSImage13is_compressedEv(ptr noundef nonnull align 8 dereferenceable(104) %8)
  br i1 %39, label %40, label %87

40:                                               ; preds = %38
  %41 = load ptr, ptr @glad_glCompressedTexImage3D, align 8, !tbaa !5
  %42 = icmp eq ptr %41, null
  br i1 %42, label %43, label %44

43:                                               ; preds = %40
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %89

44:                                               ; preds = %40
  %45 = load ptr, ptr @glad_glCompressedTexImage3D, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.nv_dds::CDDSImage", ptr %8, i32 0, i32 0
  %47 = load i32, ptr %46, align 8, !tbaa !23
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = call noundef i32 @_ZNK6nv_dds8CSurface9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %48)
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = call noundef i32 @_ZNK6nv_dds8CSurface10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %50)
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = call noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32) %52)
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = call noundef i32 @_ZNK6nv_dds8CSurface8get_sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %54)
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = call noundef ptr @_ZNK6nv_dds8CSurfacecvPhEv(ptr noundef nonnull align 8 dereferenceable(32) %56)
  call void %45(i32 noundef 32879, i32 noundef 0, i32 noundef %47, i32 noundef %49, i32 noundef %51, i32 noundef %53, i32 noundef 0, i32 noundef %55, ptr noundef %57)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !24
  br label %58

58:                                               ; preds = %83, %44
  %59 = load i32, ptr %6, align 4, !tbaa !24
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = call noundef i32 @_ZNK6nv_dds8CTexture15get_num_mipmapsEv(ptr noundef nonnull align 8 dereferenceable(112) %60)
  %62 = icmp ult i32 %59, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %58
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %86

64:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !24
  %67 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6nv_dds8CTexture10get_mipmapEj(ptr noundef nonnull align 8 dereferenceable(112) %65, i32 noundef %66)
  store ptr %67, ptr %7, align 8, !tbaa !5
  %68 = load ptr, ptr @glad_glCompressedTexImage3D, align 8, !tbaa !5
  %69 = load i32, ptr %6, align 4, !tbaa !24
  %70 = add i32 %69, 1
  %71 = getelementptr inbounds %"class.nv_dds::CDDSImage", ptr %8, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !23
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = call noundef i32 @_ZNK6nv_dds8CSurface9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %73)
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = call noundef i32 @_ZNK6nv_dds8CSurface10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %75)
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = call noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32) %77)
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = call noundef i32 @_ZNK6nv_dds8CSurface8get_sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %79)
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = call noundef ptr @_ZNK6nv_dds8CSurfacecvPhEv(ptr noundef nonnull align 8 dereferenceable(32) %81)
  call void %68(i32 noundef 32879, i32 noundef %70, i32 noundef %72, i32 noundef %74, i32 noundef %76, i32 noundef %78, i32 noundef 0, i32 noundef %80, ptr noundef %82)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %83

83:                                               ; preds = %64
  %84 = load i32, ptr %6, align 4, !tbaa !24
  %85 = add i32 %84, 1
  store i32 %85, ptr %6, align 4, !tbaa !24
  br label %58, !llvm.loop !25

86:                                               ; preds = %63
  br label %88

87:                                               ; preds = %38
  br label %88

88:                                               ; preds = %87, %86
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %89

89:                                               ; preds = %88, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %90 = load i1, ptr %2, align 1
  ret i1 %90
}

attributes #0 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #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 = { 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 #5 = { noreturn nounwind }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !13, i64 16}
!10 = !{!"_ZTSN6nv_dds9CDDSImageE", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 12, !13, i64 16, !14, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN6nv_dds11TextureTypeE", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSSt5dequeIN6nv_dds8CTextureESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt11_Deque_baseIN6nv_dds8CTextureESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt11_Deque_baseIN6nv_dds8CTextureESaIS1_EE11_Deque_implE", !17, i64 0}
!17 = !{!"_ZTSNSt11_Deque_baseIN6nv_dds8CTextureESaIS1_EE16_Deque_impl_dataE", !6, i64 0, !18, i64 8, !19, i64 16, !19, i64 48}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTSSt15_Deque_iteratorIN6nv_dds8CTextureERS1_PS1_E", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!10, !12, i64 12}
!23 = !{!10, !11, i64 0}
!24 = !{!11, !11, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"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"

@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv = external hidden unnamed_addr constant [43 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [27 x i8], align 1
@glad_glCompressedTexImage3D = external local_unnamed_addr global ptr, align 8

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(112) ptr @_ZNSt5dequeIN6nv_dds8CTextureESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(80), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CTexture15get_num_mipmapsEv(ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface8get_sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6nv_dds8CTexture10get_mipmapEj(ptr noundef nonnull align 8 dereferenceable(112), i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6nv_dds8CSurface9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6nv_dds9CDDSImage16upload_texture3DEv(ptr noundef nonnull align 8 dereferenceable(104) %0) local_unnamed_addr #3 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load i8, ptr %2, align 8, !tbaa !5, !range !19, !noundef !20
  %4 = trunc nuw i8 %3 to i1
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.1, i32 noundef 821, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #4
  unreachable

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = tail call noundef zeroext i1 @_ZNKSt5dequeIN6nv_dds8CTextureESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7) #5
  br i1 %8, label %9, label %10

9:                                                ; preds = %6
  tail call void @__assert_fail(ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.1, i32 noundef 822, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #4
  unreachable

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 12
  %12 = load i32, ptr %11, align 4, !tbaa !21
  %13 = icmp eq i32 %12, 2
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.31, ptr noundef nonnull @.str.1, i32 noundef 823, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #4
  unreachable

15:                                               ; preds = %10
  %16 = tail call noundef nonnull align 8 dereferenceable(112) ptr @_ZNSt5dequeIN6nv_dds8CTextureESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(80) %7, i64 noundef 0) #5
  %17 = tail call noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %18, label %19

18:                                               ; preds = %15
  tail call void @__assert_fail(ptr noundef nonnull @.str.32, ptr noundef nonnull @.str.1, i32 noundef 827, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN6nv_dds9CDDSImage16upload_texture3DEv) #4
  unreachable

19:                                               ; preds = %15
  %20 = tail call noundef zeroext i1 @_ZN6nv_dds9CDDSImage13is_compressedEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  br i1 %20, label %21, label %.loopexit

21:                                               ; preds = %19
  %22 = load ptr, ptr @glad_glCompressedTexImage3D, align 8, !tbaa !22
  %23 = icmp eq ptr %22, null
  br i1 %23, label %.loopexit, label %24

24:                                               ; preds = %21
  %25 = load i32, ptr %0, align 8, !tbaa !23
  %26 = tail call noundef i32 @_ZNK6nv_dds8CSurface9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  %27 = tail call noundef i32 @_ZNK6nv_dds8CSurface10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  %28 = tail call noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  %29 = tail call noundef i32 @_ZNK6nv_dds8CSurface8get_sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  %30 = tail call noundef ptr @_ZNK6nv_dds8CSurfacecvPhEv(ptr noundef nonnull align 8 dereferenceable(32) %16)
  tail call void %22(i32 noundef 32879, i32 noundef 0, i32 noundef %25, i32 noundef %26, i32 noundef %27, i32 noundef %28, i32 noundef 0, i32 noundef %29, ptr noundef %30)
  %31 = tail call noundef i32 @_ZNK6nv_dds8CTexture15get_num_mipmapsEv(ptr noundef nonnull align 8 dereferenceable(112) %16)
  %.not21 = icmp eq i32 %31, 0
  br i1 %.not21, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %24, %.lr.ph
  %.01820 = phi i32 [ %34, %.lr.ph ], [ 0, %24 ]
  %32 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNK6nv_dds8CTexture10get_mipmapEj(ptr noundef nonnull align 8 dereferenceable(112) %16, i32 noundef %.01820)
  %33 = load ptr, ptr @glad_glCompressedTexImage3D, align 8, !tbaa !22
  %34 = add nuw i32 %.01820, 1
  %35 = load i32, ptr %0, align 8, !tbaa !23
  %36 = tail call noundef i32 @_ZNK6nv_dds8CSurface9get_widthEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  %37 = tail call noundef i32 @_ZNK6nv_dds8CSurface10get_heightEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  %38 = tail call noundef i32 @_ZNK6nv_dds8CSurface9get_depthEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  %39 = tail call noundef i32 @_ZNK6nv_dds8CSurface8get_sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  %40 = tail call noundef ptr @_ZNK6nv_dds8CSurfacecvPhEv(ptr noundef nonnull align 8 dereferenceable(32) %32)
  tail call void %33(i32 noundef 32879, i32 noundef %34, i32 noundef %35, i32 noundef %36, i32 noundef %37, i32 noundef %38, i32 noundef 0, i32 noundef %39, ptr noundef %40)
  %41 = tail call noundef i32 @_ZNK6nv_dds8CTexture15get_num_mipmapsEv(ptr noundef nonnull align 8 dereferenceable(112) %16)
  %42 = icmp ult i32 %34, %41
  br i1 %42, label %.lr.ph, label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %.lr.ph, %24, %19, %21
  %.0 = phi i1 [ false, %21 ], [ true, %19 ], [ true, %24 ], [ true, %.lr.ph ]
  ret i1 %.0
}

attributes #0 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #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 = { noreturn nounwind }
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, !11, i64 16}
!6 = !{!"_ZTSN6nv_dds9CDDSImageE", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 12, !11, i64 16, !12, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN6nv_dds11TextureTypeE", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSSt5dequeIN6nv_dds8CTextureESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt11_Deque_baseIN6nv_dds8CTextureESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSNSt11_Deque_baseIN6nv_dds8CTextureESaIS1_EE11_Deque_implE", !15, i64 0}
!15 = !{!"_ZTSNSt11_Deque_baseIN6nv_dds8CTextureESaIS1_EE16_Deque_impl_dataE", !16, i64 0, !17, i64 8, !18, i64 16, !18, i64 48}
!16 = !{!"any pointer", !8, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!"_ZTSSt15_Deque_iteratorIN6nv_dds8CTextureERS1_PS1_E", !16, i64 0, !16, i64 8, !16, i64 16, !16, i64 24}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!6, !10, i64 12}
!22 = !{!16, !16, i64 0}
!23 = !{!6, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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