; LLVM IR from idmillington/cyclone-physics :: src (pcontacts)

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

%"class.cyclone::ParticleContactResolver" = type { i32, i32 }
%"class.cyclone::ParticleContact" = type { [2 x ptr], double, %"class.cyclone::Vector3", double, [2 x %"class.cyclone::Vector3"] }
%"class.cyclone::Vector3" = type { double, double, double, double }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cyclone15ParticleContact7resolveEd(ptr noundef nonnull align 8 dereferenceable(128), double noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK7cyclone15ParticleContact27calculateSeparatingVelocityEv(ptr noundef nonnull align 8 dereferenceable(128)) #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cyclone23ParticleContactResolver15resolveContactsEPNS_15ParticleContactEjd(ptr noundef nonnull align 4 dereferenceable(8) %0, ptr noundef %1, i32 noundef %2, double noundef %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store double %3, ptr %8, align 8, !tbaa !11
  %15 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %16 = getelementptr inbounds %"class.cyclone::ParticleContactResolver", ptr %15, i32 0, i32 1
  store i32 0, ptr %16, align 4, !tbaa !13
  br label %17

17:                                               ; preds = %227, %4
  %18 = getelementptr inbounds %"class.cyclone::ParticleContactResolver", ptr %15, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !13
  %20 = getelementptr inbounds %"class.cyclone::ParticleContactResolver", ptr %15, i32 0, i32 0
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = icmp ult i32 %19, %21
  br i1 %22, label %23, label %228

23:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store double 0x7FEFFFFFFFFFFFFF, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %24 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %24, ptr %11, align 4, !tbaa !9
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %53, %23
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = icmp ult i32 %26, %27
  br i1 %28, label %29, label %56

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %30, i64 %32
  %34 = call noundef double @_ZNK7cyclone15ParticleContact27calculateSeparatingVelocityEv(ptr noundef nonnull align 8 dereferenceable(128) %33)
  store double %34, ptr %12, align 8, !tbaa !11
  %35 = load double, ptr %12, align 8, !tbaa !11
  %36 = load double, ptr %10, align 8, !tbaa !11
  %37 = fcmp olt double %35, %36
  br i1 %37, label %38, label %52

38:                                               ; preds = %29
  %39 = load double, ptr %12, align 8, !tbaa !11
  %40 = fcmp olt double %39, 0.000000e+00
  br i1 %40, label %49, label %41

41:                                               ; preds = %38
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = load i32, ptr %9, align 4, !tbaa !9
  %44 = zext i32 %43 to i64
  %45 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %42, i64 %44
  %46 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %45, i32 0, i32 3
  %47 = load double, ptr %46, align 8, !tbaa !16
  %48 = fcmp ogt double %47, 0.000000e+00
  br i1 %48, label %49, label %52

49:                                               ; preds = %41, %38
  %50 = load double, ptr %12, align 8, !tbaa !11
  store double %50, ptr %10, align 8, !tbaa !11
  %51 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %51, ptr %11, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %49, %41, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = add i32 %54, 1
  store i32 %55, ptr %9, align 4, !tbaa !9
  br label %25, !llvm.loop !19

56:                                               ; preds = %25
  %57 = load i32, ptr %11, align 4, !tbaa !9
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = icmp eq i32 %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  store i32 3, ptr %13, align 4
  br label %225

61:                                               ; preds = %56
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = load i32, ptr %11, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %62, i64 %64
  %66 = load double, ptr %8, align 8, !tbaa !11
  call void @_ZN7cyclone15ParticleContact7resolveEd(ptr noundef nonnull align 8 dereferenceable(128) %65, double noundef %66)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = load i32, ptr %11, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %67, i64 %69
  %71 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %70, i32 0, i32 4
  %72 = getelementptr inbounds [2 x %"class.cyclone::Vector3"], ptr %71, i64 0, i64 0
  store ptr %72, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %218, %61
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = load i32, ptr %7, align 4, !tbaa !9
  %76 = icmp ult i32 %74, %75
  br i1 %76, label %77, label %221

77:                                               ; preds = %73
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = load i32, ptr %9, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %78, i64 %80
  %82 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds [2 x ptr], ptr %82, i64 0, i64 0
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = load i32, ptr %11, align 4, !tbaa !9
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %85, i64 %87
  %89 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %88, i32 0, i32 0
  %90 = getelementptr inbounds [2 x ptr], ptr %89, i64 0, i64 0
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = icmp eq ptr %84, %91
  br i1 %92, label %93, label %109

93:                                               ; preds = %77
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = getelementptr inbounds %"class.cyclone::Vector3", ptr %94, i64 0
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %96, i64 %98
  %100 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %99, i32 0, i32 2
  %101 = call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %95, ptr noundef nonnull align 8 dereferenceable(32) %100)
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load i32, ptr %9, align 4, !tbaa !9
  %104 = zext i32 %103 to i64
  %105 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %102, i64 %104
  %106 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %105, i32 0, i32 3
  %107 = load double, ptr %106, align 8, !tbaa !16
  %108 = fsub double %107, %101
  store double %108, ptr %106, align 8, !tbaa !16
  br label %142

109:                                              ; preds = %77
  %110 = load ptr, ptr %6, align 8, !tbaa !5
  %111 = load i32, ptr %9, align 4, !tbaa !9
  %112 = zext i32 %111 to i64
  %113 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %110, i64 %112
  %114 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds [2 x ptr], ptr %114, i64 0, i64 0
  %116 = load ptr, ptr %115, align 8, !tbaa !5
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = load i32, ptr %11, align 4, !tbaa !9
  %119 = zext i32 %118 to i64
  %120 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %117, i64 %119
  %121 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %120, i32 0, i32 0
  %122 = getelementptr inbounds [2 x ptr], ptr %121, i64 0, i64 1
  %123 = load ptr, ptr %122, align 8, !tbaa !5
  %124 = icmp eq ptr %116, %123
  br i1 %124, label %125, label %141

125:                                              ; preds = %109
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = getelementptr inbounds %"class.cyclone::Vector3", ptr %126, i64 1
  %128 = load ptr, ptr %6, align 8, !tbaa !5
  %129 = load i32, ptr %9, align 4, !tbaa !9
  %130 = zext i32 %129 to i64
  %131 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %128, i64 %130
  %132 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %131, i32 0, i32 2
  %133 = call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %127, ptr noundef nonnull align 8 dereferenceable(32) %132)
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = load i32, ptr %9, align 4, !tbaa !9
  %136 = zext i32 %135 to i64
  %137 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %134, i64 %136
  %138 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %137, i32 0, i32 3
  %139 = load double, ptr %138, align 8, !tbaa !16
  %140 = fsub double %139, %133
  store double %140, ptr %138, align 8, !tbaa !16
  br label %141

141:                                              ; preds = %125, %109
  br label %142

142:                                              ; preds = %141, %93
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = load i32, ptr %9, align 4, !tbaa !9
  %145 = zext i32 %144 to i64
  %146 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %143, i64 %145
  %147 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %146, i32 0, i32 0
  %148 = getelementptr inbounds [2 x ptr], ptr %147, i64 0, i64 1
  %149 = load ptr, ptr %148, align 8, !tbaa !5
  %150 = icmp ne ptr %149, null
  br i1 %150, label %151, label %217

151:                                              ; preds = %142
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = load i32, ptr %9, align 4, !tbaa !9
  %154 = zext i32 %153 to i64
  %155 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %152, i64 %154
  %156 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %155, i32 0, i32 0
  %157 = getelementptr inbounds [2 x ptr], ptr %156, i64 0, i64 1
  %158 = load ptr, ptr %157, align 8, !tbaa !5
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  %160 = load i32, ptr %11, align 4, !tbaa !9
  %161 = zext i32 %160 to i64
  %162 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %159, i64 %161
  %163 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %162, i32 0, i32 0
  %164 = getelementptr inbounds [2 x ptr], ptr %163, i64 0, i64 0
  %165 = load ptr, ptr %164, align 8, !tbaa !5
  %166 = icmp eq ptr %158, %165
  br i1 %166, label %167, label %183

167:                                              ; preds = %151
  %168 = load ptr, ptr %14, align 8, !tbaa !5
  %169 = getelementptr inbounds %"class.cyclone::Vector3", ptr %168, i64 0
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = load i32, ptr %9, align 4, !tbaa !9
  %172 = zext i32 %171 to i64
  %173 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %170, i64 %172
  %174 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %173, i32 0, i32 2
  %175 = call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %169, ptr noundef nonnull align 8 dereferenceable(32) %174)
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = load i32, ptr %9, align 4, !tbaa !9
  %178 = zext i32 %177 to i64
  %179 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %176, i64 %178
  %180 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %179, i32 0, i32 3
  %181 = load double, ptr %180, align 8, !tbaa !16
  %182 = fadd double %181, %175
  store double %182, ptr %180, align 8, !tbaa !16
  br label %216

183:                                              ; preds = %151
  %184 = load ptr, ptr %6, align 8, !tbaa !5
  %185 = load i32, ptr %9, align 4, !tbaa !9
  %186 = zext i32 %185 to i64
  %187 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %184, i64 %186
  %188 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %187, i32 0, i32 0
  %189 = getelementptr inbounds [2 x ptr], ptr %188, i64 0, i64 1
  %190 = load ptr, ptr %189, align 8, !tbaa !5
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = load i32, ptr %11, align 4, !tbaa !9
  %193 = zext i32 %192 to i64
  %194 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %191, i64 %193
  %195 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %194, i32 0, i32 0
  %196 = getelementptr inbounds [2 x ptr], ptr %195, i64 0, i64 1
  %197 = load ptr, ptr %196, align 8, !tbaa !5
  %198 = icmp eq ptr %190, %197
  br i1 %198, label %199, label %215

199:                                              ; preds = %183
  %200 = load ptr, ptr %14, align 8, !tbaa !5
  %201 = getelementptr inbounds %"class.cyclone::Vector3", ptr %200, i64 1
  %202 = load ptr, ptr %6, align 8, !tbaa !5
  %203 = load i32, ptr %9, align 4, !tbaa !9
  %204 = zext i32 %203 to i64
  %205 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %202, i64 %204
  %206 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %205, i32 0, i32 2
  %207 = call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %201, ptr noundef nonnull align 8 dereferenceable(32) %206)
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = load i32, ptr %9, align 4, !tbaa !9
  %210 = zext i32 %209 to i64
  %211 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %208, i64 %210
  %212 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %211, i32 0, i32 3
  %213 = load double, ptr %212, align 8, !tbaa !16
  %214 = fadd double %213, %207
  store double %214, ptr %212, align 8, !tbaa !16
  br label %215

215:                                              ; preds = %199, %183
  br label %216

216:                                              ; preds = %215, %167
  br label %217

217:                                              ; preds = %216, %142
  br label %218

218:                                              ; preds = %217
  %219 = load i32, ptr %9, align 4, !tbaa !9
  %220 = add i32 %219, 1
  store i32 %220, ptr %9, align 4, !tbaa !9
  br label %73, !llvm.loop !21

221:                                              ; preds = %73
  %222 = getelementptr inbounds %"class.cyclone::ParticleContactResolver", ptr %15, i32 0, i32 1
  %223 = load i32, ptr %222, align 4, !tbaa !13
  %224 = add i32 %223, 1
  store i32 %224, ptr %222, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  store i32 0, ptr %13, align 4
  br label %225

225:                                              ; preds = %221, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %226 = load i32, ptr %13, align 4
  switch i32 %226, label %229 [
    i32 0, label %227
    i32 3, label %228
  ]

227:                                              ; preds = %225
  br label %17, !llvm.loop !22

228:                                              ; preds = %225, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void

229:                                              ; preds = %225
  unreachable
}

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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++ 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 4}
!14 = !{!"_ZTSN7cyclone23ParticleContactResolverE", !10, i64 0, !10, i64 4}
!15 = !{!14, !10, i64 0}
!16 = !{!17, !12, i64 56}
!17 = !{!"_ZTSN7cyclone15ParticleContactE", !7, i64 0, !12, i64 16, !18, i64 24, !12, i64 56, !7, i64 64}
!18 = !{!"_ZTSN7cyclone7Vector3E", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !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"

%"class.cyclone::ParticleContact" = type { [2 x ptr], double, %"class.cyclone::Vector3", double, [2 x %"class.cyclone::Vector3"] }
%"class.cyclone::Vector3" = type { double, double, double, double }

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7cyclone15ParticleContact7resolveEd(ptr noundef nonnull align 8 dereferenceable(128), double noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK7cyclone15ParticleContact27calculateSeparatingVelocityEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7cyclone23ParticleContactResolver15resolveContactsEPNS_15ParticleContactEjd(ptr nocapture noundef nonnull align 4 dereferenceable(8) %0, ptr noundef %1, i32 noundef %2, double noundef %3) local_unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 0, ptr %5, align 4, !tbaa !5
  %6 = load i32, ptr %0, align 4, !tbaa !10
  %.not = icmp eq i32 %6, 0
  %.not91 = icmp eq i32 %2, 0
  %or.cond = or i1 %.not, %.not91
  br i1 %or.cond, label %.thread, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %4
  %wide.trip.count = zext i32 %2 to i64
  %wide.trip.count97 = zext i32 %2 to i64
  br label %.lr.ph.us

._crit_edge.us:                                   ; preds = %52
  %7 = icmp eq i32 %.166.us, %2
  br i1 %7, label %.thread, label %.lr.ph78.us

.lr.ph78.us:                                      ; preds = %._crit_edge.us
  %8 = zext i32 %.166.us to i64
  %9 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %1, i64 %8
  tail call void @_ZN7cyclone15ParticleContact7resolveEd(ptr noundef nonnull align 8 dereferenceable(128) %9, double noundef %3)
  %10 = getelementptr inbounds i8, ptr %9, i64 64
  %11 = getelementptr inbounds i8, ptr %9, i64 8
  %12 = getelementptr inbounds i8, ptr %9, i64 96
  br label %13

13:                                               ; preds = %.lr.ph78.us, %40
  %indvars.iv94 = phi i64 [ 0, %.lr.ph78.us ], [ %indvars.iv.next95, %40 ]
  %14 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %1, i64 %indvars.iv94
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = load ptr, ptr %9, align 8, !tbaa !11
  %17 = icmp eq ptr %15, %16
  br i1 %17, label %.sink.split, label %18

18:                                               ; preds = %13
  %19 = load ptr, ptr %11, align 8, !tbaa !11
  %20 = icmp eq ptr %15, %19
  br i1 %20, label %.sink.split, label %26

.sink.split:                                      ; preds = %13, %18
  %.sink = phi ptr [ %12, %18 ], [ %10, %13 ]
  %21 = getelementptr inbounds i8, ptr %14, i64 24
  %22 = tail call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %.sink, ptr noundef nonnull align 8 dereferenceable(32) %21)
  %23 = getelementptr inbounds i8, ptr %14, i64 56
  %24 = load double, ptr %23, align 8, !tbaa !13
  %25 = fsub double %24, %22
  store double %25, ptr %23, align 8, !tbaa !13
  br label %26

26:                                               ; preds = %.sink.split, %18
  %27 = getelementptr inbounds i8, ptr %14, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %.not.us = icmp eq ptr %28, null
  br i1 %.not.us, label %40, label %29

29:                                               ; preds = %26
  %30 = load ptr, ptr %9, align 8, !tbaa !11
  %31 = icmp eq ptr %28, %30
  br i1 %31, label %.sink.split103, label %32

32:                                               ; preds = %29
  %33 = load ptr, ptr %11, align 8, !tbaa !11
  %34 = icmp eq ptr %28, %33
  br i1 %34, label %.sink.split103, label %40

.sink.split103:                                   ; preds = %29, %32
  %.sink109 = phi ptr [ %12, %32 ], [ %10, %29 ]
  %35 = getelementptr inbounds i8, ptr %14, i64 24
  %36 = tail call noundef double @_ZNK7cyclone7Vector3mlERKS0_(ptr noundef nonnull align 8 dereferenceable(32) %.sink109, ptr noundef nonnull align 8 dereferenceable(32) %35)
  %37 = getelementptr inbounds i8, ptr %14, i64 56
  %38 = load double, ptr %37, align 8, !tbaa !13
  %39 = fadd double %36, %38
  store double %39, ptr %37, align 8, !tbaa !13
  br label %40

40:                                               ; preds = %.sink.split103, %32, %26
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %exitcond98.not = icmp eq i64 %indvars.iv.next95, %wide.trip.count97
  br i1 %exitcond98.not, label %._crit_edge79.us, label %13, !llvm.loop !17

.lr.ph.us:                                        ; preds = %.lr.ph.us.backedge, %.preheader.us.preheader
  %indvars.iv = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.be, %.lr.ph.us.backedge ]
  %.06374.us = phi double [ 0x7FEFFFFFFFFFFFFF, %.preheader.us.preheader ], [ %.06374.us.be, %.lr.ph.us.backedge ]
  %.06573.us = phi i32 [ %2, %.preheader.us.preheader ], [ %.06573.us.be, %.lr.ph.us.backedge ]
  %41 = getelementptr inbounds %"class.cyclone::ParticleContact", ptr %1, i64 %indvars.iv
  %42 = tail call noundef double @_ZNK7cyclone15ParticleContact27calculateSeparatingVelocityEv(ptr noundef nonnull align 8 dereferenceable(128) %41)
  %43 = fcmp olt double %42, %.06374.us
  br i1 %43, label %44, label %52

44:                                               ; preds = %.lr.ph.us
  %45 = fcmp olt double %42, 0.000000e+00
  br i1 %45, label %50, label %46

46:                                               ; preds = %44
  %47 = getelementptr inbounds i8, ptr %41, i64 56
  %48 = load double, ptr %47, align 8, !tbaa !13
  %49 = fcmp ogt double %48, 0.000000e+00
  br i1 %49, label %50, label %52

50:                                               ; preds = %46, %44
  %51 = trunc nuw i64 %indvars.iv to i32
  br label %52

52:                                               ; preds = %50, %46, %.lr.ph.us
  %.166.us = phi i32 [ %51, %50 ], [ %.06573.us, %46 ], [ %.06573.us, %.lr.ph.us ]
  %.164.us = phi double [ %42, %50 ], [ %.06374.us, %46 ], [ %.06374.us, %.lr.ph.us ]
  %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.us, label %.lr.ph.us.backedge

.lr.ph.us.backedge:                               ; preds = %52, %._crit_edge79.us
  %indvars.iv.be = phi i64 [ %indvars.iv.next, %52 ], [ 0, %._crit_edge79.us ]
  %.06374.us.be = phi double [ %.164.us, %52 ], [ 0x7FEFFFFFFFFFFFFF, %._crit_edge79.us ]
  %.06573.us.be = phi i32 [ %.166.us, %52 ], [ %2, %._crit_edge79.us ]
  br label %.lr.ph.us, !llvm.loop !19

._crit_edge79.us:                                 ; preds = %40
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = add i32 %53, 1
  store i32 %54, ptr %5, align 4, !tbaa !5
  %55 = load i32, ptr %0, align 4, !tbaa !10
  %56 = icmp ult i32 %54, %55
  br i1 %56, label %.lr.ph.us.backedge, label %.thread

.thread:                                          ; preds = %._crit_edge79.us, %._crit_edge.us, %4
  ret void
}

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 4}
!6 = !{!"_ZTSN7cyclone23ParticleContactResolverE", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!14, !15, i64 56}
!14 = !{!"_ZTSN7cyclone15ParticleContactE", !8, i64 0, !15, i64 16, !16, i64 24, !15, i64 56, !8, i64 64}
!15 = !{!"double", !8, i64 0}
!16 = !{!"_ZTSN7cyclone7Vector3E", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


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