; LLVM IR from Razakhel/RaZ :: src/RaZ/Render/Texture.ll (ZN3Raz9Texture3D4loadERKSt6vectorINS_5ImageESaIS2_EEbb)

; 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.Raz::Color" = type { %"class.Raz::Vector" }
%"class.Raz::Vector" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }
%"class.Raz::Texture3D" = type <{ %"class.Raz::Texture", i32, i32, i32, [4 x i8] }>
%"class.Raz::Texture" = type { ptr, %"class.Raz::OwnerValue", i32, i32, i32 }
%"class.Raz::OwnerValue" = type { i32 }

@_ZN3Raz11ColorPresetL5WhiteE = external hidden constant %"class.Raz::Color", align 4
@.str.9 = external hidden unnamed_addr constant [56 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @_ZN3Raz12_GLOBAL__N_113recoverFormatENS_17TextureColorspaceE(i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3Raz5Image7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN3Raz12_GLOBAL__N_117recoverColorspaceENS_15ImageColorspaceEb(i32 noundef, i1 noundef zeroext) #4

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz9Texture3D4fillERKNS_5ColorE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 4 dereferenceable(12)) #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz9Texture3D4loadERKSt6vectorINS_5ImageESaIS2_EEbb(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i1 noundef zeroext %2, i1 noundef zeroext %3) #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  %17 = zext i1 %2 to i8
  store i8 %17, ptr %7, align 1, !tbaa !9
  %18 = zext i1 %3 to i8
  store i8 %18, ptr %8, align 1, !tbaa !9
  %19 = load ptr, ptr %5, align 8
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call noundef zeroext i1 @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #7
  br i1 %21, label %26, label %22

22:                                               ; preds = %4
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #7
  %25 = call noundef zeroext i1 @_ZNK3Raz5Image7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(32) %24)
  br i1 %25, label %26, label %27

26:                                               ; preds = %22, %4
  call void @_ZN3Raz9Texture3D4fillERKNS_5ColorE(ptr noundef nonnull align 8 dereferenceable(40) %19, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz11ColorPresetL5WhiteE)
  br label %119

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #7
  %30 = call noundef i32 @_ZNK3Raz5Image13getColorspaceEv(ptr noundef nonnull align 8 dereferenceable(32) %29) #7
  store i32 %30, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #7
  %33 = call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %32) #7
  store i32 %33, ptr %10, align 4, !tbaa !13
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #7
  %36 = call noundef i32 @_ZNK3Raz5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %35) #7
  %37 = getelementptr inbounds %"class.Raz::Texture3D", ptr %19, i32 0, i32 1
  store i32 %36, ptr %37, align 8, !tbaa !15
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %38) #7
  %40 = call noundef i32 @_ZNK3Raz5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %39) #7
  %41 = getelementptr inbounds %"class.Raz::Texture3D", ptr %19, i32 0, i32 2
  store i32 %40, ptr %41, align 4, !tbaa !23
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = call noundef i64 @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %42) #7
  %44 = trunc i64 %43 to i32
  %45 = getelementptr inbounds %"class.Raz::Texture3D", ptr %19, i32 0, i32 3
  store i32 %44, ptr %45, align 8, !tbaa !24
  %46 = load i32, ptr %9, align 4, !tbaa !11
  %47 = load i8, ptr %8, align 1, !tbaa !9, !range !25, !noundef !26
  %48 = trunc i8 %47 to i1
  %49 = call noundef i32 @_ZN3Raz12_GLOBAL__N_117recoverColorspaceENS_15ImageColorspaceEb(i32 noundef %46, i1 noundef zeroext %48)
  %50 = getelementptr inbounds %"class.Raz::Texture", ptr %19, i32 0, i32 3
  store i32 %49, ptr %50, align 8, !tbaa !27
  %51 = load i32, ptr %10, align 4, !tbaa !13
  %52 = icmp eq i32 %51, 1
  %53 = zext i1 %52 to i64
  %54 = select i1 %52, i32 1, i32 0
  %55 = getelementptr inbounds %"class.Raz::Texture", ptr %19, i32 0, i32 4
  store i32 %54, ptr %55, align 4, !tbaa !28
  call void @_ZNK3Raz9Texture3D4loadEv(ptr noundef nonnull align 8 dereferenceable(40) %19)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %56 = getelementptr inbounds %"class.Raz::Texture", ptr %19, i32 0, i32 3
  %57 = load i32, ptr %56, align 8, !tbaa !27
  %58 = call noundef i32 @_ZN3Raz12_GLOBAL__N_113recoverFormatENS_17TextureColorspaceE(i32 noundef %57)
  store i32 %58, ptr %11, align 4, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %59 = getelementptr inbounds %"class.Raz::Texture", ptr %19, i32 0, i32 4
  %60 = load i32, ptr %59, align 4, !tbaa !28
  %61 = icmp eq i32 %60, 0
  %62 = zext i1 %61 to i64
  %63 = select i1 %61, i32 5121, i32 5126
  store i32 %63, ptr %12, align 4, !tbaa !31
  call void @_ZNK3Raz7Texture4bindEv(ptr noundef nonnull align 8 dereferenceable(24) %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !33
  br label %64

64:                                               ; preds = %113, %27
  %65 = load i64, ptr %13, align 8, !tbaa !33
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = call noundef i64 @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %66) #7
  %68 = icmp ult i64 %65, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %116

70:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = load i64, ptr %13, align 8, !tbaa !33
  %73 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %71, i64 noundef %72) #7
  store ptr %73, ptr %14, align 8, !tbaa !5
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  %75 = call noundef i32 @_ZNK3Raz5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %74) #7
  %76 = getelementptr inbounds %"class.Raz::Texture3D", ptr %19, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !15
  %78 = icmp ne i32 %75, %77
  br i1 %78, label %95, label %79

79:                                               ; preds = %70
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = call noundef i32 @_ZNK3Raz5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %80) #7
  %82 = getelementptr inbounds %"class.Raz::Texture3D", ptr %19, i32 0, i32 2
  %83 = load i32, ptr %82, align 4, !tbaa !23
  %84 = icmp ne i32 %81, %83
  br i1 %84, label %95, label %85

85:                                               ; preds = %79
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = call noundef i32 @_ZNK3Raz5Image13getColorspaceEv(ptr noundef nonnull align 8 dereferenceable(32) %86) #7
  %88 = load i32, ptr %9, align 4, !tbaa !11
  %89 = icmp ne i32 %87, %88
  br i1 %89, label %95, label %90

90:                                               ; preds = %85
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %91) #7
  %93 = load i32, ptr %10, align 4, !tbaa !13
  %94 = icmp ne i32 %92, %93
  br i1 %94, label %95, label %102

95:                                               ; preds = %90, %85, %79, %70
  %96 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %96, ptr noundef @.str.9)
          to label %97 unwind label %98

97:                                               ; preds = %95
  call void @__cxa_throw(ptr %96, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #8
  unreachable

98:                                               ; preds = %95
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %15, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %16, align 4
  call void @__cxa_free_exception(ptr %96) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %120

102:                                              ; preds = %90
  %103 = load i64, ptr %13, align 8, !tbaa !33
  %104 = trunc i64 %103 to i32
  %105 = getelementptr inbounds %"class.Raz::Texture3D", ptr %19, i32 0, i32 1
  %106 = load i32, ptr %105, align 8, !tbaa !15
  %107 = getelementptr inbounds %"class.Raz::Texture3D", ptr %19, i32 0, i32 2
  %108 = load i32, ptr %107, align 4, !tbaa !23
  %109 = load i32, ptr %11, align 4, !tbaa !29
  %110 = load i32, ptr %12, align 4, !tbaa !31
  %111 = load ptr, ptr %14, align 8, !tbaa !5
  %112 = call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %111) #7
  call void @_ZN3Raz8Renderer18sendImageSubData3DENS_11TextureTypeEjjjjjjjNS_13TextureFormatENS_13PixelDataTypeEPKv(i32 noundef 32879, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %104, i32 noundef %106, i32 noundef %108, i32 noundef 1, i32 noundef %109, i32 noundef %110, ptr noundef %112)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %113

113:                                              ; preds = %102
  %114 = load i64, ptr %13, align 8, !tbaa !33
  %115 = add i64 %114, 1
  store i64 %115, ptr %13, align 8, !tbaa !33
  br label %64, !llvm.loop !35

116:                                              ; preds = %69
  %117 = load i8, ptr %7, align 1, !tbaa !9, !range !25, !noundef !26
  %118 = trunc i8 %117 to i1
  call void @_ZNK3Raz7Texture19setLoadedParametersEb(ptr noundef nonnull align 8 dereferenceable(24) %19, i1 noundef zeroext %118)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %119

119:                                              ; preds = %116, %26
  ret void

120:                                              ; preds = %98
  %121 = load ptr, ptr %15, align 8
  %122 = load i32, ptr %16, align 4
  %123 = insertvalue { ptr, i32 } poison, ptr %121, 0
  %124 = insertvalue { ptr, i32 } %123, i32 %122, 1
  resume { ptr, i32 } %124
}

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

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

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

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #5

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #6

declare void @__cxa_throw(ptr, ptr, ptr)

declare void @_ZN3Raz8Renderer18sendImageSubData3DENS_11TextureTypeEjjjjjjjNS_13TextureFormatENS_13PixelDataTypeEPKv(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #5

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 = { inlinehint 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 = { 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 = { 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 = { "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 "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 #7 = { nounwind }
attributes #8 = { 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 = !{!"_ZTSN3Raz15ImageColorspaceE", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTSN3Raz13ImageDataTypeE", !7, i64 0}
!15 = !{!16, !19, i64 24}
!16 = !{!"_ZTSN3Raz9Texture3DE", !17, i64 0, !19, i64 24, !19, i64 28, !19, i64 32}
!17 = !{!"_ZTSN3Raz7TextureE", !18, i64 8, !20, i64 12, !21, i64 16, !22, i64 20}
!18 = !{!"_ZTSN3Raz10OwnerValueIjLj0EEE", !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"_ZTSN3Raz11TextureTypeE", !7, i64 0}
!21 = !{!"_ZTSN3Raz17TextureColorspaceE", !7, i64 0}
!22 = !{!"_ZTSN3Raz15TextureDataTypeE", !7, i64 0}
!23 = !{!16, !19, i64 28}
!24 = !{!16, !19, i64 32}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!17, !21, i64 16}
!28 = !{!17, !22, i64 20}
!29 = !{!30, !30, i64 0}
!30 = !{!"_ZTSN3Raz13TextureFormatE", !7, i64 0}
!31 = !{!32, !32, i64 0}
!32 = !{!"_ZTSN3Raz13PixelDataTypeE", !7, i64 0}
!33 = !{!34, !34, i64 0}
!34 = !{!"long", !7, i64 0}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


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

%"class.Raz::Color" = type { %"class.Raz::Vector" }
%"class.Raz::Vector" = type { %"struct.std::array" }
%"struct.std::array" = type { [3 x float] }

@_ZN3Raz11ColorPresetL5WhiteE = external hidden constant %"class.Raz::Color", align 4
@.str.9 = external hidden unnamed_addr constant [56 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden noundef i32 @_ZN3Raz12_GLOBAL__N_113recoverFormatENS_17TextureColorspaceE(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3Raz5Image7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN3Raz12_GLOBAL__N_117recoverColorspaceENS_15ImageColorspaceEb(i32 noundef, i1 noundef zeroext) local_unnamed_addr #3

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz9Texture3D4fillERKNS_5ColorE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz9Texture3D4loadERKSt6vectorINS_5ImageESaIS2_EEbb(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i1 noundef zeroext %2, i1 noundef zeroext %3) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = tail call noundef zeroext i1 @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  br i1 %5, label %9, label %6

6:                                                ; preds = %4
  %7 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %8 = tail call noundef zeroext i1 @_ZNK3Raz5Image7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(32) %7)
  br i1 %8, label %9, label %10

9:                                                ; preds = %6, %4
  tail call void @_ZN3Raz9Texture3D4fillERKNS_5ColorE(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 4 dereferenceable(12) @_ZN3Raz11ColorPresetL5WhiteE)
  br label %58

10:                                               ; preds = %6
  %11 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %12 = tail call noundef i32 @_ZNK3Raz5Image13getColorspaceEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  %13 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %14 = tail call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %13) #6
  %15 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %16 = tail call noundef i32 @_ZNK3Raz5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %15) #6
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %16, ptr %17, align 8, !tbaa !5
  %18 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE5frontEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %19 = tail call noundef i32 @_ZNK3Raz5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %18) #6
  %20 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %19, ptr %20, align 4, !tbaa !15
  %21 = tail call noundef i64 @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %22 = trunc i64 %21 to i32
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %22, ptr %23, align 8, !tbaa !16
  %24 = tail call noundef i32 @_ZN3Raz12_GLOBAL__N_117recoverColorspaceENS_15ImageColorspaceEb(i32 noundef %12, i1 noundef zeroext %3)
  %25 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %24, ptr %25, align 8, !tbaa !17
  %26 = icmp eq i32 %14, 1
  %27 = zext i1 %26 to i32
  %28 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %27, ptr %28, align 4, !tbaa !18
  tail call void @_ZNK3Raz9Texture3D4loadEv(ptr noundef nonnull align 8 dereferenceable(40) %0)
  %29 = load i32, ptr %25, align 8, !tbaa !17
  %30 = tail call noundef i32 @_ZN3Raz12_GLOBAL__N_113recoverFormatENS_17TextureColorspaceE(i32 noundef %29)
  %31 = load i32, ptr %28, align 4, !tbaa !18
  %32 = icmp eq i32 %31, 0
  %33 = select i1 %32, i32 5121, i32 5126
  tail call void @_ZNK3Raz7Texture4bindEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  %34 = tail call noundef i64 @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %.not32 = icmp eq i64 %34, 0
  br i1 %.not32, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %50, %10
  tail call void @_ZNK3Raz7Texture19setLoadedParametersEb(ptr noundef nonnull align 8 dereferenceable(24) %0, i1 noundef zeroext %2)
  br label %58

.lr.ph:                                           ; preds = %10, %50
  %.031 = phi i64 [ %55, %50 ], [ 0, %10 ]
  %35 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNKSt6vectorIN3Raz5ImageESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.031) #6
  %36 = tail call noundef i32 @_ZNK3Raz5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %35) #6
  %37 = load i32, ptr %17, align 8, !tbaa !5
  %.not = icmp eq i32 %36, %37
  br i1 %.not, label %38, label %45

38:                                               ; preds = %.lr.ph
  %39 = tail call noundef i32 @_ZNK3Raz5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %35) #6
  %40 = load i32, ptr %20, align 4, !tbaa !15
  %.not28 = icmp eq i32 %39, %40
  br i1 %.not28, label %41, label %45

41:                                               ; preds = %38
  %42 = tail call noundef i32 @_ZNK3Raz5Image13getColorspaceEv(ptr noundef nonnull align 8 dereferenceable(32) %35) #6
  %.not29 = icmp eq i32 %42, %12
  br i1 %.not29, label %43, label %45

43:                                               ; preds = %41
  %44 = tail call noundef i32 @_ZNK3Raz5Image11getDataTypeEv(ptr noundef nonnull align 8 dereferenceable(32) %35) #6
  %.not30 = icmp eq i32 %44, %14
  br i1 %.not30, label %50, label %45

45:                                               ; preds = %43, %41, %38, %.lr.ph
  %46 = tail call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %46, ptr noundef nonnull @.str.9)
          to label %47 unwind label %48

47:                                               ; preds = %45
  tail call void @__cxa_throw(ptr nonnull %46, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #7
  unreachable

48:                                               ; preds = %45
  %49 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %46) #6
  resume { ptr, i32 } %49

50:                                               ; preds = %43
  %51 = trunc i64 %.031 to i32
  %52 = load i32, ptr %17, align 8, !tbaa !5
  %53 = load i32, ptr %20, align 4, !tbaa !15
  %54 = tail call noundef ptr @_ZNK3Raz5Image10getDataPtrEv(ptr noundef nonnull align 8 dereferenceable(32) %35) #6
  tail call void @_ZN3Raz8Renderer18sendImageSubData3DENS_11TextureTypeEjjjjjjjNS_13TextureFormatENS_13PixelDataTypeEPKv(i32 noundef 32879, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %51, i32 noundef %52, i32 noundef %53, i32 noundef 1, i32 noundef %30, i32 noundef %33, ptr noundef %54)
  %55 = add nuw i64 %.031, 1
  %56 = tail call noundef i64 @_ZNKSt6vectorIN3Raz5ImageESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %57 = icmp ult i64 %55, %56
  br i1 %57, label %.lr.ph, label %._crit_edge, !llvm.loop !19

58:                                               ; preds = %._crit_edge, %9
  ret void
}

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

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

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

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #4

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #5

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

declare void @_ZN3Raz8Renderer18sendImageSubData3DENS_11TextureTypeEjjjjjjjNS_13TextureFormatENS_13PixelDataTypeEPKv(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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 = { inlinehint 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 #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 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind "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 }
attributes #7 = { 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, !9, i64 24}
!6 = !{!"_ZTSN3Raz9Texture3DE", !7, i64 0, !9, i64 24, !9, i64 28, !9, i64 32}
!7 = !{!"_ZTSN3Raz7TextureE", !8, i64 8, !12, i64 12, !13, i64 16, !14, i64 20}
!8 = !{!"_ZTSN3Raz10OwnerValueIjLj0EEE", !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN3Raz11TextureTypeE", !10, i64 0}
!13 = !{!"_ZTSN3Raz17TextureColorspaceE", !10, i64 0}
!14 = !{!"_ZTSN3Raz15TextureDataTypeE", !10, i64 0}
!15 = !{!6, !9, i64 28}
!16 = !{!6, !9, i64 32}
!17 = !{!7, !13, i64 16}
!18 = !{!7, !14, i64 20}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


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