; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3PlanarGrid.ll (ZNK12R3PlanarGrid4DrawEv)

; 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.R3Plane = type { %class.R3Vector, double }
%class.R3Vector = type { [3 x double] }
%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Point = type { [2 x double] }
%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.R3PlanarGrid = type <{ %class.R3Plane, %class.R3Affine, %class.R2Grid, %class.R3Box, i32, [4 x i8] }>
%class.R2Grid = type { %class.R2Affine, %class.R2Affine, double, ptr, [2 x i32], i32, i32 }
%class.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%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] }

@R3null_plane = external global %class.R3Plane, align 8
@.str.11 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [94 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #1

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

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

; Function Attrs: nounwind
declare void @_ZN7R2SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6R2Grid8WorldBoxEv(ptr dead_on_unwind noalias writable sret(%class.R2Box) align 8, ptr noundef nonnull align 8 dereferenceable(208)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK12R3PlanarGrid4DrawEv(ptr noundef nonnull align 8 dereferenceable(572) %0) #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %class.R3Affine, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %class.R2Box, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  %12 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 0
  %13 = call noundef i32 @_Z10R3ContainsRK7R3PlaneS1_(ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 8 dereferenceable(32) @R3null_plane)
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %1
  br label %167

16:                                               ; preds = %1
  %17 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 4
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = icmp sle i32 %18, 0
  br i1 %19, label %20, label %99

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  call void @glGenTextures(i32 noundef 1, ptr noundef %3)
  %21 = load i32, ptr %3, align 4, !tbaa !28
  %22 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 4
  store i32 %21, ptr %22, align 8, !tbaa !9
  %23 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 4
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %20
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str.11, ptr noundef @.str.12, i32 noundef 453, ptr noundef @.str.13)
  br label %27

27:                                               ; preds = %26, %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  %28 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %29 = call noundef i32 @_ZNK6R2Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(208) %28)
  %30 = mul nsw i32 4, %29
  %31 = sext i32 %30 to i64
  %32 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %31, i64 4)
  %33 = extractvalue { i64, i1 } %32, 1
  %34 = extractvalue { i64, i1 } %32, 0
  %35 = select i1 %33, i64 -1, i64 %34
  %36 = call noalias noundef nonnull ptr @_Znam(i64 noundef %35) #10
  store ptr %36, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  store i32 0, ptr %5, align 4, !tbaa !28
  br label %37

37:                                               ; preds = %84, %27
  %38 = load i32, ptr %5, align 4, !tbaa !28
  %39 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %40 = call noundef i32 @_ZNK6R2Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(208) %39)
  %41 = icmp slt i32 %38, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %37
  %44 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %45 = load i32, ptr %5, align 4, !tbaa !28
  %46 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %44, i32 noundef %45)
  %47 = fptrunc double %46 to float
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = load i32, ptr %5, align 4, !tbaa !28
  %50 = mul nsw i32 4, %49
  %51 = add nsw i32 %50, 0
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds float, ptr %48, i64 %52
  store float %47, ptr %53, align 4, !tbaa !29
  %54 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %55 = load i32, ptr %5, align 4, !tbaa !28
  %56 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %54, i32 noundef %55)
  %57 = fptrunc double %56 to float
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = load i32, ptr %5, align 4, !tbaa !28
  %60 = mul nsw i32 4, %59
  %61 = add nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds float, ptr %58, i64 %62
  store float %57, ptr %63, align 4, !tbaa !29
  %64 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %65 = load i32, ptr %5, align 4, !tbaa !28
  %66 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %64, i32 noundef %65)
  %67 = fptrunc double %66 to float
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = load i32, ptr %5, align 4, !tbaa !28
  %70 = mul nsw i32 4, %69
  %71 = add nsw i32 %70, 2
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds float, ptr %68, i64 %72
  store float %67, ptr %73, align 4, !tbaa !29
  %74 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %75 = load i32, ptr %5, align 4, !tbaa !28
  %76 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %74, i32 noundef %75)
  %77 = fptrunc double %76 to float
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = load i32, ptr %5, align 4, !tbaa !28
  %80 = mul nsw i32 4, %79
  %81 = add nsw i32 %80, 3
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds float, ptr %78, i64 %82
  store float %77, ptr %83, align 4, !tbaa !29
  br label %84

84:                                               ; preds = %43
  %85 = load i32, ptr %5, align 4, !tbaa !28
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %5, align 4, !tbaa !28
  br label %37, !llvm.loop !31

87:                                               ; preds = %42
  %88 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 4
  %89 = load i32, ptr %88, align 8, !tbaa !9
  call void @glBindTexture(i32 noundef 3553, i32 noundef %89)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10242, i32 noundef 10496)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10243, i32 noundef 10496)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10241, i32 noundef 9729)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10240, i32 noundef 9729)
  call void @glTexEnvi(i32 noundef 8960, i32 noundef 8704, i32 noundef 8448)
  %90 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %91 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %90)
  %92 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  %93 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %92)
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  call void @glTexImage2D(i32 noundef 3553, i32 noundef 0, i32 noundef 6408, i32 noundef %91, i32 noundef %93, i32 noundef 0, i32 noundef 6408, i32 noundef 5126, ptr noundef %94)
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = icmp eq ptr %95, null
  br i1 %96, label %98, label %97

97:                                               ; preds = %87
  call void @_ZdaPv(ptr noundef %95) #11
  br label %98

98:                                               ; preds = %97, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %99

99:                                               ; preds = %98, %16
  %100 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 4
  %101 = load i32, ptr %100, align 8, !tbaa !9
  call void @glBindTexture(i32 noundef 3553, i32 noundef %101)
  call void @llvm.lifetime.start.p0(i64 272, ptr %6) #9
  %102 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 1
  call void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %6, ptr noundef nonnull align 8 dereferenceable(272) %102)
  invoke void @_ZN8R3Affine6InvertEv(ptr noundef nonnull align 8 dereferenceable(272) %6)
          to label %103 unwind label %168

103:                                              ; preds = %99
  invoke void @_ZNK8R3Affine4PushEv(ptr noundef nonnull align 8 dereferenceable(272) %6)
          to label %104 unwind label %168

104:                                              ; preds = %103
  invoke void @glEnable(i32 noundef 3553)
          to label %105 unwind label %168

105:                                              ; preds = %104
  invoke void @glAlphaFunc(i32 noundef 516, float noundef 0x3FB99999A0000000)
          to label %106 unwind label %168

106:                                              ; preds = %105
  invoke void @glEnable(i32 noundef 3008)
          to label %107 unwind label %168

107:                                              ; preds = %106
  invoke void @glLightModeli(i32 noundef 2898, i32 noundef 1)
          to label %108 unwind label %168

108:                                              ; preds = %107
  invoke void @glDisable(i32 noundef 2884)
          to label %109 unwind label %168

109:                                              ; preds = %108
  invoke void @_Z14R3BeginPolygonv()
          to label %110 unwind label %168

110:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.start.p0(i64 40, ptr %10) #9
  %111 = getelementptr inbounds %class.R3PlanarGrid, ptr %11, i32 0, i32 2
  invoke void @_ZNK6R2Grid8WorldBoxEv(ptr dead_on_unwind writable sret(%class.R2Box) align 8 %10, ptr noundef nonnull align 8 dereferenceable(208) %111)
          to label %112 unwind label %172

112:                                              ; preds = %110
  store ptr %10, ptr %9, align 8, !tbaa !5
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 0.000000e+00)
          to label %113 unwind label %176

113:                                              ; preds = %112
  %114 = load ptr, ptr %9, align 8, !tbaa !5
  %115 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %114, i32 noundef 0)
          to label %116 unwind label %176

116:                                              ; preds = %113
  %117 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %115, i32 noundef 0)
          to label %118 unwind label %176

118:                                              ; preds = %116
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  %120 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %119, i32 noundef 0)
          to label %121 unwind label %176

121:                                              ; preds = %118
  %122 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %120, i32 noundef 1)
          to label %123 unwind label %176

123:                                              ; preds = %121
  invoke void @_Z11R2LoadPointdd(double noundef %117, double noundef %122)
          to label %124 unwind label %176

124:                                              ; preds = %123
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 0.000000e+00)
          to label %125 unwind label %176

125:                                              ; preds = %124
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %126, i32 noundef 1)
          to label %128 unwind label %176

128:                                              ; preds = %125
  %129 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %127, i32 noundef 0)
          to label %130 unwind label %176

130:                                              ; preds = %128
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %131, i32 noundef 0)
          to label %133 unwind label %176

133:                                              ; preds = %130
  %134 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %132, i32 noundef 1)
          to label %135 unwind label %176

135:                                              ; preds = %133
  invoke void @_Z11R2LoadPointdd(double noundef %129, double noundef %134)
          to label %136 unwind label %176

136:                                              ; preds = %135
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 1.000000e+00)
          to label %137 unwind label %176

137:                                              ; preds = %136
  %138 = load ptr, ptr %9, align 8, !tbaa !5
  %139 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %138, i32 noundef 1)
          to label %140 unwind label %176

140:                                              ; preds = %137
  %141 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %139, i32 noundef 0)
          to label %142 unwind label %176

142:                                              ; preds = %140
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  %144 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %143, i32 noundef 1)
          to label %145 unwind label %176

145:                                              ; preds = %142
  %146 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %144, i32 noundef 1)
          to label %147 unwind label %176

147:                                              ; preds = %145
  invoke void @_Z11R2LoadPointdd(double noundef %141, double noundef %146)
          to label %148 unwind label %176

148:                                              ; preds = %147
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 1.000000e+00)
          to label %149 unwind label %176

149:                                              ; preds = %148
  %150 = load ptr, ptr %9, align 8, !tbaa !5
  %151 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %150, i32 noundef 0)
          to label %152 unwind label %176

152:                                              ; preds = %149
  %153 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %151, i32 noundef 0)
          to label %154 unwind label %176

154:                                              ; preds = %152
  %155 = load ptr, ptr %9, align 8, !tbaa !5
  %156 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %155, i32 noundef 1)
          to label %157 unwind label %176

157:                                              ; preds = %154
  %158 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %156, i32 noundef 1)
          to label %159 unwind label %176

159:                                              ; preds = %157
  invoke void @_Z11R2LoadPointdd(double noundef %153, double noundef %158)
          to label %160 unwind label %176

160:                                              ; preds = %159
  invoke void @_Z12R3EndPolygonv()
          to label %161 unwind label %176

161:                                              ; preds = %160
  invoke void @glEnable(i32 noundef 2884)
          to label %162 unwind label %176

162:                                              ; preds = %161
  invoke void @glLightModeli(i32 noundef 2898, i32 noundef 0)
          to label %163 unwind label %176

163:                                              ; preds = %162
  invoke void @glDisable(i32 noundef 3008)
          to label %164 unwind label %176

164:                                              ; preds = %163
  invoke void @glDisable(i32 noundef 3553)
          to label %165 unwind label %176

165:                                              ; preds = %164
  invoke void @_ZNK8R3Affine3PopEv(ptr noundef nonnull align 8 dereferenceable(272) %6)
          to label %166 unwind label %176

166:                                              ; preds = %165
  call void @_ZN7R2SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #9
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %6) #9
  call void @llvm.lifetime.end.p0(i64 272, ptr %6) #9
  br label %167

167:                                              ; preds = %166, %15
  ret void

168:                                              ; preds = %109, %108, %107, %106, %105, %104, %103, %99
  %169 = landingpad { ptr, i32 }
          cleanup
  %170 = extractvalue { ptr, i32 } %169, 0
  store ptr %170, ptr %7, align 8
  %171 = extractvalue { ptr, i32 } %169, 1
  store i32 %171, ptr %8, align 4
  br label %181

172:                                              ; preds = %110
  %173 = landingpad { ptr, i32 }
          cleanup
  %174 = extractvalue { ptr, i32 } %173, 0
  store ptr %174, ptr %7, align 8
  %175 = extractvalue { ptr, i32 } %173, 1
  store i32 %175, ptr %8, align 4
  br label %180

176:                                              ; preds = %165, %164, %163, %162, %161, %160, %159, %157, %154, %152, %149, %148, %147, %145, %142, %140, %137, %136, %135, %133, %130, %128, %125, %124, %123, %121, %118, %116, %113, %112
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %7, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %8, align 4
  call void @_ZN7R2SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #9
  call void @llvm.lifetime.end.p0(i64 40, ptr %10) #9
  br label %180

180:                                              ; preds = %176, %172
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  br label %181

181:                                              ; preds = %180, %168
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %6) #9
  call void @llvm.lifetime.end.p0(i64 272, ptr %6) #9
  br label %182

182:                                              ; preds = %181
  %183 = load ptr, ptr %7, align 8
  %184 = load i32, ptr %8, align 4
  %185 = insertvalue { ptr, i32 } poison, ptr %183, 0
  %186 = insertvalue { ptr, i32 } %185, i32 %184, 1
  resume { ptr, i32 } %186
}

declare noundef i32 @_Z10R3ContainsRK7R3PlaneS1_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #4

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

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #6

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208), i32 noundef) #0 align 2

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

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

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

declare void @glTexImage2D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #4

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

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #8

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

declare void @_ZNK8R3Affine4PushEv(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #4

declare void @glEnable(i32 noundef) #4

declare void @glAlphaFunc(i32 noundef, float noundef) #4

declare void @glLightModeli(i32 noundef, i32 noundef) #4

declare void @glDisable(i32 noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z14R3BeginPolygonv() #0

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #5 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z12R3EndPolygonv() #0

declare void @_ZNK8R3Affine3PopEv(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #4

attributes #0 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nobuiltin allocsize(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 #8 = { nobuiltin 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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, !23, i64 568}
!10 = !{!"_ZTS12R3PlanarGrid", !11, i64 0, !14, i64 32, !19, i64 304, !24, i64 512, !23, i64 568}
!11 = !{!"_ZTS7R3Plane", !12, i64 0, !13, i64 24}
!12 = !{!"_ZTS8R3Vector", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!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 = !{!"_ZTS6R2Grid", !20, i64 0, !20, i64 88, !13, i64 176, !6, i64 184, !7, i64 192, !23, i64 200, !23, i64 204}
!20 = !{!"_ZTS8R2Affine", !21, i64 0, !22, i64 8, !23, i64 80}
!21 = !{!"_ZTS16R2Transformation"}
!22 = !{!"_ZTS8R3Matrix", !7, i64 0}
!23 = !{!"int", !7, i64 0}
!24 = !{!"_ZTS5R3Box", !25, i64 0, !27, i64 8, !27, i64 32}
!25 = !{!"_ZTS7R3Solid", !26, i64 0}
!26 = !{!"_ZTS7R3Shape"}
!27 = !{!"_ZTS7R3Point", !7, i64 0}
!28 = !{!23, !23, i64 0}
!29 = !{!30, !30, i64 0}
!30 = !{!"float", !7, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%class.R3Plane = type { %class.R3Vector, double }
%class.R3Vector = type { [3 x double] }
%class.R2Box = type { %class.R2Solid, %class.R2Point, %class.R2Point }
%class.R2Solid = type { %class.R2Shape }
%class.R2Shape = type { ptr }
%class.R2Point = type { [2 x double] }
%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 }

@R3null_plane = external global %class.R3Plane, align 8
@.str.11 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [94 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #1

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

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

; Function Attrs: nounwind
declare void @_ZN7R2SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6R2Grid8WorldBoxEv(ptr dead_on_unwind noalias writable sret(%class.R2Box) align 8, ptr noundef nonnull align 8 dereferenceable(208)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK12R3PlanarGrid4DrawEv(ptr noundef nonnull align 8 dereferenceable(572) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca %class.R3Affine, align 8
  %4 = alloca %class.R2Box, align 8
  %5 = tail call noundef i32 @_Z10R3ContainsRK7R3PlaneS1_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) @R3null_plane)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %99

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 568
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp slt i32 %8, 1
  br i1 %9, label %10, label %48

10:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @glGenTextures(i32 noundef 1, ptr noundef nonnull %2)
  %11 = load i32, ptr %2, align 4, !tbaa !27
  store i32 %11, ptr %7, align 8, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12, i32 noundef 453, ptr noundef nonnull @.str.13)
  br label %14

14:                                               ; preds = %13, %10
  %15 = getelementptr inbounds i8, ptr %0, i64 304
  %16 = call noundef i32 @_ZNK6R2Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(208) %15)
  %17 = shl nsw i32 %16, 2
  %18 = sext i32 %17 to i64
  %19 = icmp slt i32 %16, 0
  %20 = shl nsw i64 %18, 2
  %21 = select i1 %19, i64 -1, i64 %20
  %22 = call noalias noundef nonnull ptr @_Znam(i64 noundef %21) #9
  %23 = call noundef i32 @_ZNK6R2Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(208) %15)
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %14
  %25 = load i32, ptr %7, align 8, !tbaa !5
  call void @glBindTexture(i32 noundef 3553, i32 noundef %25)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10242, i32 noundef 10496)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10243, i32 noundef 10496)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10241, i32 noundef 9729)
  call void @glTexParameteri(i32 noundef 3553, i32 noundef 10240, i32 noundef 9729)
  call void @glTexEnvi(i32 noundef 8960, i32 noundef 8704, i32 noundef 8448)
  %26 = call noundef i32 @_ZNK6R2Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %15)
  %27 = call noundef i32 @_ZNK6R2Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(208) %15)
  call void @glTexImage2D(i32 noundef 3553, i32 noundef 0, i32 noundef 6408, i32 noundef %26, i32 noundef %27, i32 noundef 0, i32 noundef 6408, i32 noundef 5126, ptr noundef nonnull %22)
  call void @_ZdaPv(ptr noundef nonnull %22) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %.pre = load i32, ptr %7, align 8, !tbaa !5
  br label %48

.lr.ph:                                           ; preds = %14, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %14 ]
  %28 = trunc nuw nsw i64 %indvars.iv to i32
  %29 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %15, i32 noundef %28)
  %30 = fptrunc double %29 to float
  %31 = shl nsw i64 %indvars.iv, 2
  %32 = getelementptr inbounds float, ptr %22, i64 %31
  store float %30, ptr %32, align 4, !tbaa !28
  %33 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %15, i32 noundef %28)
  %34 = fptrunc double %33 to float
  %35 = or disjoint i64 %31, 1
  %36 = getelementptr inbounds float, ptr %22, i64 %35
  store float %34, ptr %36, align 4, !tbaa !28
  %37 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %15, i32 noundef %28)
  %38 = fptrunc double %37 to float
  %39 = or disjoint i64 %31, 2
  %40 = getelementptr inbounds float, ptr %22, i64 %39
  store float %38, ptr %40, align 4, !tbaa !28
  %41 = call noundef double @_ZNK6R2Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(208) %15, i32 noundef %28)
  %42 = fptrunc double %41 to float
  %43 = or disjoint i64 %31, 3
  %44 = getelementptr inbounds float, ptr %22, i64 %43
  store float %42, ptr %44, align 4, !tbaa !28
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %45 = call noundef i32 @_ZNK6R2Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(208) %15)
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next, %46
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !30

48:                                               ; preds = %._crit_edge, %6
  %49 = phi i32 [ %.pre, %._crit_edge ], [ %8, %6 ]
  call void @glBindTexture(i32 noundef 3553, i32 noundef %49)
  call void @llvm.lifetime.start.p0(i64 272, ptr nonnull %3) #8
  %50 = getelementptr inbounds i8, ptr %0, i64 32
  call void @_ZN8R3AffineC2ERKS_(ptr noundef nonnull align 8 dereferenceable(272) %3, ptr noundef nonnull align 8 dereferenceable(272) %50)
  invoke void @_ZN8R3Affine6InvertEv(ptr noundef nonnull align 8 dereferenceable(272) %3)
          to label %51 unwind label %100

51:                                               ; preds = %48
  invoke void @_ZNK8R3Affine4PushEv(ptr noundef nonnull align 8 dereferenceable(272) %3)
          to label %52 unwind label %100

52:                                               ; preds = %51
  invoke void @glEnable(i32 noundef 3553)
          to label %53 unwind label %100

53:                                               ; preds = %52
  invoke void @glAlphaFunc(i32 noundef 516, float noundef 0x3FB99999A0000000)
          to label %54 unwind label %100

54:                                               ; preds = %53
  invoke void @glEnable(i32 noundef 3008)
          to label %55 unwind label %100

55:                                               ; preds = %54
  invoke void @glLightModeli(i32 noundef 2898, i32 noundef 1)
          to label %56 unwind label %100

56:                                               ; preds = %55
  invoke void @glDisable(i32 noundef 2884)
          to label %57 unwind label %100

57:                                               ; preds = %56
  invoke void @_Z14R3BeginPolygonv()
          to label %58 unwind label %100

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #8
  %59 = getelementptr inbounds i8, ptr %0, i64 304
  invoke void @_ZNK6R2Grid8WorldBoxEv(ptr dead_on_unwind nonnull writable sret(%class.R2Box) align 8 %4, ptr noundef nonnull align 8 dereferenceable(208) %59)
          to label %60 unwind label %102

60:                                               ; preds = %58
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 0.000000e+00)
          to label %61 unwind label %104

61:                                               ; preds = %60
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 0)
  %63 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %62, i32 noundef 0)
          to label %64 unwind label %104

64:                                               ; preds = %61
  %65 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 0)
  %66 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %65, i32 noundef 1)
          to label %67 unwind label %104

67:                                               ; preds = %64
  invoke void @_Z11R2LoadPointdd(double noundef %63, double noundef %66)
          to label %68 unwind label %104

68:                                               ; preds = %67
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 0.000000e+00)
          to label %69 unwind label %104

69:                                               ; preds = %68
  %70 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 1)
  %71 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %70, i32 noundef 0)
          to label %72 unwind label %104

72:                                               ; preds = %69
  %73 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 0)
  %74 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %73, i32 noundef 1)
          to label %75 unwind label %104

75:                                               ; preds = %72
  invoke void @_Z11R2LoadPointdd(double noundef %71, double noundef %74)
          to label %76 unwind label %104

76:                                               ; preds = %75
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 1.000000e+00)
          to label %77 unwind label %104

77:                                               ; preds = %76
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 1)
  %79 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %78, i32 noundef 0)
          to label %80 unwind label %104

80:                                               ; preds = %77
  %81 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 1)
  %82 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %81, i32 noundef 1)
          to label %83 unwind label %104

83:                                               ; preds = %80
  invoke void @_Z11R2LoadPointdd(double noundef %79, double noundef %82)
          to label %84 unwind label %104

84:                                               ; preds = %83
  invoke void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 1.000000e+00)
          to label %85 unwind label %104

85:                                               ; preds = %84
  %86 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 0)
  %87 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %86, i32 noundef 0)
          to label %88 unwind label %104

88:                                               ; preds = %85
  %89 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK5R2BoxixEi(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef 1)
  %90 = invoke noundef double @_ZNK7R2PointixEi(ptr noundef nonnull align 8 dereferenceable(16) %89, i32 noundef 1)
          to label %91 unwind label %104

91:                                               ; preds = %88
  invoke void @_Z11R2LoadPointdd(double noundef %87, double noundef %90)
          to label %92 unwind label %104

92:                                               ; preds = %91
  invoke void @_Z12R3EndPolygonv()
          to label %93 unwind label %104

93:                                               ; preds = %92
  invoke void @glEnable(i32 noundef 2884)
          to label %94 unwind label %104

94:                                               ; preds = %93
  invoke void @glLightModeli(i32 noundef 2898, i32 noundef 0)
          to label %95 unwind label %104

95:                                               ; preds = %94
  invoke void @glDisable(i32 noundef 3008)
          to label %96 unwind label %104

96:                                               ; preds = %95
  invoke void @glDisable(i32 noundef 3553)
          to label %97 unwind label %104

97:                                               ; preds = %96
  invoke void @_ZNK8R3Affine3PopEv(ptr noundef nonnull align 8 dereferenceable(272) %3)
          to label %98 unwind label %104

98:                                               ; preds = %97
  call void @_ZN7R2SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #8
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %3) #8
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %3) #8
  br label %99

99:                                               ; preds = %1, %98
  ret void

100:                                              ; preds = %57, %56, %55, %54, %53, %52, %51, %48
  %101 = landingpad { ptr, i32 }
          cleanup
  br label %106

102:                                              ; preds = %58
  %103 = landingpad { ptr, i32 }
          cleanup
  br label %106

104:                                              ; preds = %97, %96, %95, %94, %93, %92, %91, %88, %85, %84, %83, %80, %77, %76, %75, %72, %69, %68, %67, %64, %61, %60
  %105 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7R2SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #8
  br label %106

106:                                              ; preds = %102, %104, %100
  %.pn.pn = phi { ptr, i32 } [ %101, %100 ], [ %105, %104 ], [ %103, %102 ]
  call void @_ZN8R3AffineD1Ev(ptr noundef nonnull align 8 dereferenceable(272) %3) #8
  call void @llvm.lifetime.end.p0(i64 272, ptr nonnull %3) #8
  resume { ptr, i32 } %.pn.pn
}

declare noundef i32 @_Z10R3ContainsRK7R3PlaneS1_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

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

declare void @_Z7RNAbortPKcz(ptr noundef, ...) local_unnamed_addr #4

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #6

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

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

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

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

declare void @glTexImage2D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #7

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

declare void @_ZNK8R3Affine4PushEv(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #4

declare void @glEnable(i32 noundef) local_unnamed_addr #4

declare void @glAlphaFunc(i32 noundef, float noundef) local_unnamed_addr #4

declare void @glLightModeli(i32 noundef, i32 noundef) local_unnamed_addr #4

declare void @glDisable(i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z14R3BeginPolygonv() local_unnamed_addr #0

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z12R3EndPolygonv() local_unnamed_addr #0

declare void @_ZNK8R3Affine3PopEv(ptr noundef nonnull align 8 dereferenceable(272)) unnamed_addr #4

attributes #0 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { 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 #6 = { nobuiltin allocsize(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 #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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, !21, i64 568}
!6 = !{!"_ZTS12R3PlanarGrid", !7, i64 0, !12, i64 32, !17, i64 304, !23, i64 512, !21, i64 568}
!7 = !{!"_ZTS7R3Plane", !8, i64 0, !11, i64 24}
!8 = !{!"_ZTS8R3Vector", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"double", !9, i64 0}
!12 = !{!"_ZTS8R3Affine", !13, i64 0, !14, i64 8, !14, i64 136, !15, i64 264}
!13 = !{!"_ZTS16R3Transformation"}
!14 = !{!"_ZTS8R4Matrix", !9, i64 0}
!15 = !{!"_ZTS7RNFlags", !16, i64 0}
!16 = !{!"long", !9, i64 0}
!17 = !{!"_ZTS6R2Grid", !18, i64 0, !18, i64 88, !11, i64 176, !22, i64 184, !9, i64 192, !21, i64 200, !21, i64 204}
!18 = !{!"_ZTS8R2Affine", !19, i64 0, !20, i64 8, !21, i64 80}
!19 = !{!"_ZTS16R2Transformation"}
!20 = !{!"_ZTS8R3Matrix", !9, i64 0}
!21 = !{!"int", !9, i64 0}
!22 = !{!"any pointer", !9, i64 0}
!23 = !{!"_ZTS5R3Box", !24, i64 0, !26, i64 8, !26, i64 32}
!24 = !{!"_ZTS7R3Solid", !25, i64 0}
!25 = !{!"_ZTS7R3Shape"}
!26 = !{!"_ZTS7R3Point", !9, i64 0}
!27 = !{!21, !21, i64 0}
!28 = !{!29, !29, i64 0}
!29 = !{!"float", !9, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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