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

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@PlaceAgentsInsideASphere.MaxStep = external hidden global i32, align 4
@PlaceAgentsInsideASphere.RandomPlaceVector = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.ActualAgentsVelocity = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.AgentjsCoords = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.DiffCoords = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.temp = external hidden global double, align 8
@PlaceAgentsInsideASphere.Phi = external hidden global double, align 8
@PlaceAgentsInsideASphere.Theta = external hidden global double, align 8
@PlaceAgentsInsideASphere.isArrangementCorrect = 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

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

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

declare double @VectAbs(ptr noundef) #3

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

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

declare double @randomizeDouble(double noundef, double noundef) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

; Function Attrs: nounwind
declare double @cos(double noundef) #4

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

; Function Attrs: nounwind
declare double @sin(double noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @PlaceAgentsInsideASphere(ptr noundef %0, double noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7) #1 {
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store double %1, ptr %10, align 8, !tbaa !9
  store i32 %2, ptr %11, align 4, !tbaa !11
  store i32 %3, ptr %12, align 4, !tbaa !11
  store double %4, ptr %13, align 8, !tbaa !9
  store double %5, ptr %14, align 8, !tbaa !9
  store double %6, ptr %15, align 8, !tbaa !9
  store double %7, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.phase_t, ptr %20, i32 0, i32 5
  %22 = load i32, ptr %21, align 4, !tbaa !13
  %23 = mul nsw i32 100, %22
  store i32 %23, ptr @PlaceAgentsInsideASphere.MaxStep, align 4, !tbaa !11
  store i8 0, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !15
  %24 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %24, ptr %17, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %34, %8
  %26 = load i32, ptr %17, align 4, !tbaa !11
  %27 = load i32, ptr %12, align 4, !tbaa !11
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %29, label %37

29:                                               ; preds = %25
  call void @FillVect(ptr noundef @PlaceAgentsInsideASphere.RandomPlaceVector, double noundef 2.000000e+22, double noundef 2.000000e+22, double noundef 2.000000e+22)
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = load i32, ptr %17, align 4, !tbaa !11
  call void @InsertAgentsCoordinates(ptr noundef %30, ptr noundef @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef %31)
  call void @NullVect(ptr noundef @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef 3)
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load i32, ptr %17, align 4, !tbaa !11
  call void @InsertAgentsVelocity(ptr noundef %32, ptr noundef @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef %33)
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %17, align 4, !tbaa !11
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %17, align 4, !tbaa !11
  br label %25, !llvm.loop !17

37:                                               ; preds = %25
  call void @NullVect(ptr noundef @PlaceAgentsInsideASphere.ActualAgentsVelocity, i32 noundef 3)
  store i32 0, ptr %19, align 4, !tbaa !11
  %38 = load i32, ptr %11, align 4, !tbaa !11
  store i32 %38, ptr %17, align 4, !tbaa !11
  br label %39

39:                                               ; preds = %114, %37
  %40 = load i32, ptr %17, align 4, !tbaa !11
  %41 = load i32, ptr %12, align 4, !tbaa !11
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %43, label %117

43:                                               ; preds = %39
  br label %44

44:                                               ; preds = %108, %43
  %45 = load i8, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !15, !range !19, !noundef !20
  %46 = trunc i8 %45 to i1
  %47 = zext i1 %46 to i32
  %48 = icmp eq i32 0, %47
  br i1 %48, label %49, label %109

49:                                               ; preds = %44
  store i8 1, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !15
  %50 = call double @randomizeDouble(double noundef 0.000000e+00, double noundef 0x401921FB54442D18)
  store double %50, ptr @PlaceAgentsInsideASphere.Phi, align 8, !tbaa !9
  %51 = call double @randomizeDouble(double noundef 0.000000e+00, double noundef 0x400921FB54442D18)
  store double %51, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !9
  %52 = load double, ptr %10, align 8, !tbaa !9
  %53 = call double @randomizeDouble(double noundef 0.000000e+00, double noundef %52)
  store double %53, ptr @PlaceAgentsInsideASphere.temp, align 8, !tbaa !9
  %54 = load double, ptr %13, align 8, !tbaa !9
  %55 = load double, ptr @PlaceAgentsInsideASphere.temp, align 8, !tbaa !9
  %56 = load double, ptr @PlaceAgentsInsideASphere.Phi, align 8, !tbaa !9
  %57 = call double @cos(double noundef %56) #6
  %58 = fmul double %55, %57
  %59 = load double, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !9
  %60 = call double @sin(double noundef %59) #6
  %61 = call double @llvm.fmuladd.f64(double %58, double %60, double %54)
  store double %61, ptr @PlaceAgentsInsideASphere.RandomPlaceVector, align 16, !tbaa !9
  %62 = load double, ptr %14, align 8, !tbaa !9
  %63 = load double, ptr @PlaceAgentsInsideASphere.temp, align 8, !tbaa !9
  %64 = load double, ptr @PlaceAgentsInsideASphere.Phi, align 8, !tbaa !9
  %65 = call double @sin(double noundef %64) #6
  %66 = fmul double %63, %65
  %67 = load double, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !9
  %68 = call double @sin(double noundef %67) #6
  %69 = call double @llvm.fmuladd.f64(double %66, double %68, double %62)
  store double %69, ptr getelementptr inbounds ([3 x double], ptr @PlaceAgentsInsideASphere.RandomPlaceVector, i64 0, i64 1), align 8, !tbaa !9
  %70 = load double, ptr %15, align 8, !tbaa !9
  %71 = load double, ptr @PlaceAgentsInsideASphere.temp, align 8, !tbaa !9
  %72 = load double, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !9
  %73 = call double @cos(double noundef %72) #6
  %74 = call double @llvm.fmuladd.f64(double %71, double %73, double %70)
  store double %74, ptr getelementptr inbounds ([3 x double], ptr @PlaceAgentsInsideASphere.RandomPlaceVector, i64 0, i64 2), align 16, !tbaa !9
  store i32 0, ptr %18, align 4, !tbaa !11
  br label %75

75:                                               ; preds = %96, %49
  %76 = load i32, ptr %18, align 4, !tbaa !11
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.phase_t, ptr %77, i32 0, i32 5
  %79 = load i32, ptr %78, align 4, !tbaa !13
  %80 = icmp slt i32 %76, %79
  br i1 %80, label %81, label %99

81:                                               ; preds = %75
  %82 = load i32, ptr %17, align 4, !tbaa !11
  %83 = load i32, ptr %18, align 4, !tbaa !11
  %84 = icmp eq i32 %82, %83
  br i1 %84, label %85, label %88

85:                                               ; preds = %81
  %86 = load i32, ptr %12, align 4, !tbaa !11
  %87 = sub nsw i32 %86, 1
  store i32 %87, ptr %18, align 4, !tbaa !11
  br label %96

88:                                               ; preds = %81
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = load i32, ptr %18, align 4, !tbaa !11
  call void @GetAgentsCoordinates(ptr noundef @PlaceAgentsInsideASphere.AgentjsCoords, ptr noundef %89, i32 noundef %90)
  call void @VectDifference(ptr noundef @PlaceAgentsInsideASphere.DiffCoords, ptr noundef @PlaceAgentsInsideASphere.AgentjsCoords, ptr noundef @PlaceAgentsInsideASphere.RandomPlaceVector)
  %91 = call double @VectAbs(ptr noundef @PlaceAgentsInsideASphere.DiffCoords)
  %92 = load double, ptr %16, align 8, !tbaa !9
  %93 = fcmp ole double %91, %92
  br i1 %93, label %94, label %95

94:                                               ; preds = %88
  store i8 0, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !15
  br label %95

95:                                               ; preds = %94, %88
  br label %96

96:                                               ; preds = %95, %85
  %97 = load i32, ptr %18, align 4, !tbaa !11
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %18, align 4, !tbaa !11
  br label %75, !llvm.loop !21

99:                                               ; preds = %75
  %100 = load i32, ptr %19, align 4, !tbaa !11
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %19, align 4, !tbaa !11
  %102 = load i32, ptr %19, align 4, !tbaa !11
  %103 = load i32, ptr @PlaceAgentsInsideASphere.MaxStep, align 4, !tbaa !11
  %104 = icmp sgt i32 %102, %103
  br i1 %104, label %105, label %108

105:                                              ; preds = %99
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.1) #6
  call void @exit(i32 noundef -1) #7
  unreachable

108:                                              ; preds = %99
  br label %44, !llvm.loop !22

109:                                              ; preds = %44
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = load i32, ptr %17, align 4, !tbaa !11
  call void @InsertAgentsVelocity(ptr noundef %110, ptr noundef @PlaceAgentsInsideASphere.ActualAgentsVelocity, i32 noundef %111)
  %112 = load ptr, ptr %9, align 8, !tbaa !5
  %113 = load i32, ptr %17, align 4, !tbaa !11
  call void @InsertAgentsCoordinates(ptr noundef %112, ptr noundef @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef %113)
  store i8 0, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !15
  br label %114

114:                                              ; preds = %109
  %115 = load i32, ptr %17, align 4, !tbaa !11
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %17, align 4, !tbaa !11
  br label %39, !llvm.loop !23

117:                                              ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  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 = { noreturn 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 #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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { noreturn 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 36}
!14 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !12, i64 32, !12, i64 36}
!15 = !{!16, !16, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1
@PlaceAgentsInsideASphere.MaxStep = external hidden local_unnamed_addr global i32, align 4
@PlaceAgentsInsideASphere.RandomPlaceVector = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.ActualAgentsVelocity = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.AgentjsCoords = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.DiffCoords = external hidden global [3 x double], align 16
@PlaceAgentsInsideASphere.temp = external hidden local_unnamed_addr global double, align 8
@PlaceAgentsInsideASphere.Phi = external hidden local_unnamed_addr global double, align 8
@PlaceAgentsInsideASphere.Theta = external hidden local_unnamed_addr global double, align 8
@PlaceAgentsInsideASphere.isArrangementCorrect = external hidden local_unnamed_addr global i8, align 1

; Function Attrs: nounwind uwtable
declare dso_local void @InsertAgentsVelocity(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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

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

declare double @VectAbs(ptr noundef) local_unnamed_addr #2

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

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

declare double @randomizeDouble(double noundef, double noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #3

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @PlaceAgentsInsideASphere(ptr noundef %0, double noundef %1, i32 noundef %2, i32 noundef %3, double noundef %4, double noundef %5, double noundef %6, double noundef %7) local_unnamed_addr #0 {
  %9 = getelementptr inbounds i8, ptr %0, i64 36
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = mul nsw i32 %10, 100
  store i32 %11, ptr @PlaceAgentsInsideASphere.MaxStep, align 4, !tbaa !11
  store i8 0, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !12
  %12 = icmp slt i32 %2, %3
  br i1 %12, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %8
  tail call void @NullVect(ptr noundef nonnull @PlaceAgentsInsideASphere.ActualAgentsVelocity, i32 noundef 3) #6
  br label %._crit_edge45

.lr.ph:                                           ; preds = %8, %.lr.ph
  %.03338 = phi i32 [ %13, %.lr.ph ], [ %2, %8 ]
  tail call void @FillVect(ptr noundef nonnull @PlaceAgentsInsideASphere.RandomPlaceVector, double noundef 2.000000e+22, double noundef 2.000000e+22, double noundef 2.000000e+22) #6
  tail call void @InsertAgentsCoordinates(ptr noundef %0, ptr noundef nonnull @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef %.03338)
  tail call void @NullVect(ptr noundef nonnull @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef 3) #6
  tail call void @InsertAgentsVelocity(ptr noundef %0, ptr noundef nonnull @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef %.03338)
  %13 = add i32 %.03338, 1
  %exitcond.not = icmp eq i32 %13, %3
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph
  tail call void @NullVect(ptr noundef nonnull @PlaceAgentsInsideASphere.ActualAgentsVelocity, i32 noundef 3) #6
  br i1 %12, label %.preheader.lr.ph, label %._crit_edge45

.preheader.lr.ph:                                 ; preds = %._crit_edge
  %14 = add nsw i32 %3, -1
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %55
  %.044 = phi i32 [ 0, %.preheader.lr.ph ], [ %.1, %55 ]
  %.13443 = phi i32 [ %2, %.preheader.lr.ph ], [ %56, %55 ]
  br label %15

15:                                               ; preds = %.preheader, %._crit_edge42
  %.1 = phi i32 [ %50, %._crit_edge42 ], [ %.044, %.preheader ]
  %16 = load i8, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !12, !range !16, !noundef !17
  %17 = icmp eq i8 %16, 0
  br i1 %17, label %18, label %55

18:                                               ; preds = %15
  store i8 1, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !12
  %19 = tail call double @randomizeDouble(double noundef 0.000000e+00, double noundef 0x401921FB54442D18) #6
  store double %19, ptr @PlaceAgentsInsideASphere.Phi, align 8, !tbaa !18
  %20 = tail call double @randomizeDouble(double noundef 0.000000e+00, double noundef 0x400921FB54442D18) #6
  store double %20, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !18
  %21 = tail call double @randomizeDouble(double noundef 0.000000e+00, double noundef %1) #6
  store double %21, ptr @PlaceAgentsInsideASphere.temp, align 8, !tbaa !18
  %22 = load double, ptr @PlaceAgentsInsideASphere.Phi, align 8, !tbaa !18
  %23 = tail call double @cos(double noundef %22) #6
  %24 = fmul double %21, %23
  %25 = load double, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !18
  %26 = tail call double @sin(double noundef %25) #6
  %27 = tail call double @llvm.fmuladd.f64(double %24, double %26, double %4)
  store double %27, ptr @PlaceAgentsInsideASphere.RandomPlaceVector, align 16, !tbaa !18
  %28 = load double, ptr @PlaceAgentsInsideASphere.temp, align 8, !tbaa !18
  %29 = load double, ptr @PlaceAgentsInsideASphere.Phi, align 8, !tbaa !18
  %30 = tail call double @sin(double noundef %29) #6
  %31 = fmul double %28, %30
  %32 = load double, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !18
  %33 = tail call double @sin(double noundef %32) #6
  %34 = tail call double @llvm.fmuladd.f64(double %31, double %33, double %5)
  store double %34, ptr getelementptr inbounds (i8, ptr @PlaceAgentsInsideASphere.RandomPlaceVector, i64 8), align 8, !tbaa !18
  %35 = load double, ptr @PlaceAgentsInsideASphere.temp, align 8, !tbaa !18
  %36 = load double, ptr @PlaceAgentsInsideASphere.Theta, align 8, !tbaa !18
  %37 = tail call double @cos(double noundef %36) #6
  %38 = tail call double @llvm.fmuladd.f64(double %35, double %37, double %6)
  store double %38, ptr getelementptr inbounds (i8, ptr @PlaceAgentsInsideASphere.RandomPlaceVector, i64 16), align 16, !tbaa !18
  %39 = load i32, ptr %9, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph41, label %._crit_edge42

.lr.ph41:                                         ; preds = %18, %46
  %.03139 = phi i32 [ %47, %46 ], [ 0, %18 ]
  %41 = icmp eq i32 %.13443, %.03139
  br i1 %41, label %46, label %42

42:                                               ; preds = %.lr.ph41
  tail call void @GetAgentsCoordinates(ptr noundef nonnull @PlaceAgentsInsideASphere.AgentjsCoords, ptr noundef nonnull %0, i32 noundef %.03139)
  tail call void @VectDifference(ptr noundef nonnull @PlaceAgentsInsideASphere.DiffCoords, ptr noundef nonnull @PlaceAgentsInsideASphere.AgentjsCoords, ptr noundef nonnull @PlaceAgentsInsideASphere.RandomPlaceVector) #6
  %43 = tail call double @VectAbs(ptr noundef nonnull @PlaceAgentsInsideASphere.DiffCoords) #6
  %44 = fcmp ugt double %43, %7
  br i1 %44, label %46, label %45

45:                                               ; preds = %42
  store i8 0, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !12
  br label %46

46:                                               ; preds = %.lr.ph41, %42, %45
  %.132 = phi i32 [ %.03139, %45 ], [ %.03139, %42 ], [ %14, %.lr.ph41 ]
  %47 = add nsw i32 %.132, 1
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %.lr.ph41, label %._crit_edge42, !llvm.loop !20

._crit_edge42:                                    ; preds = %46, %18
  %50 = add nsw i32 %.1, 1
  %51 = load i32, ptr @PlaceAgentsInsideASphere.MaxStep, align 4, !tbaa !11
  %.not = icmp slt i32 %.1, %51
  br i1 %.not, label %15, label %52, !llvm.loop !21

52:                                               ; preds = %._crit_edge42
  %53 = load ptr, ptr @stderr, align 8, !tbaa !22
  %54 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.1) #7
  tail call void @exit(i32 noundef -1) #8
  unreachable

55:                                               ; preds = %15
  tail call void @InsertAgentsVelocity(ptr noundef %0, ptr noundef nonnull @PlaceAgentsInsideASphere.ActualAgentsVelocity, i32 noundef %.13443)
  tail call void @InsertAgentsCoordinates(ptr noundef %0, ptr noundef nonnull @PlaceAgentsInsideASphere.RandomPlaceVector, i32 noundef %.13443)
  store i8 0, ptr @PlaceAgentsInsideASphere.isArrangementCorrect, align 1, !tbaa !12
  %56 = add i32 %.13443, 1
  %exitcond47.not = icmp eq i32 %56, %3
  br i1 %exitcond47.not, label %._crit_edge45, label %.preheader, !llvm.loop !23

._crit_edge45:                                    ; preds = %55, %._crit_edge.thread, %._crit_edge
  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 = { noreturn 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 #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 = { nofree 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 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { cold nounwind }
attributes #8 = { noreturn 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, !10, i64 36}
!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 = !{!10, !10, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !8, i64 0}
!20 = distinct !{!20, !15}
!21 = distinct !{!21, !15}
!22 = !{!7, !7, i64 0}
!23 = distinct !{!23, !15}


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