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

; 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.RNRgb = type { [3 x double] }
%class.R2Image = type { i32, i32, i32, i32, ptr }
%class.RGBDImage = type { ptr, ptr, i32, %class.RNArray, i32, i32, %class.R3Affine, %class.R3Matrix, %class.R3Box, i32, ptr, ptr, ptr, i32, i32 }
%class.RNArray = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }
%class.R3Matrix = type { [3 x [3 x double]] }
%class.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

declare void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4

declare void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9RGBDImage12UpdateOpenGLEv(ptr noundef nonnull align 8 dereferenceable(488) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca %class.R2Image, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %class.RNRgb, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  %12 = getelementptr inbounds %class.RGBDImage, ptr %11, i32 0, i32 9
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %1
  br label %70

16:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @glGenTextures(i32 noundef 1, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #5
  %17 = getelementptr inbounds %class.RGBDImage, ptr %11, i32 0, i32 4
  %18 = load i32, ptr %17, align 8, !tbaa !24
  %19 = getelementptr inbounds %class.RGBDImage, ptr %11, i32 0, i32 5
  %20 = load i32, ptr %19, align 4, !tbaa !25
  call void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef %18, i32 noundef %20, i32 noundef 3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !26
  br label %21

21:                                               ; preds = %49, %16
  %22 = load i32, ptr %5, align 4, !tbaa !26
  %23 = getelementptr inbounds %class.RGBDImage, ptr %11, i32 0, i32 5
  %24 = load i32, ptr %23, align 4, !tbaa !25
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %52

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !26
  br label %28

28:                                               ; preds = %41, %27
  %29 = load i32, ptr %7, align 4, !tbaa !26
  %30 = getelementptr inbounds %class.RGBDImage, ptr %11, i32 0, i32 4
  %31 = load i32, ptr %30, align 8, !tbaa !24
  %32 = icmp slt i32 %29, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %28
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %48

34:                                               ; preds = %28
  %35 = load i32, ptr %7, align 4, !tbaa !26
  %36 = load i32, ptr %5, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  %37 = load i32, ptr %7, align 4, !tbaa !26
  %38 = load i32, ptr %5, align 4, !tbaa !26
  invoke void @_ZNK9RGBDImage10PixelColorEii(ptr dead_on_unwind writable sret(%class.RNRgb) align 8 %8, ptr noundef nonnull align 8 dereferenceable(488) %11, i32 noundef %37, i32 noundef %38)
          to label %39 unwind label %44

39:                                               ; preds = %34
  invoke void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef %35, i32 noundef %36, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %40 unwind label %44

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

41:                                               ; preds = %40
  %42 = load i32, ptr %7, align 4, !tbaa !26
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %7, align 4, !tbaa !26
  br label %28, !llvm.loop !27

44:                                               ; preds = %39, %34
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %9, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %75

48:                                               ; preds = %33
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %5, align 4, !tbaa !26
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !26
  br label %21, !llvm.loop !29

52:                                               ; preds = %26
  %53 = load i32, ptr %3, align 4, !tbaa !26
  invoke void @glBindTexture(i32 noundef 3553, i32 noundef %53)
          to label %54 unwind label %71

54:                                               ; preds = %52
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10242, i32 noundef 10496)
          to label %55 unwind label %71

55:                                               ; preds = %54
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10243, i32 noundef 10496)
          to label %56 unwind label %71

56:                                               ; preds = %55
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10241, i32 noundef 9987)
          to label %57 unwind label %71

57:                                               ; preds = %56
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10240, i32 noundef 9729)
          to label %58 unwind label %71

58:                                               ; preds = %57
  invoke void @glTexEnvi(i32 noundef 8960, i32 noundef 8704, i32 noundef 8448)
          to label %59 unwind label %71

59:                                               ; preds = %58
  %60 = invoke noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %61 unwind label %71

61:                                               ; preds = %59
  %62 = invoke noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %63 unwind label %71

63:                                               ; preds = %61
  %64 = invoke noundef ptr @_ZNK7R2Image6PixelsEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %65 unwind label %71

65:                                               ; preds = %63
  %66 = invoke i32 @gluBuild2DMipmaps(i32 noundef 3553, i32 noundef 3, i32 noundef %60, i32 noundef %62, i32 noundef 6407, i32 noundef 5121, ptr noundef %64)
          to label %67 unwind label %71

67:                                               ; preds = %65
  %68 = load i32, ptr %3, align 4, !tbaa !26
  %69 = getelementptr inbounds %class.RGBDImage, ptr %11, i32 0, i32 9
  store i32 %68, ptr %69, align 8, !tbaa !9
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %70

70:                                               ; preds = %67, %15
  ret void

71:                                               ; preds = %65, %63, %61, %59, %58, %57, %56, %55, %54, %52
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %9, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %10, align 4
  br label %75

75:                                               ; preds = %71, %44
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %76

76:                                               ; preds = %75
  %77 = load ptr, ptr %9, align 8
  %78 = load i32, ptr %10, align 4
  %79 = insertvalue { ptr, i32 } poison, ptr %77, 0
  %80 = insertvalue { ptr, i32 } %79, i32 %78, 1
  resume { ptr, i32 } %80
}

declare void @glGenTextures(i32 noundef, ptr noundef) #3

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

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

declare i32 @gluBuild2DMipmaps(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nounwind "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, !11, i64 448}
!10 = !{!"_ZTS9RGBDImage", !6, i64 8, !11, i64 16, !12, i64 24, !11, i64 40, !11, i64 44, !14, i64 48, !19, i64 320, !20, i64 392, !11, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !11, i64 480, !11, i64 484}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTS7RNArrayIP6R2GridE", !13, i64 0}
!13 = !{!"_ZTS8RNVArray", !6, i64 0, !11, i64 8, !11, i64 12}
!14 = !{!"_ZTS8R3Affine", !15, i64 0, !16, i64 8, !16, i64 136, !17, i64 264}
!15 = !{!"_ZTS16R3Transformation"}
!16 = !{!"_ZTS8R4Matrix", !7, i64 0}
!17 = !{!"_ZTS7RNFlags", !18, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTS8R3Matrix", !7, i64 0}
!20 = !{!"_ZTS5R3Box", !21, i64 0, !23, i64 8, !23, i64 32}
!21 = !{!"_ZTS7R3Solid", !22, i64 0}
!22 = !{!"_ZTS7R3Shape"}
!23 = !{!"_ZTS7R3Point", !7, i64 0}
!24 = !{!10, !11, i64 40}
!25 = !{!10, !11, i64 44}
!26 = !{!11, !11, 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.RNRgb = type { [3 x double] }
%class.R2Image = type { i32, i32, i32, i32, ptr }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

declare void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3

; Function Attrs: nounwind
declare void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4

declare void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9RGBDImage12UpdateOpenGLEv(ptr noundef nonnull align 8 dereferenceable(488) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %class.R2Image, align 8
  %4 = alloca %class.RNRgb, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 448
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %44, label %8

8:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @glGenTextures(i32 noundef 1, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load i32, ptr %9, align 8, !tbaa !23
  %11 = getelementptr inbounds i8, ptr %0, i64 44
  %12 = load i32, ptr %11, align 4, !tbaa !24
  call void @_ZN7R2ImageC1Eiii(ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %10, i32 noundef %12, i32 noundef 3)
  %13 = load i32, ptr %11, align 4, !tbaa !24
  %14 = icmp sgt i32 %13, 0
  %15 = load i32, ptr %9, align 8
  %16 = icmp sgt i32 %15, 0
  %or.cond = select i1 %14, i1 %16, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge16

.preheader:                                       ; preds = %8, %._crit_edge
  %17 = phi i32 [ %21, %._crit_edge ], [ %13, %8 ]
  %18 = phi i32 [ %22, %._crit_edge ], [ %15, %8 ]
  %.01215 = phi i32 [ %23, %._crit_edge ], [ 0, %8 ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %._crit_edge

._crit_edge16:                                    ; preds = %._crit_edge, %8
  %20 = load i32, ptr %2, align 4, !tbaa !25
  invoke void @glBindTexture(i32 noundef 3553, i32 noundef %20)
          to label %32 unwind label %45

._crit_edge.loopexit:                             ; preds = %26
  %.pre = load i32, ptr %11, align 4, !tbaa !24
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %21 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %17, %.preheader ]
  %22 = phi i32 [ %28, %._crit_edge.loopexit ], [ %18, %.preheader ]
  %23 = add nuw nsw i32 %.01215, 1
  %24 = icmp slt i32 %23, %21
  br i1 %24, label %.preheader, label %._crit_edge16, !llvm.loop !26

.lr.ph:                                           ; preds = %.preheader, %26
  %.01114 = phi i32 [ %27, %26 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #5
  invoke void @_ZNK9RGBDImage10PixelColorEii(ptr dead_on_unwind nonnull writable sret(%class.RNRgb) align 8 %4, ptr noundef nonnull align 8 dereferenceable(488) %0, i32 noundef %.01114, i32 noundef %.01215)
          to label %25 unwind label %30

25:                                               ; preds = %.lr.ph
  invoke void @_ZN7R2Image11SetPixelRGBEiiRK5RNRgb(ptr noundef nonnull align 8 dereferenceable(24) %3, i32 noundef %.01114, i32 noundef %.01215, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %26 unwind label %30

26:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  %27 = add nuw nsw i32 %.01114, 1
  %28 = load i32, ptr %9, align 8, !tbaa !23
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !29

30:                                               ; preds = %25, %.lr.ph
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #5
  br label %47

32:                                               ; preds = %._crit_edge16
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10242, i32 noundef 10496)
          to label %33 unwind label %45

33:                                               ; preds = %32
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10243, i32 noundef 10496)
          to label %34 unwind label %45

34:                                               ; preds = %33
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10241, i32 noundef 9987)
          to label %35 unwind label %45

35:                                               ; preds = %34
  invoke void @glTexParameteri(i32 noundef 3553, i32 noundef 10240, i32 noundef 9729)
          to label %36 unwind label %45

36:                                               ; preds = %35
  invoke void @glTexEnvi(i32 noundef 8960, i32 noundef 8704, i32 noundef 8448)
          to label %37 unwind label %45

37:                                               ; preds = %36
  %38 = call noundef i32 @_ZNK7R2Image5WidthEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %39 = call noundef i32 @_ZNK7R2Image6HeightEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %40 = call noundef ptr @_ZNK7R2Image6PixelsEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %41 = invoke i32 @gluBuild2DMipmaps(i32 noundef 3553, i32 noundef 3, i32 noundef %38, i32 noundef %39, i32 noundef 6407, i32 noundef 5121, ptr noundef %40)
          to label %42 unwind label %45

42:                                               ; preds = %37
  %43 = load i32, ptr %2, align 4, !tbaa !25
  store i32 %43, ptr %5, align 8, !tbaa !5
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br label %44

44:                                               ; preds = %1, %42
  ret void

45:                                               ; preds = %37, %36, %35, %34, %33, %32, %._crit_edge16
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %47

47:                                               ; preds = %45, %30
  %.pn = phi { ptr, i32 } [ %31, %30 ], [ %46, %45 ]
  call void @_ZN7R2ImageD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  resume { ptr, i32 } %.pn
}

declare void @glGenTextures(i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

declare i32 @gluBuild2DMipmaps(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nounwind "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 448}
!6 = !{!"_ZTS9RGBDImage", !7, i64 8, !10, i64 16, !11, i64 24, !10, i64 40, !10, i64 44, !13, i64 48, !18, i64 320, !19, i64 392, !10, i64 448, !7, i64 456, !7, i64 464, !7, i64 472, !10, i64 480, !10, i64 484}
!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 = !{!"_ZTS8R3Affine", !14, i64 0, !15, i64 8, !15, i64 136, !16, i64 264}
!14 = !{!"_ZTS16R3Transformation"}
!15 = !{!"_ZTS8R4Matrix", !8, i64 0}
!16 = !{!"_ZTS7RNFlags", !17, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!"_ZTS8R3Matrix", !8, i64 0}
!19 = !{!"_ZTS5R3Box", !20, i64 0, !22, i64 8, !22, i64 32}
!20 = !{!"_ZTS7R3Solid", !21, i64 0}
!21 = !{!"_ZTS7R3Shape"}
!22 = !{!"_ZTS7R3Point", !8, i64 0}
!23 = !{!6, !10, i64 40}
!24 = !{!6, !10, i64 44}
!25 = !{!10, !10, i64 0}
!26 = distinct !{!26, !27, !28}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!"llvm.loop.unswitch.partial.disable"}
!29 = distinct !{!29, !27}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass