; LLVM IR from niessner/Matterport :: code/gaps/pkgs/RGBD/RGBDSurface.ll (ZNK11RGBDSurface9DrawFacesEi)

; 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.RNFlags = type { i64 }
%class.RGBDSurface = type { ptr, ptr, i32, %class.RNArray, i32, i32, i32, ptr, ptr, %class.R2Box, i32, ptr, ptr, ptr }
%class.RNArray = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Point = type { [2 x double] }

; 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh10FaceNormalEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK11RGBDSurface9DrawFacesEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) unnamed_addr #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %class.RNFlags, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %11 = load ptr, ptr %3, align 8
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = icmp eq i32 %12, 2
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  call void @glEnable(i32 noundef 2903)
  call void @glColorMaterial(i32 noundef 1032, i32 noundef 5634)
  call void @glEnable(i32 noundef 2896)
  br label %15

15:                                               ; preds = %14, %2
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = load ptr, ptr %11, align 8, !tbaa !11
  %18 = getelementptr inbounds ptr, ptr %17, i64 15
  %19 = load ptr, ptr %18, align 8
  call void %19(ptr noundef nonnull align 8 dereferenceable(144) %11, i32 noundef %16)
  %20 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 11
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %31

23:                                               ; preds = %15
  %24 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 11
  %25 = load ptr, ptr %24, align 8, !tbaa !13
  call void @_ZN7RNFlagsC2Em(ptr noundef nonnull align 8 dereferenceable(8) %5, i64 noundef 1906)
  %26 = getelementptr inbounds %class.RNFlags, ptr %5, i32 0, i32 0
  %27 = load i64, ptr %26, align 8
  %28 = load ptr, ptr %25, align 8, !tbaa !11
  %29 = getelementptr inbounds ptr, ptr %28, i64 21
  %30 = load ptr, ptr %29, align 8
  call void %30(ptr noundef nonnull align 8 dereferenceable(120) %25, i64 %27)
  br label %127

31:                                               ; preds = %15
  %32 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %33 = load ptr, ptr %32, align 8, !tbaa !21
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %126

35:                                               ; preds = %31
  call void @glBegin(i32 noundef 4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %122, %35
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %39 = load ptr, ptr %38, align 8, !tbaa !21
  %40 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %39)
  %41 = icmp slt i32 %37, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %125

43:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %44 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %45 = load ptr, ptr %44, align 8, !tbaa !21
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %45, i32 noundef %46)
  store ptr %47, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %48 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %49 = load ptr, ptr %48, align 8, !tbaa !21
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %49, ptr noundef %50, i32 noundef 0)
  store ptr %51, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %52 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %53 = load ptr, ptr %52, align 8, !tbaa !21
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %53, ptr noundef %54, i32 noundef 1)
  store ptr %55, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %56 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %57, ptr noundef %58, i32 noundef 2)
  store ptr %59, ptr %10, align 8, !tbaa !5
  %60 = load i32, ptr %4, align 4, !tbaa !9
  %61 = icmp eq i32 %60, 1
  br i1 %61, label %62, label %87

62:                                               ; preds = %43
  %63 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %64 = load ptr, ptr %63, align 8, !tbaa !21
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %64, ptr noundef %65)
  call void @_Z9RNLoadRgbRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %66)
  %67 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %68 = load ptr, ptr %67, align 8, !tbaa !21
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %68, ptr noundef %69)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %70)
  %71 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %72 = load ptr, ptr %71, align 8, !tbaa !21
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %72, ptr noundef %73)
  call void @_Z9RNLoadRgbRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %74)
  %75 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %76 = load ptr, ptr %75, align 8, !tbaa !21
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %76, ptr noundef %77)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %78)
  %79 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %80 = load ptr, ptr %79, align 8, !tbaa !21
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %80, ptr noundef %81)
  call void @_Z9RNLoadRgbRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %82)
  %83 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %84 = load ptr, ptr %83, align 8, !tbaa !21
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %84, ptr noundef %85)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %86)
  br label %121

87:                                               ; preds = %43
  %88 = load i32, ptr %4, align 4, !tbaa !9
  %89 = icmp eq i32 %88, 2
  br i1 %89, label %90, label %107

90:                                               ; preds = %87
  %91 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %92 = load ptr, ptr %91, align 8, !tbaa !21
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh10FaceNormalEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %92, ptr noundef %93)
  call void @_Z12R3LoadNormalRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(24) %94)
  %95 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %96 = load ptr, ptr %95, align 8, !tbaa !21
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %96, ptr noundef %97)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %98)
  %99 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %100 = load ptr, ptr %99, align 8, !tbaa !21
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %100, ptr noundef %101)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %102)
  %103 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %104 = load ptr, ptr %103, align 8, !tbaa !21
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %104, ptr noundef %105)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %106)
  br label %120

107:                                              ; preds = %87
  %108 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %109 = load ptr, ptr %108, align 8, !tbaa !21
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %109, ptr noundef %110)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %111)
  %112 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %113 = load ptr, ptr %112, align 8, !tbaa !21
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %113, ptr noundef %114)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %115)
  %116 = getelementptr inbounds %class.RGBDSurface, ptr %11, i32 0, i32 12
  %117 = load ptr, ptr %116, align 8, !tbaa !21
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %117, ptr noundef %118)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %119)
  br label %120

120:                                              ; preds = %107, %90
  br label %121

121:                                              ; preds = %120, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %6, align 4, !tbaa !9
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %6, align 4, !tbaa !9
  br label %36, !llvm.loop !22

125:                                              ; preds = %42
  call void @glEnd()
  br label %126

126:                                              ; preds = %125, %31
  br label %127

127:                                              ; preds = %126, %23
  %128 = load i32, ptr %4, align 4, !tbaa !9
  %129 = icmp eq i32 %128, 2
  br i1 %129, label %130, label %131

130:                                              ; preds = %127
  call void @glDisable(i32 noundef 2903)
  call void @glDisable(i32 noundef 2896)
  br label %131

131:                                              ; preds = %130, %127
  ret void
}

declare void @glEnable(i32 noundef) #3

declare void @glColorMaterial(i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN7RNFlagsC2Em(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) unnamed_addr #4 align 2

declare void @glBegin(i32 noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272), i32 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z9RNLoadRgbRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24)) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24)) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z12R3LoadNormalRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(24)) #1

declare void @glEnd() #3

declare void @glDisable(i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !6, i64 120}
!14 = !{!"_ZTS11RGBDSurface", !6, i64 8, !10, i64 16, !15, i64 24, !10, i64 40, !10, i64 44, !10, i64 48, !6, i64 56, !6, i64 64, !17, i64 72, !10, i64 112, !6, i64 120, !6, i64 128, !6, i64 136}
!15 = !{!"_ZTS7RNArrayIP6R2GridE", !16, i64 0}
!16 = !{!"_ZTS8RNVArray", !6, i64 0, !10, i64 8, !10, i64 12}
!17 = !{!"_ZTS5R2Box", !18, i64 0, !20, i64 8, !20, i64 24}
!18 = !{!"_ZTS7R2Solid", !19, i64 0}
!19 = !{!"_ZTS7R2Shape"}
!20 = !{!"_ZTS7R2Point", !7, i64 0}
!21 = !{!14, !6, i64 128}
!22 = distinct !{!22, !23}
!23 = !{!"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.RNFlags = type { i64 }

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh10FaceNormalEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK11RGBDSurface9DrawFacesEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca %class.RNFlags, align 8
  %4 = icmp eq i32 %1, 2
  br i1 %4, label %5, label %6

5:                                                ; preds = %2
  tail call void @glEnable(i32 noundef 2903)
  tail call void @glColorMaterial(i32 noundef 1032, i32 noundef 5634)
  tail call void @glEnable(i32 noundef 2896)
  br label %6

6:                                                ; preds = %5, %2
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 120
  %9 = load ptr, ptr %8, align 8
  tail call void %9(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1)
  %10 = getelementptr inbounds i8, ptr %0, i64 120
  %11 = load ptr, ptr %10, align 8, !tbaa !8
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %17, label %12

12:                                               ; preds = %6
  call void @_ZN7RNFlagsC2Em(ptr noundef nonnull align 8 dereferenceable(8) %3, i64 noundef 1906)
  %13 = load i64, ptr %3, align 8
  %14 = load ptr, ptr %11, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %14, i64 168
  %16 = load ptr, ptr %15, align 8
  call void %16(ptr noundef nonnull align 8 dereferenceable(120) %11, i64 %13)
  br label %87

17:                                               ; preds = %6
  %18 = getelementptr inbounds i8, ptr %0, i64 128
  %19 = load ptr, ptr %18, align 8, !tbaa !19
  %.not25 = icmp eq ptr %19, null
  br i1 %.not25, label %87, label %20

20:                                               ; preds = %17
  tail call void @glBegin(i32 noundef 4)
  %21 = load ptr, ptr %18, align 8, !tbaa !19
  %22 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %21)
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %20
  %24 = icmp eq i32 %1, 1
  br i1 %24, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %.026.us = phi i32 [ %45, %.lr.ph.split.us ], [ 0, %.lr.ph ]
  %25 = load ptr, ptr %18, align 8, !tbaa !19
  %26 = tail call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %25, i32 noundef %.026.us)
  %27 = load ptr, ptr %18, align 8, !tbaa !19
  %28 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %27, ptr noundef %26, i32 noundef 0)
  %29 = load ptr, ptr %18, align 8, !tbaa !19
  %30 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %29, ptr noundef %26, i32 noundef 1)
  %31 = load ptr, ptr %18, align 8, !tbaa !19
  %32 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %31, ptr noundef %26, i32 noundef 2)
  %33 = load ptr, ptr %18, align 8, !tbaa !19
  %34 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %33, ptr noundef %28)
  tail call void @_Z9RNLoadRgbRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %34)
  %35 = load ptr, ptr %18, align 8, !tbaa !19
  %36 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %35, ptr noundef %28)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %36)
  %37 = load ptr, ptr %18, align 8, !tbaa !19
  %38 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %37, ptr noundef %30)
  tail call void @_Z9RNLoadRgbRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %38)
  %39 = load ptr, ptr %18, align 8, !tbaa !19
  %40 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %39, ptr noundef %30)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %40)
  %41 = load ptr, ptr %18, align 8, !tbaa !19
  %42 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %41, ptr noundef %32)
  tail call void @_Z9RNLoadRgbRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %42)
  %43 = load ptr, ptr %18, align 8, !tbaa !19
  %44 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %43, ptr noundef %32)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %44)
  %45 = add nuw nsw i32 %.026.us, 1
  %46 = load ptr, ptr %18, align 8, !tbaa !19
  %47 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %46)
  %48 = icmp slt i32 %45, %47
  br i1 %48, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !20

.lr.ph.split:                                     ; preds = %.lr.ph
  br i1 %4, label %.lr.ph.split.split.us, label %.lr.ph.split.split

.lr.ph.split.split.us:                            ; preds = %.lr.ph.split, %.lr.ph.split.split.us
  %.026.us27 = phi i32 [ %65, %.lr.ph.split.split.us ], [ 0, %.lr.ph.split ]
  %49 = load ptr, ptr %18, align 8, !tbaa !19
  %50 = tail call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %49, i32 noundef %.026.us27)
  %51 = load ptr, ptr %18, align 8, !tbaa !19
  %52 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %51, ptr noundef %50, i32 noundef 0)
  %53 = load ptr, ptr %18, align 8, !tbaa !19
  %54 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %53, ptr noundef %50, i32 noundef 1)
  %55 = load ptr, ptr %18, align 8, !tbaa !19
  %56 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %55, ptr noundef %50, i32 noundef 2)
  %57 = load ptr, ptr %18, align 8, !tbaa !19
  %58 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh10FaceNormalEPK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %57, ptr noundef %50)
  tail call void @_Z12R3LoadNormalRK8R3Vector(ptr noundef nonnull align 8 dereferenceable(24) %58)
  %59 = load ptr, ptr %18, align 8, !tbaa !19
  %60 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %59, ptr noundef %52)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %60)
  %61 = load ptr, ptr %18, align 8, !tbaa !19
  %62 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %61, ptr noundef %54)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %62)
  %63 = load ptr, ptr %18, align 8, !tbaa !19
  %64 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %63, ptr noundef %56)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %64)
  %65 = add nuw nsw i32 %.026.us27, 1
  %66 = load ptr, ptr %18, align 8, !tbaa !19
  %67 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %66)
  %68 = icmp slt i32 %65, %67
  br i1 %68, label %.lr.ph.split.split.us, label %._crit_edge, !llvm.loop !20

._crit_edge:                                      ; preds = %.lr.ph.split.split, %.lr.ph.split.split.us, %.lr.ph.split.us, %20
  tail call void @glEnd()
  br label %87

.lr.ph.split.split:                               ; preds = %.lr.ph.split, %.lr.ph.split.split
  %.026 = phi i32 [ %83, %.lr.ph.split.split ], [ 0, %.lr.ph.split ]
  %69 = load ptr, ptr %18, align 8, !tbaa !19
  %70 = tail call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %69, i32 noundef %.026)
  %71 = load ptr, ptr %18, align 8, !tbaa !19
  %72 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %71, ptr noundef %70, i32 noundef 0)
  %73 = load ptr, ptr %18, align 8, !tbaa !19
  %74 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %73, ptr noundef %70, i32 noundef 1)
  %75 = load ptr, ptr %18, align 8, !tbaa !19
  %76 = tail call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %75, ptr noundef %70, i32 noundef 2)
  %77 = load ptr, ptr %18, align 8, !tbaa !19
  %78 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %77, ptr noundef %72)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %78)
  %79 = load ptr, ptr %18, align 8, !tbaa !19
  %80 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %79, ptr noundef %74)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %80)
  %81 = load ptr, ptr %18, align 8, !tbaa !19
  %82 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %81, ptr noundef %76)
  tail call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %82)
  %83 = add nuw nsw i32 %.026, 1
  %84 = load ptr, ptr %18, align 8, !tbaa !19
  %85 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %84)
  %86 = icmp slt i32 %83, %85
  br i1 %86, label %.lr.ph.split.split, label %._crit_edge, !llvm.loop !20

87:                                               ; preds = %17, %._crit_edge, %12
  br i1 %4, label %88, label %89

88:                                               ; preds = %87
  call void @glDisable(i32 noundef 2903)
  call void @glDisable(i32 noundef 2896)
  br label %89

89:                                               ; preds = %88, %87
  ret void
}

declare void @glEnable(i32 noundef) local_unnamed_addr #2

declare void @glColorMaterial(i32 noundef, i32 noundef) local_unnamed_addr #2

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

declare void @glBegin(i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh11VertexColorEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #3 align 2

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

declare void @glEnd() local_unnamed_addr #2

declare void @glDisable(i32 noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 120}
!9 = !{!"_ZTS11RGBDSurface", !10, i64 8, !12, i64 16, !13, i64 24, !12, i64 40, !12, i64 44, !12, i64 48, !10, i64 56, !10, i64 64, !15, i64 72, !12, i64 112, !10, i64 120, !10, i64 128, !10, i64 136}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"int", !11, i64 0}
!13 = !{!"_ZTS7RNArrayIP6R2GridE", !14, i64 0}
!14 = !{!"_ZTS8RNVArray", !10, i64 0, !12, i64 8, !12, i64 12}
!15 = !{!"_ZTS5R2Box", !16, i64 0, !18, i64 8, !18, i64 24}
!16 = !{!"_ZTS7R2Solid", !17, i64 0}
!17 = !{!"_ZTS7R2Shape"}
!18 = !{!"_ZTS7R2Point", !11, i64 0}
!19 = !{!9, !10, i64 128}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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