; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics (IslandBuilder)

; 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.JPH::AssertLastParam" = type { i8 }
%"class.JPH::IslandBuilder" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32 }
%"struct.JPH::IslandBuilder::BodyLink" = type { %"struct.std::atomic", i32 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [29 x 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: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13IslandBuilder22BuildConstraintIslandsEPKjjRPjS4_PNS_13TempAllocatorE(ptr noundef nonnull align 8 dereferenceable(112) %0, ptr noundef %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5) #2 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %"struct.JPH::AssertLastParam", align 1
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %"struct.JPH::AssertLastParam", align 1
  %25 = alloca %"struct.JPH::AssertLastParam", align 1
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %6
  br label %185

30:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = load i32, ptr %9, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = mul i64 %33, 4
  %35 = trunc i64 %34 to i32
  %36 = load ptr, ptr %31, align 8, !tbaa !11
  %37 = getelementptr inbounds ptr, ptr %36, i64 2
  %38 = load ptr, ptr %37, align 8
  %39 = call noundef ptr %38(ptr noundef nonnull align 8 dereferenceable(8) %31, i32 noundef %35)
  store ptr %39, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.JPH::IslandBuilder", ptr %26, i32 0, i32 16
  %42 = load i32, ptr %41, align 4, !tbaa !13
  %43 = add i32 %42, 1
  %44 = zext i32 %43 to i64
  %45 = mul i64 %44, 4
  %46 = trunc i64 %45 to i32
  %47 = load ptr, ptr %40, align 8, !tbaa !11
  %48 = getelementptr inbounds ptr, ptr %47, i64 2
  %49 = load ptr, ptr %48, align 8
  %50 = call noundef ptr %49(ptr noundef nonnull align 8 dereferenceable(8) %40, i32 noundef %46)
  store ptr %50, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %62, %30
  %52 = load i32, ptr %15, align 4, !tbaa !9
  %53 = getelementptr inbounds %"class.JPH::IslandBuilder", ptr %26, i32 0, i32 16
  %54 = load i32, ptr %53, align 4, !tbaa !13
  %55 = icmp ult i32 %52, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %65

57:                                               ; preds = %51
  %58 = load ptr, ptr %14, align 8, !tbaa !5
  %59 = load i32, ptr %15, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds i32, ptr %58, i64 %60
  store i32 0, ptr %61, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %57
  %63 = load i32, ptr %15, align 4, !tbaa !9
  %64 = add i32 %63, 1
  store i32 %64, ptr %15, align 4, !tbaa !9
  br label %51, !llvm.loop !15

65:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %102, %65
  %67 = load i32, ptr %16, align 4, !tbaa !9
  %68 = load i32, ptr %9, align 4, !tbaa !9
  %69 = icmp ult i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  br label %105

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = load i32, ptr %16, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds i32, ptr %72, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  store i32 %76, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %77 = getelementptr inbounds %"class.JPH::IslandBuilder", ptr %26, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = load i32, ptr %17, align 4, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %78, i64 %80
  %82 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !18
  %84 = add i32 %83, 1
  store i32 %84, ptr %18, align 4, !tbaa !9
  br label %85

85:                                               ; preds = %71
  %86 = load i32, ptr %18, align 4, !tbaa !9
  %87 = getelementptr inbounds %"class.JPH::IslandBuilder", ptr %26, i32 0, i32 16
  %88 = load i32, ptr %87, align 4, !tbaa !13
  %89 = icmp ule i32 %86, %88
  br i1 %89, label %93, label %90

90:                                               ; preds = %85
  %91 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.19, ptr noundef @.str.1, i32 noundef 307)
  br i1 %91, label %92, label %93

92:                                               ; preds = %90
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !22
  br label %93

93:                                               ; preds = %92, %90, %85
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  %96 = load ptr, ptr %14, align 8, !tbaa !5
  %97 = load i32, ptr %18, align 4, !tbaa !9
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds i32, ptr %96, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = add i32 %100, 1
  store i32 %101, ptr %99, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  br label %102

102:                                              ; preds = %95
  %103 = load i32, ptr %16, align 4, !tbaa !9
  %104 = add i32 %103, 1
  store i32 %104, ptr %16, align 4, !tbaa !9
  br label %66, !llvm.loop !23

105:                                              ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  store i32 1, ptr %20, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %125, %105
  %107 = load i32, ptr %20, align 4, !tbaa !9
  %108 = getelementptr inbounds %"class.JPH::IslandBuilder", ptr %26, i32 0, i32 16
  %109 = load i32, ptr %108, align 4, !tbaa !13
  %110 = icmp ult i32 %107, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  br label %128

112:                                              ; preds = %106
  %113 = load ptr, ptr %14, align 8, !tbaa !5
  %114 = load i32, ptr %20, align 4, !tbaa !9
  %115 = sub i32 %114, 1
  %116 = zext i32 %115 to i64
  %117 = getelementptr inbounds i32, ptr %113, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !9
  %119 = load ptr, ptr %14, align 8, !tbaa !5
  %120 = load i32, ptr %20, align 4, !tbaa !9
  %121 = zext i32 %120 to i64
  %122 = getelementptr inbounds i32, ptr %119, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !9
  %124 = add i32 %123, %118
  store i32 %124, ptr %122, align 4, !tbaa !9
  br label %125

125:                                              ; preds = %112
  %126 = load i32, ptr %20, align 4, !tbaa !9
  %127 = add i32 %126, 1
  store i32 %127, ptr %20, align 4, !tbaa !9
  br label %106, !llvm.loop !24

128:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %129

129:                                              ; preds = %157, %128
  %130 = load i32, ptr %21, align 4, !tbaa !9
  %131 = load i32, ptr %9, align 4, !tbaa !9
  %132 = icmp ult i32 %130, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  br label %160

134:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = load i32, ptr %21, align 4, !tbaa !9
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr %135, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !9
  store i32 %139, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %140 = getelementptr inbounds %"class.JPH::IslandBuilder", ptr %26, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !17
  %142 = load i32, ptr %22, align 4, !tbaa !9
  %143 = zext i32 %142 to i64
  %144 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %141, i64 %143
  %145 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %144, i32 0, i32 1
  %146 = load i32, ptr %145, align 4, !tbaa !18
  store i32 %146, ptr %23, align 4, !tbaa !9
  %147 = load i32, ptr %21, align 4, !tbaa !9
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = load ptr, ptr %14, align 8, !tbaa !5
  %150 = load i32, ptr %23, align 4, !tbaa !9
  %151 = zext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr %149, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !9
  %154 = add i32 %153, 1
  store i32 %154, ptr %152, align 4, !tbaa !9
  %155 = zext i32 %153 to i64
  %156 = getelementptr inbounds i32, ptr %148, i64 %155
  store i32 %147, ptr %156, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  br label %157

157:                                              ; preds = %134
  %158 = load i32, ptr %21, align 4, !tbaa !9
  %159 = add i32 %158, 1
  store i32 %159, ptr %21, align 4, !tbaa !9
  br label %129, !llvm.loop !25

160:                                              ; preds = %133
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr %10, align 8, !tbaa !5
  %163 = load ptr, ptr %162, align 8, !tbaa !5
  %164 = icmp eq ptr %163, null
  br i1 %164, label %168, label %165

165:                                              ; preds = %161
  %166 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.20, ptr noundef @.str.1, i32 noundef 323)
  br i1 %166, label %167, label %168

167:                                              ; preds = %165
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !26
  br label %168

168:                                              ; preds = %167, %165, %161
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169
  %171 = load ptr, ptr %13, align 8, !tbaa !5
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %171, ptr %172, align 8, !tbaa !5
  br label %173

173:                                              ; preds = %170
  %174 = load ptr, ptr %11, align 8, !tbaa !5
  %175 = load ptr, ptr %174, align 8, !tbaa !5
  %176 = icmp eq ptr %175, null
  br i1 %176, label %180, label %177

177:                                              ; preds = %173
  %178 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.21, ptr noundef @.str.1, i32 noundef 325)
  br i1 %178, label %179, label %180

179:                                              ; preds = %177
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !27
  br label %180

180:                                              ; preds = %179, %177, %173
  br label %181

181:                                              ; preds = %180
  br label %182

182:                                              ; preds = %181
  %183 = load ptr, ptr %14, align 8, !tbaa !5
  %184 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %183, ptr %184, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %185

185:                                              ; preds = %182, %29
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { 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 #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 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 108}
!14 = !{!"_ZTSN3JPH13IslandBuilderE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!14, !6, i64 0}
!18 = !{!19, !10, i64 4}
!19 = !{!"_ZTSN3JPH13IslandBuilder8BodyLinkE", !20, i64 0, !10, i64 4}
!20 = !{!"_ZTSSt6atomicIjE", !21, i64 0}
!21 = !{!"_ZTSSt13__atomic_baseIjE", !10, i64 0}
!22 = !{i64 2158303398}
!23 = distinct !{!23, !16}
!24 = distinct !{!24, !16}
!25 = distinct !{!25, !16}
!26 = !{i64 2158303739}
!27 = !{i64 2158304086}


; 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.JPH::IslandBuilder::BodyLink" = type { %"struct.std::atomic", i32 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }

@.str.1 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH13IslandBuilder22BuildConstraintIslandsEPKjjRPjS4_PNS_13TempAllocatorE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(112) %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr nocapture noundef nonnull align 8 dereferenceable(8) %3, ptr nocapture noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %5) local_unnamed_addr #1 align 2 {
  %7 = icmp eq i32 %2, 0
  br i1 %7, label %105, label %8

8:                                                ; preds = %6
  %9 = shl i32 %2, 2
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %12 = load ptr, ptr %11, align 8
  %13 = tail call noundef ptr %12(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef %9)
  %14 = getelementptr inbounds i8, ptr %0, i64 108
  %15 = load i32, ptr %14, align 4, !tbaa !8
  %16 = shl i32 %15, 2
  %17 = add i32 %16, 4
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 16
  %20 = load ptr, ptr %19, align 8
  %21 = tail call noundef ptr %20(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef %17)
  %22 = load i32, ptr %14, align 4, !tbaa !8
  %.not50 = icmp eq i32 %22, 0
  br i1 %.not50, label %.preheader44, label %.lr.ph

.preheader44:                                     ; preds = %.lr.ph, %8
  %umax = tail call i32 @llvm.umax.i32(i32 %2, i32 1)
  %wide.trip.count = zext i32 %umax to i64
  br label %29

.lr.ph:                                           ; preds = %8, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %8 ]
  %23 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv
  store i32 0, ptr %23, align 4, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr %14, align 4, !tbaa !8
  %25 = zext i32 %24 to i64
  %26 = icmp ult i64 %indvars.iv.next, %25
  br i1 %26, label %.lr.ph, label %.preheader44, !llvm.loop !14

.preheader43:                                     ; preds = %41
  %27 = load i32, ptr %14, align 4, !tbaa !8
  %28 = icmp ugt i32 %27, 1
  br i1 %28, label %.lr.ph48.preheader, label %.preheader

.lr.ph48.preheader:                               ; preds = %.preheader43
  %.pre = load i32, ptr %21, align 4, !tbaa !13
  br label %.lr.ph48

29:                                               ; preds = %.preheader44, %41
  %indvars.iv52 = phi i64 [ 0, %.preheader44 ], [ %indvars.iv.next53, %41 ]
  %30 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv52
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = load ptr, ptr %0, align 8, !tbaa !16
  %33 = zext i32 %31 to i64
  %34 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %32, i64 %33, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !17
  %36 = add i32 %35, 1
  %37 = load i32, ptr %14, align 4, !tbaa !8
  %.not = icmp ugt i32 %36, %37
  br i1 %.not, label %38, label %41

38:                                               ; preds = %29
  %39 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.1, i32 noundef 307)
  br i1 %39, label %40, label %41

40:                                               ; preds = %38
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !21
  br label %41

41:                                               ; preds = %40, %38, %29
  %42 = zext i32 %36 to i64
  %43 = getelementptr inbounds i32, ptr %21, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !13
  %45 = add i32 %44, 1
  store i32 %45, ptr %43, align 4, !tbaa !13
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count
  br i1 %exitcond.not, label %.preheader43, label %29, !llvm.loop !22

.preheader:                                       ; preds = %.lr.ph48, %.preheader43
  %46 = load ptr, ptr %0, align 8, !tbaa !16
  %xtraiter = and i64 %wide.trip.count, 1
  %47 = icmp eq i32 %2, 1
  br i1 %47, label %.unr-lcssa, label %.preheader.new

.preheader.new:                                   ; preds = %.preheader
  %unroll_iter = and i64 %wide.trip.count, 4294967294
  br label %70

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %.lr.ph48
  %48 = phi i32 [ %.pre, %.lr.ph48.preheader ], [ %51, %.lr.ph48 ]
  %indvars.iv55 = phi i64 [ 1, %.lr.ph48.preheader ], [ %indvars.iv.next56, %.lr.ph48 ]
  %49 = getelementptr inbounds i32, ptr %21, i64 %indvars.iv55
  %50 = load i32, ptr %49, align 4, !tbaa !13
  %51 = add i32 %50, %48
  store i32 %51, ptr %49, align 4, !tbaa !13
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %52 = load i32, ptr %14, align 4, !tbaa !8
  %53 = zext i32 %52 to i64
  %54 = icmp ult i64 %indvars.iv.next56, %53
  br i1 %54, label %.lr.ph48, label %.preheader, !llvm.loop !23

.unr-lcssa:                                       ; preds = %70, %.preheader
  %indvars.iv58.unr = phi i64 [ 0, %.preheader ], [ %indvars.iv.next59.1, %70 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %67, label %.epilog-lcssa

.epilog-lcssa:                                    ; preds = %.unr-lcssa
  %55 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv58.unr
  %56 = load i32, ptr %55, align 4, !tbaa !13
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %46, i64 %57, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !17
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds i32, ptr %21, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !13
  %63 = add i32 %62, 1
  store i32 %63, ptr %61, align 4, !tbaa !13
  %64 = zext i32 %62 to i64
  %65 = getelementptr inbounds i32, ptr %13, i64 %64
  %66 = trunc nuw i64 %indvars.iv58.unr to i32
  store i32 %66, ptr %65, align 4, !tbaa !13
  br label %67

67:                                               ; preds = %.unr-lcssa, %.epilog-lcssa
  %68 = load ptr, ptr %3, align 8, !tbaa !24
  %69 = icmp eq ptr %68, null
  br i1 %69, label %98, label %95

70:                                               ; preds = %70, %.preheader.new
  %indvars.iv58 = phi i64 [ 0, %.preheader.new ], [ %indvars.iv.next59.1, %70 ]
  %niter = phi i64 [ 0, %.preheader.new ], [ %niter.next.1, %70 ]
  %71 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv58
  %72 = load i32, ptr %71, align 4, !tbaa !13
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %46, i64 %73, i32 1
  %75 = load i32, ptr %74, align 4, !tbaa !17
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr %21, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !13
  %79 = add i32 %78, 1
  store i32 %79, ptr %77, align 4, !tbaa !13
  %80 = zext i32 %78 to i64
  %81 = getelementptr inbounds i32, ptr %13, i64 %80
  %82 = trunc nuw i64 %indvars.iv58 to i32
  store i32 %82, ptr %81, align 4, !tbaa !13
  %indvars.iv.next59 = or disjoint i64 %indvars.iv58, 1
  %83 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv.next59
  %84 = load i32, ptr %83, align 4, !tbaa !13
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds %"struct.JPH::IslandBuilder::BodyLink", ptr %46, i64 %85, i32 1
  %87 = load i32, ptr %86, align 4, !tbaa !17
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr %21, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !13
  %91 = add i32 %90, 1
  store i32 %91, ptr %89, align 4, !tbaa !13
  %92 = zext i32 %90 to i64
  %93 = getelementptr inbounds i32, ptr %13, i64 %92
  %94 = trunc nuw i64 %indvars.iv.next59 to i32
  store i32 %94, ptr %93, align 4, !tbaa !13
  %indvars.iv.next59.1 = add nuw nsw i64 %indvars.iv58, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.unr-lcssa, label %70, !llvm.loop !25

95:                                               ; preds = %67
  %96 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.1, i32 noundef 323)
  br i1 %96, label %97, label %98

97:                                               ; preds = %95
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !26
  br label %98

98:                                               ; preds = %97, %95, %67
  store ptr %13, ptr %3, align 8, !tbaa !24
  %99 = load ptr, ptr %4, align 8, !tbaa !24
  %100 = icmp eq ptr %99, null
  br i1 %100, label %104, label %101

101:                                              ; preds = %98
  %102 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.1, i32 noundef 325)
  br i1 %102, label %103, label %104

103:                                              ; preds = %101
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #3, !srcloc !27
  br label %104

104:                                              ; preds = %103, %101, %98
  store ptr %21, ptr %4, align 8, !tbaa !24
  br label %105

105:                                              ; preds = %6, %104
  ret void
}

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

attributes #0 = { inlinehint 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !12, i64 108}
!9 = !{!"_ZTSN3JPH13IslandBuilderE", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"int", !11, i64 0}
!13 = !{!12, !12, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!9, !10, i64 0}
!17 = !{!18, !12, i64 4}
!18 = !{!"_ZTSN3JPH13IslandBuilder8BodyLinkE", !19, i64 0, !12, i64 4}
!19 = !{!"_ZTSSt6atomicIjE", !20, i64 0}
!20 = !{!"_ZTSSt13__atomic_baseIjE", !12, i64 0}
!21 = !{i64 2158303398}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = !{!10, !10, i64 0}
!25 = distinct !{!25, !15}
!26 = !{i64 2158303739}
!27 = !{i64 2158304086}


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