; LLVM IR from niessner/Matterport :: code/gaps/apps/mpview/mpview.ll (Z11GLUTSpecialiii)

; 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.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }
%struct.MPHouse = type { %class.RNArray.5, %class.RNArray.0, %class.RNArray.6, %class.RNArray.4, %class.RNArray.2, %class.RNArray.7, %class.RNArray.1, %class.RNArray.8, %class.RNArray.3, %class.RNArray.9, %class.RGBDConfiguration, ptr, ptr, %class.R3Box, ptr, ptr }
%class.RNArray.5 = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.RNArray.0 = type { %class.RNVArray }
%class.RNArray.6 = type { %class.RNVArray }
%class.RNArray.4 = type { %class.RNVArray }
%class.RNArray.2 = type { %class.RNVArray }
%class.RNArray.7 = type { %class.RNVArray }
%class.RNArray.1 = type { %class.RNVArray }
%class.RNArray.8 = type { %class.RNVArray }
%class.RNArray.3 = type { %class.RNVArray }
%class.RNArray.9 = type { %class.RNVArray }
%class.RGBDConfiguration = type { ptr, %class.RNArray.10, %class.RNArray.11, ptr, ptr, ptr, ptr, %class.R3Box }
%class.RNArray.10 = type { %class.RNVArray }
%class.RNArray.11 = type { %class.RNVArray }

@_ZL8clip_box = external hidden global %class.R3Box, align 8
@_ZL5house = external hidden global ptr, align 8
@_ZL17GLUTwindow_height = external hidden global i32, align 4
@_ZL9GLUTmouse = external hidden global [2 x i32], align 4
@_ZL13GLUTmodifiers = external hidden global i32, align 4
@_ZL16snap_image_index = external hidden global i32, align 4

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

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

declare void @glutPostRedisplay() #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL4PickiiPP10MPPanoramaPP7MPImagePP9MPSegmentPP8MPObjectPP8MPRegionPP11R3SceneNodePP14R3SceneElementPP7R3ShapePP10R3MeshFaceP7R3PointP8R3VectorPd(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @glutGetModifiers() #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11GLUTSpecialiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  %8 = load i32, ptr @_ZL17GLUTwindow_height, align 4, !tbaa !5
  %9 = load i32, ptr %6, align 4, !tbaa !5
  %10 = sub nsw i32 %8, %9
  store i32 %10, ptr %6, align 4, !tbaa !5
  %11 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %11, label %135 [
    i32 1, label %12
    i32 104, label %20
    i32 105, label %43
    i32 100, label %59
    i32 102, label %78
    i32 103, label %97
    i32 101, label %116
  ]

12:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !9
  %13 = load i32, ptr %5, align 4, !tbaa !5
  %14 = load i32, ptr %6, align 4, !tbaa !5
  %15 = call noundef i32 @_ZL4PickiiPP10MPPanoramaPP7MPImagePP9MPSegmentPP8MPObjectPP8MPRegionPP11R3SceneNodePP14R3SceneElementPP7R3ShapePP10R3MeshFaceP7R3PointP8R3VectorPd(i32 noundef %13, i32 noundef %14, ptr noundef null, ptr noundef %7, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null)
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %12
  %18 = load ptr, ptr %7, align 8, !tbaa !9
  call void @_ZL9SnapImageP7MPImage(ptr noundef %18)
  br label %19

19:                                               ; preds = %17, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %135

20:                                               ; preds = %3
  %21 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.MPHouse, ptr %21, i32 0, i32 0
  %23 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %25, label %42

25:                                               ; preds = %20
  %26 = load i32, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %28 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.MPHouse, ptr %28, i32 0, i32 0
  %30 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %29)
  %31 = icmp sge i32 %27, %30
  br i1 %31, label %32, label %37

32:                                               ; preds = %25
  %33 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct.MPHouse, ptr %33, i32 0, i32 0
  %35 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %34)
  %36 = sub nsw i32 %35, 1
  store i32 %36, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %32, %25
  %38 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.MPHouse, ptr %38, i32 0, i32 0
  %40 = load i32, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %41 = call noundef ptr @_ZNK7RNArrayIP7MPImageE3KthEi(ptr noundef nonnull align 8 dereferenceable(16) %39, i32 noundef %40)
  call void @_ZL9SnapImageP7MPImage(ptr noundef %41)
  br label %42

42:                                               ; preds = %37, %20
  br label %135

43:                                               ; preds = %3
  %44 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.MPHouse, ptr %44, i32 0, i32 0
  %46 = call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %45)
  %47 = icmp sgt i32 %46, 0
  br i1 %47, label %48, label %58

48:                                               ; preds = %43
  %49 = load i32, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %51 = icmp slt i32 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %48
  store i32 0, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %52, %48
  %54 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.MPHouse, ptr %54, i32 0, i32 0
  %56 = load i32, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %57 = call noundef ptr @_ZNK7RNArrayIP7MPImageE3KthEi(ptr noundef nonnull align 8 dereferenceable(16) %55, i32 noundef %56)
  call void @_ZL9SnapImageP7MPImage(ptr noundef %57)
  br label %58

58:                                               ; preds = %53, %43
  br label %135

59:                                               ; preds = %3
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %60, i32 noundef 2)
  %62 = load double, ptr %61, align 8, !tbaa !11
  %63 = fsub double %62, 1.000000e-01
  store double %63, ptr %61, align 8, !tbaa !11
  %64 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %64, i32 noundef 2)
  %66 = load double, ptr %65, align 8, !tbaa !11
  %67 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %67, i32 noundef 2)
  %69 = load double, ptr %68, align 8, !tbaa !11
  %70 = fcmp ogt double %66, %69
  br i1 %70, label %71, label %77

71:                                               ; preds = %59
  %72 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %72, i32 noundef 2)
  %74 = load double, ptr %73, align 8, !tbaa !11
  %75 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %75, i32 noundef 2)
  store double %74, ptr %76, align 8, !tbaa !11
  br label %77

77:                                               ; preds = %71, %59
  br label %135

78:                                               ; preds = %3
  %79 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %79, i32 noundef 2)
  %81 = load double, ptr %80, align 8, !tbaa !11
  %82 = fadd double %81, 1.000000e-01
  store double %82, ptr %80, align 8, !tbaa !11
  %83 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %83, i32 noundef 2)
  %85 = load double, ptr %84, align 8, !tbaa !11
  %86 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct.MPHouse, ptr %86, i32 0, i32 13
  %88 = call noundef double @_ZNK5R3Box4ZMinEv(ptr noundef nonnull align 8 dereferenceable(56) %87)
  %89 = fcmp olt double %85, %88
  br i1 %89, label %90, label %96

90:                                               ; preds = %78
  %91 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.MPHouse, ptr %91, i32 0, i32 13
  %93 = call noundef double @_ZNK5R3Box4ZMinEv(ptr noundef nonnull align 8 dereferenceable(56) %92)
  %94 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %94, i32 noundef 2)
  store double %93, ptr %95, align 8, !tbaa !11
  br label %96

96:                                               ; preds = %90, %78
  br label %135

97:                                               ; preds = %3
  %98 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %98, i32 noundef 2)
  %100 = load double, ptr %99, align 8, !tbaa !11
  %101 = fsub double %100, 1.000000e-01
  store double %101, ptr %99, align 8, !tbaa !11
  %102 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %102, i32 noundef 2)
  %104 = load double, ptr %103, align 8, !tbaa !11
  %105 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %105, i32 noundef 2)
  %107 = load double, ptr %106, align 8, !tbaa !11
  %108 = fcmp olt double %104, %107
  br i1 %108, label %109, label %115

109:                                              ; preds = %97
  %110 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %110, i32 noundef 2)
  %112 = load double, ptr %111, align 8, !tbaa !11
  %113 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %113, i32 noundef 2)
  store double %112, ptr %114, align 8, !tbaa !11
  br label %115

115:                                              ; preds = %109, %97
  br label %135

116:                                              ; preds = %3
  %117 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %118 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %117, i32 noundef 2)
  %119 = load double, ptr %118, align 8, !tbaa !11
  %120 = fadd double %119, 1.000000e-01
  store double %120, ptr %118, align 8, !tbaa !11
  %121 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %121, i32 noundef 2)
  %123 = load double, ptr %122, align 8, !tbaa !11
  %124 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct.MPHouse, ptr %124, i32 0, i32 13
  %126 = call noundef double @_ZNK5R3Box4ZMaxEv(ptr noundef nonnull align 8 dereferenceable(56) %125)
  %127 = fcmp ogt double %123, %126
  br i1 %127, label %128, label %134

128:                                              ; preds = %116
  %129 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %130 = getelementptr inbounds %struct.MPHouse, ptr %129, i32 0, i32 13
  %131 = call noundef double @_ZNK5R3Box4ZMaxEv(ptr noundef nonnull align 8 dereferenceable(56) %130)
  %132 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %132, i32 noundef 2)
  store double %131, ptr %133, align 8, !tbaa !11
  br label %134

134:                                              ; preds = %128, %116
  br label %135

135:                                              ; preds = %134, %115, %96, %77, %58, %42, %19, %3
  %136 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %136, ptr @_ZL9GLUTmouse, align 4, !tbaa !5
  %137 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %137, ptr getelementptr inbounds ([2 x i32], ptr @_ZL9GLUTmouse, i64 0, i64 1), align 4, !tbaa !5
  %138 = call i32 @glutGetModifiers()
  store i32 %138, ptr @_ZL13GLUTmodifiers, align 4, !tbaa !5
  call void @glutPostRedisplay()
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9SnapImageP7MPImage(ptr noundef) #2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5R3Box4ZMinEv(ptr noundef nonnull align 8 dereferenceable(56)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5R3Box4ZMaxEv(ptr noundef nonnull align 8 dereferenceable(56)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress 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 #4 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}


; 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.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }

@_ZL8clip_box = external hidden global %class.R3Box, align 8
@_ZL5house = external hidden local_unnamed_addr global ptr, align 8
@_ZL17GLUTwindow_height = external hidden local_unnamed_addr global i32, align 4
@_ZL9GLUTmouse = external hidden local_unnamed_addr global [2 x i32], align 4
@_ZL13GLUTmodifiers = external hidden local_unnamed_addr global i32, align 4
@_ZL16snap_image_index = external hidden local_unnamed_addr global i32, align 4

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

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

declare void @glutPostRedisplay() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL4PickiiPP10MPPanoramaPP7MPImagePP9MPSegmentPP8MPObjectPP8MPRegionPP11R3SceneNodePP14R3SceneElementPP7R3ShapePP10R3MeshFaceP7R3PointP8R3VectorPd(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @glutGetModifiers() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11GLUTSpecialiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = load i32, ptr @_ZL17GLUTwindow_height, align 4, !tbaa !5
  %6 = sub nsw i32 %5, %2
  switch i32 %0, label %110 [
    i32 1, label %7
    i32 104, label %12
    i32 105, label %29
    i32 100, label %38
    i32 102, label %56
    i32 103, label %74
    i32 101, label %92
  ]

7:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  store ptr null, ptr %4, align 8, !tbaa !9
  %8 = call noundef i32 @_ZL4PickiiPP10MPPanoramaPP7MPImagePP9MPSegmentPP8MPObjectPP8MPRegionPP11R3SceneNodePP14R3SceneElementPP7R3ShapePP10R3MeshFaceP7R3PointP8R3VectorPd(i32 noundef %1, i32 noundef %6, ptr noundef null, ptr noundef nonnull %4, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null)
  %.not6 = icmp eq i32 %8, 0
  br i1 %.not6, label %11, label %9

9:                                                ; preds = %7
  %10 = load ptr, ptr %4, align 8, !tbaa !9
  call void @_ZL9SnapImageP7MPImage(ptr noundef %10)
  br label %11

11:                                               ; preds = %9, %7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %110

12:                                               ; preds = %3
  %13 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %14 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %13)
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %110

16:                                               ; preds = %12
  %17 = load i32, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %19 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %20 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %19)
  %.not = icmp slt i32 %18, %20
  br i1 %.not, label %._crit_edge, label %21

._crit_edge:                                      ; preds = %16
  %.pre = load i32, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  br label %25

21:                                               ; preds = %16
  %22 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %23 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %._crit_edge, %21
  %26 = phi i32 [ %.pre, %._crit_edge ], [ %24, %21 ]
  %27 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %28 = tail call noundef ptr @_ZNK7RNArrayIP7MPImageE3KthEi(ptr noundef nonnull align 8 dereferenceable(16) %27, i32 noundef %26)
  tail call void @_ZL9SnapImageP7MPImage(ptr noundef %28)
  br label %110

29:                                               ; preds = %3
  %30 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %31 = tail call noundef i32 @_ZNK8RNVArray8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(16) %30)
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %33, label %110

33:                                               ; preds = %29
  %34 = load i32, ptr @_ZL16snap_image_index, align 4, !tbaa !5
  %35 = tail call i32 @llvm.smax.i32(i32 %34, i32 1)
  %spec.store.select = add nsw i32 %35, -1
  store i32 %spec.store.select, ptr @_ZL16snap_image_index, align 4
  %36 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %37 = tail call noundef ptr @_ZNK7RNArrayIP7MPImageE3KthEi(ptr noundef nonnull align 8 dereferenceable(16) %36, i32 noundef %spec.store.select)
  tail call void @_ZL9SnapImageP7MPImage(ptr noundef %37)
  br label %110

38:                                               ; preds = %3
  %39 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %39, i32 noundef 2)
  %41 = load double, ptr %40, align 8, !tbaa !11
  %42 = fadd double %41, -1.000000e-01
  store double %42, ptr %40, align 8, !tbaa !11
  %43 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %44 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %43, i32 noundef 2)
  %45 = load double, ptr %44, align 8, !tbaa !11
  %46 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %47 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %46, i32 noundef 2)
  %48 = load double, ptr %47, align 8, !tbaa !11
  %49 = fcmp ogt double %45, %48
  br i1 %49, label %50, label %110

50:                                               ; preds = %38
  %51 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %52 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %51, i32 noundef 2)
  %53 = load double, ptr %52, align 8, !tbaa !11
  %54 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %55 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %54, i32 noundef 2)
  store double %53, ptr %55, align 8, !tbaa !11
  br label %110

56:                                               ; preds = %3
  %57 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %58 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %57, i32 noundef 2)
  %59 = load double, ptr %58, align 8, !tbaa !11
  %60 = fadd double %59, 1.000000e-01
  store double %60, ptr %58, align 8, !tbaa !11
  %61 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %62 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %61, i32 noundef 2)
  %63 = load double, ptr %62, align 8, !tbaa !11
  %64 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %65 = getelementptr inbounds i8, ptr %64, i64 304
  %66 = tail call noundef double @_ZNK5R3Box4ZMinEv(ptr noundef nonnull align 8 dereferenceable(56) %65)
  %67 = fcmp olt double %63, %66
  br i1 %67, label %68, label %110

68:                                               ; preds = %56
  %69 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %70 = getelementptr inbounds i8, ptr %69, i64 304
  %71 = tail call noundef double @_ZNK5R3Box4ZMinEv(ptr noundef nonnull align 8 dereferenceable(56) %70)
  %72 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %73 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %72, i32 noundef 2)
  store double %71, ptr %73, align 8, !tbaa !11
  br label %110

74:                                               ; preds = %3
  %75 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %76 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %75, i32 noundef 2)
  %77 = load double, ptr %76, align 8, !tbaa !11
  %78 = fadd double %77, -1.000000e-01
  store double %78, ptr %76, align 8, !tbaa !11
  %79 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %80 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %79, i32 noundef 2)
  %81 = load double, ptr %80, align 8, !tbaa !11
  %82 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %83 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %82, i32 noundef 2)
  %84 = load double, ptr %83, align 8, !tbaa !11
  %85 = fcmp olt double %81, %84
  br i1 %85, label %86, label %110

86:                                               ; preds = %74
  %87 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 0)
  %88 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %87, i32 noundef 2)
  %89 = load double, ptr %88, align 8, !tbaa !11
  %90 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %91 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %90, i32 noundef 2)
  store double %89, ptr %91, align 8, !tbaa !11
  br label %110

92:                                               ; preds = %3
  %93 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %94 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %93, i32 noundef 2)
  %95 = load double, ptr %94, align 8, !tbaa !11
  %96 = fadd double %95, 1.000000e-01
  store double %96, ptr %94, align 8, !tbaa !11
  %97 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %98 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %97, i32 noundef 2)
  %99 = load double, ptr %98, align 8, !tbaa !11
  %100 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %101 = getelementptr inbounds i8, ptr %100, i64 304
  %102 = tail call noundef double @_ZNK5R3Box4ZMaxEv(ptr noundef nonnull align 8 dereferenceable(56) %101)
  %103 = fcmp ogt double %99, %102
  br i1 %103, label %104, label %110

104:                                              ; preds = %92
  %105 = load ptr, ptr @_ZL5house, align 8, !tbaa !9
  %106 = getelementptr inbounds i8, ptr %105, i64 304
  %107 = tail call noundef double @_ZNK5R3Box4ZMaxEv(ptr noundef nonnull align 8 dereferenceable(56) %106)
  %108 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZN5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) @_ZL8clip_box, i32 noundef 1)
  %109 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %108, i32 noundef 2)
  store double %107, ptr %109, align 8, !tbaa !11
  br label %110

110:                                              ; preds = %92, %104, %74, %86, %56, %68, %38, %50, %29, %33, %12, %25, %11, %3
  store i32 %1, ptr @_ZL9GLUTmouse, align 4, !tbaa !5
  store i32 %6, ptr getelementptr inbounds (i8, ptr @_ZL9GLUTmouse, i64 4), align 4, !tbaa !5
  %111 = call i32 @glutGetModifiers()
  store i32 %111, ptr @_ZL13GLUTmodifiers, align 4, !tbaa !5
  call void @glutPostRedisplay()
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL9SnapImageP7MPImage(ptr noundef) local_unnamed_addr #2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5R3Box4ZMinEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5R3Box4ZMaxEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass