; LLVM IR from csviragh/robotsim :: src (algo_spp_evol)

; 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.arenas_t = type { [32 x %struct.arena_t], i32 }
%struct.arena_t = type { i32, [32 x i8], [128 x [3 x double]], i32 }
%struct.obstacles_t = type { [32 x %struct.obstacle_t], i32 }
%struct.obstacle_t = type { [32 x i8], [10 x [3 x double]], [2 x double], i32 }
%struct.phase_t = type { ptr, ptr, ptr, ptr, i32, i32 }

@V_Flock = external dso_local global double, align 8
@V_Rep = external dso_local global double, align 8
@V_Frict = external dso_local global double, align 8
@V_Max = external dso_local global double, align 8
@R_0 = external dso_local global double, align 8
@R_0_Offset_Frict = external dso_local global double, align 8
@R_0_Shill = external dso_local global double, align 8
@Slope_Rep = external dso_local global double, align 8
@Slope_Frict = external dso_local global double, align 8
@Acc_Frict = external dso_local global double, align 8
@Slope_Shill = external dso_local global double, align 8
@V_Shill = external dso_local global double, align 8
@Acc_Shill = external dso_local global double, align 8
@ArenaRadius = external dso_local global double, align 8
@C_Frict = external dso_local global double, align 8
@ArenaCenterX = external dso_local global double, align 8
@ArenaCenterY = external dso_local global double, align 8
@ArenaShape = external dso_local global double, align 8
@Dim = external dso_local global double, align 8
@Arenas = external dso_local global %struct.arenas_t, align 8
@obstacles = external dso_local global %struct.obstacles_t, align 8
@CalculatePreferredVelocity.ArenaVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.ObstacleVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.PotentialVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.SlipVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.ActualNeighboursCoordinates = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.ActualNeighboursVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.DifferenceVector = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.DistanceFromObstVect = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.NormalizedAgentsVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.CutOffMode = external hidden global i8, align 1

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @Shill_Obstacle_LinSqrt(ptr noundef, ptr noundef, ptr noundef, double noundef, double noundef, double noundef, double noundef, i32 noundef) #2

declare double @VectAbs(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @CalculatePreferredVelocity(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, double noundef %6, double noundef %7, ptr noundef %8) #2 {
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store i32 %3, ptr %13, align 4, !tbaa !9
  store ptr %4, ptr %14, align 8, !tbaa !5
  store ptr %5, ptr %15, align 8, !tbaa !5
  store double %6, ptr %16, align 8, !tbaa !11
  store double %7, ptr %17, align 8, !tbaa !11
  store ptr %8, ptr %18, align 8, !tbaa !5
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  call void @NullVect(ptr noundef %23, i32 noundef 3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.phase_t, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = load i32, ptr %13, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds ptr, ptr %26, i64 %28
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  store ptr %30, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.phase_t, ptr %31, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = load i32, ptr %13, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %33, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  store ptr %37, ptr %22, align 8, !tbaa !5
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.ArenaVelocity, i32 noundef 3)
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.ObstacleVelocity, i32 noundef 3)
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.PotentialVelocity, i32 noundef 3)
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.SlipVelocity, i32 noundef 3)
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.ActualNeighboursCoordinates, i32 noundef 3)
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.ActualNeighboursVelocity, i32 noundef 3)
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.DifferenceVector, i32 noundef 3)
  call void @NullVect(ptr noundef @CalculatePreferredVelocity.DistanceFromObstVect, i32 noundef 3)
  %38 = load ptr, ptr %22, align 8, !tbaa !5
  %39 = getelementptr inbounds double, ptr %38, i64 0
  %40 = load double, ptr %39, align 8, !tbaa !11
  %41 = load ptr, ptr %22, align 8, !tbaa !5
  %42 = getelementptr inbounds double, ptr %41, i64 1
  %43 = load double, ptr %42, align 8, !tbaa !11
  %44 = load ptr, ptr %22, align 8, !tbaa !5
  %45 = getelementptr inbounds double, ptr %44, i64 2
  %46 = load double, ptr %45, align 8, !tbaa !11
  call void @FillVect(ptr noundef @CalculatePreferredVelocity.NormalizedAgentsVelocity, double noundef %40, double noundef %43, double noundef %46)
  call void @UnitVect(ptr noundef @CalculatePreferredVelocity.NormalizedAgentsVelocity, ptr noundef @CalculatePreferredVelocity.NormalizedAgentsVelocity)
  %47 = load double, ptr @V_Flock, align 8, !tbaa !11
  %48 = load double, ptr @Dim, align 8, !tbaa !11
  %49 = fptosi double %48 to i32
  call void @MultiplicateWithScalar(ptr noundef @CalculatePreferredVelocity.NormalizedAgentsVelocity, ptr noundef @CalculatePreferredVelocity.NormalizedAgentsVelocity, double noundef %47, i32 noundef %49)
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = load double, ptr @V_Rep, align 8, !tbaa !11
  %52 = load double, ptr @Slope_Rep, align 8, !tbaa !11
  %53 = load double, ptr @R_0, align 8, !tbaa !11
  %54 = load i32, ptr %13, align 4, !tbaa !9
  %55 = load double, ptr @Dim, align 8, !tbaa !11
  %56 = fptosi double %55 to i32
  call void @RepulsionLin(ptr noundef @CalculatePreferredVelocity.PotentialVelocity, ptr noundef %50, double noundef %51, double noundef %52, double noundef %53, i32 noundef %54, i32 noundef %56, i1 noundef zeroext false)
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = load double, ptr @C_Frict, align 8, !tbaa !11
  %59 = load double, ptr @V_Frict, align 8, !tbaa !11
  %60 = load double, ptr @Acc_Frict, align 8, !tbaa !11
  %61 = load double, ptr @Slope_Frict, align 8, !tbaa !11
  %62 = load double, ptr @R_0, align 8, !tbaa !11
  %63 = load double, ptr @R_0_Offset_Frict, align 8, !tbaa !11
  %64 = fadd double %62, %63
  %65 = load i32, ptr %13, align 4, !tbaa !9
  %66 = load double, ptr @Dim, align 8, !tbaa !11
  %67 = fptosi double %66 to i32
  call void @FrictionLinSqrt(ptr noundef @CalculatePreferredVelocity.SlipVelocity, ptr noundef %57, double noundef %58, double noundef %59, double noundef %60, double noundef %61, double noundef %64, i32 noundef %65, i32 noundef %67)
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = load double, ptr @ArenaCenterX, align 8, !tbaa !11
  %70 = load double, ptr @ArenaCenterY, align 8, !tbaa !11
  %71 = load double, ptr @ArenaRadius, align 8, !tbaa !11
  %72 = load double, ptr @ArenaShape, align 8, !tbaa !11
  %73 = fptosi double %72 to i32
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [32 x %struct.arena_t], ptr @Arenas, i64 0, i64 %74
  %76 = load double, ptr @V_Shill, align 8, !tbaa !11
  %77 = load double, ptr @R_0_Shill, align 8, !tbaa !11
  %78 = load double, ptr @Acc_Shill, align 8, !tbaa !11
  %79 = load double, ptr @Slope_Shill, align 8, !tbaa !11
  %80 = load i32, ptr %13, align 4, !tbaa !9
  %81 = load double, ptr @Dim, align 8, !tbaa !11
  %82 = fptosi double %81 to i32
  call void @Shill_Wall_LinSqrt(ptr noundef @CalculatePreferredVelocity.ArenaVelocity, ptr noundef %68, double noundef %69, double noundef %70, double noundef %71, ptr noundef %75, double noundef %76, double noundef %77, double noundef %78, double noundef %79, i32 noundef %80, i32 noundef %82)
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %97, %9
  %84 = load i32, ptr %19, align 4, !tbaa !9
  %85 = load i32, ptr getelementptr inbounds (%struct.obstacles_t, ptr @obstacles, i32 0, i32 1), align 8, !tbaa !16
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %100

87:                                               ; preds = %83
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = load i32, ptr %19, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [32 x %struct.obstacle_t], ptr @obstacles, i64 0, i64 %90
  %92 = load double, ptr @V_Shill, align 8, !tbaa !11
  %93 = load double, ptr @R_0_Shill, align 8, !tbaa !11
  %94 = load double, ptr @Acc_Shill, align 8, !tbaa !11
  %95 = load double, ptr @Slope_Shill, align 8, !tbaa !11
  %96 = load i32, ptr %13, align 4, !tbaa !9
  call void @Shill_Obstacle_LinSqrt(ptr noundef @CalculatePreferredVelocity.ObstacleVelocity, ptr noundef %88, ptr noundef %91, double noundef %92, double noundef %93, double noundef %94, double noundef %95, i32 noundef %96)
  br label %97

97:                                               ; preds = %87
  %98 = load i32, ptr %19, align 4, !tbaa !9
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %19, align 4, !tbaa !9
  br label %83, !llvm.loop !18

100:                                              ; preds = %83
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  call void @VectSum(ptr noundef %101, ptr noundef %102, ptr noundef @CalculatePreferredVelocity.NormalizedAgentsVelocity)
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  call void @VectSum(ptr noundef %103, ptr noundef %104, ptr noundef @CalculatePreferredVelocity.PotentialVelocity)
  %105 = load ptr, ptr %10, align 8, !tbaa !5
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  call void @VectSum(ptr noundef %105, ptr noundef %106, ptr noundef @CalculatePreferredVelocity.SlipVelocity)
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  call void @VectSum(ptr noundef %107, ptr noundef %108, ptr noundef @CalculatePreferredVelocity.ArenaVelocity)
  %109 = load ptr, ptr %10, align 8, !tbaa !5
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  call void @VectSum(ptr noundef %109, ptr noundef %110, ptr noundef @CalculatePreferredVelocity.ObstacleVelocity)
  %111 = load i8, ptr @CalculatePreferredVelocity.CutOffMode, align 1, !tbaa !20, !range !22, !noundef !23
  %112 = trunc i8 %111 to i1
  %113 = zext i1 %112 to i32
  %114 = icmp eq i32 0, %113
  br i1 %114, label %115, label %123

115:                                              ; preds = %100
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = load ptr, ptr %10, align 8, !tbaa !5
  call void @UnitVect(ptr noundef %116, ptr noundef %117)
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = load double, ptr @V_Flock, align 8, !tbaa !11
  %121 = load double, ptr @Dim, align 8, !tbaa !11
  %122 = fptosi double %121 to i32
  call void @MultiplicateWithScalar(ptr noundef %118, ptr noundef %119, double noundef %120, i32 noundef %122)
  br label %137

123:                                              ; preds = %100
  %124 = load ptr, ptr %10, align 8, !tbaa !5
  %125 = call double @VectAbs(ptr noundef %124)
  %126 = load double, ptr @V_Max, align 8, !tbaa !11
  %127 = fcmp ogt double %125, %126
  br i1 %127, label %128, label %136

128:                                              ; preds = %123
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  call void @UnitVect(ptr noundef %129, ptr noundef %130)
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  %133 = load double, ptr @V_Max, align 8, !tbaa !11
  %134 = load double, ptr @Dim, align 8, !tbaa !11
  %135 = fptosi double %134 to i32
  call void @MultiplicateWithScalar(ptr noundef %131, ptr noundef %132, double noundef %133, i32 noundef %135)
  br label %136

136:                                              ; preds = %128, %123
  br label %137

137:                                              ; preds = %136, %115
  %138 = load double, ptr @Dim, align 8, !tbaa !11
  %139 = fcmp oeq double 2.000000e+00, %138
  br i1 %139, label %140, label %143

140:                                              ; preds = %137
  %141 = load ptr, ptr %10, align 8, !tbaa !5
  %142 = getelementptr inbounds double, ptr %141, i64 2
  store double 0.000000e+00, ptr %142, align 8, !tbaa !11
  br label %143

143:                                              ; preds = %140, %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  ret void
}

declare void @NullVect(ptr noundef, i32 noundef) #1

declare void @RepulsionLin(ptr noundef, ptr noundef, double noundef, double noundef, double noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #1

declare void @FrictionLinSqrt(ptr noundef, ptr noundef, double noundef, double noundef, double noundef, double noundef, double noundef, i32 noundef, i32 noundef) #1

declare void @Shill_Wall_LinSqrt(ptr noundef, ptr noundef, double noundef, double noundef, double noundef, ptr noundef, double noundef, double noundef, double noundef, double noundef, i32 noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36}
!15 = !{!14, !6, i64 8}
!16 = !{!17, !10, i64 9472}
!17 = !{!"", !7, i64 0, !10, i64 9472}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !21, i64 0}
!21 = !{!"_Bool", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}


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

%struct.arenas_t = type { [32 x %struct.arena_t], i32 }
%struct.arena_t = type { i32, [32 x i8], [128 x [3 x double]], i32 }
%struct.obstacles_t = type { [32 x %struct.obstacle_t], i32 }
%struct.obstacle_t = type { [32 x i8], [10 x [3 x double]], [2 x double], i32 }

@V_Flock = external dso_local local_unnamed_addr global double, align 8
@V_Rep = external dso_local local_unnamed_addr global double, align 8
@V_Frict = external dso_local local_unnamed_addr global double, align 8
@V_Max = external dso_local local_unnamed_addr global double, align 8
@R_0 = external dso_local local_unnamed_addr global double, align 8
@R_0_Offset_Frict = external dso_local local_unnamed_addr global double, align 8
@R_0_Shill = external dso_local local_unnamed_addr global double, align 8
@Slope_Rep = external dso_local local_unnamed_addr global double, align 8
@Slope_Frict = external dso_local local_unnamed_addr global double, align 8
@Acc_Frict = external dso_local local_unnamed_addr global double, align 8
@Slope_Shill = external dso_local local_unnamed_addr global double, align 8
@V_Shill = external dso_local local_unnamed_addr global double, align 8
@Acc_Shill = external dso_local local_unnamed_addr global double, align 8
@ArenaRadius = external dso_local local_unnamed_addr global double, align 8
@C_Frict = external dso_local local_unnamed_addr global double, align 8
@ArenaCenterX = external dso_local local_unnamed_addr global double, align 8
@ArenaCenterY = external dso_local local_unnamed_addr global double, align 8
@ArenaShape = external dso_local local_unnamed_addr global double, align 8
@Dim = external dso_local local_unnamed_addr global double, align 8
@Arenas = external dso_local global %struct.arenas_t, align 8
@obstacles = external dso_local global %struct.obstacles_t, align 8
@CalculatePreferredVelocity.ArenaVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.ObstacleVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.PotentialVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.SlipVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.ActualNeighboursCoordinates = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.ActualNeighboursVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.DifferenceVector = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.DistanceFromObstVect = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.NormalizedAgentsVelocity = external hidden global [3 x double], align 16
@CalculatePreferredVelocity.CutOffMode = external hidden local_unnamed_addr global i8, align 1

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @Shill_Obstacle_LinSqrt(ptr noundef, ptr noundef, ptr noundef, double noundef, double noundef, double noundef, double noundef, i32 noundef) local_unnamed_addr #1

declare double @VectAbs(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @CalculatePreferredVelocity(ptr noundef %0, ptr nocapture noundef readnone %1, ptr noundef %2, i32 noundef %3, ptr nocapture noundef readnone %4, ptr nocapture noundef readnone %5, double noundef %6, double noundef %7, ptr nocapture noundef readnone %8) local_unnamed_addr #1 {
  tail call void @NullVect(ptr noundef %0, i32 noundef 3) #2
  %10 = sext i32 %3 to i64
  %11 = getelementptr inbounds i8, ptr %2, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds ptr, ptr %12, i64 %10
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.ArenaVelocity, i32 noundef 3) #2
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.ObstacleVelocity, i32 noundef 3) #2
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.PotentialVelocity, i32 noundef 3) #2
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.SlipVelocity, i32 noundef 3) #2
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.ActualNeighboursCoordinates, i32 noundef 3) #2
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.ActualNeighboursVelocity, i32 noundef 3) #2
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.DifferenceVector, i32 noundef 3) #2
  tail call void @NullVect(ptr noundef nonnull @CalculatePreferredVelocity.DistanceFromObstVect, i32 noundef 3) #2
  %15 = load double, ptr %14, align 8, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %14, i64 8
  %17 = load double, ptr %16, align 8, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %14, i64 16
  %19 = load double, ptr %18, align 8, !tbaa !12
  tail call void @FillVect(ptr noundef nonnull @CalculatePreferredVelocity.NormalizedAgentsVelocity, double noundef %15, double noundef %17, double noundef %19) #2
  tail call void @UnitVect(ptr noundef nonnull @CalculatePreferredVelocity.NormalizedAgentsVelocity, ptr noundef nonnull @CalculatePreferredVelocity.NormalizedAgentsVelocity) #2
  %20 = load double, ptr @V_Flock, align 8, !tbaa !12
  %21 = load double, ptr @Dim, align 8, !tbaa !12
  %22 = fptosi double %21 to i32
  tail call void @MultiplicateWithScalar(ptr noundef nonnull @CalculatePreferredVelocity.NormalizedAgentsVelocity, ptr noundef nonnull @CalculatePreferredVelocity.NormalizedAgentsVelocity, double noundef %20, i32 noundef %22) #2
  %23 = load double, ptr @V_Rep, align 8, !tbaa !12
  %24 = load double, ptr @Slope_Rep, align 8, !tbaa !12
  %25 = load double, ptr @R_0, align 8, !tbaa !12
  %26 = load double, ptr @Dim, align 8, !tbaa !12
  %27 = fptosi double %26 to i32
  tail call void @RepulsionLin(ptr noundef nonnull @CalculatePreferredVelocity.PotentialVelocity, ptr noundef %2, double noundef %23, double noundef %24, double noundef %25, i32 noundef %3, i32 noundef %27, i1 noundef zeroext false) #2
  %28 = load double, ptr @C_Frict, align 8, !tbaa !12
  %29 = load double, ptr @V_Frict, align 8, !tbaa !12
  %30 = load double, ptr @Acc_Frict, align 8, !tbaa !12
  %31 = load double, ptr @Slope_Frict, align 8, !tbaa !12
  %32 = load double, ptr @R_0, align 8, !tbaa !12
  %33 = load double, ptr @R_0_Offset_Frict, align 8, !tbaa !12
  %34 = fadd double %32, %33
  %35 = load double, ptr @Dim, align 8, !tbaa !12
  %36 = fptosi double %35 to i32
  tail call void @FrictionLinSqrt(ptr noundef nonnull @CalculatePreferredVelocity.SlipVelocity, ptr noundef %2, double noundef %28, double noundef %29, double noundef %30, double noundef %31, double noundef %34, i32 noundef %3, i32 noundef %36) #2
  %37 = load double, ptr @ArenaCenterX, align 8, !tbaa !12
  %38 = load double, ptr @ArenaCenterY, align 8, !tbaa !12
  %39 = load double, ptr @ArenaRadius, align 8, !tbaa !12
  %40 = load double, ptr @ArenaShape, align 8, !tbaa !12
  %41 = fptosi double %40 to i32
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [32 x %struct.arena_t], ptr @Arenas, i64 0, i64 %42
  %44 = load double, ptr @V_Shill, align 8, !tbaa !12
  %45 = load double, ptr @R_0_Shill, align 8, !tbaa !12
  %46 = load double, ptr @Acc_Shill, align 8, !tbaa !12
  %47 = load double, ptr @Slope_Shill, align 8, !tbaa !12
  %48 = load double, ptr @Dim, align 8, !tbaa !12
  %49 = fptosi double %48 to i32
  tail call void @Shill_Wall_LinSqrt(ptr noundef nonnull @CalculatePreferredVelocity.ArenaVelocity, ptr noundef %2, double noundef %37, double noundef %38, double noundef %39, ptr noundef nonnull %43, double noundef %44, double noundef %45, double noundef %46, double noundef %47, i32 noundef %3, i32 noundef %49) #2
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @obstacles, i64 9472), align 8, !tbaa !14
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %9, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %9 ]
  %52 = getelementptr inbounds [32 x %struct.obstacle_t], ptr @obstacles, i64 0, i64 %indvars.iv
  %53 = load double, ptr @V_Shill, align 8, !tbaa !12
  %54 = load double, ptr @R_0_Shill, align 8, !tbaa !12
  %55 = load double, ptr @Acc_Shill, align 8, !tbaa !12
  %56 = load double, ptr @Slope_Shill, align 8, !tbaa !12
  tail call void @Shill_Obstacle_LinSqrt(ptr noundef nonnull @CalculatePreferredVelocity.ObstacleVelocity, ptr noundef %2, ptr noundef nonnull %52, double noundef %53, double noundef %54, double noundef %55, double noundef %56, i32 noundef %3)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @obstacles, i64 9472), align 8, !tbaa !14
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next, %58
  br i1 %59, label %.lr.ph, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %9
  tail call void @VectSum(ptr noundef %0, ptr noundef %0, ptr noundef nonnull @CalculatePreferredVelocity.NormalizedAgentsVelocity) #2
  tail call void @VectSum(ptr noundef %0, ptr noundef %0, ptr noundef nonnull @CalculatePreferredVelocity.PotentialVelocity) #2
  tail call void @VectSum(ptr noundef %0, ptr noundef %0, ptr noundef nonnull @CalculatePreferredVelocity.SlipVelocity) #2
  tail call void @VectSum(ptr noundef %0, ptr noundef %0, ptr noundef nonnull @CalculatePreferredVelocity.ArenaVelocity) #2
  tail call void @VectSum(ptr noundef %0, ptr noundef %0, ptr noundef nonnull @CalculatePreferredVelocity.ObstacleVelocity) #2
  %60 = load i8, ptr @CalculatePreferredVelocity.CutOffMode, align 1, !tbaa !18, !range !20, !noundef !21
  %61 = icmp eq i8 %60, 0
  br i1 %61, label %.sink.split, label %62

62:                                               ; preds = %._crit_edge
  %63 = tail call double @VectAbs(ptr noundef %0) #2
  %64 = load double, ptr @V_Max, align 8, !tbaa !12
  %65 = fcmp ogt double %63, %64
  br i1 %65, label %.sink.split, label %69

.sink.split:                                      ; preds = %62, %._crit_edge
  %V_Max.sink = phi ptr [ @V_Flock, %._crit_edge ], [ @V_Max, %62 ]
  tail call void @UnitVect(ptr noundef %0, ptr noundef %0) #2
  %66 = load double, ptr %V_Max.sink, align 8, !tbaa !12
  %67 = load double, ptr @Dim, align 8, !tbaa !12
  %68 = fptosi double %67 to i32
  tail call void @MultiplicateWithScalar(ptr noundef %0, ptr noundef %0, double noundef %66, i32 noundef %68) #2
  br label %69

69:                                               ; preds = %.sink.split, %62
  %70 = load double, ptr @Dim, align 8, !tbaa !12
  %71 = fcmp oeq double %70, 2.000000e+00
  br i1 %71, label %72, label %74

72:                                               ; preds = %69
  %73 = getelementptr inbounds i8, ptr %0, i64 16
  store double 0.000000e+00, ptr %73, align 8, !tbaa !12
  br label %74

74:                                               ; preds = %72, %69
  ret void
}

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

declare void @RepulsionLin(ptr noundef, ptr noundef, double noundef, double noundef, double noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #0

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

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

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 8}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!15, !10, i64 9472}
!15 = !{!"", !8, i64 0, !10, i64 9472}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !19, i64 0}
!19 = !{!"_Bool", !8, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}


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