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

; 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.phase_t = type { ptr, ptr, ptr, ptr, i32, i32 }

@GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException = external hidden global i8, align 1
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.n = external hidden global i32, align 4
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.x = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.v = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn = external hidden global double, align 8
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.DistanceVector = 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
declare dso_local void @GetAgentsVelocity(ptr noundef, ptr noundef, i32 noundef) #1

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

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

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

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

declare void @RotateVectXY(ptr noundef, ptr noundef, double noundef) #2

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

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

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

declare double @VectAbsXY(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @GetAgentSpecificLocalAverageOfXYTangentialVelocity(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, double noundef %5) #1 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  store double %5, ptr %12, align 8, !tbaa !11
  store i8 0, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException, align 1, !tbaa !13
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  call void @NullVect(ptr noundef %15, i32 noundef 3)
  store i32 1, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = load i32, ptr %11, align 4, !tbaa !9
  call void @GetAgentsCoordinates(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x, ptr noundef %16, i32 noundef %17)
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = load i32, ptr %11, align 4, !tbaa !9
  call void @GetAgentsVelocity(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, ptr noundef %18, i32 noundef %19)
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  call void @VectDifference(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x, ptr noundef %20)
  call void @RotateVectXY(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, double noundef 0x3FF921FB54442D18)
  call void @UnitVect(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP)
  %21 = call double @ScalarProduct(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, i32 noundef 2)
  store double %21, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %81, %6
  %23 = load i32, ptr %14, align 4, !tbaa !9
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.phase_t, ptr %24, i32 0, i32 5
  %26 = load i32, ptr %25, align 4, !tbaa !15
  %27 = icmp slt i32 %23, %26
  br i1 %27, label %28, label %84

28:                                               ; preds = %22
  %29 = load i32, ptr %14, align 4, !tbaa !9
  %30 = load i32, ptr %11, align 4, !tbaa !9
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %28
  br label %81

33:                                               ; preds = %28
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %56, %33
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.phase_t, ptr %36, i32 0, i32 5
  %38 = load i32, ptr %37, align 4, !tbaa !15
  %39 = icmp slt i32 %35, %38
  br i1 %39, label %40, label %45

40:                                               ; preds = %34
  %41 = load i8, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException, align 1, !tbaa !13, !range !17, !noundef !18
  %42 = trunc i8 %41 to i1
  %43 = zext i1 %42 to i32
  %44 = icmp eq i32 %43, 0
  br label %45

45:                                               ; preds = %40, %34
  %46 = phi i1 [ false, %34 ], [ %44, %40 ]
  br i1 %46, label %47, label %59

47:                                               ; preds = %45
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = load i32, ptr %13, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %48, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = load i32, ptr %14, align 4, !tbaa !9
  %54 = icmp eq i32 %52, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %47
  store i8 1, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException, align 1, !tbaa !13
  br label %56

56:                                               ; preds = %55, %47
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %13, align 4, !tbaa !9
  br label %34, !llvm.loop !19

59:                                               ; preds = %45
  %60 = load i8, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException, align 1, !tbaa !13, !range !17, !noundef !18
  %61 = trunc i8 %60 to i1
  %62 = zext i1 %61 to i32
  %63 = icmp eq i32 1, %62
  br i1 %63, label %64, label %65

64:                                               ; preds = %59
  br label %81

65:                                               ; preds = %59
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = load i32, ptr %14, align 4, !tbaa !9
  call void @GetAgentsCoordinates(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour, ptr noundef %66, i32 noundef %67)
  call void @VectDifference(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.DistanceVector, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x)
  %68 = call double @VectAbsXY(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.DistanceVector)
  %69 = load double, ptr %12, align 8, !tbaa !11
  %70 = fcmp ole double %68, %69
  br i1 %70, label %71, label %80

71:                                               ; preds = %65
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = load i32, ptr %14, align 4, !tbaa !9
  call void @GetAgentsVelocity(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, ptr noundef %72, i32 noundef %73)
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  call void @VectDifference(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour, ptr noundef %74)
  call void @RotateVectXY(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, double noundef 0x3FF921FB54442D18)
  call void @UnitVect(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP)
  %75 = call double @ScalarProduct(ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP, ptr noundef @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, i32 noundef 2)
  %76 = load double, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  %77 = fadd double %76, %75
  store double %77, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  %78 = load i32, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %71, %65
  br label %81

81:                                               ; preds = %80, %64, %32
  %82 = load i32, ptr %14, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %14, align 4, !tbaa !9
  br label %22, !llvm.loop !21

84:                                               ; preds = %22
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = load double, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, align 16, !tbaa !11
  %87 = load double, ptr getelementptr inbounds ([3 x double], ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, i64 0, i64 1), align 8, !tbaa !11
  call void @FillVect(ptr noundef %85, double noundef %86, double noundef %87, double noundef 0.000000e+00)
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = load double, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  %91 = load i32, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  %92 = sitofp i32 %91 to double
  %93 = fdiv double %90, %92
  call void @MultiplicateWithScalar(ptr noundef %88, ptr noundef %89, double noundef %93, i32 noundef 2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  ret void
}

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 = { "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, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !10, i64 36}
!16 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !10, i64 36}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


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

@GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException = external hidden local_unnamed_addr global i8, align 1
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.n = external hidden local_unnamed_addr global i32, align 4
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.x = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.v = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn = external hidden local_unnamed_addr global double, align 8
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour = external hidden global [3 x double], align 16
@GetAgentSpecificLocalAverageOfXYTangentialVelocity.DistanceVector = external hidden global [3 x double], align 16

; Function Attrs: nounwind uwtable
declare dso_local void @GetAgentsVelocity(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @GetAgentsCoordinates(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

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

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

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

declare void @RotateVectXY(ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

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

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

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

declare double @VectAbsXY(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @GetAgentSpecificLocalAverageOfXYTangentialVelocity(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4, double noundef %5) local_unnamed_addr #0 {
  store i8 0, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException, align 1, !tbaa !5
  tail call void @NullVect(ptr noundef %0, i32 noundef 3) #2
  store i32 1, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  tail call void @GetAgentsCoordinates(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x, ptr noundef %1, i32 noundef %4)
  tail call void @GetAgentsVelocity(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, ptr noundef %1, i32 noundef %4)
  tail call void @VectDifference(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x, ptr noundef %2) #2
  tail call void @RotateVectXY(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, double noundef 0x3FF921FB54442D18) #2
  tail call void @UnitVect(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP) #2
  %7 = tail call double @ScalarProduct(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, i32 noundef 2) #2
  store double %7, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %1, i64 36
  %9 = load i32, ptr %8, align 4, !tbaa !13
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph29, label %._crit_edge30

.lr.ph29:                                         ; preds = %6, %32
  %11 = phi i32 [ %34, %32 ], [ %9, %6 ]
  %.027 = phi i32 [ %33, %32 ], [ 0, %6 ]
  %12 = icmp eq i32 %.027, %4
  br i1 %12, label %32, label %.preheader

.preheader:                                       ; preds = %.lr.ph29
  %GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException.promoted = load i8, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException, align 1
  %13 = icmp sgt i32 %11, 0
  %14 = icmp eq i8 %GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException.promoted, 0
  %15 = select i1 %13, i1 %14, i1 false
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader
  %16 = zext nneg i32 %11 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %20
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %20 ]
  %17 = getelementptr inbounds i32, ptr %3, i64 %indvars.iv
  %18 = load i32, ptr %17, align 4, !tbaa !9
  %19 = icmp ne i32 %18, %.027
  br i1 %19, label %20, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph
  store i8 1, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException, align 1, !tbaa !5
  br label %32

20:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = icmp ult i64 %indvars.iv.next, %16
  %22 = and i1 %21, %19
  br i1 %22, label %.lr.ph, label %._crit_edge.thread34, !llvm.loop !16

._crit_edge:                                      ; preds = %.preheader
  %23 = trunc nuw i8 %GetAgentSpecificLocalAverageOfXYTangentialVelocity.IsItAnException.promoted to i1
  br i1 %23, label %32, label %._crit_edge.thread34

._crit_edge.thread34:                             ; preds = %20, %._crit_edge
  tail call void @GetAgentsCoordinates(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour, ptr noundef %1, i32 noundef %.027)
  tail call void @VectDifference(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.DistanceVector, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x) #2
  %24 = tail call double @VectAbsXY(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.DistanceVector) #2
  %25 = fcmp ugt double %24, %5
  br i1 %25, label %32, label %26

26:                                               ; preds = %._crit_edge.thread34
  tail call void @GetAgentsVelocity(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, ptr noundef %1, i32 noundef %.027)
  tail call void @VectDifference(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.x_neighbour, ptr noundef %2) #2
  tail call void @RotateVectXY(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.to_ref, double noundef 0x3FF921FB54442D18) #2
  tail call void @UnitVect(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP) #2
  %27 = tail call double @ScalarProduct(ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_j_LAP, ptr noundef nonnull @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v, i32 noundef 2) #2
  %28 = load double, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  %29 = fadd double %27, %28
  store double %29, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  %30 = load i32, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %._crit_edge.thread, %._crit_edge.thread34, %26, %._crit_edge, %.lr.ph29
  %33 = add nuw nsw i32 %.027, 1
  %34 = load i32, ptr %8, align 4, !tbaa !13
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %.lr.ph29, label %._crit_edge30, !llvm.loop !18

._crit_edge30:                                    ; preds = %32, %6
  %36 = load double, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, align 16, !tbaa !11
  %37 = load double, ptr getelementptr inbounds (i8, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.v_i_LAP, i64 8), align 8, !tbaa !11
  tail call void @FillVect(ptr noundef %0, double noundef %36, double noundef %37, double noundef 0.000000e+00) #2
  %38 = load double, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.ProjectedMagn, align 8, !tbaa !11
  %39 = load i32, ptr @GetAgentSpecificLocalAverageOfXYTangentialVelocity.n, align 4, !tbaa !9
  %40 = sitofp i32 %39 to double
  %41 = fdiv double %38, %40
  tail call void @MultiplicateWithScalar(ptr noundef %0, ptr noundef %0, double noundef %41, i32 noundef 2) #2
  ret void
}

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 = { "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, !6, i64 0}
!6 = !{!"_Bool", !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, !10, i64 36}
!14 = !{!"", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !10, i64 32, !10, i64 36}
!15 = !{!"any pointer", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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