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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%class.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }

@RN_EPSILON = external global double, align 8
@_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel = external hidden global [5 x [5 x [5 x double]]], align 16

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592), double noundef, double noundef, double noundef) #5 align 2

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

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

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

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

; Function Attrs: nounwind
declare double @exp(double noundef) #7

; 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

declare void @_ZN7R3PointC1Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #8

declare void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #8

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointpLERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #8

declare noundef double @_ZNK8R3Vector3DotERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #8

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Grid20ClusterWithMeanShiftEv(ptr noundef nonnull align 8 dereferenceable(592) %0) #5 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %class.R3Point, align 8
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca %class.R3Vector, align 8
  %20 = alloca i32, align 4
  %21 = alloca double, align 8
  %22 = alloca i32, align 4
  %23 = alloca double, align 8
  %24 = alloca i32, align 4
  %25 = alloca double, align 8
  %26 = alloca double, align 8
  %27 = alloca double, align 8
  %28 = alloca %class.R3Vector, align 8
  %29 = alloca %class.R3Vector, align 8
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %39 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  %40 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  store i32 %40, ptr %3, align 4, !tbaa !9
  %41 = load i32, ptr %3, align 4, !tbaa !9
  %42 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %1
  %45 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  store i32 %45, ptr %3, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %44, %1
  %47 = load i32, ptr %3, align 4, !tbaa !9
  %48 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %46
  %51 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  store i32 %51, ptr %3, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %50, %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  store double 1.000000e+00, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  store double -2.000000e+00, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  store i32 -2, ptr %6, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %103, %52
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = icmp sle i32 %54, 2
  br i1 %55, label %57, label %56

56:                                               ; preds = %53
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  br label %106

57:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  store i32 -2, ptr %8, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %99, %57
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = icmp sle i32 %59, 2
  br i1 %60, label %62, label %61

61:                                               ; preds = %58
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  br label %102

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 -2, ptr %9, align 4, !tbaa !9
  br label %63

63:                                               ; preds = %95, %62
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = icmp sle i32 %64, 2
  br i1 %65, label %67, label %66

66:                                               ; preds = %63
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %98

67:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = mul nsw i32 %68, %69
  %71 = load i32, ptr %8, align 4, !tbaa !9
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = mul nsw i32 %71, %72
  %74 = add nsw i32 %70, %73
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = mul nsw i32 %75, %76
  %78 = add nsw i32 %74, %77
  %79 = sitofp i32 %78 to double
  store double %79, ptr %10, align 8, !tbaa !11
  %80 = load double, ptr %10, align 8, !tbaa !11
  %81 = fdiv double %80, -2.000000e+00
  %82 = call double @exp(double noundef %81) #9
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = add nsw i32 %83, 2
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 %85
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = add nsw i32 %87, 2
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [5 x [5 x double]], ptr %86, i64 0, i64 %89
  %91 = load i32, ptr %6, align 4, !tbaa !9
  %92 = add nsw i32 %91, 2
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [5 x double], ptr %90, i64 0, i64 %93
  store double %82, ptr %94, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %95

95:                                               ; preds = %67
  %96 = load i32, ptr %9, align 4, !tbaa !9
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %9, align 4, !tbaa !9
  br label %63, !llvm.loop !13

98:                                               ; preds = %66
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %8, align 4, !tbaa !9
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %8, align 4, !tbaa !9
  br label %58, !llvm.loop !15

102:                                              ; preds = %61
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %6, align 4, !tbaa !9
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %6, align 4, !tbaa !9
  br label %53, !llvm.loop !16

106:                                              ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %107 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %108 = sext i32 %107 to i64
  %109 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %108, i64 4)
  %110 = extractvalue { i64, i1 } %109, 1
  %111 = extractvalue { i64, i1 } %109, 0
  %112 = select i1 %110, i64 -1, i64 %111
  %113 = call noalias noundef nonnull ptr @_Znam(i64 noundef %112) #10
  store ptr %113, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #9
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %318, %106
  %115 = load i32, ptr %13, align 4, !tbaa !9
  %116 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #9
  br label %321

119:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %314, %119
  %121 = load i32, ptr %14, align 4, !tbaa !9
  %122 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %317

125:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #9
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %310, %125
  %127 = load i32, ptr %15, align 4, !tbaa !9
  %128 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #9
  br label %313

131:                                              ; preds = %126
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = load i32, ptr %11, align 4, !tbaa !9
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i32, ptr %132, i64 %134
  store i32 -1, ptr %135, align 4, !tbaa !9
  %136 = load i32, ptr %15, align 4, !tbaa !9
  %137 = load i32, ptr %14, align 4, !tbaa !9
  %138 = load i32, ptr %13, align 4, !tbaa !9
  %139 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %39, i32 noundef %136, i32 noundef %137, i32 noundef %138)
  %140 = fcmp ogt double %139, 0.000000e+00
  br i1 %140, label %141, label %307

141:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #9
  %142 = load i32, ptr %15, align 4, !tbaa !9
  %143 = sitofp i32 %142 to double
  %144 = load i32, ptr %14, align 4, !tbaa !9
  %145 = sitofp i32 %144 to double
  %146 = load i32, ptr %13, align 4, !tbaa !9
  %147 = sitofp i32 %146 to double
  call void @_ZN7R3PointC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %16, double noundef %143, double noundef %145, double noundef %147)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %148

148:                                              ; preds = %250, %141
  %149 = load i32, ptr %17, align 4, !tbaa !9
  %150 = load i32, ptr %3, align 4, !tbaa !9
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 20, ptr %7, align 4
  br label %253

153:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  store double 0.000000e+00, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #9
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %19, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 -2, ptr %20, align 4, !tbaa !9
  br label %154

154:                                              ; preds = %231, %153
  %155 = load i32, ptr %20, align 4, !tbaa !9
  %156 = icmp sle i32 %155, 2
  br i1 %156, label %158, label %157

157:                                              ; preds = %154
  store i32 23, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %234

158:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #9
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef 2)
  %160 = load double, ptr %159, align 8, !tbaa !11
  %161 = load i32, ptr %20, align 4, !tbaa !9
  %162 = sitofp i32 %161 to double
  %163 = fadd double %160, %162
  store double %163, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  store i32 -2, ptr %22, align 4, !tbaa !9
  br label %164

164:                                              ; preds = %227, %158
  %165 = load i32, ptr %22, align 4, !tbaa !9
  %166 = icmp sle i32 %165, 2
  br i1 %166, label %168, label %167

167:                                              ; preds = %164
  store i32 26, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  br label %230

168:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #9
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef 1)
  %170 = load double, ptr %169, align 8, !tbaa !11
  %171 = load i32, ptr %22, align 4, !tbaa !9
  %172 = sitofp i32 %171 to double
  %173 = fadd double %170, %172
  store double %173, ptr %23, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  store i32 -2, ptr %24, align 4, !tbaa !9
  br label %174

174:                                              ; preds = %223, %168
  %175 = load i32, ptr %24, align 4, !tbaa !9
  %176 = icmp sle i32 %175, 2
  br i1 %176, label %178, label %177

177:                                              ; preds = %174
  store i32 29, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  br label %226

178:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #9
  %179 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef 0)
  %180 = load double, ptr %179, align 8, !tbaa !11
  %181 = load i32, ptr %24, align 4, !tbaa !9
  %182 = sitofp i32 %181 to double
  %183 = fadd double %180, %182
  store double %183, ptr %25, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #9
  %184 = load double, ptr %25, align 8, !tbaa !11
  %185 = load double, ptr %23, align 8, !tbaa !11
  %186 = load double, ptr %21, align 8, !tbaa !11
  %187 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %39, double noundef %184, double noundef %185, double noundef %186)
  store double %187, ptr %26, align 8, !tbaa !11
  %188 = load double, ptr %26, align 8, !tbaa !11
  %189 = fcmp ogt double %188, 0.000000e+00
  br i1 %189, label %190, label %222

190:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #9
  %191 = load i32, ptr %24, align 4, !tbaa !9
  %192 = add nsw i32 %191, 2
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 %193
  %195 = load i32, ptr %22, align 4, !tbaa !9
  %196 = add nsw i32 %195, 2
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [5 x [5 x double]], ptr %194, i64 0, i64 %197
  %199 = load i32, ptr %20, align 4, !tbaa !9
  %200 = add nsw i32 %199, 2
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [5 x double], ptr %198, i64 0, i64 %201
  %203 = load double, ptr %202, align 8, !tbaa !11
  %204 = load double, ptr %26, align 8, !tbaa !11
  %205 = fmul double %203, %204
  store double %205, ptr %27, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %28) #9
  %206 = load double, ptr %27, align 8, !tbaa !11
  %207 = load i32, ptr %24, align 4, !tbaa !9
  %208 = sitofp i32 %207 to double
  %209 = fmul double %206, %208
  %210 = load double, ptr %27, align 8, !tbaa !11
  %211 = load i32, ptr %22, align 4, !tbaa !9
  %212 = sitofp i32 %211 to double
  %213 = fmul double %210, %212
  %214 = load double, ptr %27, align 8, !tbaa !11
  %215 = load i32, ptr %20, align 4, !tbaa !9
  %216 = sitofp i32 %215 to double
  %217 = fmul double %214, %216
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %28, double noundef %209, double noundef %213, double noundef %217)
  %218 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(24) %28)
  call void @llvm.lifetime.end.p0(i64 24, ptr %28) #9
  %219 = load double, ptr %27, align 8, !tbaa !11
  %220 = load double, ptr %18, align 8, !tbaa !11
  %221 = fadd double %220, %219
  store double %221, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #9
  br label %222

222:                                              ; preds = %190, %178
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #9
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %24, align 4, !tbaa !9
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %24, align 4, !tbaa !9
  br label %174, !llvm.loop !17

226:                                              ; preds = %177
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #9
  br label %227

227:                                              ; preds = %226
  %228 = load i32, ptr %22, align 4, !tbaa !9
  %229 = add nsw i32 %228, 1
  store i32 %229, ptr %22, align 4, !tbaa !9
  br label %164, !llvm.loop !18

230:                                              ; preds = %167
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #9
  br label %231

231:                                              ; preds = %230
  %232 = load i32, ptr %20, align 4, !tbaa !9
  %233 = add nsw i32 %232, 1
  store i32 %233, ptr %20, align 4, !tbaa !9
  br label %154, !llvm.loop !19

234:                                              ; preds = %157
  %235 = load double, ptr %18, align 8, !tbaa !11
  %236 = fcmp oeq double %235, 0.000000e+00
  br i1 %236, label %237, label %238

237:                                              ; preds = %234
  store i32 20, ptr %7, align 4
  br label %247

238:                                              ; preds = %234
  %239 = call noundef double @_ZNK8R3Vector3DotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(24) %19)
  %240 = load double, ptr @RN_EPSILON, align 8, !tbaa !11
  %241 = call noundef i32 @_Z8RNIsZerodd(double noundef %239, double noundef %240)
  %242 = icmp ne i32 %241, 0
  br i1 %242, label %243, label %244

243:                                              ; preds = %238
  store i32 20, ptr %7, align 4
  br label %247

244:                                              ; preds = %238
  call void @llvm.lifetime.start.p0(i64 24, ptr %29) #9
  %245 = load double, ptr %18, align 8, !tbaa !11
  call void @_ZdvRK8R3Vectord(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %29, ptr noundef nonnull align 8 dereferenceable(24) %19, double noundef %245)
  %246 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointpLERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) %29)
  call void @llvm.lifetime.end.p0(i64 24, ptr %29) #9
  store i32 0, ptr %7, align 4
  br label %247

247:                                              ; preds = %244, %243, %237
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  %248 = load i32, ptr %7, align 4
  switch i32 %248, label %253 [
    i32 0, label %249
  ]

249:                                              ; preds = %247
  br label %250

250:                                              ; preds = %249
  %251 = load i32, ptr %17, align 4, !tbaa !9
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %17, align 4, !tbaa !9
  br label %148, !llvm.loop !20

253:                                              ; preds = %247, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %254

254:                                              ; preds = %253
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #9
  %255 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef 0)
  %256 = load double, ptr %255, align 8, !tbaa !11
  %257 = fadd double %256, 5.000000e-01
  %258 = fptosi double %257 to i32
  store i32 %258, ptr %30, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #9
  %259 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef 1)
  %260 = load double, ptr %259, align 8, !tbaa !11
  %261 = fadd double %260, 5.000000e-01
  %262 = fptosi double %261 to i32
  store i32 %262, ptr %31, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #9
  %263 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef 2)
  %264 = load double, ptr %263, align 8, !tbaa !11
  %265 = fadd double %264, 5.000000e-01
  %266 = fptosi double %265 to i32
  store i32 %266, ptr %32, align 4, !tbaa !9
  %267 = load i32, ptr %30, align 4, !tbaa !9
  %268 = icmp slt i32 %267, 0
  br i1 %268, label %269, label %270

269:                                              ; preds = %254
  store i32 0, ptr %30, align 4, !tbaa !9
  br label %270

270:                                              ; preds = %269, %254
  %271 = load i32, ptr %31, align 4, !tbaa !9
  %272 = icmp slt i32 %271, 0
  br i1 %272, label %273, label %274

273:                                              ; preds = %270
  store i32 0, ptr %31, align 4, !tbaa !9
  br label %274

274:                                              ; preds = %273, %270
  %275 = load i32, ptr %32, align 4, !tbaa !9
  %276 = icmp slt i32 %275, 0
  br i1 %276, label %277, label %278

277:                                              ; preds = %274
  store i32 0, ptr %32, align 4, !tbaa !9
  br label %278

278:                                              ; preds = %277, %274
  %279 = load i32, ptr %30, align 4, !tbaa !9
  %280 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %281 = icmp sge i32 %279, %280
  br i1 %281, label %282, label %285

282:                                              ; preds = %278
  %283 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %284 = sub nsw i32 %283, 1
  store i32 %284, ptr %30, align 4, !tbaa !9
  br label %285

285:                                              ; preds = %282, %278
  %286 = load i32, ptr %31, align 4, !tbaa !9
  %287 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %288 = icmp sge i32 %286, %287
  br i1 %288, label %289, label %292

289:                                              ; preds = %285
  %290 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %291 = sub nsw i32 %290, 1
  store i32 %291, ptr %30, align 4, !tbaa !9
  br label %292

292:                                              ; preds = %289, %285
  %293 = load i32, ptr %32, align 4, !tbaa !9
  %294 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %295 = icmp sge i32 %293, %294
  br i1 %295, label %296, label %299

296:                                              ; preds = %292
  %297 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %298 = sub nsw i32 %297, 1
  store i32 %298, ptr %30, align 4, !tbaa !9
  br label %299

299:                                              ; preds = %296, %292
  %300 = load i32, ptr %30, align 4, !tbaa !9
  %301 = load i32, ptr %31, align 4, !tbaa !9
  %302 = load i32, ptr %32, align 4, !tbaa !9
  %303 = load ptr, ptr %12, align 8, !tbaa !5
  %304 = load i32, ptr %11, align 4, !tbaa !9
  %305 = sext i32 %304 to i64
  %306 = getelementptr inbounds i32, ptr %303, i64 %305
  call void @_ZNK6R3Grid14IndicesToIndexEiiiRi(ptr noundef nonnull align 8 dereferenceable(592) %39, i32 noundef %300, i32 noundef %301, i32 noundef %302, ptr noundef nonnull align 4 dereferenceable(4) %306)
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #9
  br label %307

307:                                              ; preds = %299, %131
  %308 = load i32, ptr %11, align 4, !tbaa !9
  %309 = add nsw i32 %308, 1
  store i32 %309, ptr %11, align 4, !tbaa !9
  br label %310

310:                                              ; preds = %307
  %311 = load i32, ptr %15, align 4, !tbaa !9
  %312 = add nsw i32 %311, 1
  store i32 %312, ptr %15, align 4, !tbaa !9
  br label %126, !llvm.loop !21

313:                                              ; preds = %130
  br label %314

314:                                              ; preds = %313
  %315 = load i32, ptr %14, align 4, !tbaa !9
  %316 = add nsw i32 %315, 1
  store i32 %316, ptr %14, align 4, !tbaa !9
  br label %120, !llvm.loop !22

317:                                              ; preds = %124
  br label %318

318:                                              ; preds = %317
  %319 = load i32, ptr %13, align 4, !tbaa !9
  %320 = add nsw i32 %319, 1
  store i32 %320, ptr %13, align 4, !tbaa !9
  br label %114, !llvm.loop !23

321:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #9
  store i32 0, ptr %33, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #9
  store i32 0, ptr %34, align 4, !tbaa !9
  br label %322

322:                                              ; preds = %343, %321
  %323 = load i32, ptr %34, align 4, !tbaa !9
  %324 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %325 = icmp slt i32 %323, %324
  br i1 %325, label %327, label %326

326:                                              ; preds = %322
  store i32 32, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #9
  br label %346

327:                                              ; preds = %322
  %328 = load ptr, ptr %12, align 8, !tbaa !5
  %329 = load i32, ptr %34, align 4, !tbaa !9
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds i32, ptr %328, i64 %330
  %332 = load i32, ptr %331, align 4, !tbaa !9
  %333 = load i32, ptr %34, align 4, !tbaa !9
  %334 = icmp eq i32 %332, %333
  br i1 %334, label %335, label %342

335:                                              ; preds = %327
  %336 = load i32, ptr %34, align 4, !tbaa !9
  %337 = load i32, ptr %33, align 4, !tbaa !9
  %338 = add nsw i32 %337, 1
  %339 = sitofp i32 %338 to double
  call void @_ZN6R3Grid12SetGridValueEid(ptr noundef nonnull align 8 dereferenceable(592) %39, i32 noundef %336, double noundef %339)
  %340 = load i32, ptr %33, align 4, !tbaa !9
  %341 = add nsw i32 %340, 1
  store i32 %341, ptr %33, align 4, !tbaa !9
  br label %342

342:                                              ; preds = %335, %327
  br label %343

343:                                              ; preds = %342
  %344 = load i32, ptr %34, align 4, !tbaa !9
  %345 = add nsw i32 %344, 1
  store i32 %345, ptr %34, align 4, !tbaa !9
  br label %322, !llvm.loop !24

346:                                              ; preds = %326
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #9
  store i32 0, ptr %35, align 4, !tbaa !9
  br label %347

347:                                              ; preds = %395, %346
  %348 = load i32, ptr %35, align 4, !tbaa !9
  %349 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %350 = icmp slt i32 %348, %349
  br i1 %350, label %352, label %351

351:                                              ; preds = %347
  store i32 35, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #9
  br label %398

352:                                              ; preds = %347
  %353 = load ptr, ptr %12, align 8, !tbaa !5
  %354 = load i32, ptr %35, align 4, !tbaa !9
  %355 = sext i32 %354 to i64
  %356 = getelementptr inbounds i32, ptr %353, i64 %355
  %357 = load i32, ptr %356, align 4, !tbaa !9
  %358 = icmp sge i32 %357, 0
  br i1 %358, label %359, label %394

359:                                              ; preds = %352
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #9
  %360 = load ptr, ptr %12, align 8, !tbaa !5
  %361 = load i32, ptr %35, align 4, !tbaa !9
  %362 = sext i32 %361 to i64
  %363 = getelementptr inbounds i32, ptr %360, i64 %362
  %364 = load i32, ptr %363, align 4, !tbaa !9
  store i32 %364, ptr %36, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #9
  store i32 0, ptr %37, align 4, !tbaa !9
  br label %365

365:                                              ; preds = %385, %359
  %366 = load i32, ptr %37, align 4, !tbaa !9
  %367 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %39)
  %368 = icmp slt i32 %366, %367
  br i1 %368, label %370, label %369

369:                                              ; preds = %365
  store i32 38, ptr %7, align 4
  br label %388

370:                                              ; preds = %365
  %371 = load i32, ptr %36, align 4, !tbaa !9
  %372 = load ptr, ptr %12, align 8, !tbaa !5
  %373 = load i32, ptr %36, align 4, !tbaa !9
  %374 = sext i32 %373 to i64
  %375 = getelementptr inbounds i32, ptr %372, i64 %374
  %376 = load i32, ptr %375, align 4, !tbaa !9
  %377 = icmp eq i32 %371, %376
  br i1 %377, label %378, label %379

378:                                              ; preds = %370
  store i32 38, ptr %7, align 4
  br label %388

379:                                              ; preds = %370
  %380 = load ptr, ptr %12, align 8, !tbaa !5
  %381 = load i32, ptr %36, align 4, !tbaa !9
  %382 = sext i32 %381 to i64
  %383 = getelementptr inbounds i32, ptr %380, i64 %382
  %384 = load i32, ptr %383, align 4, !tbaa !9
  store i32 %384, ptr %36, align 4, !tbaa !9
  br label %385

385:                                              ; preds = %379
  %386 = load i32, ptr %37, align 4, !tbaa !9
  %387 = add nsw i32 %386, 1
  store i32 %387, ptr %37, align 4, !tbaa !9
  br label %365, !llvm.loop !25

388:                                              ; preds = %378, %369
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #9
  br label %389

389:                                              ; preds = %388
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #9
  %390 = load i32, ptr %36, align 4, !tbaa !9
  %391 = call noundef double @_ZNK6R3Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(592) %39, i32 noundef %390)
  store double %391, ptr %38, align 8, !tbaa !11
  %392 = load i32, ptr %35, align 4, !tbaa !9
  %393 = load double, ptr %38, align 8, !tbaa !11
  call void @_ZN6R3Grid12SetGridValueEid(ptr noundef nonnull align 8 dereferenceable(592) %39, i32 noundef %392, double noundef %393)
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #9
  br label %394

394:                                              ; preds = %389, %352
  br label %395

395:                                              ; preds = %394
  %396 = load i32, ptr %35, align 4, !tbaa !9
  %397 = add nsw i32 %396, 1
  store i32 %397, ptr %35, align 4, !tbaa !9
  br label %347, !llvm.loop !26

398:                                              ; preds = %351
  %399 = load ptr, ptr %12, align 8, !tbaa !5
  %400 = icmp eq ptr %399, null
  br i1 %400, label %402, label %401

401:                                              ; preds = %398
  call void @_ZdaPv(ptr noundef %399) #11
  br label %402

402:                                              ; preds = %401, %398
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  ret void
}

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

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #8

declare void @_ZdvRK8R3Vectord(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) #8

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNK6R3Grid14IndicesToIndexEiiiRi(ptr noundef nonnull align 8 dereferenceable(592), i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) #6 align 2

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

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { 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 #6 = { 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 #7 = { 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 = { "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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}


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

%class.R3Point = type { [3 x double] }
%class.R3Vector = type { [3 x double] }

@RN_EPSILON = external local_unnamed_addr global double, align 8
@_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel = external hidden local_unnamed_addr global [5 x [5 x [5 x double]]], align 16

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8RNIsZerodd(double noundef, double noundef) local_unnamed_addr #2

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

; 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 #4 align 2

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

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #6

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

declare void @_ZN7R3PointC1Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #7

declare void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #7

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointpLERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #7

declare noundef double @_ZNK8R3Vector3DotERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #7

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Grid20ClusterWithMeanShiftEv(ptr noundef nonnull align 8 dereferenceable(592) %0) local_unnamed_addr #4 align 2 {
  %2 = alloca %class.R3Point, align 8
  %3 = alloca %class.R3Vector, align 8
  %4 = alloca %class.R3Vector, align 8
  %5 = alloca %class.R3Vector, align 8
  %6 = tail call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %7 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %8 = icmp slt i32 %6, %7
  br i1 %8, label %9, label %11

9:                                                ; preds = %1
  %10 = tail call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  br label %11

11:                                               ; preds = %9, %1
  %.0 = phi i32 [ %10, %9 ], [ %6, %1 ]
  %12 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %13 = icmp slt i32 %.0, %12
  br i1 %13, label %14, label %16

14:                                               ; preds = %11
  %15 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  br label %16

16:                                               ; preds = %14, %11
  %.1 = phi i32 [ %15, %14 ], [ %.0, %11 ]
  br label %.preheader139

.preheader139:                                    ; preds = %16, %.preheader139
  %indvars.iv = phi i64 [ -2, %16 ], [ %indvars.iv.next, %.preheader139 ]
  %17 = mul nsw i64 %indvars.iv, %indvars.iv
  %18 = add nsw i64 %indvars.iv, 2
  %19 = trunc i64 %17 to i32
  %20 = add i32 %19, 8
  %21 = uitofp nneg i32 %20 to double
  %22 = fmul double %21, -5.000000e-01
  %23 = tail call double @exp(double noundef %22) #9
  %24 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 0, i64 0, i64 %18
  store double %23, ptr %24, align 8, !tbaa !5
  %25 = trunc i64 %17 to i32
  %26 = add i32 %25, 5
  %27 = uitofp nneg i32 %26 to double
  %28 = fmul double %27, -5.000000e-01
  %29 = tail call double @exp(double noundef %28) #9
  %30 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 1, i64 0, i64 %18
  store double %29, ptr %30, align 8, !tbaa !5
  %31 = trunc i64 %17 to i32
  %32 = add i32 %31, 4
  %33 = uitofp nneg i32 %32 to double
  %34 = fmul double %33, -5.000000e-01
  %35 = tail call double @exp(double noundef %34) #9
  %36 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 2, i64 0, i64 %18
  store double %35, ptr %36, align 8, !tbaa !5
  %37 = tail call double @exp(double noundef %28) #9
  %38 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 3, i64 0, i64 %18
  store double %37, ptr %38, align 8, !tbaa !5
  %39 = tail call double @exp(double noundef %22) #9
  %40 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 4, i64 0, i64 %18
  store double %39, ptr %40, align 8, !tbaa !5
  %41 = trunc i64 %17 to i32
  %42 = add i32 %41, 5
  %43 = uitofp nneg i32 %42 to double
  %44 = fmul double %43, -5.000000e-01
  %45 = tail call double @exp(double noundef %44) #9
  %46 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 0, i64 1, i64 %18
  store double %45, ptr %46, align 8, !tbaa !5
  %47 = trunc i64 %17 to i32
  %48 = add i32 %47, 2
  %49 = uitofp nneg i32 %48 to double
  %50 = fmul double %49, -5.000000e-01
  %51 = tail call double @exp(double noundef %50) #9
  %52 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 1, i64 1, i64 %18
  store double %51, ptr %52, align 8, !tbaa !5
  %53 = trunc i64 %17 to i32
  %54 = add i32 %53, 1
  %55 = uitofp nneg i32 %54 to double
  %56 = fmul double %55, -5.000000e-01
  %57 = tail call double @exp(double noundef %56) #9
  %58 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 2, i64 1, i64 %18
  store double %57, ptr %58, align 8, !tbaa !5
  %59 = tail call double @exp(double noundef %50) #9
  %60 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 3, i64 1, i64 %18
  store double %59, ptr %60, align 8, !tbaa !5
  %61 = tail call double @exp(double noundef %44) #9
  %62 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 4, i64 1, i64 %18
  store double %61, ptr %62, align 8, !tbaa !5
  %63 = tail call double @exp(double noundef %34) #9
  %64 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 0, i64 2, i64 %18
  store double %63, ptr %64, align 8, !tbaa !5
  %65 = tail call double @exp(double noundef %56) #9
  %66 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 1, i64 2, i64 %18
  store double %65, ptr %66, align 8, !tbaa !5
  %67 = trunc nsw i64 %17 to i32
  %68 = uitofp nneg i32 %67 to double
  %69 = fmul double %68, -5.000000e-01
  %70 = tail call double @exp(double noundef %69) #9
  %71 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 2, i64 2, i64 %18
  store double %70, ptr %71, align 8, !tbaa !5
  %72 = tail call double @exp(double noundef %56) #9
  %73 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 3, i64 2, i64 %18
  store double %72, ptr %73, align 8, !tbaa !5
  %74 = tail call double @exp(double noundef %34) #9
  %75 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 4, i64 2, i64 %18
  store double %74, ptr %75, align 8, !tbaa !5
  %76 = tail call double @exp(double noundef %44) #9
  %77 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 0, i64 3, i64 %18
  store double %76, ptr %77, align 8, !tbaa !5
  %78 = tail call double @exp(double noundef %50) #9
  %79 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 1, i64 3, i64 %18
  store double %78, ptr %79, align 8, !tbaa !5
  %80 = tail call double @exp(double noundef %56) #9
  %81 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 2, i64 3, i64 %18
  store double %80, ptr %81, align 8, !tbaa !5
  %82 = tail call double @exp(double noundef %50) #9
  %83 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 3, i64 3, i64 %18
  store double %82, ptr %83, align 8, !tbaa !5
  %84 = tail call double @exp(double noundef %44) #9
  %85 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 4, i64 3, i64 %18
  store double %84, ptr %85, align 8, !tbaa !5
  %86 = tail call double @exp(double noundef %22) #9
  %87 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 0, i64 4, i64 %18
  store double %86, ptr %87, align 8, !tbaa !5
  %88 = tail call double @exp(double noundef %28) #9
  %89 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 1, i64 4, i64 %18
  store double %88, ptr %89, align 8, !tbaa !5
  %90 = tail call double @exp(double noundef %34) #9
  %91 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 2, i64 4, i64 %18
  store double %90, ptr %91, align 8, !tbaa !5
  %92 = tail call double @exp(double noundef %28) #9
  %93 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 3, i64 4, i64 %18
  store double %92, ptr %93, align 8, !tbaa !5
  %94 = tail call double @exp(double noundef %22) #9
  %95 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 4, i64 4, i64 %18
  store double %94, ptr %95, align 8, !tbaa !5
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 3
  br i1 %exitcond.not, label %96, label %.preheader139, !llvm.loop !9

96:                                               ; preds = %.preheader139
  %97 = tail call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %98 = zext nneg i32 %97 to i64
  %99 = icmp slt i32 %97, 0
  %100 = shl nuw nsw i64 %98, 2
  %101 = select i1 %99, i64 -1, i64 %100
  %102 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %101) #10
  %103 = tail call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %104 = icmp sgt i32 %103, 0
  br i1 %104, label %.preheader137.lr.ph, label %.preheader135

.preheader137.lr.ph:                              ; preds = %96
  %105 = icmp sgt i32 %.1, 0
  br label %.preheader137

.preheader137:                                    ; preds = %.preheader137.lr.ph, %._crit_edge155
  %.0116158 = phi i32 [ 0, %.preheader137.lr.ph ], [ %.1117.lcssa, %._crit_edge155 ]
  %.0126157 = phi i32 [ 0, %.preheader137.lr.ph ], [ %115, %._crit_edge155 ]
  %106 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %107 = icmp sgt i32 %106, 0
  br i1 %107, label %.preheader136.lr.ph, label %._crit_edge155

.preheader136.lr.ph:                              ; preds = %.preheader137
  %108 = uitofp nneg i32 %.0126157 to double
  br label %.preheader136

.preheader135:                                    ; preds = %._crit_edge155, %96
  %109 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %110 = icmp sgt i32 %109, 0
  br i1 %110, label %.lr.ph161, label %.preheader134

.preheader136:                                    ; preds = %.preheader136.lr.ph, %._crit_edge
  %.1117154 = phi i32 [ %.0116158, %.preheader136.lr.ph ], [ %.2118.lcssa, %._crit_edge ]
  %.0125153 = phi i32 [ 0, %.preheader136.lr.ph ], [ %119, %._crit_edge ]
  %111 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %112 = icmp sgt i32 %111, 0
  br i1 %112, label %.lr.ph152, label %._crit_edge

.lr.ph152:                                        ; preds = %.preheader136
  %113 = uitofp nneg i32 %.0125153 to double
  %114 = sext i32 %.1117154 to i64
  br label %122

._crit_edge155:                                   ; preds = %._crit_edge, %.preheader137
  %.1117.lcssa = phi i32 [ %.0116158, %.preheader137 ], [ %.2118.lcssa, %._crit_edge ]
  %115 = add nuw nsw i32 %.0126157, 1
  %116 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %.preheader137, label %.preheader135, !llvm.loop !11

._crit_edge.loopexit:                             ; preds = %253
  %118 = trunc nsw i64 %indvars.iv.next189 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader136
  %.2118.lcssa = phi i32 [ %.1117154, %.preheader136 ], [ %118, %._crit_edge.loopexit ]
  %119 = add nuw nsw i32 %.0125153, 1
  %120 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %.preheader136, label %._crit_edge155, !llvm.loop !12

122:                                              ; preds = %.lr.ph152, %253
  %indvars.iv188 = phi i64 [ %114, %.lr.ph152 ], [ %indvars.iv.next189, %253 ]
  %.0124150 = phi i32 [ 0, %.lr.ph152 ], [ %254, %253 ]
  %123 = getelementptr inbounds i32, ptr %102, i64 %indvars.iv188
  store i32 -1, ptr %123, align 4, !tbaa !13
  %124 = call noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0124150, i32 noundef %.0125153, i32 noundef %.0126157)
  %125 = fcmp ogt double %124, 0.000000e+00
  br i1 %125, label %126, label %253

126:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #9
  %127 = uitofp nneg i32 %.0124150 to double
  call void @_ZN7R3PointC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %2, double noundef %127, double noundef %113, double noundef %108)
  br i1 %105, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %126, %.critedge
  %.0123149 = phi i32 [ %224, %.critedge ], [ 0, %126 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #9
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %3, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  br label %130

128:                                              ; preds = %137
  %129 = fcmp oeq double %.3.4, 0.000000e+00
  br i1 %129, label %225, label %219

130:                                              ; preds = %.lr.ph, %137
  %indvars.iv183 = phi i64 [ -2, %.lr.ph ], [ %indvars.iv.next184, %137 ]
  %.0120147 = phi double [ 0.000000e+00, %.lr.ph ], [ %.3.4, %137 ]
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 2)
  %132 = load double, ptr %131, align 8, !tbaa !5
  %133 = trunc nsw i64 %indvars.iv183 to i32
  %134 = sitofp i32 %133 to double
  %135 = fadd double %132, %134
  %136 = add nsw i64 %indvars.iv183, 2
  br label %138

137:                                              ; preds = %218
  %indvars.iv.next184 = add nsw i64 %indvars.iv183, 1
  %exitcond186.not = icmp eq i64 %indvars.iv.next184, 3
  br i1 %exitcond186.not, label %128, label %130, !llvm.loop !15

138:                                              ; preds = %130, %218
  %indvars.iv179 = phi i64 [ -2, %130 ], [ %indvars.iv.next180, %218 ]
  %.1121145 = phi double [ %.0120147, %130 ], [ %.3.4, %218 ]
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 1)
  %140 = load double, ptr %139, align 8, !tbaa !5
  %141 = trunc nsw i64 %indvars.iv179 to i32
  %142 = sitofp i32 %141 to double
  %143 = fadd double %140, %142
  %144 = add nsw i64 %indvars.iv179, 2
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
  %146 = load double, ptr %145, align 8, !tbaa !5
  %147 = fadd double %146, -2.000000e+00
  %148 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %0, double noundef %147, double noundef %143, double noundef %135)
  %149 = fcmp ogt double %148, 0.000000e+00
  br i1 %149, label %150, label %159

150:                                              ; preds = %138
  %151 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 0, i64 %144, i64 %136
  %152 = load double, ptr %151, align 8, !tbaa !5
  %153 = fmul double %148, %152
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  %154 = fmul double %153, -2.000000e+00
  %155 = fmul double %153, %142
  %156 = fmul double %153, %134
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %4, double noundef %154, double noundef %155, double noundef %156)
  %157 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  %158 = fadd double %.1121145, %153
  br label %159

159:                                              ; preds = %150, %138
  %.3 = phi double [ %158, %150 ], [ %.1121145, %138 ]
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
  %161 = load double, ptr %160, align 8, !tbaa !5
  %162 = fadd double %161, -1.000000e+00
  %163 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %0, double noundef %162, double noundef %143, double noundef %135)
  %164 = fcmp ogt double %163, 0.000000e+00
  br i1 %164, label %165, label %174

165:                                              ; preds = %159
  %166 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 1, i64 %144, i64 %136
  %167 = load double, ptr %166, align 8, !tbaa !5
  %168 = fmul double %163, %167
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  %169 = fneg double %168
  %170 = fmul double %168, %142
  %171 = fmul double %168, %134
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %4, double noundef %169, double noundef %170, double noundef %171)
  %172 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  %173 = fadd double %.3, %168
  br label %174

174:                                              ; preds = %165, %159
  %.3.1 = phi double [ %173, %165 ], [ %.3, %159 ]
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
  %176 = load double, ptr %175, align 8, !tbaa !5
  %177 = fadd double %176, 0.000000e+00
  %178 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %0, double noundef %177, double noundef %143, double noundef %135)
  %179 = fcmp ogt double %178, 0.000000e+00
  br i1 %179, label %180, label %189

180:                                              ; preds = %174
  %181 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 2, i64 %144, i64 %136
  %182 = load double, ptr %181, align 8, !tbaa !5
  %183 = fmul double %178, %182
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  %184 = fmul double %183, 0.000000e+00
  %185 = fmul double %183, %142
  %186 = fmul double %183, %134
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %4, double noundef %184, double noundef %185, double noundef %186)
  %187 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  %188 = fadd double %.3.1, %183
  br label %189

189:                                              ; preds = %180, %174
  %.3.2 = phi double [ %188, %180 ], [ %.3.1, %174 ]
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
  %191 = load double, ptr %190, align 8, !tbaa !5
  %192 = fadd double %191, 1.000000e+00
  %193 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %0, double noundef %192, double noundef %143, double noundef %135)
  %194 = fcmp ogt double %193, 0.000000e+00
  br i1 %194, label %195, label %203

195:                                              ; preds = %189
  %196 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 3, i64 %144, i64 %136
  %197 = load double, ptr %196, align 8, !tbaa !5
  %198 = fmul double %193, %197
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  %199 = fmul double %198, %142
  %200 = fmul double %198, %134
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %4, double noundef %198, double noundef %199, double noundef %200)
  %201 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  %202 = fadd double %.3.2, %198
  br label %203

203:                                              ; preds = %195, %189
  %.3.3 = phi double [ %202, %195 ], [ %.3.2, %189 ]
  %204 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
  %205 = load double, ptr %204, align 8, !tbaa !5
  %206 = fadd double %205, 2.000000e+00
  %207 = call noundef double @_ZNK6R3Grid9GridValueEddd(ptr noundef nonnull align 8 dereferenceable(592) %0, double noundef %206, double noundef %143, double noundef %135)
  %208 = fcmp ogt double %207, 0.000000e+00
  br i1 %208, label %209, label %218

209:                                              ; preds = %203
  %210 = getelementptr inbounds [5 x [5 x [5 x double]]], ptr @_ZZN6R3Grid20ClusterWithMeanShiftEvE6kernel, i64 0, i64 4, i64 %144, i64 %136
  %211 = load double, ptr %210, align 8, !tbaa !5
  %212 = fmul double %207, %211
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #9
  %213 = fmul double %212, 2.000000e+00
  %214 = fmul double %212, %142
  %215 = fmul double %212, %134
  call void @_ZN8R3VectorC1Eddd(ptr noundef nonnull align 8 dereferenceable(24) %4, double noundef %213, double noundef %214, double noundef %215)
  %216 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #9
  %217 = fadd double %.3.3, %212
  br label %218

218:                                              ; preds = %209, %203
  %.3.4 = phi double [ %217, %209 ], [ %.3.3, %203 ]
  %indvars.iv.next180 = add nsw i64 %indvars.iv179, 1
  %exitcond182.not = icmp eq i64 %indvars.iv.next180, 3
  br i1 %exitcond182.not, label %137, label %138, !llvm.loop !16

219:                                              ; preds = %128
  %220 = call noundef double @_ZNK8R3Vector3DotERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %3)
  %221 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %222 = call noundef i32 @_Z8RNIsZerodd(double noundef %220, double noundef %221)
  %.not = icmp eq i32 %222, 0
  br i1 %.not, label %.critedge, label %225

.critedge:                                        ; preds = %219
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #9
  call void @_ZdvRK8R3Vectord(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %3, double noundef %.3.4)
  %223 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN7R3PointpLERK8R3Vector(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %5)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  %224 = add nuw nsw i32 %.0123149, 1
  %exitcond187.not = icmp eq i32 %224, %.1
  br i1 %exitcond187.not, label %.loopexit, label %.lr.ph, !llvm.loop !17

225:                                              ; preds = %219, %128
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #9
  br label %.loopexit

.loopexit:                                        ; preds = %.critedge, %126, %225
  %226 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 0)
  %227 = load double, ptr %226, align 8, !tbaa !5
  %228 = fadd double %227, 5.000000e-01
  %229 = fptosi double %228 to i32
  %230 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 1)
  %231 = load double, ptr %230, align 8, !tbaa !5
  %232 = fadd double %231, 5.000000e-01
  %233 = fptosi double %232 to i32
  %234 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef 2)
  %235 = load double, ptr %234, align 8, !tbaa !5
  %236 = fadd double %235, 5.000000e-01
  %237 = fptosi double %236 to i32
  %spec.store.select1 = call i32 @llvm.smax.i32(i32 %229, i32 0)
  %spec.store.select = call i32 @llvm.smax.i32(i32 %233, i32 0)
  %spec.store.select2 = call i32 @llvm.smax.i32(i32 %237, i32 0)
  %238 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %.not131 = icmp slt i32 %spec.store.select1, %238
  br i1 %.not131, label %242, label %239

239:                                              ; preds = %.loopexit
  %240 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %241 = add nsw i32 %240, -1
  br label %242

242:                                              ; preds = %239, %.loopexit
  %.0108 = phi i32 [ %241, %239 ], [ %spec.store.select1, %.loopexit ]
  %243 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %.not132 = icmp slt i32 %spec.store.select, %243
  br i1 %.not132, label %247, label %244

244:                                              ; preds = %242
  %245 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %246 = add nsw i32 %245, -1
  br label %247

247:                                              ; preds = %244, %242
  %.1109 = phi i32 [ %246, %244 ], [ %.0108, %242 ]
  %248 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %.not133 = icmp slt i32 %spec.store.select2, %248
  br i1 %.not133, label %252, label %249

249:                                              ; preds = %247
  %250 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %251 = add nsw i32 %250, -1
  br label %252

252:                                              ; preds = %249, %247
  %.2 = phi i32 [ %251, %249 ], [ %.1109, %247 ]
  call void @_ZNK6R3Grid14IndicesToIndexEiiiRi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.2, i32 noundef %spec.store.select, i32 noundef %spec.store.select2, ptr noundef nonnull align 4 dereferenceable(4) %123)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #9
  br label %253

253:                                              ; preds = %252, %122
  %indvars.iv.next189 = add nsw i64 %indvars.iv188, 1
  %254 = add nuw nsw i32 %.0124150, 1
  %255 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %256 = icmp slt i32 %254, %255
  br i1 %256, label %122, label %._crit_edge.loopexit, !llvm.loop !18

.preheader134:                                    ; preds = %267, %.preheader135
  %257 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %258 = icmp sgt i32 %257, 0
  br i1 %258, label %.lr.ph170, label %._crit_edge171

.lr.ph161:                                        ; preds = %.preheader135, %267
  %indvars.iv191 = phi i64 [ %indvars.iv.next192, %267 ], [ 0, %.preheader135 ]
  %.0106159 = phi i32 [ %.1107, %267 ], [ 0, %.preheader135 ]
  %259 = getelementptr inbounds i32, ptr %102, i64 %indvars.iv191
  %260 = load i32, ptr %259, align 4, !tbaa !13
  %261 = zext i32 %260 to i64
  %262 = icmp eq i64 %indvars.iv191, %261
  br i1 %262, label %263, label %267

263:                                              ; preds = %.lr.ph161
  %264 = add nsw i32 %.0106159, 1
  %265 = sitofp i32 %264 to double
  %266 = trunc nuw nsw i64 %indvars.iv191 to i32
  call void @_ZN6R3Grid12SetGridValueEid(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %266, double noundef %265)
  br label %267

267:                                              ; preds = %.lr.ph161, %263
  %.1107 = phi i32 [ %264, %263 ], [ %.0106159, %.lr.ph161 ]
  %indvars.iv.next192 = add nuw nsw i64 %indvars.iv191, 1
  %268 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %269 = sext i32 %268 to i64
  %270 = icmp slt i64 %indvars.iv.next192, %269
  br i1 %270, label %.lr.ph161, label %.preheader134, !llvm.loop !19

.lr.ph170:                                        ; preds = %.preheader134, %286
  %indvars.iv194 = phi i64 [ %indvars.iv.next195, %286 ], [ 0, %.preheader134 ]
  %271 = getelementptr inbounds i32, ptr %102, i64 %indvars.iv194
  %272 = load i32, ptr %271, align 4, !tbaa !13
  %273 = icmp sgt i32 %272, -1
  br i1 %273, label %.preheader, label %286

.preheader:                                       ; preds = %.lr.ph170
  %274 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %275 = icmp sgt i32 %274, 0
  br i1 %275, label %.lr.ph164, label %._crit_edge165

276:                                              ; preds = %.lr.ph164
  %277 = add nuw nsw i32 %.0102163, 1
  %278 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %279 = icmp slt i32 %277, %278
  br i1 %279, label %.lr.ph164, label %._crit_edge165, !llvm.loop !20

.lr.ph164:                                        ; preds = %.preheader, %276
  %.0102163 = phi i32 [ %277, %276 ], [ 0, %.preheader ]
  %.0103162 = phi i32 [ %282, %276 ], [ %272, %.preheader ]
  %280 = sext i32 %.0103162 to i64
  %281 = getelementptr inbounds i32, ptr %102, i64 %280
  %282 = load i32, ptr %281, align 4, !tbaa !13
  %283 = icmp eq i32 %.0103162, %282
  br i1 %283, label %._crit_edge165, label %276

._crit_edge165:                                   ; preds = %276, %.lr.ph164, %.preheader
  %.0103.lcssa = phi i32 [ %272, %.preheader ], [ %.0103162, %.lr.ph164 ], [ %282, %276 ]
  %284 = call noundef double @_ZNK6R3Grid9GridValueEi(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.0103.lcssa)
  %285 = trunc nuw nsw i64 %indvars.iv194 to i32
  call void @_ZN6R3Grid12SetGridValueEid(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %285, double noundef %284)
  br label %286

286:                                              ; preds = %.lr.ph170, %._crit_edge165
  %indvars.iv.next195 = add nuw nsw i64 %indvars.iv194, 1
  %287 = call noundef i32 @_ZNK6R3Grid8NEntriesEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %288 = sext i32 %287 to i64
  %289 = icmp slt i64 %indvars.iv.next195, %288
  br i1 %289, label %.lr.ph170, label %._crit_edge171, !llvm.loop !21

._crit_edge171:                                   ; preds = %286, %.preheader134
  call void @_ZdaPv(ptr noundef nonnull %102) #11
  ret void
}

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

declare noundef nonnull align 8 dereferenceable(24) ptr @_ZN8R3VectorpLERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #7

declare void @_ZdvRK8R3Vectord(ptr dead_on_unwind writable sret(%class.R3Vector) align 8, ptr noundef nonnull align 8 dereferenceable(24), double noundef) local_unnamed_addr #7

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNK6R3Grid14IndicesToIndexEiiiRi(ptr noundef nonnull align 8 dereferenceable(592), i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

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

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

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


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