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

; 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.R3Point = type { [3 x double] }
%class.R2Point = type { [2 x double] }
%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 }

; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK11RGBDSurface9NChannelsEv(ptr noundef nonnull align 8 dereferenceable(144)) #2 align 2

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, i32 noundef) #1 align 2

declare void @glEnable(i32 noundef) #3

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) #2 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) #2 align 2

declare void @glEnd() #3

declare void @glDisable(i32 noundef) #3

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

20:                                               ; preds = %2
  br label %126

21:                                               ; preds = %2
  %22 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 6
  %23 = load i32, ptr %22, align 8, !tbaa !11
  %24 = icmp sle i32 %23, 0
  br i1 %24, label %25, label %29

25:                                               ; preds = %21
  %26 = load ptr, ptr %17, align 8, !tbaa !19
  %27 = getelementptr inbounds ptr, ptr %26, i64 27
  %28 = load ptr, ptr %27, align 8
  call void %28(ptr noundef nonnull align 8 dereferenceable(144) %17)
  br label %29

29:                                               ; preds = %25, %21
  %30 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 6
  %31 = load i32, ptr %30, align 8, !tbaa !11
  %32 = icmp sle i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  br label %126

34:                                               ; preds = %29
  %35 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 6
  %36 = load i32, ptr %35, align 8, !tbaa !11
  call void @glBindTexture(i32 noundef 3553, i32 noundef %36)
  call void @glEnable(i32 noundef 3553)
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = load ptr, ptr %17, align 8, !tbaa !19
  %39 = getelementptr inbounds ptr, ptr %38, i64 15
  %40 = load ptr, ptr %39, align 8
  call void %40(ptr noundef nonnull align 8 dereferenceable(144) %17, i32 noundef %37)
  %41 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 11
  %42 = load ptr, ptr %41, align 8, !tbaa !21
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %53

44:                                               ; preds = %34
  call void @glBegin(i32 noundef 7)
  call void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #5
  %45 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 11
  %46 = load ptr, ptr %45, align 8, !tbaa !21
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %5, ptr noundef nonnull align 8 dereferenceable(120) %46, i32 noundef 0, i32 noundef 0)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #5
  call void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #5
  %47 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 11
  %48 = load ptr, ptr %47, align 8, !tbaa !21
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %6, ptr noundef nonnull align 8 dereferenceable(120) %48, i32 noundef 1, i32 noundef 0)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #5
  call void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #5
  %49 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 11
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %7, ptr noundef nonnull align 8 dereferenceable(120) %50, i32 noundef 1, i32 noundef 1)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #5
  call void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  %51 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 11
  %52 = load ptr, ptr %51, align 8, !tbaa !21
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind writable sret(%class.R3Point) align 8 %8, ptr noundef nonnull align 8 dereferenceable(120) %52, i32 noundef 0, i32 noundef 1)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %8)
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  call void @glEnd()
  br label %125

53:                                               ; preds = %34
  %54 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 12
  %55 = load ptr, ptr %54, align 8, !tbaa !22
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %124

57:                                               ; preds = %53
  %58 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 4
  %59 = load i32, ptr %58, align 8, !tbaa !23
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %61, label %123

61:                                               ; preds = %57
  %62 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 5
  %63 = load i32, ptr %62, align 4, !tbaa !24
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %65, label %123

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

66:                                               ; preds = %119, %65
  %67 = load i32, ptr %9, align 4, !tbaa !9
  %68 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 12
  %69 = load ptr, ptr %68, align 8, !tbaa !22
  %70 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %69)
  %71 = icmp slt i32 %67, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %66
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %122

73:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %74 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 12
  %75 = load ptr, ptr %74, align 8, !tbaa !22
  %76 = load i32, ptr %9, align 4, !tbaa !9
  %77 = call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %75, i32 noundef %76)
  store ptr %77, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %115, %73
  %79 = load i32, ptr %12, align 4, !tbaa !9
  %80 = icmp slt i32 %79, 3
  br i1 %80, label %82, label %81

81:                                               ; preds = %78
  store i32 5, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %118

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %83 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 12
  %84 = load ptr, ptr %83, align 8, !tbaa !22
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = load i32, ptr %12, align 4, !tbaa !9
  %87 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %84, ptr noundef %85, i32 noundef %86)
  store ptr %87, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %88 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 12
  %89 = load ptr, ptr %88, align 8, !tbaa !22
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %89, ptr noundef %90)
  store ptr %91, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #5
  call void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %15)
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #5
  %92 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 12
  %93 = load ptr, ptr %92, align 8, !tbaa !22
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %93, ptr noundef %94)
  call void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %95)
  %96 = load ptr, ptr %17, align 8, !tbaa !19
  %97 = getelementptr inbounds ptr, ptr %96, i64 8
  %98 = load ptr, ptr %97, align 8
  %99 = call noundef i32 %98(ptr noundef nonnull align 8 dereferenceable(144) %17, ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %15, i32 noundef 0)
  %101 = load double, ptr %100, align 8, !tbaa !25
  %102 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 4
  %103 = load i32, ptr %102, align 8, !tbaa !23
  %104 = sitofp i32 %103 to double
  %105 = fdiv double %101, %104
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %15, i32 noundef 0)
  store double %105, ptr %106, align 8, !tbaa !25
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %15, i32 noundef 1)
  %108 = load double, ptr %107, align 8, !tbaa !25
  %109 = getelementptr inbounds %class.RGBDSurface, ptr %17, i32 0, i32 5
  %110 = load i32, ptr %109, align 4, !tbaa !24
  %111 = sitofp i32 %110 to double
  %112 = fdiv double %108, %111
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %15, i32 noundef 1)
  store double %112, ptr %113, align 8, !tbaa !25
  call void @_Z19R3LoadTextureCoordsRK7R2Point(ptr noundef nonnull align 8 dereferenceable(16) %15)
  %114 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %114)
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %115

115:                                              ; preds = %82
  %116 = load i32, ptr %12, align 4, !tbaa !9
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %12, align 4, !tbaa !9
  br label %78, !llvm.loop !27

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

119:                                              ; preds = %118
  %120 = load i32, ptr %9, align 4, !tbaa !9
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %9, align 4, !tbaa !9
  br label %66, !llvm.loop !29

122:                                              ; preds = %72
  call void @glEnd()
  br label %123

123:                                              ; preds = %122, %61, %57
  br label %124

124:                                              ; preds = %123, %53
  br label %125

125:                                              ; preds = %124, %44
  call void @glDisable(i32 noundef 3553)
  call void @glBindTexture(i32 noundef 3553, i32 noundef 0)
  br label %126

126:                                              ; preds = %125, %33, %20
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z19R3LoadTextureCoordsdd(double noundef, double noundef) #1

declare void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

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

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 = { 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 #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 = { 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 = { 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, !10, i64 48}
!12 = !{!"_ZTS11RGBDSurface", !6, i64 8, !10, i64 16, !13, i64 24, !10, i64 40, !10, i64 44, !10, i64 48, !6, i64 56, !6, i64 64, !15, i64 72, !10, i64 112, !6, i64 120, !6, i64 128, !6, i64 136}
!13 = !{!"_ZTS7RNArrayIP6R2GridE", !14, i64 0}
!14 = !{!"_ZTS8RNVArray", !6, i64 0, !10, i64 8, !10, i64 12}
!15 = !{!"_ZTS5R2Box", !16, i64 0, !18, i64 8, !18, i64 24}
!16 = !{!"_ZTS7R2Solid", !17, i64 0}
!17 = !{!"_ZTS7R2Shape"}
!18 = !{!"_ZTS7R2Point", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"vtable pointer", !8, i64 0}
!21 = !{!12, !6, i64 120}
!22 = !{!12, !6, i64 128}
!23 = !{!12, !10, i64 40}
!24 = !{!12, !10, i64 44}
!25 = !{!26, !26, i64 0}
!26 = !{!"double", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}


; 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.R3Point = type { [3 x double] }
%class.R2Point = type { [2 x double] }

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

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

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

declare void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind noalias writable sret(%class.R3Point) align 8, ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

declare void @glEnable(i32 noundef) local_unnamed_addr #3

declare void @glBegin(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #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) local_unnamed_addr #2 align 2

declare void @glEnd() local_unnamed_addr #3

declare void @glDisable(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK11RGBDSurface11DrawTextureEi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1) unnamed_addr #4 align 2 {
  %3 = alloca %class.R3Point, align 8
  %4 = alloca %class.R3Point, align 8
  %5 = alloca %class.R3Point, align 8
  %6 = alloca %class.R3Point, align 8
  %7 = alloca %class.R2Point, align 8
  %8 = alloca %class.R2Point, align 8
  %9 = tail call noundef i32 @_ZNK11RGBDSurface9NChannelsEv(ptr noundef nonnull align 8 dereferenceable(144) %0)
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %119, label %11

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %0, i64 48
  %13 = load i32, ptr %12, align 8, !tbaa !5
  %14 = icmp slt i32 %13, 1
  br i1 %14, label %15, label %.thread

15:                                               ; preds = %11
  %16 = load ptr, ptr %0, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %16, i64 216
  %18 = load ptr, ptr %17, align 8
  tail call void %18(ptr noundef nonnull align 8 dereferenceable(144) %0)
  %.pr = load i32, ptr %12, align 8, !tbaa !5
  %19 = icmp slt i32 %.pr, 1
  br i1 %19, label %119, label %.thread

.thread:                                          ; preds = %11, %15
  %20 = phi i32 [ %.pr, %15 ], [ %13, %11 ]
  tail call void @glBindTexture(i32 noundef 3553, i32 noundef %20)
  tail call void @glEnable(i32 noundef 3553)
  %21 = load ptr, ptr %0, align 8, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %21, i64 120
  %23 = load ptr, ptr %22, align 8
  tail call void %23(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %1)
  %24 = getelementptr inbounds i8, ptr %0, i64 120
  %25 = load ptr, ptr %24, align 8, !tbaa !19
  %.not = icmp eq ptr %25, null
  br i1 %.not, label %31, label %26

26:                                               ; preds = %.thread
  tail call void @glBegin(i32 noundef 7)
  tail call void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  %27 = load ptr, ptr %24, align 8, !tbaa !19
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %3, ptr noundef nonnull align 8 dereferenceable(120) %27, i32 noundef 0, i32 noundef 0)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  call void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  %28 = load ptr, ptr %24, align 8, !tbaa !19
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %4, ptr noundef nonnull align 8 dereferenceable(120) %28, i32 noundef 1, i32 noundef 0)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  call void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  %29 = load ptr, ptr %24, align 8, !tbaa !19
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %5, ptr noundef nonnull align 8 dereferenceable(120) %29, i32 noundef 1, i32 noundef 1)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  %30 = load ptr, ptr %24, align 8, !tbaa !19
  call void @_ZNK11R3Rectangle6CornerEii(ptr dead_on_unwind nonnull writable sret(%class.R3Point) align 8 %6, ptr noundef nonnull align 8 dereferenceable(120) %30, i32 noundef 0, i32 noundef 1)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  br label %.sink.split

31:                                               ; preds = %.thread
  %32 = getelementptr inbounds i8, ptr %0, i64 128
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %.not13 = icmp eq ptr %33, null
  br i1 %.not13, label %118, label %34

34:                                               ; preds = %31
  %35 = getelementptr inbounds i8, ptr %0, i64 40
  %36 = load i32, ptr %35, align 8, !tbaa !21
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %38, label %118

38:                                               ; preds = %34
  %39 = getelementptr inbounds i8, ptr %0, i64 44
  %40 = load i32, ptr %39, align 4, !tbaa !22
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %42, label %118

42:                                               ; preds = %38
  tail call void @glBegin(i32 noundef 4)
  %43 = load ptr, ptr %32, align 8, !tbaa !20
  %44 = tail call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %43)
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph, label %.sink.split

.lr.ph:                                           ; preds = %42, %.lr.ph
  %.015 = phi i32 [ %114, %.lr.ph ], [ 0, %42 ]
  %46 = load ptr, ptr %32, align 8, !tbaa !20
  %47 = call noundef ptr @_ZNK6R3Mesh4FaceEi(ptr noundef nonnull align 8 dereferenceable(272) %46, i32 noundef %.015)
  %48 = load ptr, ptr %32, align 8, !tbaa !20
  %49 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %48, ptr noundef %47, i32 noundef 0)
  %50 = load ptr, ptr %32, align 8, !tbaa !20
  %51 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %50, ptr noundef %49)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  call void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %52 = load ptr, ptr %32, align 8, !tbaa !20
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %52, ptr noundef %49)
  call void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %53)
  %54 = load ptr, ptr %0, align 8, !tbaa !17
  %55 = getelementptr inbounds i8, ptr %54, i64 64
  %56 = load ptr, ptr %55, align 8
  %57 = call noundef i32 %56(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
  %59 = load double, ptr %58, align 8, !tbaa !23
  %60 = load i32, ptr %35, align 8, !tbaa !21
  %61 = sitofp i32 %60 to double
  %62 = fdiv double %59, %61
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
  store double %62, ptr %63, align 8, !tbaa !23
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 1)
  %65 = load double, ptr %64, align 8, !tbaa !23
  %66 = load i32, ptr %39, align 4, !tbaa !22
  %67 = sitofp i32 %66 to double
  %68 = fdiv double %65, %67
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 1)
  store double %68, ptr %69, align 8, !tbaa !23
  call void @_Z19R3LoadTextureCoordsRK7R2Point(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %51)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  %70 = load ptr, ptr %32, align 8, !tbaa !20
  %71 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %70, ptr noundef %47, i32 noundef 1)
  %72 = load ptr, ptr %32, align 8, !tbaa !20
  %73 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %72, ptr noundef %71)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  call void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %74 = load ptr, ptr %32, align 8, !tbaa !20
  %75 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %74, ptr noundef %71)
  call void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %75)
  %76 = load ptr, ptr %0, align 8, !tbaa !17
  %77 = getelementptr inbounds i8, ptr %76, i64 64
  %78 = load ptr, ptr %77, align 8
  %79 = call noundef i32 %78(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
  %81 = load double, ptr %80, align 8, !tbaa !23
  %82 = load i32, ptr %35, align 8, !tbaa !21
  %83 = sitofp i32 %82 to double
  %84 = fdiv double %81, %83
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
  store double %84, ptr %85, align 8, !tbaa !23
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 1)
  %87 = load double, ptr %86, align 8, !tbaa !23
  %88 = load i32, ptr %39, align 4, !tbaa !22
  %89 = sitofp i32 %88 to double
  %90 = fdiv double %87, %89
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 1)
  store double %90, ptr %91, align 8, !tbaa !23
  call void @_Z19R3LoadTextureCoordsRK7R2Point(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %73)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  %92 = load ptr, ptr %32, align 8, !tbaa !20
  %93 = call noundef ptr @_ZNK6R3Mesh12VertexOnFaceEPK10R3MeshFacei(ptr noundef nonnull align 8 dereferenceable(272) %92, ptr noundef %47, i32 noundef 2)
  %94 = load ptr, ptr %32, align 8, !tbaa !20
  %95 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6R3Mesh14VertexPositionEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %94, ptr noundef %93)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #5
  call void @_ZN7R2PointC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  %96 = load ptr, ptr %32, align 8, !tbaa !20
  %97 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6R3Mesh19VertexTextureCoordsEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %96, ptr noundef %93)
  call void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %97)
  %98 = load ptr, ptr %0, align 8, !tbaa !17
  %99 = getelementptr inbounds i8, ptr %98, i64 64
  %100 = load ptr, ptr %99, align 8
  %101 = call noundef i32 %100(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
  %103 = load double, ptr %102, align 8, !tbaa !23
  %104 = load i32, ptr %35, align 8, !tbaa !21
  %105 = sitofp i32 %104 to double
  %106 = fdiv double %103, %105
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
  store double %106, ptr %107, align 8, !tbaa !23
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 1)
  %109 = load double, ptr %108, align 8, !tbaa !23
  %110 = load i32, ptr %39, align 4, !tbaa !22
  %111 = sitofp i32 %110 to double
  %112 = fdiv double %109, %111
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 1)
  store double %112, ptr %113, align 8, !tbaa !23
  call void @_Z19R3LoadTextureCoordsRK7R2Point(ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @_Z11R3LoadPointRK7R3Point(ptr noundef nonnull align 8 dereferenceable(24) %95)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #5
  %114 = add nuw nsw i32 %.015, 1
  %115 = load ptr, ptr %32, align 8, !tbaa !20
  %116 = call noundef i32 @_ZNK6R3Mesh6NFacesEv(ptr noundef nonnull align 8 dereferenceable(272) %115)
  %117 = icmp slt i32 %114, %116
  br i1 %117, label %.lr.ph, label %.sink.split, !llvm.loop !25

.sink.split:                                      ; preds = %.lr.ph, %42, %26
  call void @glEnd()
  br label %118

118:                                              ; preds = %.sink.split, %31, %38, %34
  call void @glDisable(i32 noundef 3553)
  call void @glBindTexture(i32 noundef 3553, i32 noundef 0)
  br label %119

119:                                              ; preds = %15, %2, %118
  ret void
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z19R3LoadTextureCoordsdd(double noundef, double noundef) local_unnamed_addr #1

declare void @_ZN7R2PointC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

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

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


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