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

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

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@_ZZNK6R3Grid9DrawSliceEiiE13previous_grid = external hidden global [3 x ptr], align 16
@_ZZNK6R3Grid9DrawSliceEiiE14previous_coord = external hidden global [3 x i32], align 4
@_ZZNK6R3Grid9DrawSliceEiiE10texture_id = external hidden global [3 x i32], align 4
@_ZZNK6R3Grid9DrawSliceEiiE6pixels = external hidden global [1048576 x float], align 16
@RNunit_interval = external global %class.RNInterval, align 8
@.str.171 = external hidden unnamed_addr constant [16 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6R3Grid5RangeEv(ptr dead_on_unwind noalias writable sret(%class.RNInterval) align 8, ptr noundef nonnull align 8 dereferenceable(592)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592), double noundef, double noundef, double noundef) #2 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) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10RNInterval3MinEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592), i32 noundef) #3 align 2

declare void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6R3Grid9DrawSliceEii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %1, i32 noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %class.RNInterval, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca [3 x double], align 16
  %18 = alloca double, align 8
  %19 = alloca %class.R3Point, align 8
  %20 = alloca %class.R3Point, align 8
  %21 = alloca %class.R3Point, align 8
  %22 = alloca %class.R3Point, align 8
  %23 = alloca double, align 8
  %24 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  %25 = load ptr, ptr %4, align 8
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %31, label %28

28:                                               ; preds = %3
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = icmp sgt i32 %29, 2
  br i1 %30, label %31, label %32

31:                                               ; preds = %28, %3
  br label %261

32:                                               ; preds = %28
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %40, label %35

35:                                               ; preds = %32
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = load i32, ptr %5, align 4, !tbaa !9
  %38 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %37)
  %39 = icmp sge i32 %36, %38
  br i1 %39, label %40, label %41

40:                                               ; preds = %35, %32
  br label %261

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  %44 = srem i32 %43, 3
  store i32 %44, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %45 = load i32, ptr %5, align 4, !tbaa !9
  %46 = add nsw i32 %45, 2
  %47 = srem i32 %46, 3
  store i32 %47, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %48 = load i32, ptr %7, align 4, !tbaa !9
  %49 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %48)
  store i32 %49, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %50)
  store i32 %51, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1024, ptr %11, align 4, !tbaa !9
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = icmp sgt i32 %52, 1024
  br i1 %53, label %54, label %55

54:                                               ; preds = %41
  store i32 1024, ptr %9, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %54, %41
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = icmp sgt i32 %56, 1024
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  store i32 1024, ptr %10, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %58, %55
  %60 = load i32, ptr %5, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [3 x ptr], ptr @_ZZNK6R3Grid9DrawSliceEiiE13previous_grid, i64 0, i64 %61
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = icmp ne ptr %25, %63
  br i1 %64, label %72, label %65

65:                                               ; preds = %59
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = load i32, ptr %5, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE14previous_coord, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !9
  %71 = icmp ne i32 %66, %70
  br i1 %71, label %72, label %169

72:                                               ; preds = %65, %59
  %73 = load i32, ptr %5, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %78, label %82

78:                                               ; preds = %72
  %79 = load i32, ptr %5, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %80
  call void @glDeleteTextures(i32 noundef 1, ptr noundef %81)
  br label %82

82:                                               ; preds = %78, %72
  %83 = load i32, ptr %5, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %84
  call void @glGenTextures(i32 noundef 1, ptr noundef %85)
  %86 = load i32, ptr %5, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !9
  call void @glBindTexture(i32 noundef 3553, i32 noundef %89)
  call void @glTexEnvi(i32 noundef 8960, i32 noundef 8704, i32 noundef 8448)
  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 @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  call void @_ZNK6R3Grid5RangeEv(ptr dead_on_unwind writable sret(%class.RNInterval) align 8 %12, ptr noundef nonnull align 8 dereferenceable(592) %25)
  %90 = call noundef double @_ZNK10RNInterval8DiameterEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  %91 = fcmp ole double %90, 0.000000e+00
  br i1 %91, label %92, label %93

92:                                               ; preds = %82
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 @RNunit_interval, i64 16, i1 false), !tbaa.struct !11
  br label %93

93:                                               ; preds = %92, %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store ptr @_ZZNK6R3Grid9DrawSliceEiiE6pixels, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %156, %93
  %95 = load i32, ptr %14, align 4, !tbaa !9
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %159

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %152, %99
  %101 = load i32, ptr %16, align 4, !tbaa !9
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %155

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #6
  %106 = load i32, ptr %6, align 4, !tbaa !9
  %107 = sitofp i32 %106 to double
  %108 = load i32, ptr %5, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 %109
  store double %107, ptr %110, align 8, !tbaa !12
  %111 = load i32, ptr %16, align 4, !tbaa !9
  %112 = sitofp i32 %111 to double
  %113 = fadd double %112, 5.000000e-01
  %114 = load i32, ptr %7, align 4, !tbaa !9
  %115 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %114)
  %116 = sitofp i32 %115 to double
  %117 = fmul double %113, %116
  %118 = load i32, ptr %9, align 4, !tbaa !9
  %119 = sitofp i32 %118 to double
  %120 = fdiv double %117, %119
  %121 = load i32, ptr %7, align 4, !tbaa !9
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 %122
  store double %120, ptr %123, align 8, !tbaa !12
  %124 = load i32, ptr %14, align 4, !tbaa !9
  %125 = sitofp i32 %124 to double
  %126 = fadd double %125, 5.000000e-01
  %127 = load i32, ptr %8, align 4, !tbaa !9
  %128 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %127)
  %129 = sitofp i32 %128 to double
  %130 = fmul double %126, %129
  %131 = load i32, ptr %10, align 4, !tbaa !9
  %132 = sitofp i32 %131 to double
  %133 = fdiv double %130, %132
  %134 = load i32, ptr %8, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 %135
  store double %133, ptr %136, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %137 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 0
  %138 = load double, ptr %137, align 16, !tbaa !12
  %139 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 1
  %140 = load double, ptr %139, align 8, !tbaa !12
  %141 = getelementptr inbounds [3 x double], ptr %17, i64 0, i64 2
  %142 = load double, ptr %141, align 16, !tbaa !12
  %143 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %25, double noundef %138, double noundef %140, double noundef %142)
  store double %143, ptr %18, align 8, !tbaa !12
  %144 = load double, ptr %18, align 8, !tbaa !12
  %145 = call noundef double @_ZNK10RNInterval3MinEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  %146 = fsub double %144, %145
  %147 = call noundef double @_ZNK10RNInterval8DiameterEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  %148 = fdiv double %146, %147
  %149 = fptrunc double %148 to float
  %150 = load ptr, ptr %13, align 8, !tbaa !5
  %151 = getelementptr inbounds float, ptr %150, i32 1
  store ptr %151, ptr %13, align 8, !tbaa !5
  store float %149, ptr %150, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  br label %152

152:                                              ; preds = %105
  %153 = load i32, ptr %16, align 4, !tbaa !9
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %16, align 4, !tbaa !9
  br label %100, !llvm.loop !16

155:                                              ; preds = %104
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %14, align 4, !tbaa !9
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %14, align 4, !tbaa !9
  br label %94, !llvm.loop !18

159:                                              ; preds = %98
  %160 = load i32, ptr %9, align 4, !tbaa !9
  %161 = load i32, ptr %10, align 4, !tbaa !9
  call void @glTexImage2D(i32 noundef 3553, i32 noundef 0, i32 noundef 1, i32 noundef %160, i32 noundef %161, i32 noundef 0, i32 noundef 6409, i32 noundef 5126, ptr noundef @_ZZNK6R3Grid9DrawSliceEiiE6pixels)
  %162 = load i32, ptr %6, align 4, !tbaa !9
  %163 = load i32, ptr %5, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE14previous_coord, i64 0, i64 %164
  store i32 %162, ptr %165, align 4, !tbaa !9
  %166 = load i32, ptr %5, align 4, !tbaa !9
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [3 x ptr], ptr @_ZZNK6R3Grid9DrawSliceEiiE13previous_grid, i64 0, i64 %167
  store ptr %25, ptr %168, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  br label %169

169:                                              ; preds = %159, %65
  %170 = load i32, ptr %5, align 4, !tbaa !9
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !9
  %174 = icmp ne i32 %173, 0
  br i1 %174, label %176, label %175

175:                                              ; preds = %169
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.171, i32 noundef 5219, ptr noundef @.str.2)
  br label %176

176:                                              ; preds = %175, %169
  %177 = load i32, ptr %5, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !9
  call void @glBindTexture(i32 noundef 3553, i32 noundef %180)
  call void @glEnable(i32 noundef 3553)
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #6
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %19)
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #6
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %20)
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #6
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %21)
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #6
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %22)
  %181 = load i32, ptr %6, align 4, !tbaa !9
  %182 = sitofp i32 %181 to double
  %183 = load i32, ptr %5, align 4, !tbaa !9
  %184 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %19, i32 noundef %183)
  store double %182, ptr %184, align 8, !tbaa !12
  %185 = load i32, ptr %7, align 4, !tbaa !9
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %19, i32 noundef %185)
  store double 0.000000e+00, ptr %186, align 8, !tbaa !12
  %187 = load i32, ptr %8, align 4, !tbaa !9
  %188 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %19, i32 noundef %187)
  store double 0.000000e+00, ptr %188, align 8, !tbaa !12
  %189 = load i32, ptr %6, align 4, !tbaa !9
  %190 = sitofp i32 %189 to double
  %191 = load i32, ptr %5, align 4, !tbaa !9
  %192 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %20, i32 noundef %191)
  store double %190, ptr %192, align 8, !tbaa !12
  %193 = load i32, ptr %7, align 4, !tbaa !9
  %194 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %193)
  %195 = sub nsw i32 %194, 1
  %196 = sitofp i32 %195 to double
  %197 = load i32, ptr %7, align 4, !tbaa !9
  %198 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %20, i32 noundef %197)
  store double %196, ptr %198, align 8, !tbaa !12
  %199 = load i32, ptr %8, align 4, !tbaa !9
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %20, i32 noundef %199)
  store double 0.000000e+00, ptr %200, align 8, !tbaa !12
  %201 = load i32, ptr %6, align 4, !tbaa !9
  %202 = sitofp i32 %201 to double
  %203 = load i32, ptr %5, align 4, !tbaa !9
  %204 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %21, i32 noundef %203)
  store double %202, ptr %204, align 8, !tbaa !12
  %205 = load i32, ptr %7, align 4, !tbaa !9
  %206 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %205)
  %207 = sub nsw i32 %206, 1
  %208 = sitofp i32 %207 to double
  %209 = load i32, ptr %7, align 4, !tbaa !9
  %210 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %21, i32 noundef %209)
  store double %208, ptr %210, align 8, !tbaa !12
  %211 = load i32, ptr %8, align 4, !tbaa !9
  %212 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %211)
  %213 = sub nsw i32 %212, 1
  %214 = sitofp i32 %213 to double
  %215 = load i32, ptr %8, align 4, !tbaa !9
  %216 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %21, i32 noundef %215)
  store double %214, ptr %216, align 8, !tbaa !12
  %217 = load i32, ptr %6, align 4, !tbaa !9
  %218 = sitofp i32 %217 to double
  %219 = load i32, ptr %5, align 4, !tbaa !9
  %220 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %22, i32 noundef %219)
  store double %218, ptr %220, align 8, !tbaa !12
  %221 = load i32, ptr %7, align 4, !tbaa !9
  %222 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %22, i32 noundef %221)
  store double 0.000000e+00, ptr %222, align 8, !tbaa !12
  %223 = load i32, ptr %8, align 4, !tbaa !9
  %224 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %25, i32 noundef %223)
  %225 = sub nsw i32 %224, 1
  %226 = sitofp i32 %225 to double
  %227 = load i32, ptr %8, align 4, !tbaa !9
  %228 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %22, i32 noundef %227)
  store double %226, ptr %228, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  store double 1.000000e+00, ptr %23, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  store double 0.000000e+00, ptr %24, align 8, !tbaa !12
  call void @_Z14R3BeginPolygonv()
  %229 = load double, ptr %24, align 8, !tbaa !12
  %230 = load double, ptr %24, align 8, !tbaa !12
  call void @_Z19R3LoadTextureCoordsdd(double noundef %229, double noundef %230)
  %231 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %19, i32 noundef 0)
  %232 = load double, ptr %231, align 8, !tbaa !12
  %233 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %19, i32 noundef 1)
  %234 = load double, ptr %233, align 8, !tbaa !12
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %19, i32 noundef 2)
  %236 = load double, ptr %235, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %232, double noundef %234, double noundef %236)
  %237 = load double, ptr %23, align 8, !tbaa !12
  %238 = load double, ptr %24, align 8, !tbaa !12
  call void @_Z19R3LoadTextureCoordsdd(double noundef %237, double noundef %238)
  %239 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %20, i32 noundef 0)
  %240 = load double, ptr %239, align 8, !tbaa !12
  %241 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %20, i32 noundef 1)
  %242 = load double, ptr %241, align 8, !tbaa !12
  %243 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %20, i32 noundef 2)
  %244 = load double, ptr %243, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %240, double noundef %242, double noundef %244)
  %245 = load double, ptr %23, align 8, !tbaa !12
  %246 = load double, ptr %23, align 8, !tbaa !12
  call void @_Z19R3LoadTextureCoordsdd(double noundef %245, double noundef %246)
  %247 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %21, i32 noundef 0)
  %248 = load double, ptr %247, align 8, !tbaa !12
  %249 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %21, i32 noundef 1)
  %250 = load double, ptr %249, align 8, !tbaa !12
  %251 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %21, i32 noundef 2)
  %252 = load double, ptr %251, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %248, double noundef %250, double noundef %252)
  %253 = load double, ptr %24, align 8, !tbaa !12
  %254 = load double, ptr %23, align 8, !tbaa !12
  call void @_Z19R3LoadTextureCoordsdd(double noundef %253, double noundef %254)
  %255 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %22, i32 noundef 0)
  %256 = load double, ptr %255, align 8, !tbaa !12
  %257 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %22, i32 noundef 1)
  %258 = load double, ptr %257, align 8, !tbaa !12
  %259 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %22, i32 noundef 2)
  %260 = load double, ptr %259, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %256, double noundef %258, double noundef %260)
  call void @_Z12R3EndPolygonv()
  call void @glDisable(i32 noundef 3553)
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %261

261:                                              ; preds = %176, %40, %31
  ret void
}

declare void @glDeleteTextures(i32 noundef, ptr noundef) #0

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10RNInterval8DiameterEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

declare void @glEnable(i32 noundef) #0

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

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

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

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

declare void @glDisable(i32 noundef) #0

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


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

@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@_ZZNK6R3Grid9DrawSliceEiiE13previous_grid = external hidden local_unnamed_addr global [3 x ptr], align 16
@_ZZNK6R3Grid9DrawSliceEiiE14previous_coord = external hidden local_unnamed_addr global [3 x i32], align 4
@_ZZNK6R3Grid9DrawSliceEiiE10texture_id = external hidden global [3 x i32], align 4
@_ZZNK6R3Grid9DrawSliceEiiE6pixels = external hidden global [1048576 x float], align 16
@RNunit_interval = external local_unnamed_addr global %class.RNInterval, align 8
@.str.171 = external hidden unnamed_addr constant [16 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK6R3Grid5RangeEv(ptr dead_on_unwind noalias writable sret(%class.RNInterval) align 8, ptr noundef nonnull align 8 dereferenceable(592)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592), double noundef, double noundef, double noundef) local_unnamed_addr #2 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 #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10RNInterval3MinEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

declare void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6R3Grid9DrawSliceEii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %class.RNInterval, align 8
  %5 = alloca [3 x double], align 16
  %6 = alloca %class.R3Point, align 8
  %7 = alloca %class.R3Point, align 8
  %8 = alloca %class.R3Point, align 8
  %9 = alloca %class.R3Point, align 8
  %or.cond = icmp ugt i32 %1, 2
  %10 = icmp slt i32 %2, 0
  %or.cond3 = or i1 %or.cond, %10
  br i1 %or.cond3, label %127, label %11

11:                                               ; preds = %3
  %12 = tail call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %1)
  %.not = icmp sgt i32 %12, %2
  br i1 %.not, label %13, label %127

13:                                               ; preds = %11
  %.cmp.inv = icmp ugt i32 %1, 1
  %.v = select i1 %.cmp.inv, i32 -2, i32 1
  %14 = add nsw i32 %.v, %1
  %.urem83 = add nsw i32 %1, -1
  %.cmp84 = icmp eq i32 %1, 0
  %15 = select i1 %.cmp84, i32 2, i32 %.urem83
  %16 = tail call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %14)
  %17 = tail call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %15)
  %spec.store.select = tail call i32 @llvm.smin.i32(i32 %16, i32 1024)
  %spec.store.select4 = tail call i32 @llvm.smin.i32(i32 %17, i32 1024)
  %18 = zext nneg i32 %1 to i64
  %19 = getelementptr inbounds [3 x ptr], ptr @_ZZNK6R3Grid9DrawSliceEiiE13previous_grid, i64 0, i64 %18
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %.not79 = icmp eq ptr %20, %0
  br i1 %.not79, label %21, label %24

21:                                               ; preds = %13
  %22 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE14previous_coord, i64 0, i64 %18
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %.not80 = icmp eq i32 %23, %2
  br i1 %.not80, label %72, label %24

24:                                               ; preds = %21, %13
  %25 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %18
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %.not81 = icmp eq i32 %26, 0
  br i1 %.not81, label %28, label %27

27:                                               ; preds = %24
  tail call void @glDeleteTextures(i32 noundef 1, ptr noundef nonnull %25)
  br label %28

28:                                               ; preds = %27, %24
  tail call void @glGenTextures(i32 noundef 1, ptr noundef nonnull %25)
  %29 = load i32, ptr %25, align 4, !tbaa !9
  tail call void @glBindTexture(i32 noundef 3553, i32 noundef %29)
  tail call void @glTexEnvi(i32 noundef 8960, i32 noundef 8704, i32 noundef 8448)
  tail call void @glTexParameteri(i32 noundef 3553, i32 noundef 10242, i32 noundef 10496)
  tail call void @glTexParameteri(i32 noundef 3553, i32 noundef 10243, i32 noundef 10496)
  tail call void @glTexParameteri(i32 noundef 3553, i32 noundef 10241, i32 noundef 9729)
  tail call void @glTexParameteri(i32 noundef 3553, i32 noundef 10240, i32 noundef 9729)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @_ZNK6R3Grid5RangeEv(ptr dead_on_unwind nonnull writable sret(%class.RNInterval) align 8 %4, ptr noundef nonnull align 8 dereferenceable(592) %0)
  %30 = call noundef double @_ZNK10RNInterval8DiameterEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %31 = fcmp ugt double %30, 0.000000e+00
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) @RNunit_interval, i64 16, i1 false), !tbaa.struct !11
  br label %33

33:                                               ; preds = %32, %28
  %34 = icmp sgt i32 %17, 0
  br i1 %34, label %.preheader.lr.ph, label %._crit_edge89

.preheader.lr.ph:                                 ; preds = %33
  %35 = icmp sgt i32 %16, 0
  %36 = uitofp nneg i32 %2 to double
  %37 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 %18
  %38 = sitofp i32 %spec.store.select to double
  %39 = zext nneg i32 %14 to i64
  %40 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 %39
  %41 = sitofp i32 %spec.store.select4 to double
  %42 = zext nneg i32 %15 to i64
  %43 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 %42
  %44 = getelementptr inbounds i8, ptr %5, i64 8
  %45 = getelementptr inbounds i8, ptr %5, i64 16
  br i1 %35, label %.preheader.us, label %._crit_edge89

.preheader.us:                                    ; preds = %.preheader.lr.ph, %._crit_edge.us
  %.088.us = phi ptr [ %68, %._crit_edge.us ], [ @_ZZNK6R3Grid9DrawSliceEiiE6pixels, %.preheader.lr.ph ]
  %.07687.us = phi i32 [ %70, %._crit_edge.us ], [ 0, %.preheader.lr.ph ]
  %46 = uitofp nneg i32 %.07687.us to double
  %47 = fadd double %46, 5.000000e-01
  br label %48

48:                                               ; preds = %.preheader.us, %48
  %.186.us = phi ptr [ %.088.us, %.preheader.us ], [ %68, %48 ]
  %.07585.us = phi i32 [ 0, %.preheader.us ], [ %69, %48 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  store double %36, ptr %37, align 8, !tbaa !12
  %49 = uitofp nneg i32 %.07585.us to double
  %50 = fadd double %49, 5.000000e-01
  %51 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %14)
  %52 = sitofp i32 %51 to double
  %53 = fmul double %50, %52
  %54 = fdiv double %53, %38
  store double %54, ptr %40, align 8, !tbaa !12
  %55 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %15)
  %56 = sitofp i32 %55 to double
  %57 = fmul double %47, %56
  %58 = fdiv double %57, %41
  store double %58, ptr %43, align 8, !tbaa !12
  %59 = load double, ptr %5, align 16, !tbaa !12
  %60 = load double, ptr %44, align 8, !tbaa !12
  %61 = load double, ptr %45, align 16, !tbaa !12
  %62 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %0, double noundef %59, double noundef %60, double noundef %61)
  %63 = call noundef double @_ZNK10RNInterval3MinEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %64 = fsub double %62, %63
  %65 = call noundef double @_ZNK10RNInterval8DiameterEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %66 = fdiv double %64, %65
  %67 = fptrunc double %66 to float
  %68 = getelementptr inbounds i8, ptr %.186.us, i64 4
  store float %67, ptr %.186.us, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  %69 = add nuw nsw i32 %.07585.us, 1
  %exitcond.not = icmp eq i32 %69, %spec.store.select
  br i1 %exitcond.not, label %._crit_edge.us, label %48, !llvm.loop !16

._crit_edge.us:                                   ; preds = %48
  %70 = add nuw nsw i32 %.07687.us, 1
  %exitcond91.not = icmp eq i32 %70, %spec.store.select4
  br i1 %exitcond91.not, label %._crit_edge89, label %.preheader.us, !llvm.loop !18

._crit_edge89:                                    ; preds = %._crit_edge.us, %.preheader.lr.ph, %33
  call void @glTexImage2D(i32 noundef 3553, i32 noundef 0, i32 noundef 1, i32 noundef %spec.store.select, i32 noundef %spec.store.select4, i32 noundef 0, i32 noundef 6409, i32 noundef 5126, ptr noundef nonnull @_ZZNK6R3Grid9DrawSliceEiiE6pixels)
  %71 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE14previous_coord, i64 0, i64 %18
  store i32 %2, ptr %71, align 4, !tbaa !9
  store ptr %0, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  br label %72

72:                                               ; preds = %._crit_edge89, %21
  %73 = getelementptr inbounds [3 x i32], ptr @_ZZNK6R3Grid9DrawSliceEiiE10texture_id, i64 0, i64 %18
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %.not82 = icmp eq i32 %74, 0
  br i1 %.not82, label %75, label %76

75:                                               ; preds = %72
  call void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.171, i32 noundef 5219, ptr noundef nonnull @.str.2)
  %.pre = load i32, ptr %73, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %75, %72
  %77 = phi i32 [ %.pre, %75 ], [ %74, %72 ]
  call void @glBindTexture(i32 noundef 3553, i32 noundef %77)
  call void @glEnable(i32 noundef 3553)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #7
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #7
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #7
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %8)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #7
  call void @_ZN7R3PointC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %78 = uitofp nneg i32 %2 to double
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %1)
  store double %78, ptr %79, align 8, !tbaa !12
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %14)
  store double 0.000000e+00, ptr %80, align 8, !tbaa !12
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef %15)
  store double 0.000000e+00, ptr %81, align 8, !tbaa !12
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef %1)
  store double %78, ptr %82, align 8, !tbaa !12
  %83 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %14)
  %84 = add nsw i32 %83, -1
  %85 = sitofp i32 %84 to double
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef %14)
  store double %85, ptr %86, align 8, !tbaa !12
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef %15)
  store double 0.000000e+00, ptr %87, align 8, !tbaa !12
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef %1)
  store double %78, ptr %88, align 8, !tbaa !12
  %89 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %14)
  %90 = add nsw i32 %89, -1
  %91 = sitofp i32 %90 to double
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef %14)
  store double %91, ptr %92, align 8, !tbaa !12
  %93 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %15)
  %94 = add nsw i32 %93, -1
  %95 = sitofp i32 %94 to double
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef %15)
  store double %95, ptr %96, align 8, !tbaa !12
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef %1)
  store double %78, ptr %97, align 8, !tbaa !12
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef %14)
  store double 0.000000e+00, ptr %98, align 8, !tbaa !12
  %99 = call noundef i32 @_ZNK6R3Grid10ResolutionEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %15)
  %100 = add nsw i32 %99, -1
  %101 = sitofp i32 %100 to double
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef %15)
  store double %101, ptr %102, align 8, !tbaa !12
  call void @_Z14R3BeginPolygonv()
  call void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 0.000000e+00)
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef 0)
  %104 = load double, ptr %103, align 8, !tbaa !12
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef 1)
  %106 = load double, ptr %105, align 8, !tbaa !12
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef 2)
  %108 = load double, ptr %107, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %104, double noundef %106, double noundef %108)
  call void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 0.000000e+00)
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 0)
  %110 = load double, ptr %109, align 8, !tbaa !12
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 1)
  %112 = load double, ptr %111, align 8, !tbaa !12
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 2)
  %114 = load double, ptr %113, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %110, double noundef %112, double noundef %114)
  call void @_Z19R3LoadTextureCoordsdd(double noundef 1.000000e+00, double noundef 1.000000e+00)
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef 0)
  %116 = load double, ptr %115, align 8, !tbaa !12
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef 1)
  %118 = load double, ptr %117, align 8, !tbaa !12
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef 2)
  %120 = load double, ptr %119, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %116, double noundef %118, double noundef %120)
  call void @_Z19R3LoadTextureCoordsdd(double noundef 0.000000e+00, double noundef 1.000000e+00)
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef 0)
  %122 = load double, ptr %121, align 8, !tbaa !12
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef 1)
  %124 = load double, ptr %123, align 8, !tbaa !12
  %125 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef 2)
  %126 = load double, ptr %125, align 8, !tbaa !12
  call void @_Z11R3LoadPointddd(double noundef %122, double noundef %124, double noundef %126)
  call void @_Z12R3EndPolygonv()
  call void @glDisable(i32 noundef 3553)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #7
  br label %127

127:                                              ; preds = %11, %3, %76
  ret void
}

declare void @glDeleteTextures(i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10RNInterval8DiameterEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

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

declare void @glEnable(i32 noundef) local_unnamed_addr #0

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

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

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

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

declare void @glDisable(i32 noundef) local_unnamed_addr #0

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

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

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

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


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