; LLVM IR from Razakhel/RaZ :: src/RaZ/Render/MeshRenderer.ll (ZN3Raz12MeshRenderer4loadERKNS_4MeshENS_10RenderModeE)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.39" = type { i8 }
%"class.Raz::Material" = type { %"class.Raz::RenderShaderProgram" }
%"class.Raz::RenderShaderProgram" = type { %"class.Raz::ShaderProgram", %"class.Raz::VertexShader", %"class.std::optional", %"class.std::optional.44", %"class.std::optional.54", %"class.Raz::FragmentShader" }
%"class.Raz::ShaderProgram" = type { ptr, %"class.Raz::OwnerValue", %"class.std::unordered_map", %"class.std::vector.29", %"class.std::vector.34" }
%"class.Raz::OwnerValue" = type { i32 }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.std::vector.29" = type { %"struct.std::_Vector_base.30" }
%"struct.std::_Vector_base.30" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.34" = type { %"struct.std::_Vector_base.35" }
%"struct.std::_Vector_base.35" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Raz::VertexShader" = type { %"class.Raz::Shader" }
%"class.Raz::Shader" = type { ptr, %"class.Raz::OwnerValue", %"class.Raz::FilePath" }
%"class.Raz::FilePath" = type { %"class.std::__cxx11::basic_string" }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload.base", [7 x i8] }
%"struct.std::_Optional_payload.base" = type { %"struct.std::_Optional_payload_base.base" }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<Raz::TessellationControlShader>::_Storage", i8 }>
%"union.std::_Optional_payload_base<Raz::TessellationControlShader>::_Storage" = type { %"class.Raz::TessellationControlShader" }
%"class.Raz::TessellationControlShader" = type { %"class.Raz::Shader" }
%"class.std::optional.44" = type { %"struct.std::_Optional_base.45" }
%"struct.std::_Optional_base.45" = type { %"struct.std::_Optional_payload.47" }
%"struct.std::_Optional_payload.47" = type { %"struct.std::_Optional_payload.base.51", [7 x i8] }
%"struct.std::_Optional_payload.base.51" = type { %"struct.std::_Optional_payload_base.base.50" }
%"struct.std::_Optional_payload_base.base.50" = type <{ %"union.std::_Optional_payload_base<Raz::TessellationEvaluationShader>::_Storage", i8 }>
%"union.std::_Optional_payload_base<Raz::TessellationEvaluationShader>::_Storage" = type { %"class.Raz::TessellationEvaluationShader" }
%"class.Raz::TessellationEvaluationShader" = type { %"class.Raz::Shader" }
%"class.std::optional.54" = type { %"struct.std::_Optional_base.55" }
%"struct.std::_Optional_base.55" = type { %"struct.std::_Optional_payload.57" }
%"struct.std::_Optional_payload.57" = type { %"struct.std::_Optional_payload.base.61", [7 x i8] }
%"struct.std::_Optional_payload.base.61" = type { %"struct.std::_Optional_payload_base.base.60" }
%"struct.std::_Optional_payload_base.base.60" = type <{ %"union.std::_Optional_payload_base<Raz::GeometryShader>::_Storage", i8 }>
%"union.std::_Optional_payload_base<Raz::GeometryShader>::_Storage" = type { %"class.Raz::GeometryShader" }
%"class.Raz::GeometryShader" = type { %"class.Raz::Shader" }
%"class.Raz::FragmentShader" = type { %"class.Raz::Shader" }
%"class.Raz::MeshRenderer" = type { %"class.Raz::Component", i8, %"class.std::vector", %"class.std::vector.0" }
%"class.Raz::Component" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Raz::SubmeshRenderer, std::allocator<Raz::SubmeshRenderer>>::_Vector_impl" }
%"struct.std::_Vector_base<Raz::SubmeshRenderer, std::allocator<Raz::SubmeshRenderer>>::_Vector_impl" = type { %"struct.std::_Vector_base<Raz::SubmeshRenderer, std::allocator<Raz::SubmeshRenderer>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Raz::SubmeshRenderer, std::allocator<Raz::SubmeshRenderer>>::_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<Raz::Material, std::allocator<Raz::Material>>::_Vector_impl" }
%"struct.std::_Vector_base<Raz::Material, std::allocator<Raz::Material>>::_Vector_impl" = type { %"struct.std::_Vector_base<Raz::Material, std::allocator<Raz::Material>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Raz::Material, std::allocator<Raz::Material>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 x i8], align 1

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(384) ptr @_ZN3Raz12MeshRenderer11setMaterialEONS_8MaterialE(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef nonnull align 8 dereferenceable(384)) #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3Raz8MaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(384)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz12MeshRenderer4loadERKNS_4MeshENS_10RenderModeE(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  %8 = alloca %"class.std::allocator.39", align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca %"class.Raz::Material", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %13 = load ptr, ptr %4, align 8
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %14)
  %16 = call noundef zeroext i1 @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %15) #5
  br i1 %16, label %17, label %29

17:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %18 unwind label %20

18:                                               ; preds = %17
  invoke void @_ZN3Raz6Logger5errorERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %19 unwind label %24

19:                                               ; preds = %18
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  br label %64

20:                                               ; preds = %17
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %9, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %10, align 4
  br label %28

24:                                               ; preds = %18
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %9, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #5
  br label %28

28:                                               ; preds = %24, %20
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #5
  br label %65

29:                                               ; preds = %3
  call void @_ZN3Raz6Logger5debugEPKc(ptr noundef @.str.3)
  %30 = getelementptr inbounds %"class.Raz::MeshRenderer", ptr %13, i32 0, i32 2
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %31)
  %33 = call noundef i64 @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %32) #5
  call void @_ZNSt6vectorIN3Raz15SubmeshRendererESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %33)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %34

34:                                               ; preds = %50, %29
  %35 = load i64, ptr %11, align 8, !tbaa !11
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %36)
  %38 = call noundef i64 @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %37) #5
  %39 = icmp ult i64 %35, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %53

41:                                               ; preds = %34
  %42 = getelementptr inbounds %"class.Raz::MeshRenderer", ptr %13, i32 0, i32 2
  %43 = load i64, ptr %11, align 8, !tbaa !11
  %44 = call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorIN3Raz15SubmeshRendererESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %42, i64 noundef %43) #5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %45)
  %47 = load i64, ptr %11, align 8, !tbaa !11
  %48 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #5
  %49 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN3Raz15SubmeshRenderer4loadERKNS_7SubmeshENS_10RenderModeE(ptr noundef nonnull align 8 dereferenceable(72) %44, ptr noundef nonnull align 8 dereferenceable(104) %48, i32 noundef %49)
  br label %50

50:                                               ; preds = %41
  %51 = load i64, ptr %11, align 8, !tbaa !11
  %52 = add i64 %51, 1
  store i64 %52, ptr %11, align 8, !tbaa !11
  br label %34, !llvm.loop !13

53:                                               ; preds = %40
  %54 = getelementptr inbounds %"class.Raz::MeshRenderer", ptr %13, i32 0, i32 3
  %55 = call noundef zeroext i1 @_ZNKSt6vectorIN3Raz8MaterialESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %54) #5
  br i1 %55, label %56, label %63

56:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 384, ptr %12) #5
  call void @_ZN3Raz8MaterialC2ENS_12MaterialTypeE(ptr noundef nonnull align 8 dereferenceable(384) %12, i32 noundef 0)
  %57 = invoke noundef nonnull align 8 dereferenceable(384) ptr @_ZN3Raz12MeshRenderer11setMaterialEONS_8MaterialE(ptr noundef nonnull align 8 dereferenceable(64) %13, ptr noundef nonnull align 8 dereferenceable(384) %12)
          to label %58 unwind label %59

58:                                               ; preds = %56
  call void @_ZN3Raz8MaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %12) #5
  call void @llvm.lifetime.end.p0(i64 384, ptr %12) #5
  br label %63

59:                                               ; preds = %56
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %9, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %10, align 4
  call void @_ZN3Raz8MaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %12) #5
  call void @llvm.lifetime.end.p0(i64 384, ptr %12) #5
  br label %65

63:                                               ; preds = %58, %53
  call void @_ZN3Raz6Logger5debugEPKc(ptr noundef @.str.4)
  br label %64

64:                                               ; preds = %63, %19
  ret void

65:                                               ; preds = %59, %28
  %66 = load ptr, ptr %9, align 8
  %67 = load i32, ptr %10, align 4
  %68 = insertvalue { ptr, i32 } poison, ptr %66, 0
  %69 = insertvalue { ptr, i32 } %68, i32 %67, 1
  resume { ptr, i32 } %69
}

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

declare void @_ZN3Raz6Logger5errorERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz6Logger5debugEPKc(ptr noundef) #2 align 2

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

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

declare void @_ZN3Raz15SubmeshRenderer4loadERKNS_7SubmeshENS_10RenderModeE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz8MaterialC2ENS_12MaterialTypeE(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) unnamed_addr #2 align 2

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

attributes #0 = { nocallback nofree nosync 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 = { 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 }

!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 = !{!"_ZTSN3Raz10RenderModeE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.39" = type { i8 }
%"class.Raz::Material" = type { %"class.Raz::RenderShaderProgram" }
%"class.Raz::RenderShaderProgram" = type { %"class.Raz::ShaderProgram", %"class.Raz::VertexShader", %"class.std::optional", %"class.std::optional.44", %"class.std::optional.54", %"class.Raz::FragmentShader" }
%"class.Raz::ShaderProgram" = type { ptr, %"class.Raz::OwnerValue", %"class.std::unordered_map", %"class.std::vector.29", %"class.std::vector.34" }
%"class.Raz::OwnerValue" = type { i32 }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.std::vector.29" = type { %"struct.std::_Vector_base.30" }
%"struct.std::_Vector_base.30" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, std::__cxx11::basic_string<char>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.34" = type { %"struct.std::_Vector_base.35" }
%"struct.std::_Vector_base.35" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>, std::allocator<std::pair<std::shared_ptr<Raz::Texture>, Raz::ShaderProgram::ImageTextureAttachment>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Raz::VertexShader" = type { %"class.Raz::Shader" }
%"class.Raz::Shader" = type { ptr, %"class.Raz::OwnerValue", %"class.Raz::FilePath" }
%"class.Raz::FilePath" = type { %"class.std::__cxx11::basic_string" }
%"class.std::optional" = type { %"struct.std::_Optional_base" }
%"struct.std::_Optional_base" = type { %"struct.std::_Optional_payload" }
%"struct.std::_Optional_payload" = type { %"struct.std::_Optional_payload.base", [7 x i8] }
%"struct.std::_Optional_payload.base" = type { %"struct.std::_Optional_payload_base.base" }
%"struct.std::_Optional_payload_base.base" = type <{ %"union.std::_Optional_payload_base<Raz::TessellationControlShader>::_Storage", i8 }>
%"union.std::_Optional_payload_base<Raz::TessellationControlShader>::_Storage" = type { %"class.Raz::TessellationControlShader" }
%"class.Raz::TessellationControlShader" = type { %"class.Raz::Shader" }
%"class.std::optional.44" = type { %"struct.std::_Optional_base.45" }
%"struct.std::_Optional_base.45" = type { %"struct.std::_Optional_payload.47" }
%"struct.std::_Optional_payload.47" = type { %"struct.std::_Optional_payload.base.51", [7 x i8] }
%"struct.std::_Optional_payload.base.51" = type { %"struct.std::_Optional_payload_base.base.50" }
%"struct.std::_Optional_payload_base.base.50" = type <{ %"union.std::_Optional_payload_base<Raz::TessellationEvaluationShader>::_Storage", i8 }>
%"union.std::_Optional_payload_base<Raz::TessellationEvaluationShader>::_Storage" = type { %"class.Raz::TessellationEvaluationShader" }
%"class.Raz::TessellationEvaluationShader" = type { %"class.Raz::Shader" }
%"class.std::optional.54" = type { %"struct.std::_Optional_base.55" }
%"struct.std::_Optional_base.55" = type { %"struct.std::_Optional_payload.57" }
%"struct.std::_Optional_payload.57" = type { %"struct.std::_Optional_payload.base.61", [7 x i8] }
%"struct.std::_Optional_payload.base.61" = type { %"struct.std::_Optional_payload_base.base.60" }
%"struct.std::_Optional_payload_base.base.60" = type <{ %"union.std::_Optional_payload_base<Raz::GeometryShader>::_Storage", i8 }>
%"union.std::_Optional_payload_base<Raz::GeometryShader>::_Storage" = type { %"class.Raz::GeometryShader" }
%"class.Raz::GeometryShader" = type { %"class.Raz::Shader" }
%"class.Raz::FragmentShader" = type { %"class.Raz::Shader" }

@.str.2 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorIN3Raz15SubmeshRendererESaIS1_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(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(384) ptr @_ZN3Raz12MeshRenderer11setMaterialEONS_8MaterialE(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef nonnull align 8 dereferenceable(384)) local_unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3Raz8MaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(384)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz12MeshRenderer4loadERKNS_4MeshENS_10RenderModeE(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator.39", align 1
  %6 = alloca %"class.Raz::Material", align 8
  %7 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %8 = tail call noundef zeroext i1 @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  br i1 %8, label %9, label %17

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %10 unwind label %12

10:                                               ; preds = %9
  invoke void @_ZN3Raz6Logger5errorERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %11 unwind label %14

11:                                               ; preds = %10
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %38

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

14:                                               ; preds = %10
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  br label %16

16:                                               ; preds = %14, %12
  %.pn = phi { ptr, i32 } [ %15, %14 ], [ %13, %12 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %39

17:                                               ; preds = %3
  tail call void @_ZN3Raz6Logger5debugEPKc(ptr noundef nonnull @.str.3)
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %20 = tail call noundef i64 @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #5
  tail call void @_ZNSt6vectorIN3Raz15SubmeshRendererESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %20)
  %21 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %22 = tail call noundef i64 @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %21) #5
  %.not = icmp eq i64 %22, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %17
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = tail call noundef zeroext i1 @_ZNKSt6vectorIN3Raz8MaterialESaIS1_EE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #5
  br i1 %24, label %32, label %37

.lr.ph:                                           ; preds = %17, %.lr.ph
  %.016 = phi i64 [ %28, %.lr.ph ], [ 0, %17 ]
  %25 = tail call noundef nonnull align 8 dereferenceable(72) ptr @_ZNSt6vectorIN3Raz15SubmeshRendererESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %18, i64 noundef %.016) #5
  %26 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %27 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %.016) #5
  tail call void @_ZN3Raz15SubmeshRenderer4loadERKNS_7SubmeshENS_10RenderModeE(ptr noundef nonnull align 8 dereferenceable(72) %25, ptr noundef nonnull align 8 dereferenceable(104) %27, i32 noundef %2)
  %28 = add nuw i64 %.016, 1
  %29 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK3Raz4Mesh12getSubmeshesEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %30 = tail call noundef i64 @_ZNKSt6vectorIN3Raz7SubmeshESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %29) #5
  %31 = icmp ult i64 %28, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !5

32:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 384, ptr nonnull %6) #5
  call void @_ZN3Raz8MaterialC2ENS_12MaterialTypeE(ptr noundef nonnull align 8 dereferenceable(384) %6, i32 noundef 0)
  %33 = invoke noundef nonnull align 8 dereferenceable(384) ptr @_ZN3Raz12MeshRenderer11setMaterialEONS_8MaterialE(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(384) %6)
          to label %34 unwind label %35

34:                                               ; preds = %32
  call void @_ZN3Raz8MaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %6) #5
  call void @llvm.lifetime.end.p0(i64 384, ptr nonnull %6) #5
  br label %37

35:                                               ; preds = %32
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3Raz8MaterialD2Ev(ptr noundef nonnull align 8 dereferenceable(384) %6) #5
  call void @llvm.lifetime.end.p0(i64 384, ptr nonnull %6) #5
  br label %39

37:                                               ; preds = %34, %._crit_edge
  call void @_ZN3Raz6Logger5debugEPKc(ptr noundef nonnull @.str.4)
  br label %38

38:                                               ; preds = %37, %11
  ret void

39:                                               ; preds = %35, %16
  %.pn.pn = phi { ptr, i32 } [ %.pn, %16 ], [ %36, %35 ]
  resume { ptr, i32 } %.pn.pn
}

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

declare void @_ZN3Raz6Logger5errorERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz6Logger5debugEPKc(ptr noundef) local_unnamed_addr #2 align 2

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

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

declare void @_ZN3Raz15SubmeshRenderer4loadERKNS_7SubmeshENS_10RenderModeE(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef nonnull align 8 dereferenceable(104), i32 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Raz8MaterialC2ENS_12MaterialTypeE(ptr noundef nonnull align 8 dereferenceable(384), i32 noundef) unnamed_addr #2 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync 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 = { 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 }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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