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

; 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::LargeIslandSplitter::Splits" = type <{ [32 x %"struct.JPH::LargeIslandSplitter::Split"], i32, i32, i32, i32, i32, [4 x i8], %"struct.std::atomic", %"struct.std::atomic.0", [4 x i8] }>
%"struct.JPH::LargeIslandSplitter::Split" = type { i32, i32, i32, i32 }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i64 }
%"struct.std::atomic.0" = type { %"struct.std::__atomic_base.1" }
%"struct.std::__atomic_base.1" = type { i32 }

@.str = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [64 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: mustprogress uwtable
define dso_local noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits14FetchNextBatchERjS2_S2_S2_Rb(ptr noundef nonnull align 8 dereferenceable(548) %0, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 1 dereferenceable(1) %5) #1 align 2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.JPH::AssertLastParam", align 1
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %"struct.JPH::AssertLastParam", align 1
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %31 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %32 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 7
  %33 = call noundef i64 @_ZNKSt13__atomic_baseImE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %32, i32 noundef 2) #5
  store i64 %33, ptr %14, align 8, !tbaa !9
  %34 = load i64, ptr %14, align 8, !tbaa !9
  %35 = icmp eq i64 %34, 4294967295
  br i1 %35, label %36, label %37

36:                                               ; preds = %6
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %83

37:                                               ; preds = %6
  %38 = load i64, ptr %14, align 8, !tbaa !9
  %39 = call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits13sGetIterationEm(i64 noundef %38)
  %40 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 3
  %41 = load i32, ptr %40, align 8, !tbaa !11
  %42 = icmp sge i32 %39, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %37
  store i32 2, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %83

44:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %45 = load i64, ptr %14, align 8, !tbaa !9
  %46 = call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits8sGetItemEm(i64 noundef %45)
  store i32 %46, ptr %16, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %47 = load i64, ptr %14, align 8, !tbaa !9
  %48 = call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits9sGetSplitEm(i64 noundef %47)
  store i32 %48, ptr %17, align 4, !tbaa !18
  %49 = load i32, ptr %17, align 4, !tbaa !18
  %50 = icmp eq i32 %49, 31
  br i1 %50, label %51, label %56

51:                                               ; preds = %44
  %52 = load i32, ptr %16, align 4, !tbaa !18
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %51
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %82

55:                                               ; preds = %51
  br label %81

56:                                               ; preds = %44
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %17, align 4, !tbaa !18
  %59 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 2
  %60 = load i32, ptr %59, align 4, !tbaa !19
  %61 = icmp ult i32 %58, %60
  br i1 %61, label %65, label %62

62:                                               ; preds = %57
  %63 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 47)
  br i1 %63, label %64, label %65

64:                                               ; preds = %62
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !20
  br label %65

65:                                               ; preds = %64, %62, %57
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %68 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 0
  %69 = load i32, ptr %17, align 4, !tbaa !18
  %70 = zext i32 %69 to i64
  %71 = getelementptr inbounds [32 x %"struct.JPH::LargeIslandSplitter::Split"], ptr %68, i64 0, i64 %70
  store ptr %71, ptr %19, align 8, !tbaa !5
  %72 = load i32, ptr %16, align 4, !tbaa !18
  %73 = load ptr, ptr %19, align 8, !tbaa !5
  %74 = call noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split11GetNumItemsEv(ptr noundef nonnull align 4 dereferenceable(16) %73)
  %75 = icmp uge i32 %72, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %67
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %78

77:                                               ; preds = %67
  store i32 0, ptr %15, align 4
  br label %78

78:                                               ; preds = %77, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  %79 = load i32, ptr %15, align 4
  switch i32 %79, label %82 [
    i32 0, label %80
  ]

80:                                               ; preds = %78
  br label %81

81:                                               ; preds = %80, %55
  store i32 0, ptr %15, align 4
  br label %82

82:                                               ; preds = %81, %78, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %83

83:                                               ; preds = %82, %43, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %84 = load i32, ptr %15, align 4
  switch i32 %84, label %226 [
    i32 0, label %85
    i32 1, label %224
  ]

85:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %86 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 7
  %87 = call noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %86, i64 noundef 16, i32 noundef 2) #5
  store i64 %87, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %88 = load i64, ptr %20, align 8, !tbaa !9
  %89 = call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits13sGetIterationEm(i64 noundef %88)
  store i32 %89, ptr %21, align 4, !tbaa !18
  %90 = load i32, ptr %21, align 4, !tbaa !18
  %91 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 3
  %92 = load i32, ptr %91, align 8, !tbaa !11
  %93 = icmp sge i32 %90, %92
  br i1 %93, label %94, label %95

94:                                               ; preds = %85
  store i32 2, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %223

95:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %96 = load i64, ptr %20, align 8, !tbaa !9
  %97 = call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits9sGetSplitEm(i64 noundef %96)
  store i32 %97, ptr %22, align 4, !tbaa !18
  br label %98

98:                                               ; preds = %95
  %99 = load i32, ptr %22, align 4, !tbaa !18
  %100 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 2
  %101 = load i32, ptr %100, align 4, !tbaa !19
  %102 = icmp ult i32 %99, %101
  br i1 %102, label %109, label %103

103:                                              ; preds = %98
  %104 = load i32, ptr %22, align 4, !tbaa !18
  %105 = icmp eq i32 %104, 31
  br i1 %105, label %109, label %106

106:                                              ; preds = %103
  %107 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 61)
  br i1 %107, label %108, label %109

108:                                              ; preds = %106
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !21
  br label %109

109:                                              ; preds = %108, %106, %103, %98
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %112 = getelementptr inbounds %"class.JPH::LargeIslandSplitter::Splits", ptr %31, i32 0, i32 0
  %113 = load i32, ptr %22, align 4, !tbaa !18
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds [32 x %"struct.JPH::LargeIslandSplitter::Split"], ptr %112, i64 0, i64 %114
  store ptr %115, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %116 = load i64, ptr %20, align 8, !tbaa !9
  %117 = call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits8sGetItemEm(i64 noundef %116)
  store i32 %117, ptr %25, align 4, !tbaa !18
  %118 = load i32, ptr %22, align 4, !tbaa !18
  %119 = icmp eq i32 %118, 31
  br i1 %119, label %120, label %145

120:                                              ; preds = %111
  %121 = load i32, ptr %25, align 4, !tbaa !18
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %123, label %144

123:                                              ; preds = %120
  %124 = load ptr, ptr %24, align 8, !tbaa !5
  %125 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %124, i32 0, i32 2
  %126 = load i32, ptr %125, align 4, !tbaa !22
  %127 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %126, ptr %127, align 4, !tbaa !18
  %128 = load ptr, ptr %24, align 8, !tbaa !5
  %129 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %128, i32 0, i32 3
  %130 = load i32, ptr %129, align 4, !tbaa !24
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %130, ptr %131, align 4, !tbaa !18
  %132 = load ptr, ptr %24, align 8, !tbaa !5
  %133 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %132, i32 0, i32 0
  %134 = load i32, ptr %133, align 4, !tbaa !25
  %135 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %134, ptr %135, align 4, !tbaa !18
  %136 = load ptr, ptr %24, align 8, !tbaa !5
  %137 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %136, i32 0, i32 1
  %138 = load i32, ptr %137, align 4, !tbaa !26
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 %138, ptr %139, align 4, !tbaa !18
  %140 = load i32, ptr %21, align 4, !tbaa !18
  %141 = icmp eq i32 %140, 0
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = zext i1 %141 to i8
  store i8 %143, ptr %142, align 1, !tbaa !27
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %222

144:                                              ; preds = %120
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %222

145:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  %146 = load ptr, ptr %24, align 8, !tbaa !5
  %147 = call noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split17GetNumConstraintsEv(ptr noundef nonnull align 4 dereferenceable(16) %146)
  store i32 %147, ptr %26, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #5
  %148 = load ptr, ptr %24, align 8, !tbaa !5
  %149 = call noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split14GetNumContactsEv(ptr noundef nonnull align 4 dereferenceable(16) %148)
  store i32 %149, ptr %27, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #5
  %150 = load i32, ptr %26, align 4, !tbaa !18
  %151 = load i32, ptr %27, align 4, !tbaa !18
  %152 = add i32 %150, %151
  store i32 %152, ptr %28, align 4, !tbaa !18
  %153 = load i32, ptr %25, align 4, !tbaa !18
  %154 = load i32, ptr %28, align 4, !tbaa !18
  %155 = icmp uge i32 %153, %154
  br i1 %155, label %156, label %157

156:                                              ; preds = %145
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %221

157:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #5
  %158 = load i32, ptr %25, align 4, !tbaa !18
  %159 = add i32 %158, 16
  store i32 %159, ptr %30, align 4, !tbaa !18
  %160 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %30, ptr noundef nonnull align 4 dereferenceable(4) %28)
  %161 = load i32, ptr %160, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #5
  store i32 %161, ptr %29, align 4, !tbaa !18
  %162 = load i32, ptr %29, align 4, !tbaa !18
  %163 = load i32, ptr %26, align 4, !tbaa !18
  %164 = icmp uge i32 %162, %163
  br i1 %164, label %165, label %201

165:                                              ; preds = %157
  %166 = load i32, ptr %25, align 4, !tbaa !18
  %167 = load i32, ptr %26, align 4, !tbaa !18
  %168 = icmp ult i32 %166, %167
  br i1 %168, label %169, label %180

169:                                              ; preds = %165
  %170 = load ptr, ptr %24, align 8, !tbaa !5
  %171 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %170, i32 0, i32 2
  %172 = load i32, ptr %171, align 4, !tbaa !22
  %173 = load i32, ptr %25, align 4, !tbaa !18
  %174 = add i32 %172, %173
  %175 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %174, ptr %175, align 4, !tbaa !18
  %176 = load ptr, ptr %24, align 8, !tbaa !5
  %177 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %176, i32 0, i32 3
  %178 = load i32, ptr %177, align 4, !tbaa !24
  %179 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %178, ptr %179, align 4, !tbaa !18
  br label %183

180:                                              ; preds = %165
  %181 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %181, align 4, !tbaa !18
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 0, ptr %182, align 4, !tbaa !18
  br label %183

183:                                              ; preds = %180, %169
  %184 = load ptr, ptr %24, align 8, !tbaa !5
  %185 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %184, i32 0, i32 0
  %186 = load i32, ptr %185, align 4, !tbaa !25
  %187 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %25, ptr noundef nonnull align 4 dereferenceable(4) %26)
  %188 = load i32, ptr %187, align 4, !tbaa !18
  %189 = load i32, ptr %26, align 4, !tbaa !18
  %190 = sub i32 %188, %189
  %191 = add i32 %186, %190
  %192 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %191, ptr %192, align 4, !tbaa !18
  %193 = load ptr, ptr %24, align 8, !tbaa !5
  %194 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %193, i32 0, i32 0
  %195 = load i32, ptr %194, align 4, !tbaa !25
  %196 = load i32, ptr %29, align 4, !tbaa !18
  %197 = load i32, ptr %26, align 4, !tbaa !18
  %198 = sub i32 %196, %197
  %199 = add i32 %195, %198
  %200 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 %199, ptr %200, align 4, !tbaa !18
  br label %216

201:                                              ; preds = %157
  %202 = load ptr, ptr %24, align 8, !tbaa !5
  %203 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %202, i32 0, i32 2
  %204 = load i32, ptr %203, align 4, !tbaa !22
  %205 = load i32, ptr %25, align 4, !tbaa !18
  %206 = add i32 %204, %205
  %207 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %206, ptr %207, align 4, !tbaa !18
  %208 = load ptr, ptr %24, align 8, !tbaa !5
  %209 = getelementptr inbounds %"struct.JPH::LargeIslandSplitter::Split", ptr %208, i32 0, i32 2
  %210 = load i32, ptr %209, align 4, !tbaa !22
  %211 = load i32, ptr %29, align 4, !tbaa !18
  %212 = add i32 %210, %211
  %213 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %212, ptr %213, align 4, !tbaa !18
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 0, ptr %214, align 4, !tbaa !18
  %215 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 0, ptr %215, align 4, !tbaa !18
  br label %216

216:                                              ; preds = %201, %183
  %217 = load i32, ptr %21, align 4, !tbaa !18
  %218 = icmp eq i32 %217, 0
  %219 = load ptr, ptr %13, align 8, !tbaa !5
  %220 = zext i1 %218 to i8
  store i8 %220, ptr %219, align 1, !tbaa !27
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #5
  br label %221

221:                                              ; preds = %216, %156
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %222

222:                                              ; preds = %221, %144, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %223

223:                                              ; preds = %222, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %224

224:                                              ; preds = %223, %83
  %225 = load i32, ptr %7, align 4
  ret i32 %225

226:                                              ; preds = %83
  unreachable
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt13__atomic_baseImE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits13sGetIterationEm(i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits8sGetItemEm(i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits9sGetSplitEm(i64 noundef) #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split11GetNumItemsEv(ptr noundef nonnull align 4 dereferenceable(16)) #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split17GetNumConstraintsEv(ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split14GetNumContactsEv(ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { alwaysinline 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 = { inlinehint 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 #4 = { 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 #5 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 520}
!12 = !{!"_ZTSN3JPH19LargeIslandSplitter6SplitsE", !7, i64 0, !13, i64 512, !13, i64 516, !13, i64 520, !13, i64 524, !13, i64 528, !14, i64 536, !16, i64 544}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTSSt6atomicImE", !15, i64 0}
!15 = !{!"_ZTSSt13__atomic_baseImE", !10, i64 0}
!16 = !{!"_ZTSSt6atomicIjE", !17, i64 0}
!17 = !{!"_ZTSSt13__atomic_baseIjE", !13, i64 0}
!18 = !{!13, !13, i64 0}
!19 = !{!12, !13, i64 516}
!20 = !{i64 2158941371}
!21 = !{i64 2158941793}
!22 = !{!23, !13, i64 8}
!23 = !{!"_ZTSN3JPH19LargeIslandSplitter5SplitE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!24 = !{!23, !13, i64 12}
!25 = !{!23, !13, i64 0}
!26 = !{!23, !13, i64 4}
!27 = !{!28, !28, i64 0}
!28 = !{!"bool", !7, i64 0}


; 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::LargeIslandSplitter::Split" = type { i32, i32, i32, i32 }

@.str = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [64 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 3) i32 @_ZN3JPH19LargeIslandSplitter6Splits14FetchNextBatchERjS2_S2_S2_Rb(ptr noundef nonnull align 8 dereferenceable(548) %0, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %1, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %2, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %3, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %4, ptr nocapture noundef nonnull writeonly align 1 dereferenceable(1) %5) local_unnamed_addr #1 align 2 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = getelementptr inbounds i8, ptr %0, i64 536
  %12 = tail call noundef i64 @_ZNKSt13__atomic_baseImE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef 2) #5
  %13 = icmp eq i64 %12, 4294967295
  br i1 %13, label %.thread, label %14

14:                                               ; preds = %6
  %15 = tail call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits13sGetIterationEm(i64 noundef %12)
  %16 = getelementptr inbounds i8, ptr %0, i64 520
  %17 = load i32, ptr %16, align 8, !tbaa !5
  %.not = icmp slt i32 %15, %17
  br i1 %.not, label %18, label %.thread

18:                                               ; preds = %14
  %19 = tail call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits8sGetItemEm(i64 noundef %12)
  %20 = tail call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits9sGetSplitEm(i64 noundef %12)
  %21 = icmp eq i32 %20, 31
  br i1 %21, label %22, label %23

22:                                               ; preds = %18
  %.not65 = icmp eq i32 %19, 0
  br i1 %.not65, label %34, label %.thread

23:                                               ; preds = %18
  %24 = getelementptr inbounds i8, ptr %0, i64 516
  %25 = load i32, ptr %24, align 4, !tbaa !15
  %26 = icmp ult i32 %20, %25
  br i1 %26, label %30, label %27

27:                                               ; preds = %23
  %28 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 47)
  br i1 %28, label %29, label %30

29:                                               ; preds = %27
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !16
  br label %30

30:                                               ; preds = %29, %27, %23
  %31 = zext i32 %20 to i64
  %32 = getelementptr inbounds [32 x %"struct.JPH::LargeIslandSplitter::Split"], ptr %0, i64 0, i64 %31
  %33 = tail call noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split11GetNumItemsEv(ptr noundef nonnull align 4 dereferenceable(16) %32)
  %.not64 = icmp ult i32 %19, %33
  br i1 %.not64, label %34, label %.thread

34:                                               ; preds = %30, %22
  %35 = tail call noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8) %11, i64 noundef 16, i32 noundef 2) #5
  %36 = tail call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits13sGetIterationEm(i64 noundef %35)
  %37 = load i32, ptr %16, align 8, !tbaa !5
  %.not66 = icmp slt i32 %36, %37
  br i1 %.not66, label %38, label %.thread

38:                                               ; preds = %34
  %39 = tail call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits9sGetSplitEm(i64 noundef %35)
  %40 = getelementptr inbounds i8, ptr %0, i64 516
  %41 = load i32, ptr %40, align 4, !tbaa !15
  %42 = icmp ult i32 %39, %41
  %43 = icmp eq i32 %39, 31
  %or.cond = or i1 %43, %42
  br i1 %or.cond, label %50, label %44

44:                                               ; preds = %38
  %45 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 61)
  br i1 %45, label %46, label %.thread74

46:                                               ; preds = %44
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !17
  br label %.thread74

.thread74:                                        ; preds = %46, %44
  %47 = zext i32 %39 to i64
  %48 = getelementptr inbounds [32 x %"struct.JPH::LargeIslandSplitter::Split"], ptr %0, i64 0, i64 %47
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %49 = tail call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits8sGetItemEm(i64 noundef %35)
  store i32 %49, ptr %7, align 4, !tbaa !18
  br label %66

50:                                               ; preds = %38
  %51 = zext i32 %39 to i64
  %52 = getelementptr inbounds [32 x %"struct.JPH::LargeIslandSplitter::Split"], ptr %0, i64 0, i64 %51
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %53 = tail call noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits8sGetItemEm(i64 noundef %35)
  store i32 %53, ptr %7, align 4, !tbaa !18
  br i1 %43, label %54, label %66

54:                                               ; preds = %50
  %55 = icmp eq i32 %53, 0
  br i1 %55, label %56, label %105

56:                                               ; preds = %54
  %57 = getelementptr inbounds i8, ptr %52, i64 8
  %58 = load i32, ptr %57, align 8, !tbaa !19
  store i32 %58, ptr %1, align 4, !tbaa !18
  %59 = getelementptr inbounds i8, ptr %52, i64 12
  %60 = load i32, ptr %59, align 4, !tbaa !21
  store i32 %60, ptr %2, align 4, !tbaa !18
  %61 = load i32, ptr %52, align 8, !tbaa !22
  store i32 %61, ptr %3, align 4, !tbaa !18
  %62 = getelementptr inbounds i8, ptr %52, i64 4
  %63 = load i32, ptr %62, align 4, !tbaa !23
  store i32 %63, ptr %4, align 4, !tbaa !18
  %64 = icmp eq i32 %36, 0
  %65 = zext i1 %64 to i8
  store i8 %65, ptr %5, align 1, !tbaa !24
  br label %105

66:                                               ; preds = %.thread74, %50
  %67 = phi i32 [ %49, %.thread74 ], [ %53, %50 ]
  %68 = phi ptr [ %48, %.thread74 ], [ %52, %50 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %69 = tail call noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split17GetNumConstraintsEv(ptr noundef nonnull align 4 dereferenceable(16) %68)
  store i32 %69, ptr %8, align 4, !tbaa !18
  %70 = tail call noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split14GetNumContactsEv(ptr noundef nonnull align 4 dereferenceable(16) %68)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  %71 = add i32 %69, %70
  store i32 %71, ptr %9, align 4, !tbaa !18
  %.not67 = icmp ult i32 %67, %71
  br i1 %.not67, label %72, label %104

72:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  %73 = add i32 %67, 16
  store i32 %73, ptr %10, align 4, !tbaa !18
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %75 = load i32, ptr %74, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  %.not68 = icmp ult i32 %75, %69
  br i1 %.not68, label %95, label %76

76:                                               ; preds = %72
  %77 = icmp ult i32 %67, %69
  br i1 %77, label %78, label %84

78:                                               ; preds = %76
  %79 = getelementptr inbounds i8, ptr %68, i64 8
  %80 = load i32, ptr %79, align 4, !tbaa !19
  %81 = add i32 %80, %67
  store i32 %81, ptr %1, align 4, !tbaa !18
  %82 = getelementptr inbounds i8, ptr %68, i64 12
  %83 = load i32, ptr %82, align 4, !tbaa !21
  br label %85

84:                                               ; preds = %76
  store i32 0, ptr %1, align 4, !tbaa !18
  br label %85

85:                                               ; preds = %84, %78
  %storemerge69 = phi i32 [ 0, %84 ], [ %83, %78 ]
  store i32 %storemerge69, ptr %2, align 4, !tbaa !18
  %86 = load i32, ptr %68, align 4, !tbaa !22
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %88 = load i32, ptr %87, align 4, !tbaa !18
  %89 = load i32, ptr %8, align 4, !tbaa !18
  %90 = add i32 %88, %86
  %91 = sub i32 %90, %89
  store i32 %91, ptr %3, align 4, !tbaa !18
  %92 = load i32, ptr %68, align 4, !tbaa !22
  %93 = sub i32 %75, %89
  %94 = add i32 %93, %92
  br label %101

95:                                               ; preds = %72
  %96 = getelementptr inbounds i8, ptr %68, i64 8
  %97 = load i32, ptr %96, align 4, !tbaa !19
  %98 = add i32 %67, %97
  store i32 %98, ptr %1, align 4, !tbaa !18
  %99 = load i32, ptr %96, align 4, !tbaa !19
  %100 = add i32 %99, %75
  store i32 %100, ptr %2, align 4, !tbaa !18
  store i32 0, ptr %3, align 4, !tbaa !18
  br label %101

101:                                              ; preds = %95, %85
  %storemerge = phi i32 [ 0, %95 ], [ %94, %85 ]
  store i32 %storemerge, ptr %4, align 4, !tbaa !18
  %102 = icmp eq i32 %36, 0
  %103 = zext i1 %102 to i8
  store i8 %103, ptr %5, align 1, !tbaa !24
  br label %104

104:                                              ; preds = %66, %101
  %.4 = phi i32 [ 1, %101 ], [ 0, %66 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  br label %105

105:                                              ; preds = %54, %104, %56
  %.5 = phi i32 [ 1, %56 ], [ %.4, %104 ], [ 0, %54 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  br label %.thread

.thread:                                          ; preds = %22, %30, %14, %6, %105, %34
  %.7 = phi i32 [ %.5, %105 ], [ 2, %34 ], [ 0, %30 ], [ 0, %22 ], [ 2, %14 ], [ 0, %6 ]
  ret i32 %.7
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt13__atomic_baseImE4loadESt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits13sGetIterationEm(i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits8sGetItemEm(i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN3JPH19LargeIslandSplitter6Splits9sGetSplitEm(i64 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split11GetNumItemsEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt13__atomic_baseImE9fetch_addEmSt12memory_order(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split17GetNumConstraintsEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH19LargeIslandSplitter5Split14GetNumContactsEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { alwaysinline 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 = { inlinehint 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 #4 = { 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 #5 = { 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, !9, i64 520}
!6 = !{!"_ZTSN3JPH19LargeIslandSplitter6SplitsE", !7, i64 0, !9, i64 512, !9, i64 516, !9, i64 520, !9, i64 524, !9, i64 528, !10, i64 536, !13, i64 544}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_ZTSSt6atomicImE", !11, i64 0}
!11 = !{!"_ZTSSt13__atomic_baseImE", !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTSSt6atomicIjE", !14, i64 0}
!14 = !{!"_ZTSSt13__atomic_baseIjE", !9, i64 0}
!15 = !{!6, !9, i64 516}
!16 = !{i64 2158941371}
!17 = !{i64 2158941793}
!18 = !{!9, !9, i64 0}
!19 = !{!20, !9, i64 8}
!20 = !{!"_ZTSN3JPH19LargeIslandSplitter5SplitE", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12}
!21 = !{!20, !9, i64 12}
!22 = !{!20, !9, i64 0}
!23 = !{!20, !9, i64 4}
!24 = !{!25, !25, i64 0}
!25 = !{!"bool", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass