; LLVM IR from csviragh/robotsim :: src/utilities (arenas)

; 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"

%struct.arena_t = type { i32, [32 x i8], [128 x [3 x double]], i32 }

@NearestArenaPoint.p = external hidden global [258 x double], align 16
@NearestArenaPoint.Temp1 = external hidden global [3 x double], align 16
@NearestArenaPoint.Temp2 = external hidden global [3 x double], align 16

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @NearestArenaPoint(ptr noundef %0, ptr noundef %1, ptr noundef %2, double noundef %3, double noundef %4, double noundef %5) #1 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store double %3, ptr %11, align 8, !tbaa !9
  store double %4, ptr %12, align 8, !tbaa !9
  store double %5, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  store double 1.000000e+222, ptr %16, align 8, !tbaa !9
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %18

18:                                               ; preds = %54, %6
  %19 = load i32, ptr %14, align 4, !tbaa !11
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.arena_t, ptr %20, i32 0, i32 3
  %22 = load i32, ptr %21, align 8, !tbaa !13
  %23 = icmp slt i32 %19, %22
  br i1 %23, label %24, label %57

24:                                               ; preds = %18
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.arena_t, ptr %25, i32 0, i32 2
  %27 = load i32, ptr %14, align 4, !tbaa !11
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [128 x [3 x double]], ptr %26, i64 0, i64 %28
  %30 = getelementptr inbounds [3 x double], ptr %29, i64 0, i64 0
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = load double, ptr %11, align 8, !tbaa !9
  %33 = load double, ptr %12, align 8, !tbaa !9
  %34 = call double @llvm.fmuladd.f64(double %31, double %32, double %33)
  %35 = load i32, ptr %14, align 4, !tbaa !11
  %36 = mul nsw i32 %35, 2
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %37
  store double %34, ptr %38, align 8, !tbaa !9
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.arena_t, ptr %39, i32 0, i32 2
  %41 = load i32, ptr %14, align 4, !tbaa !11
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [128 x [3 x double]], ptr %40, i64 0, i64 %42
  %44 = getelementptr inbounds [3 x double], ptr %43, i64 0, i64 1
  %45 = load double, ptr %44, align 8, !tbaa !9
  %46 = load double, ptr %11, align 8, !tbaa !9
  %47 = load double, ptr %13, align 8, !tbaa !9
  %48 = call double @llvm.fmuladd.f64(double %45, double %46, double %47)
  %49 = load i32, ptr %14, align 4, !tbaa !11
  %50 = mul nsw i32 %49, 2
  %51 = add nsw i32 %50, 1
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %52
  store double %48, ptr %53, align 8, !tbaa !9
  br label %54

54:                                               ; preds = %24
  %55 = load i32, ptr %14, align 4, !tbaa !11
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %14, align 4, !tbaa !11
  br label %18, !llvm.loop !15

57:                                               ; preds = %18
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.arena_t, ptr %58, i32 0, i32 2
  %60 = getelementptr inbounds [128 x [3 x double]], ptr %59, i64 0, i64 0
  %61 = getelementptr inbounds [3 x double], ptr %60, i64 0, i64 0
  %62 = load double, ptr %61, align 8, !tbaa !9
  %63 = load double, ptr %11, align 8, !tbaa !9
  %64 = load double, ptr %12, align 8, !tbaa !9
  %65 = call double @llvm.fmuladd.f64(double %62, double %63, double %64)
  %66 = load i32, ptr %14, align 4, !tbaa !11
  %67 = mul nsw i32 %66, 2
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %68
  store double %65, ptr %69, align 8, !tbaa !9
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.arena_t, ptr %70, i32 0, i32 2
  %72 = getelementptr inbounds [128 x [3 x double]], ptr %71, i64 0, i64 0
  %73 = getelementptr inbounds [3 x double], ptr %72, i64 0, i64 1
  %74 = load double, ptr %73, align 8, !tbaa !9
  %75 = load double, ptr %11, align 8, !tbaa !9
  %76 = load double, ptr %13, align 8, !tbaa !9
  %77 = call double @llvm.fmuladd.f64(double %74, double %75, double %76)
  %78 = load i32, ptr %14, align 4, !tbaa !11
  %79 = mul nsw i32 %78, 2
  %80 = add nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %81
  store double %77, ptr %82, align 8, !tbaa !9
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.arena_t, ptr %84, i32 0, i32 3
  %86 = load i32, ptr %85, align 8, !tbaa !13
  %87 = add nsw i32 %86, 1
  %88 = call zeroext i1 @IsInsidePolygon(ptr noundef %83, ptr noundef @NearestArenaPoint.p, i32 noundef %87)
  br i1 %88, label %89, label %90

89:                                               ; preds = %57
  store i32 0, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %163

90:                                               ; preds = %57
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %91

91:                                               ; preds = %159, %90
  %92 = load i32, ptr %14, align 4, !tbaa !11
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.arena_t, ptr %93, i32 0, i32 3
  %95 = load i32, ptr %94, align 8, !tbaa !13
  %96 = icmp slt i32 %92, %95
  br i1 %96, label %97, label %162

97:                                               ; preds = %91
  %98 = load i32, ptr %14, align 4, !tbaa !11
  %99 = mul nsw i32 %98, 2
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %100
  %102 = load i32, ptr %14, align 4, !tbaa !11
  %103 = add nsw i32 %102, 1
  %104 = mul nsw i32 %103, 2
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %105
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = call i32 @AtShadow(ptr noundef %101, ptr noundef %106, ptr noundef %107)
  %109 = icmp sgt i32 %108, 0
  br i1 %109, label %110, label %133

110:                                              ; preds = %97
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = load i32, ptr %14, align 4, !tbaa !11
  %113 = mul nsw i32 %112, 2
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %114
  call void @VectDifference(ptr noundef @NearestArenaPoint.Temp1, ptr noundef %111, ptr noundef %115)
  %116 = load i32, ptr %14, align 4, !tbaa !11
  %117 = add nsw i32 %116, 1
  %118 = mul nsw i32 %117, 2
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %119
  %121 = load i32, ptr %14, align 4, !tbaa !11
  %122 = mul nsw i32 %121, 2
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %123
  call void @VectDifference(ptr noundef @NearestArenaPoint.Temp2, ptr noundef %120, ptr noundef %124)
  store double 0.000000e+00, ptr getelementptr inbounds ([3 x double], ptr @NearestArenaPoint.Temp2, i64 0, i64 2), align 16, !tbaa !9
  call void @UnitVect(ptr noundef @NearestArenaPoint.Temp2, ptr noundef @NearestArenaPoint.Temp2)
  %125 = call double @ScalarProduct(ptr noundef @NearestArenaPoint.Temp1, ptr noundef @NearestArenaPoint.Temp2, i32 noundef 2)
  call void @MultiplicateWithScalar(ptr noundef @NearestArenaPoint.Temp2, ptr noundef @NearestArenaPoint.Temp2, double noundef %125, i32 noundef 2)
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = load i32, ptr %14, align 4, !tbaa !11
  %128 = mul nsw i32 %127, 2
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %129
  call void @VectSum(ptr noundef %126, ptr noundef %130, ptr noundef @NearestArenaPoint.Temp2)
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = getelementptr inbounds double, ptr %131, i64 2
  store double 0.000000e+00, ptr %132, align 8, !tbaa !9
  store i32 1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %163

133:                                              ; preds = %97
  %134 = load ptr, ptr %9, align 8, !tbaa !5
  %135 = load i32, ptr %14, align 4, !tbaa !11
  %136 = mul nsw i32 %135, 2
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %137
  call void @VectDifference(ptr noundef @NearestArenaPoint.Temp1, ptr noundef %134, ptr noundef %138)
  %139 = call double @VectAbsXY(ptr noundef @NearestArenaPoint.Temp1)
  store double %139, ptr %15, align 8, !tbaa !9
  %140 = load double, ptr %15, align 8, !tbaa !9
  %141 = load double, ptr %16, align 8, !tbaa !9
  %142 = fcmp olt double %140, %141
  br i1 %142, label %143, label %157

143:                                              ; preds = %133
  %144 = load double, ptr %15, align 8, !tbaa !9
  store double %144, ptr %16, align 8, !tbaa !9
  %145 = load ptr, ptr %8, align 8, !tbaa !5
  %146 = load i32, ptr %14, align 4, !tbaa !11
  %147 = mul nsw i32 %146, 2
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %148
  %150 = load double, ptr %149, align 8, !tbaa !9
  %151 = load i32, ptr %14, align 4, !tbaa !11
  %152 = mul nsw i32 %151, 2
  %153 = add nsw i32 %152, 1
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %154
  %156 = load double, ptr %155, align 8, !tbaa !9
  call void @FillVect(ptr noundef %145, double noundef %150, double noundef %156, double noundef 0.000000e+00)
  br label %157

157:                                              ; preds = %143, %133
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %14, align 4, !tbaa !11
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %14, align 4, !tbaa !11
  br label %91, !llvm.loop !17

162:                                              ; preds = %91
  store i32 2, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %163

163:                                              ; preds = %162, %110, %89
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %164 = load i32, ptr %7, align 4
  ret i32 %164
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

declare zeroext i1 @IsInsidePolygon(ptr noundef, ptr noundef, i32 noundef) #3

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

declare void @VectDifference(ptr noundef, ptr noundef, ptr noundef) #3

declare void @UnitVect(ptr noundef, ptr noundef) #3

declare void @MultiplicateWithScalar(ptr noundef, ptr noundef, double noundef, i32 noundef) #3

declare double @ScalarProduct(ptr noundef, ptr noundef, i32 noundef) #3

declare void @VectSum(ptr noundef, ptr noundef, ptr noundef) #3

declare double @VectAbsXY(ptr noundef) #3

declare void @FillVect(ptr noundef, double noundef, double noundef, double noundef) #3

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

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 3112}
!14 = !{!"", !12, i64 0, !7, i64 4, !7, i64 40, !12, i64 3112}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; 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"

@NearestArenaPoint.p = external hidden global [258 x double], align 16
@NearestArenaPoint.Temp1 = external hidden global [3 x double], align 16
@NearestArenaPoint.Temp2 = external hidden global [3 x double], align 16

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @NearestArenaPoint(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, double noundef %3, double noundef %4, double noundef %5) local_unnamed_addr #0 {
  %7 = getelementptr inbounds i8, ptr %2, i64 3112
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %6
  %10 = getelementptr inbounds i8, ptr %2, i64 40
  %wide.trip.count = zext nneg i32 %8 to i64
  %min.iters.check = icmp ult i32 %8, 7
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph
  %11 = shl nuw nsw i64 %wide.trip.count, 4
  %scevgep = getelementptr i8, ptr @NearestArenaPoint.p, i64 %11
  %12 = mul nuw nsw i64 %wide.trip.count, 24
  %13 = getelementptr i8, ptr %2, i64 %12
  %scevgep70 = getelementptr i8, ptr %13, i64 32
  %bound0 = icmp ugt ptr %scevgep70, @NearestArenaPoint.p
  %bound1 = icmp ult ptr %10, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %.neg = or i64 %wide.trip.count, -2
  %n.vec = add nsw i64 %.neg, %wide.trip.count
  %broadcast.splatinsert = insertelement <2 x double> poison, double %3, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert71 = insertelement <2 x double> poison, double %4, i64 0
  %broadcast.splat72 = shufflevector <2 x double> %broadcast.splatinsert71, <2 x double> poison, <2 x i32> zeroinitializer
  %broadcast.splatinsert73 = insertelement <2 x double> poison, double %5, i64 0
  %broadcast.splat74 = shufflevector <2 x double> %broadcast.splatinsert73, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %14 = or disjoint i64 %index, 1
  %15 = getelementptr inbounds [128 x [3 x double]], ptr %10, i64 0, i64 %index
  %16 = getelementptr inbounds [128 x [3 x double]], ptr %10, i64 0, i64 %14
  %17 = load double, ptr %15, align 8, !tbaa !10, !alias.scope !12
  %18 = load double, ptr %16, align 8, !tbaa !10, !alias.scope !12
  %19 = insertelement <2 x double> poison, double %17, i64 0
  %20 = insertelement <2 x double> %19, double %18, i64 1
  %21 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %20, <2 x double> %broadcast.splat, <2 x double> %broadcast.splat72)
  %22 = shl nuw nsw i64 %index, 1
  %23 = getelementptr inbounds i8, ptr %15, i64 8
  %24 = getelementptr inbounds i8, ptr %16, i64 8
  %25 = load double, ptr %23, align 8, !tbaa !10, !alias.scope !12
  %26 = load double, ptr %24, align 8, !tbaa !10, !alias.scope !12
  %27 = insertelement <2 x double> poison, double %25, i64 0
  %28 = insertelement <2 x double> %27, double %26, i64 1
  %29 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %28, <2 x double> %broadcast.splat, <2 x double> %broadcast.splat74)
  %30 = or disjoint i64 %22, 1
  %gep = getelementptr [258 x double], ptr getelementptr (i8, ptr @NearestArenaPoint.p, i64 -8), i64 0, i64 %30
  %interleaved.vec = shufflevector <2 x double> %21, <2 x double> %29, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
  store <4 x double> %interleaved.vec, ptr %gep, align 16, !tbaa !10
  %index.next = add nuw i64 %index, 2
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %scalar.ph.preheader, label %vector.body, !llvm.loop !15

scalar.ph.preheader:                              ; preds = %vector.body, %vector.memcheck, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph ], [ %n.vec, %vector.body ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %32 = getelementptr inbounds [128 x [3 x double]], ptr %10, i64 0, i64 %indvars.iv
  %33 = load double, ptr %32, align 8, !tbaa !10
  %34 = tail call double @llvm.fmuladd.f64(double %33, double %3, double %4)
  %35 = shl nuw nsw i64 %indvars.iv, 1
  %36 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %35
  store double %34, ptr %36, align 16, !tbaa !10
  %37 = getelementptr inbounds i8, ptr %32, i64 8
  %38 = load double, ptr %37, align 8, !tbaa !10
  %39 = tail call double @llvm.fmuladd.f64(double %38, double %3, double %5)
  %40 = or disjoint i64 %35, 1
  %41 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %40
  store double %39, ptr %41, align 8, !tbaa !10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %scalar.ph, !llvm.loop !19

._crit_edge.loopexit:                             ; preds = %scalar.ph
  %42 = shl nuw nsw i32 %8, 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %6
  %.045.lcssa = phi i32 [ 0, %6 ], [ %42, %._crit_edge.loopexit ]
  %43 = getelementptr inbounds i8, ptr %2, i64 40
  %44 = load double, ptr %43, align 8, !tbaa !10
  %45 = tail call double @llvm.fmuladd.f64(double %44, double %3, double %4)
  %46 = zext nneg i32 %.045.lcssa to i64
  %47 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %46
  store double %45, ptr %47, align 16, !tbaa !10
  %48 = getelementptr inbounds i8, ptr %2, i64 48
  %49 = load double, ptr %48, align 8, !tbaa !10
  %50 = tail call double @llvm.fmuladd.f64(double %49, double %3, double %5)
  %51 = or disjoint i32 %.045.lcssa, 1
  %52 = zext nneg i32 %51 to i64
  %53 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %52
  store double %50, ptr %53, align 8, !tbaa !10
  %54 = add nsw i32 %8, 1
  %55 = tail call zeroext i1 @IsInsidePolygon(ptr noundef %1, ptr noundef nonnull @NearestArenaPoint.p, i32 noundef %54) #4
  br i1 %55, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %56 = load i32, ptr %7, align 8, !tbaa !5
  %57 = icmp sgt i32 %56, 0
  br i1 %57, label %.lr.ph55, label %.loopexit

.lr.ph55:                                         ; preds = %.preheader, %75
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %75 ], [ 0, %.preheader ]
  %.054 = phi double [ %.1, %75 ], [ 1.000000e+222, %.preheader ]
  %58 = shl nuw nsw i64 %indvars.iv61, 1
  %59 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %58
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %60 = shl nuw nsw i64 %indvars.iv.next62, 1
  %61 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %60
  %62 = tail call i32 @AtShadow(ptr noundef nonnull %59, ptr noundef nonnull %61, ptr noundef %1) #4
  %63 = icmp sgt i32 %62, 0
  tail call void @VectDifference(ptr noundef nonnull @NearestArenaPoint.Temp1, ptr noundef %1, ptr noundef nonnull %59) #4
  br i1 %63, label %64, label %67

64:                                               ; preds = %.lr.ph55
  tail call void @VectDifference(ptr noundef nonnull @NearestArenaPoint.Temp2, ptr noundef nonnull %61, ptr noundef nonnull %59) #4
  store double 0.000000e+00, ptr getelementptr inbounds (i8, ptr @NearestArenaPoint.Temp2, i64 16), align 16, !tbaa !10
  tail call void @UnitVect(ptr noundef nonnull @NearestArenaPoint.Temp2, ptr noundef nonnull @NearestArenaPoint.Temp2) #4
  %65 = tail call double @ScalarProduct(ptr noundef nonnull @NearestArenaPoint.Temp1, ptr noundef nonnull @NearestArenaPoint.Temp2, i32 noundef 2) #4
  tail call void @MultiplicateWithScalar(ptr noundef nonnull @NearestArenaPoint.Temp2, ptr noundef nonnull @NearestArenaPoint.Temp2, double noundef %65, i32 noundef 2) #4
  tail call void @VectSum(ptr noundef %0, ptr noundef nonnull %59, ptr noundef nonnull @NearestArenaPoint.Temp2) #4
  %66 = getelementptr inbounds i8, ptr %0, i64 16
  store double 0.000000e+00, ptr %66, align 8, !tbaa !10
  br label %.loopexit

67:                                               ; preds = %.lr.ph55
  %68 = tail call double @VectAbsXY(ptr noundef nonnull @NearestArenaPoint.Temp1) #4
  %69 = fcmp olt double %68, %.054
  br i1 %69, label %70, label %75

70:                                               ; preds = %67
  %71 = load double, ptr %59, align 16, !tbaa !10
  %72 = or disjoint i64 %58, 1
  %73 = getelementptr inbounds [258 x double], ptr @NearestArenaPoint.p, i64 0, i64 %72
  %74 = load double, ptr %73, align 8, !tbaa !10
  tail call void @FillVect(ptr noundef %0, double noundef %71, double noundef %74, double noundef 0.000000e+00) #4
  br label %75

75:                                               ; preds = %70, %67
  %.1 = phi double [ %68, %70 ], [ %.054, %67 ]
  %76 = load i32, ptr %7, align 8, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = icmp slt i64 %indvars.iv.next62, %77
  br i1 %78, label %.lr.ph55, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %75, %.preheader, %._crit_edge, %64
  %.044 = phi i32 [ 1, %64 ], [ 0, %._crit_edge ], [ 2, %.preheader ], [ 2, %75 ]
  ret i32 %.044
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

declare zeroext i1 @IsInsidePolygon(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare i32 @AtShadow(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @VectDifference(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @UnitVect(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @MultiplicateWithScalar(ptr noundef, ptr noundef, double noundef, i32 noundef) local_unnamed_addr #2

declare double @ScalarProduct(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @VectSum(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare double @VectAbsXY(ptr noundef) local_unnamed_addr #2

declare void @FillVect(ptr noundef, double noundef, double noundef, double noundef) local_unnamed_addr #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #3

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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, !7, i64 3112}
!6 = !{!"", !7, i64 0, !8, i64 4, !8, i64 40, !7, i64 3112}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!13}
!13 = distinct !{!13, !14}
!14 = distinct !{!14, !"LVerDomain"}
!15 = distinct !{!15, !16, !17, !18}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !16, !17}
!20 = distinct !{!20, !16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass