; LLVM IR from achilles288/robot-monitor-graphics :: src/base/internal (shadow_map_shader)

; 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.rmg::ObjectList::iterator" = type { ptr, ptr }
%"struct.rmg::Mat4" = type { %union.anon.1 }
%union.anon.1 = type { [4 x [4 x float]] }
%"class.rmg::internal::Shader" = type <{ ptr, i32, [4 x i8] }>
%"class.rmg::internal::ShadowMapShader" = type { %"class.rmg::internal::Shader.base", %"class.rmg::Camera", %"struct.rmg::Vec3", %"struct.rmg::Vec3", %"struct.rmg::Vec3", float, float, float, i32, i32, i32 }
%"class.rmg::internal::Shader.base" = type <{ ptr, i32 }>
%"class.rmg::Camera" = type { %"struct.rmg::Vec3", %"struct.rmg::Mat3", %"struct.rmg::Mat4", %"struct.rmg::Mat4", %"struct.rmg::Mat4", float, float, float, float, float, i32 }
%"struct.rmg::Mat3" = type { %union.anon.0 }
%union.anon.0 = type { [3 x [3 x float]] }
%"struct.rmg::Vec3" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { float, float, float }

@_ZN3rmg8internal17glBindFramebufferE = external global ptr, align 8
@_ZN3rmg8internal12glUseProgramE = external global ptr, align 8
@_ZN3rmg8internal18glUniformMatrix4fvE = external global ptr, align 8

; 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

declare noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg6Camera11getVPMatrixEv(ptr noundef nonnull align 4 dereferenceable(264)) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3rmg8internal15ShadowMapShader15createShadowMapERKNS_10ObjectListE(ptr noundef nonnull align 8 dereferenceable(336) %0, ptr noundef nonnull align 8 dereferenceable(20) %1) #2 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.rmg::ObjectList::iterator", align 8
  %7 = alloca %"class.rmg::ObjectList::iterator", align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %"struct.rmg::Mat4", align 4
  %11 = alloca %"class.rmg::ObjectList::iterator", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8
  %13 = getelementptr inbounds %"class.rmg::internal::Shader", ptr %12, i32 0, i32 1
  %14 = load i32, ptr %13, align 8, !tbaa !9
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  br label %73

17:                                               ; preds = %2
  %18 = load ptr, ptr @_ZN3rmg8internal17glBindFramebufferE, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.rmg::internal::ShadowMapShader", ptr %12, i32 0, i32 8
  %20 = load i32, ptr %19, align 4, !tbaa !12
  call void %18(i32 noundef 36160, i32 noundef %20)
  call void @glViewport(i32 noundef 0, i32 noundef 0, i32 noundef 512, i32 noundef 512)
  call void @glClearDepth(double noundef 1.000000e+00)
  call void @glClear(i32 noundef 256)
  call void @glEnable(i32 noundef 2929)
  call void @glDepthFunc(i32 noundef 513)
  call void @glFrontFace(i32 noundef 2305)
  call void @glEnable(i32 noundef 2884)
  call void @glCullFace(i32 noundef 1028)
  call void @glDisable(i32 noundef 3042)
  %21 = load ptr, ptr @_ZN3rmg8internal12glUseProgramE, align 8, !tbaa !5
  %22 = getelementptr inbounds %"class.rmg::internal::Shader", ptr %12, i32 0, i32 1
  %23 = load i32, ptr %22, align 8, !tbaa !9
  call void %21(i32 noundef %23)
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call { ptr, ptr } @_ZNK3rmg10ObjectList5beginEv(ptr noundef nonnull align 8 dereferenceable(20) %24)
  %26 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 0
  %27 = extractvalue { ptr, ptr } %25, 0
  store ptr %27, ptr %26, align 8
  %28 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 1
  %29 = extractvalue { ptr, ptr } %25, 1
  store ptr %29, ptr %28, align 8
  br label %30

30:                                               ; preds = %63, %17
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call { ptr, ptr } @_ZNK3rmg10ObjectList3endEv(ptr noundef nonnull align 8 dereferenceable(20) %31)
  %33 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 0
  %34 = extractvalue { ptr, ptr } %32, 0
  store ptr %34, ptr %33, align 8
  %35 = getelementptr inbounds { ptr, ptr }, ptr %7, i32 0, i32 1
  %36 = extractvalue { ptr, ptr } %32, 1
  store ptr %36, ptr %35, align 8
  %37 = call noundef zeroext i1 @_ZN3rmg10ObjectList8iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  br i1 %37, label %39, label %38

38:                                               ; preds = %30
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  br label %69

39:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %40 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN3rmg10ObjectList8iteratordeEv(ptr noundef nonnull align 8 dereferenceable(16) %6)
  store ptr %40, ptr %9, align 8, !tbaa !5
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = call noundef zeroext i1 @_ZNK3rmg6Object8isHiddenEv(ptr noundef nonnull align 8 dereferenceable(48) %41)
  br i1 %42, label %47, label %43

43:                                               ; preds = %39
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = call noundef ptr @_ZNK3rmg8Object3D6getVBOEv(ptr noundef nonnull align 8 dereferenceable(216) %44)
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %43, %39
  store i32 4, ptr %8, align 4
  br label %60

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #4
  %49 = getelementptr inbounds %"class.rmg::internal::ShadowMapShader", ptr %12, i32 0, i32 1
  %50 = call noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg6Camera11getVPMatrixEv(ptr noundef nonnull align 4 dereferenceable(264) %49)
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  %52 = call noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg8Object3D14getModelMatrixEv(ptr noundef nonnull align 8 dereferenceable(216) %51)
  call void @_ZNK3rmg4Mat4mlERKS0_(ptr dead_on_unwind writable sret(%"struct.rmg::Mat4") align 4 %10, ptr noundef nonnull align 4 dereferenceable(64) %50, ptr noundef nonnull align 4 dereferenceable(64) %52)
  %53 = load ptr, ptr @_ZN3rmg8internal18glUniformMatrix4fvE, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.rmg::internal::ShadowMapShader", ptr %12, i32 0, i32 10
  %55 = load i32, ptr %54, align 4, !tbaa !20
  %56 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN3rmg4Mat4ixEh(ptr noundef nonnull align 4 dereferenceable(64) %10, i8 noundef zeroext 0)
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat4RowixEh(ptr noundef nonnull align 4 dereferenceable(16) %56, i8 noundef zeroext 0)
  call void %53(i32 noundef %55, i32 noundef 1, i8 noundef zeroext 1, ptr noundef %57)
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = call noundef ptr @_ZNK3rmg8Object3D6getVBOEv(ptr noundef nonnull align 8 dereferenceable(216) %58)
  call void @_ZNK3rmg8internal3VBO4drawEv(ptr noundef nonnull align 4 dereferenceable(28) %59)
  call void @llvm.lifetime.end.p0(i64 64, ptr %10) #4
  store i32 0, ptr %8, align 4
  br label %60

60:                                               ; preds = %48, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %61 = load i32, ptr %8, align 4
  switch i32 %61, label %75 [
    i32 0, label %62
    i32 4, label %63
  ]

62:                                               ; preds = %60
  br label %63

63:                                               ; preds = %62, %60
  %64 = call { ptr, ptr } @_ZN3rmg10ObjectList8iteratorppEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef 0)
  %65 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 0
  %66 = extractvalue { ptr, ptr } %64, 0
  store ptr %66, ptr %65, align 8
  %67 = getelementptr inbounds { ptr, ptr }, ptr %11, i32 0, i32 1
  %68 = extractvalue { ptr, ptr } %64, 1
  store ptr %68, ptr %67, align 8
  br label %30, !llvm.loop !21

69:                                               ; preds = %38
  %70 = load ptr, ptr @_ZN3rmg8internal17glBindFramebufferE, align 8, !tbaa !5
  call void %70(i32 noundef 36160, i32 noundef 0)
  %71 = getelementptr inbounds %"class.rmg::internal::ShadowMapShader", ptr %12, i32 0, i32 9
  %72 = load i32, ptr %71, align 8, !tbaa !23
  store i32 %72, ptr %3, align 4
  br label %73

73:                                               ; preds = %69, %16
  %74 = load i32, ptr %3, align 4
  ret i32 %74

75:                                               ; preds = %60
  unreachable
}

declare void @glViewport(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

declare void @glClearDepth(double noundef) #1

declare void @glClear(i32 noundef) #1

declare void @glEnable(i32 noundef) #1

declare void @glDepthFunc(i32 noundef) #1

declare void @glFrontFace(i32 noundef) #1

declare void @glCullFace(i32 noundef) #1

declare void @glDisable(i32 noundef) #1

declare { ptr, ptr } @_ZNK3rmg10ObjectList5beginEv(ptr noundef nonnull align 8 dereferenceable(20)) #1

declare noundef zeroext i1 @_ZN3rmg10ObjectList8iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1

declare { ptr, ptr } @_ZNK3rmg10ObjectList3endEv(ptr noundef nonnull align 8 dereferenceable(20)) #1

declare noundef nonnull align 8 dereferenceable(48) ptr @_ZN3rmg10ObjectList8iteratordeEv(ptr noundef nonnull align 8 dereferenceable(16)) #1

declare noundef zeroext i1 @_ZNK3rmg6Object8isHiddenEv(ptr noundef nonnull align 8 dereferenceable(48)) #1

declare noundef ptr @_ZNK3rmg8Object3D6getVBOEv(ptr noundef nonnull align 8 dereferenceable(216)) #1

declare void @_ZNK3rmg4Mat4mlERKS0_(ptr dead_on_unwind writable sret(%"struct.rmg::Mat4") align 4, ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(64)) #1

declare noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg8Object3D14getModelMatrixEv(ptr noundef nonnull align 8 dereferenceable(216)) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3rmg4Mat4ixEh(ptr noundef nonnull align 4 dereferenceable(64), i8 noundef zeroext) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat4RowixEh(ptr noundef nonnull align 4 dereferenceable(16), i8 noundef zeroext) #3 align 2

declare void @_ZNK3rmg8internal3VBO4drawEv(ptr noundef nonnull align 4 dereferenceable(28)) #1

declare { ptr, ptr } @_ZN3rmg10ObjectList8iteratorppEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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, !11, i64 8}
!10 = !{!"_ZTSN3rmg8internal6ShaderE", !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 324}
!13 = !{!"_ZTSN3rmg8internal15ShadowMapShaderE", !10, i64 0, !14, i64 12, !15, i64 276, !15, i64 288, !15, i64 300, !18, i64 312, !18, i64 316, !18, i64 320, !11, i64 324, !11, i64 328, !11, i64 332}
!14 = !{!"_ZTSN3rmg6CameraE", !15, i64 0, !16, i64 12, !17, i64 48, !17, i64 112, !17, i64 176, !18, i64 240, !18, i64 244, !18, i64 248, !18, i64 252, !18, i64 256, !19, i64 260}
!15 = !{!"_ZTSN3rmg4Vec3E", !7, i64 0}
!16 = !{!"_ZTSN3rmg4Mat3E", !7, i64 0}
!17 = !{!"_ZTSN3rmg4Mat4E", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTSN3rmg14ProjectionModeE", !7, i64 0}
!20 = !{!13, !11, i64 332}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!13, !11, i64 328}


; 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.rmg::ObjectList::iterator" = type { ptr, ptr }
%"struct.rmg::Mat4" = type { %union.anon.1 }
%union.anon.1 = type { [4 x [4 x float]] }

@_ZN3rmg8internal17glBindFramebufferE = external local_unnamed_addr global ptr, align 8
@_ZN3rmg8internal12glUseProgramE = external local_unnamed_addr global ptr, align 8
@_ZN3rmg8internal18glUniformMatrix4fvE = external local_unnamed_addr global ptr, align 8

; 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

declare noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg6Camera11getVPMatrixEv(ptr noundef nonnull align 4 dereferenceable(264)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3rmg8internal15ShadowMapShader15createShadowMapERKNS_10ObjectListE(ptr noundef nonnull align 8 dereferenceable(336) %0, ptr noundef nonnull align 8 dereferenceable(20) %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"class.rmg::ObjectList::iterator", align 8
  %4 = alloca %"class.rmg::ObjectList::iterator", align 8
  %5 = alloca %"struct.rmg::Mat4", align 4
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %49, label %9

9:                                                ; preds = %2
  %10 = load ptr, ptr @_ZN3rmg8internal17glBindFramebufferE, align 8, !tbaa !10
  %11 = getelementptr inbounds i8, ptr %0, i64 324
  %12 = load i32, ptr %11, align 4, !tbaa !12
  tail call void %10(i32 noundef 36160, i32 noundef %12)
  tail call void @glViewport(i32 noundef 0, i32 noundef 0, i32 noundef 512, i32 noundef 512)
  tail call void @glClearDepth(double noundef 1.000000e+00)
  tail call void @glClear(i32 noundef 256)
  tail call void @glEnable(i32 noundef 2929)
  tail call void @glDepthFunc(i32 noundef 513)
  tail call void @glFrontFace(i32 noundef 2305)
  tail call void @glEnable(i32 noundef 2884)
  tail call void @glCullFace(i32 noundef 1028)
  tail call void @glDisable(i32 noundef 3042)
  %13 = load ptr, ptr @_ZN3rmg8internal12glUseProgramE, align 8, !tbaa !10
  %14 = load i32, ptr %6, align 8, !tbaa !5
  tail call void %13(i32 noundef %14)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  %15 = tail call { ptr, ptr } @_ZNK3rmg10ObjectList5beginEv(ptr noundef nonnull align 8 dereferenceable(20) %1)
  %16 = extractvalue { ptr, ptr } %15, 0
  store ptr %16, ptr %3, align 8
  %17 = getelementptr inbounds i8, ptr %3, i64 8
  %18 = extractvalue { ptr, ptr } %15, 1
  store ptr %18, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %19 = tail call { ptr, ptr } @_ZNK3rmg10ObjectList3endEv(ptr noundef nonnull align 8 dereferenceable(20) %1)
  %20 = extractvalue { ptr, ptr } %19, 0
  store ptr %20, ptr %4, align 8
  %21 = getelementptr inbounds i8, ptr %4, i64 8
  %22 = extractvalue { ptr, ptr } %19, 1
  store ptr %22, ptr %21, align 8
  %23 = call noundef zeroext i1 @_ZN3rmg10ObjectList8iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br i1 %23, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %9
  %24 = getelementptr inbounds i8, ptr %0, i64 12
  %25 = getelementptr inbounds i8, ptr %0, i64 332
  br label %29

._crit_edge:                                      ; preds = %43, %9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  %26 = load ptr, ptr @_ZN3rmg8internal17glBindFramebufferE, align 8, !tbaa !10
  call void %26(i32 noundef 36160, i32 noundef 0)
  %27 = getelementptr inbounds i8, ptr %0, i64 328
  %28 = load i32, ptr %27, align 8, !tbaa !20
  br label %49

29:                                               ; preds = %.lr.ph, %43
  %30 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN3rmg10ObjectList8iteratordeEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %31 = call noundef zeroext i1 @_ZNK3rmg6Object8isHiddenEv(ptr noundef nonnull align 8 dereferenceable(48) %30)
  br i1 %31, label %43, label %32

32:                                               ; preds = %29
  %33 = call noundef ptr @_ZNK3rmg8Object3D6getVBOEv(ptr noundef nonnull align 8 dereferenceable(216) %30)
  %34 = icmp eq ptr %33, null
  br i1 %34, label %43, label %35

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #4
  %36 = call noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg6Camera11getVPMatrixEv(ptr noundef nonnull align 4 dereferenceable(264) %24)
  %37 = call noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg8Object3D14getModelMatrixEv(ptr noundef nonnull align 8 dereferenceable(216) %30)
  call void @_ZNK3rmg4Mat4mlERKS0_(ptr dead_on_unwind nonnull writable sret(%"struct.rmg::Mat4") align 4 %5, ptr noundef nonnull align 4 dereferenceable(64) %36, ptr noundef nonnull align 4 dereferenceable(64) %37)
  %38 = load ptr, ptr @_ZN3rmg8internal18glUniformMatrix4fvE, align 8, !tbaa !10
  %39 = load i32, ptr %25, align 4, !tbaa !21
  %40 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN3rmg4Mat4ixEh(ptr noundef nonnull align 4 dereferenceable(64) %5, i8 noundef zeroext 0)
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat4RowixEh(ptr noundef nonnull align 4 dereferenceable(16) %40, i8 noundef zeroext 0)
  call void %38(i32 noundef %39, i32 noundef 1, i8 noundef zeroext 1, ptr noundef nonnull %41)
  %42 = call noundef ptr @_ZNK3rmg8Object3D6getVBOEv(ptr noundef nonnull align 8 dereferenceable(216) %30)
  call void @_ZNK3rmg8internal3VBO4drawEv(ptr noundef nonnull align 4 dereferenceable(28) %42)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #4
  br label %43

43:                                               ; preds = %29, %32, %35
  %44 = call { ptr, ptr } @_ZN3rmg10ObjectList8iteratorppEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  %45 = call { ptr, ptr } @_ZNK3rmg10ObjectList3endEv(ptr noundef nonnull align 8 dereferenceable(20) %1)
  %46 = extractvalue { ptr, ptr } %45, 0
  store ptr %46, ptr %4, align 8
  %47 = extractvalue { ptr, ptr } %45, 1
  store ptr %47, ptr %21, align 8
  %48 = call noundef zeroext i1 @_ZN3rmg10ObjectList8iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  br i1 %48, label %29, label %._crit_edge, !llvm.loop !22

49:                                               ; preds = %2, %._crit_edge
  %.0 = phi i32 [ %28, %._crit_edge ], [ 0, %2 ]
  ret i32 %.0
}

declare void @glViewport(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @glClearDepth(double noundef) local_unnamed_addr #1

declare void @glClear(i32 noundef) local_unnamed_addr #1

declare void @glEnable(i32 noundef) local_unnamed_addr #1

declare void @glDepthFunc(i32 noundef) local_unnamed_addr #1

declare void @glFrontFace(i32 noundef) local_unnamed_addr #1

declare void @glCullFace(i32 noundef) local_unnamed_addr #1

declare void @glDisable(i32 noundef) local_unnamed_addr #1

declare { ptr, ptr } @_ZNK3rmg10ObjectList5beginEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN3rmg10ObjectList8iteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare { ptr, ptr } @_ZNK3rmg10ObjectList3endEv(ptr noundef nonnull align 8 dereferenceable(20)) local_unnamed_addr #1

declare noundef nonnull align 8 dereferenceable(48) ptr @_ZN3rmg10ObjectList8iteratordeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

declare noundef zeroext i1 @_ZNK3rmg6Object8isHiddenEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #1

declare noundef ptr @_ZNK3rmg8Object3D6getVBOEv(ptr noundef nonnull align 8 dereferenceable(216)) local_unnamed_addr #1

declare void @_ZNK3rmg4Mat4mlERKS0_(ptr dead_on_unwind writable sret(%"struct.rmg::Mat4") align 4, ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 4 dereferenceable(64)) local_unnamed_addr #1

declare noundef nonnull align 4 dereferenceable(64) ptr @_ZNK3rmg8Object3D14getModelMatrixEv(ptr noundef nonnull align 8 dereferenceable(216)) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN3rmg4Mat4ixEh(ptr noundef nonnull align 4 dereferenceable(64), i8 noundef zeroext) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3rmg7Mat4RowixEh(ptr noundef nonnull align 4 dereferenceable(16), i8 noundef zeroext) local_unnamed_addr #3 align 2

declare void @_ZNK3rmg8internal3VBO4drawEv(ptr noundef nonnull align 4 dereferenceable(28)) local_unnamed_addr #1

declare { ptr, ptr } @_ZN3rmg10ObjectList8iteratorppEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!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, !7, i64 8}
!6 = !{!"_ZTSN3rmg8internal6ShaderE", !7, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!13, !7, i64 324}
!13 = !{!"_ZTSN3rmg8internal15ShadowMapShaderE", !6, i64 0, !14, i64 12, !15, i64 276, !15, i64 288, !15, i64 300, !18, i64 312, !18, i64 316, !18, i64 320, !7, i64 324, !7, i64 328, !7, i64 332}
!14 = !{!"_ZTSN3rmg6CameraE", !15, i64 0, !16, i64 12, !17, i64 48, !17, i64 112, !17, i64 176, !18, i64 240, !18, i64 244, !18, i64 248, !18, i64 252, !18, i64 256, !19, i64 260}
!15 = !{!"_ZTSN3rmg4Vec3E", !8, i64 0}
!16 = !{!"_ZTSN3rmg4Mat3E", !8, i64 0}
!17 = !{!"_ZTSN3rmg4Mat4E", !8, i64 0}
!18 = !{!"float", !8, i64 0}
!19 = !{!"_ZTSN3rmg14ProjectionModeE", !8, i64 0}
!20 = !{!13, !7, i64 328}
!21 = !{!13, !7, i64 332}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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