; LLVM IR from merpheus-dev/LavaEngine :: src/Platforms/OpenGL (GLStandardRenderer)

; 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::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"struct.glm::vec.28" = type { %union.anon.29, %union.anon.30, %union.anon.31 }
%union.anon.29 = type { float }
%union.anon.30 = type { float }
%union.anon.31 = type { float }
%"struct.Lava::OpenGL::GLRenderObject" = type { %"struct.Lava::RenderObject", %"class.std::shared_ptr.41", %"class.std::shared_ptr.41", %"class.std::shared_ptr.44", %"class.std::shared_ptr.41", %"class.std::shared_ptr.41", ptr, ptr }
%"struct.Lava::RenderObject" = type { %"struct.Lava::Mesh", %"struct.Lava::Material" }
%"struct.Lava::Mesh" = type { ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32 }
%"struct.Lava::Material" = type <{ ptr, ptr, ptr, %"struct.glm::vec.28", [4 x i8], ptr, i32, i8, i8, [2 x i8], [3 x float], float, float, [4 x i8] }>
%"class.std::shared_ptr.44" = type { %"class.std::__shared_ptr.45" }
%"class.std::__shared_ptr.45" = type { ptr, %"class.std::__shared_count" }
%"class.std::shared_ptr.41" = type { %"class.std::__shared_ptr.42" }
%"class.std::__shared_ptr.42" = type { ptr, %"class.std::__shared_count" }
%"class.Lava::Entity" = type { %"class.Lava::SceneObject", ptr, ptr, ptr, ptr }
%"class.Lava::SceneObject" = type { ptr }
%"struct.Lava::Texture" = type <{ i32, i32, i32, i32, ptr, i8, [7 x i8] }>
%"class.Lava::OpenGL::GLStandardRenderer" = type { %"class.Lava::EntityRenderer", %"class.std::map", %"class.std::vector.3", ptr }
%"class.Lava::EntityRenderer" = type { %"class.Lava::BaseRenderer" }
%"class.Lava::BaseRenderer" = type { ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<Lava::MeshRenderer *, std::pair<Lava::MeshRenderer *const, std::vector<Lava::Entity *> *>, std::_Select1st<std::pair<Lava::MeshRenderer *const, std::vector<Lava::Entity *> *>>, std::less<Lava::MeshRenderer *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Lava::MeshRenderer *, std::pair<Lava::MeshRenderer *const, std::vector<Lava::Entity *> *>, std::_Select1st<std::pair<Lava::MeshRenderer *const, std::vector<Lava::Entity *> *>>, std::less<Lava::MeshRenderer *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::vector.3" = type { %"struct.std::_Vector_base.4" }
%"struct.std::_Vector_base.4" = type { %"struct.std::_Vector_base<Lava::Entity *, std::allocator<Lava::Entity *>>::_Vector_impl" }
%"struct.std::_Vector_base<Lava::Entity *, std::allocator<Lava::Entity *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Lava::Entity *, std::allocator<Lava::Entity *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Lava::Entity *, std::allocator<Lava::Entity *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@__glewEnableVertexAttribArray = external global ptr, align 8
@__glewActiveTexture = external global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [17 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr") align 8, ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #1 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Lava6OpenGL18GLStandardRenderer11BindObjectsEPNS_6EntityE(ptr noundef nonnull align 8 dereferenceable(96) %0, ptr noundef %1) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::shared_ptr", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::shared_ptr", align 8
  %11 = alloca %"struct.glm::vec.28", align 4
  %12 = alloca { <2 x float>, float }, align 4
  %13 = alloca %"class.std::shared_ptr", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call noundef ptr @_ZN4Lava6Entity15GetMeshRendererENS_8PlatformE(ptr noundef nonnull align 8 dereferenceable(40) %15, i32 noundef 0)
  %17 = call noundef ptr @_ZN4Lava12MeshRenderer15GetRenderObjectEv(ptr noundef nonnull align 8 dereferenceable(24) %16)
  store ptr %17, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.Lava::OpenGL::GLRenderObject", ptr %18, i32 0, i32 6
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = load ptr, ptr %20, align 8, !tbaa !23
  %22 = getelementptr inbounds ptr, ptr %21, i64 2
  %23 = load ptr, ptr %22, align 8
  call void %23(ptr noundef nonnull align 8 dereferenceable(56) %20)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !25
  br label %24

24:                                               ; preds = %36, %2
  %25 = load i32, ptr %6, align 4, !tbaa !25
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %"class.Lava::Entity", ptr %26, i32 0, i32 3
  %28 = load ptr, ptr %27, align 8, !tbaa !26
  %29 = getelementptr inbounds %"struct.Lava::Mesh", ptr %28, i32 0, i32 11
  %30 = load i32, ptr %29, align 8, !tbaa !29
  %31 = icmp slt i32 %25, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %39

33:                                               ; preds = %24
  %34 = load ptr, ptr @__glewEnableVertexAttribArray, align 8, !tbaa !5
  %35 = load i32, ptr %6, align 4, !tbaa !25
  call void %34(i32 noundef %35)
  br label %36

36:                                               ; preds = %33
  %37 = load i32, ptr %6, align 4, !tbaa !25
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %6, align 4, !tbaa !25
  br label %24, !llvm.loop !30

39:                                               ; preds = %32
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = call noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject10HasTextureEv(ptr noundef nonnull align 8 dereferenceable(272) %40)
  br i1 %41, label %42, label %62

42:                                               ; preds = %39
  %43 = load ptr, ptr @__glewActiveTexture, align 8, !tbaa !5
  call void %43(i32 noundef 33984)
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %"class.Lava::Entity", ptr %44, i32 0, i32 4
  %46 = load ptr, ptr %45, align 8, !tbaa !32
  %47 = getelementptr inbounds %"struct.Lava::Material", ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !33
  %49 = getelementptr inbounds %"struct.Lava::Texture", ptr %48, i32 0, i32 3
  %50 = load i32, ptr %49, align 4, !tbaa !34
  call void @glBindTexture(i32 noundef 3553, i32 noundef %50)
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  %51 = getelementptr inbounds %"class.Lava::OpenGL::GLStandardRenderer", ptr %14, i32 0, i32 3
  %52 = load ptr, ptr %51, align 8, !tbaa !36
  call void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind writable sret(%"class.std::shared_ptr") align 8 %7, ptr noundef nonnull align 8 dereferenceable(40) %52, i32 noundef 1)
  %53 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  %54 = load ptr, ptr %53, align 8, !tbaa !23
  %55 = getelementptr inbounds ptr, ptr %54, i64 2
  %56 = load ptr, ptr %55, align 8
  invoke void %56(ptr noundef nonnull align 8 dereferenceable(36) %53, ptr noundef @.str.13, i32 noundef 0)
          to label %57 unwind label %58

57:                                               ; preds = %42
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  br label %62

58:                                               ; preds = %42
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %8, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %9, align 4
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  br label %105

62:                                               ; preds = %57, %39
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %63 = getelementptr inbounds %"class.Lava::OpenGL::GLStandardRenderer", ptr %14, i32 0, i32 3
  %64 = load ptr, ptr %63, align 8, !tbaa !36
  call void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind writable sret(%"class.std::shared_ptr") align 8 %10, ptr noundef nonnull align 8 dereferenceable(40) %64, i32 noundef 1)
  %65 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %"class.Lava::Entity", ptr %66, i32 0, i32 4
  %68 = load ptr, ptr %67, align 8, !tbaa !32
  %69 = getelementptr inbounds %"struct.Lava::Material", ptr %68, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 8 %69, i64 12, i1 false), !tbaa.struct !53
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %11, i64 12, i1 false)
  %70 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 0
  %71 = load <2 x float>, ptr %70, align 4
  %72 = getelementptr inbounds { <2 x float>, float }, ptr %12, i32 0, i32 1
  %73 = load float, ptr %72, align 4
  %74 = load ptr, ptr %65, align 8, !tbaa !23
  %75 = getelementptr inbounds ptr, ptr %74, i64 4
  %76 = load ptr, ptr %75, align 8
  invoke void %76(ptr noundef nonnull align 8 dereferenceable(36) %65, ptr noundef @.str.14, <2 x float> %71, float %73)
          to label %77 unwind label %96

77:                                               ; preds = %62
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = call noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject12HasNormalMapEv(ptr noundef nonnull align 8 dereferenceable(272) %78)
  br i1 %79, label %80, label %104

80:                                               ; preds = %77
  %81 = load ptr, ptr @__glewActiveTexture, align 8, !tbaa !5
  call void %81(i32 noundef 33985)
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %"class.Lava::Entity", ptr %82, i32 0, i32 4
  %84 = load ptr, ptr %83, align 8, !tbaa !32
  %85 = getelementptr inbounds %"struct.Lava::Material", ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !55
  %87 = getelementptr inbounds %"struct.Lava::Texture", ptr %86, i32 0, i32 3
  %88 = load i32, ptr %87, align 4, !tbaa !34
  call void @glBindTexture(i32 noundef 3553, i32 noundef %88)
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  %89 = getelementptr inbounds %"class.Lava::OpenGL::GLStandardRenderer", ptr %14, i32 0, i32 3
  %90 = load ptr, ptr %89, align 8, !tbaa !36
  call void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind writable sret(%"class.std::shared_ptr") align 8 %13, ptr noundef nonnull align 8 dereferenceable(40) %90, i32 noundef 1)
  %91 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %13) #6
  %92 = load ptr, ptr %91, align 8, !tbaa !23
  %93 = getelementptr inbounds ptr, ptr %92, i64 2
  %94 = load ptr, ptr %93, align 8
  invoke void %94(ptr noundef nonnull align 8 dereferenceable(36) %91, ptr noundef @.str.15, i32 noundef 1)
          to label %95 unwind label %100

95:                                               ; preds = %80
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %104

96:                                               ; preds = %62
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %8, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %9, align 4
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  br label %105

100:                                              ; preds = %80
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %8, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %9, align 4
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %105

104:                                              ; preds = %95, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void

105:                                              ; preds = %100, %96, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %106

106:                                              ; preds = %105
  %107 = load ptr, ptr %8, align 8
  %108 = load i32, ptr %9, align 4
  %109 = insertvalue { ptr, i32 } poison, ptr %107, 0
  %110 = insertvalue { ptr, i32 } %109, i32 %108, 1
  resume { ptr, i32 } %110
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Lava6Entity15GetMeshRendererENS_8PlatformE(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #4 align 2

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

declare noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject10HasTextureEv(ptr noundef nonnull align 8 dereferenceable(272)) #5

declare void @glBindTexture(i32 noundef, i32 noundef) #5

declare noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject12HasNormalMapEv(ptr noundef nonnull align 8 dereferenceable(272)) #5

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="64" "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 = { "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 }

!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, !6, i64 256}
!10 = !{!"_ZTSN4Lava6OpenGL14GLRenderObjectE", !11, i64 0, !18, i64 176, !18, i64 192, !21, i64 208, !18, i64 224, !18, i64 240, !6, i64 256, !6, i64 264}
!11 = !{!"_ZTSN4Lava12RenderObjectE", !12, i64 0, !14, i64 96}
!12 = !{!"_ZTSN4Lava4MeshE", !6, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !13, i64 40, !6, i64 48, !13, i64 56, !6, i64 64, !13, i64 72, !6, i64 80, !13, i64 88}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSN4Lava8MaterialE", !6, i64 0, !6, i64 8, !6, i64 16, !15, i64 24, !6, i64 40, !13, i64 48, !16, i64 52, !16, i64 53, !7, i64 56, !17, i64 68, !17, i64 72}
!15 = !{!"_ZTSN3glm3vecILi3EfLNS_9qualifierE0EEE", !7, i64 0, !7, i64 4, !7, i64 8}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"_ZTSSt10shared_ptrIN4Lava6OpenGL14GLVertexBufferEE", !19, i64 0}
!19 = !{!"_ZTSSt12__shared_ptrIN4Lava6OpenGL14GLVertexBufferELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !20, i64 8}
!20 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!21 = !{!"_ZTSSt10shared_ptrIN4Lava6OpenGL13GLIndexBufferEE", !22, i64 0}
!22 = !{!"_ZTSSt12__shared_ptrIN4Lava6OpenGL13GLIndexBufferELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !20, i64 8}
!23 = !{!24, !24, i64 0}
!24 = !{!"vtable pointer", !8, i64 0}
!25 = !{!13, !13, i64 0}
!26 = !{!27, !6, i64 24}
!27 = !{!"_ZTSN4Lava6EntityE", !28, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!28 = !{!"_ZTSN4Lava11SceneObjectE"}
!29 = !{!12, !13, i64 88}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!27, !6, i64 32}
!33 = !{!14, !6, i64 0}
!34 = !{!35, !13, i64 12}
!35 = !{!"_ZTSN4Lava7TextureE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !6, i64 16, !16, i64 24}
!36 = !{!37, !6, i64 88}
!37 = !{!"_ZTSN4Lava6OpenGL18GLStandardRendererE", !38, i64 0, !40, i64 16, !49, i64 64, !6, i64 88}
!38 = !{!"_ZTSN4Lava14EntityRendererE", !39, i64 0}
!39 = !{!"_ZTSN4Lava12BaseRendererE", !6, i64 8}
!40 = !{!"_ZTSSt3mapIPN4Lava12MeshRendererEPSt6vectorIPNS0_6EntityESaIS5_EESt4lessIS2_ESaISt4pairIKS2_S8_EEE", !41, i64 0}
!41 = !{!"_ZTSSt8_Rb_treeIPN4Lava12MeshRendererESt4pairIKS2_PSt6vectorIPNS0_6EntityESaIS7_EEESt10_Select1stISB_ESt4lessIS2_ESaISB_EE", !42, i64 0}
!42 = !{!"_ZTSNSt8_Rb_treeIPN4Lava12MeshRendererESt4pairIKS2_PSt6vectorIPNS0_6EntityESaIS7_EEESt10_Select1stISB_ESt4lessIS2_ESaISB_EE13_Rb_tree_implISF_Lb1EEE", !43, i64 0, !45, i64 8}
!43 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIPN4Lava12MeshRendererEEE", !44, i64 0}
!44 = !{!"_ZTSSt4lessIPN4Lava12MeshRendererEE"}
!45 = !{!"_ZTSSt15_Rb_tree_header", !46, i64 0, !48, i64 32}
!46 = !{!"_ZTSSt18_Rb_tree_node_base", !47, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!47 = !{!"_ZTSSt14_Rb_tree_color", !7, i64 0}
!48 = !{!"long", !7, i64 0}
!49 = !{!"_ZTSSt6vectorIPN4Lava6EntityESaIS2_EE", !50, i64 0}
!50 = !{!"_ZTSSt12_Vector_baseIPN4Lava6EntityESaIS2_EE", !51, i64 0}
!51 = !{!"_ZTSNSt12_Vector_baseIPN4Lava6EntityESaIS2_EE12_Vector_implE", !52, i64 0}
!52 = !{!"_ZTSNSt12_Vector_baseIPN4Lava6EntityESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!53 = !{i64 0, i64 4, !54, i64 4, i64 4, !54, i64 8, i64 4, !54}
!54 = !{!7, !7, i64 0}
!55 = !{!14, !6, i64 8}


; 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::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }

@__glewEnableVertexAttribArray = external local_unnamed_addr global ptr, align 8
@__glewActiveTexture = external local_unnamed_addr global ptr, align 8
@.str.13 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [17 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr") align 8, ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Lava6OpenGL18GLStandardRenderer11BindObjectsEPNS_6EntityE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(96) %0, ptr noundef nonnull %1) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::shared_ptr", align 8
  %4 = alloca %"class.std::shared_ptr", align 8
  %5 = alloca %"class.std::shared_ptr", align 8
  %6 = tail call noundef ptr @_ZN4Lava6Entity15GetMeshRendererENS_8PlatformE(ptr noundef nonnull align 8 dereferenceable(40) %1, i32 noundef 0)
  %7 = tail call noundef ptr @_ZN4Lava12MeshRenderer15GetRenderObjectEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  %8 = getelementptr inbounds i8, ptr %7, i64 256
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %9, align 8, !tbaa !22
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %12 = load ptr, ptr %11, align 8
  tail call void %12(ptr noundef nonnull align 8 dereferenceable(56) %9)
  %13 = getelementptr inbounds i8, ptr %1, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !24
  %15 = getelementptr inbounds i8, ptr %14, i64 88
  %16 = load i32, ptr %15, align 8, !tbaa !27
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %2
  %18 = tail call noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject10HasTextureEv(ptr noundef nonnull align 8 dereferenceable(272) %7)
  br i1 %18, label %25, label %41

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.018 = phi i32 [ %20, %.lr.ph ], [ 0, %2 ]
  %19 = load ptr, ptr @__glewEnableVertexAttribArray, align 8, !tbaa !28
  tail call void %19(i32 noundef %.018)
  %20 = add nuw nsw i32 %.018, 1
  %21 = load ptr, ptr %13, align 8, !tbaa !24
  %22 = getelementptr inbounds i8, ptr %21, i64 88
  %23 = load i32, ptr %22, align 8, !tbaa !27
  %24 = icmp slt i32 %20, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !29

25:                                               ; preds = %._crit_edge
  %26 = load ptr, ptr @__glewActiveTexture, align 8, !tbaa !28
  tail call void %26(i32 noundef 33984)
  %27 = getelementptr inbounds i8, ptr %1, i64 32
  %28 = load ptr, ptr %27, align 8, !tbaa !31
  %29 = load ptr, ptr %28, align 8, !tbaa !32
  %30 = getelementptr inbounds i8, ptr %29, i64 12
  %31 = load i32, ptr %30, align 4, !tbaa !33
  tail call void @glBindTexture(i32 noundef 3553, i32 noundef %31)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  %32 = getelementptr inbounds i8, ptr %0, i64 88
  %33 = load ptr, ptr %32, align 8, !tbaa !35
  call void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr") align 8 %3, ptr noundef nonnull align 8 dereferenceable(40) %33, i32 noundef 1)
  %34 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  %35 = load ptr, ptr %34, align 8, !tbaa !22
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  %37 = load ptr, ptr %36, align 8
  invoke void %37(ptr noundef nonnull align 8 dereferenceable(36) %34, ptr noundef nonnull @.str.13, i32 noundef 0)
          to label %38 unwind label %39

38:                                               ; preds = %25
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  br label %41

39:                                               ; preds = %25
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  br label %71

41:                                               ; preds = %38, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %42 = getelementptr inbounds i8, ptr %0, i64 88
  %43 = load ptr, ptr %42, align 8, !tbaa !35
  call void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr") align 8 %4, ptr noundef nonnull align 8 dereferenceable(40) %43, i32 noundef 1)
  %44 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  %45 = getelementptr inbounds i8, ptr %1, i64 32
  %46 = load ptr, ptr %45, align 8, !tbaa !31
  %47 = getelementptr inbounds i8, ptr %46, i64 24
  %.sroa.01.0.copyload = load <2 x float>, ptr %47, align 8
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %46, i64 32
  %.sroa.22.0.copyload = load float, ptr %.sroa.22.0..sroa_idx, align 8, !tbaa !52
  %48 = load ptr, ptr %44, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %48, i64 32
  %50 = load ptr, ptr %49, align 8
  invoke void %50(ptr noundef nonnull align 8 dereferenceable(36) %44, ptr noundef nonnull @.str.14, <2 x float> %.sroa.01.0.copyload, float %.sroa.22.0.copyload)
          to label %51 unwind label %66

51:                                               ; preds = %41
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  %52 = call noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject12HasNormalMapEv(ptr noundef nonnull align 8 dereferenceable(272) %7)
  br i1 %52, label %53, label %70

53:                                               ; preds = %51
  %54 = load ptr, ptr @__glewActiveTexture, align 8, !tbaa !28
  call void %54(i32 noundef 33985)
  %55 = load ptr, ptr %45, align 8, !tbaa !31
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %57 = load ptr, ptr %56, align 8, !tbaa !53
  %58 = getelementptr inbounds i8, ptr %57, i64 12
  %59 = load i32, ptr %58, align 4, !tbaa !33
  call void @glBindTexture(i32 noundef 3553, i32 noundef %59)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %60 = load ptr, ptr %42, align 8, !tbaa !35
  call void @_ZN4Lava10ShaderBank9GetShaderEi(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr") align 8 %5, ptr noundef nonnull align 8 dereferenceable(40) %60, i32 noundef 1)
  %61 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %64 = load ptr, ptr %63, align 8
  invoke void %64(ptr noundef nonnull align 8 dereferenceable(36) %61, ptr noundef nonnull @.str.15, i32 noundef 1)
          to label %65 unwind label %68

65:                                               ; preds = %53
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %70

66:                                               ; preds = %41
  %67 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br label %71

68:                                               ; preds = %53
  %69 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt12__shared_ptrIN4Lava6ShaderELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %71

70:                                               ; preds = %65, %51
  ret void

71:                                               ; preds = %68, %66, %39
  %.pn = phi { ptr, i32 } [ %69, %68 ], [ %67, %66 ], [ %40, %39 ]
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN4Lava6Entity15GetMeshRendererENS_8PlatformE(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #3 align 2

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

declare noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject10HasTextureEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #4

declare void @glBindTexture(i32 noundef, i32 noundef) local_unnamed_addr #4

declare noundef zeroext i1 @_ZN4Lava6OpenGL14GLRenderObject12HasNormalMapEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #4

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"="64" "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 = { "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, !9, i64 256}
!6 = !{!"_ZTSN4Lava6OpenGL14GLRenderObjectE", !7, i64 0, !17, i64 176, !17, i64 192, !20, i64 208, !17, i64 224, !17, i64 240, !9, i64 256, !9, i64 264}
!7 = !{!"_ZTSN4Lava12RenderObjectE", !8, i64 0, !13, i64 96}
!8 = !{!"_ZTSN4Lava4MeshE", !9, i64 0, !12, i64 8, !9, i64 16, !12, i64 24, !9, i64 32, !12, i64 40, !9, i64 48, !12, i64 56, !9, i64 64, !12, i64 72, !9, i64 80, !12, i64 88}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"int", !10, i64 0}
!13 = !{!"_ZTSN4Lava8MaterialE", !9, i64 0, !9, i64 8, !9, i64 16, !14, i64 24, !9, i64 40, !12, i64 48, !15, i64 52, !15, i64 53, !10, i64 56, !16, i64 68, !16, i64 72}
!14 = !{!"_ZTSN3glm3vecILi3EfLNS_9qualifierE0EEE", !10, i64 0, !10, i64 4, !10, i64 8}
!15 = !{!"bool", !10, i64 0}
!16 = !{!"float", !10, i64 0}
!17 = !{!"_ZTSSt10shared_ptrIN4Lava6OpenGL14GLVertexBufferEE", !18, i64 0}
!18 = !{!"_ZTSSt12__shared_ptrIN4Lava6OpenGL14GLVertexBufferELN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0, !19, i64 8}
!19 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0}
!20 = !{!"_ZTSSt10shared_ptrIN4Lava6OpenGL13GLIndexBufferEE", !21, i64 0}
!21 = !{!"_ZTSSt12__shared_ptrIN4Lava6OpenGL13GLIndexBufferELN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0, !19, i64 8}
!22 = !{!23, !23, i64 0}
!23 = !{!"vtable pointer", !11, i64 0}
!24 = !{!25, !9, i64 24}
!25 = !{!"_ZTSN4Lava6EntityE", !26, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32}
!26 = !{!"_ZTSN4Lava11SceneObjectE"}
!27 = !{!8, !12, i64 88}
!28 = !{!9, !9, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!25, !9, i64 32}
!32 = !{!13, !9, i64 0}
!33 = !{!34, !12, i64 12}
!34 = !{!"_ZTSN4Lava7TextureE", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !9, i64 16, !15, i64 24}
!35 = !{!36, !9, i64 88}
!36 = !{!"_ZTSN4Lava6OpenGL18GLStandardRendererE", !37, i64 0, !39, i64 16, !48, i64 64, !9, i64 88}
!37 = !{!"_ZTSN4Lava14EntityRendererE", !38, i64 0}
!38 = !{!"_ZTSN4Lava12BaseRendererE", !9, i64 8}
!39 = !{!"_ZTSSt3mapIPN4Lava12MeshRendererEPSt6vectorIPNS0_6EntityESaIS5_EESt4lessIS2_ESaISt4pairIKS2_S8_EEE", !40, i64 0}
!40 = !{!"_ZTSSt8_Rb_treeIPN4Lava12MeshRendererESt4pairIKS2_PSt6vectorIPNS0_6EntityESaIS7_EEESt10_Select1stISB_ESt4lessIS2_ESaISB_EE", !41, i64 0}
!41 = !{!"_ZTSNSt8_Rb_treeIPN4Lava12MeshRendererESt4pairIKS2_PSt6vectorIPNS0_6EntityESaIS7_EEESt10_Select1stISB_ESt4lessIS2_ESaISB_EE13_Rb_tree_implISF_Lb1EEE", !42, i64 0, !44, i64 8}
!42 = !{!"_ZTSSt20_Rb_tree_key_compareISt4lessIPN4Lava12MeshRendererEEE", !43, i64 0}
!43 = !{!"_ZTSSt4lessIPN4Lava12MeshRendererEE"}
!44 = !{!"_ZTSSt15_Rb_tree_header", !45, i64 0, !47, i64 32}
!45 = !{!"_ZTSSt18_Rb_tree_node_base", !46, i64 0, !9, i64 8, !9, i64 16, !9, i64 24}
!46 = !{!"_ZTSSt14_Rb_tree_color", !10, i64 0}
!47 = !{!"long", !10, i64 0}
!48 = !{!"_ZTSSt6vectorIPN4Lava6EntityESaIS2_EE", !49, i64 0}
!49 = !{!"_ZTSSt12_Vector_baseIPN4Lava6EntityESaIS2_EE", !50, i64 0}
!50 = !{!"_ZTSNSt12_Vector_baseIPN4Lava6EntityESaIS2_EE12_Vector_implE", !51, i64 0}
!51 = !{!"_ZTSNSt12_Vector_baseIPN4Lava6EntityESaIS2_EE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!52 = !{!10, !10, i64 0}
!53 = !{!13, !9, i64 8}


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