; LLVM IR from jrouwe/JoltPhysics :: Jolt/TriangleSplitter (TriangleSplitter)

; 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 }
%"struct.JPH::TriangleSplitter::Range" = type { i32, i32 }
%"class.JPH::TriangleSplitter" = type { ptr, ptr, ptr, %"class.JPH::Array", %"class.JPH::Array.0" }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::Array.0" = type { i64, i64, ptr }

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [58 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 nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH16TriangleSplitter13SplitInternalERKNS0_5RangeEjfRS1_S4_(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, i32 noundef %2, float noundef %3, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5) #3 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"struct.JPH::AssertLastParam", align 1
  %16 = alloca i32, align 4
  %17 = alloca %"struct.JPH::AssertLastParam", align 1
  %18 = alloca %"struct.JPH::AssertLastParam", align 1
  %19 = alloca i32, align 4
  %20 = alloca %"struct.JPH::AssertLastParam", align 1
  %21 = alloca i32, align 4
  %22 = alloca %"struct.JPH::AssertLastParam", align 1
  %23 = alloca %"struct.JPH::TriangleSplitter::Range", align 4
  %24 = alloca %"struct.JPH::TriangleSplitter::Range", align 4
  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 float %3, ptr %10, align 4, !tbaa !11
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %26 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 4
  %27 = call noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %26)
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr %27, i64 %31
  store ptr %32, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %33 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 4
  %34 = call noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %33)
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !15
  %38 = zext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr %34, i64 %38
  store ptr %39, ptr %14, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %96, %6
  %41 = load ptr, ptr %13, align 8, !tbaa !5
  %42 = load ptr, ptr %14, align 8, !tbaa !5
  %43 = icmp ult ptr %41, %42
  br i1 %43, label %44, label %97

44:                                               ; preds = %40
  br label %45

45:                                               ; preds = %61, %44
  %46 = load ptr, ptr %13, align 8, !tbaa !5
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = icmp ult ptr %46, %47
  br i1 %48, label %49, label %59

49:                                               ; preds = %45
  %50 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 3
  %51 = load ptr, ptr %13, align 8, !tbaa !5
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = zext i32 %52 to i64
  %54 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %50, i64 noundef %53)
  %55 = load i32, ptr %9, align 4, !tbaa !9
  %56 = call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %54, i32 noundef %55)
  %57 = load float, ptr %10, align 4, !tbaa !11
  %58 = fcmp olt float %56, %57
  br label %59

59:                                               ; preds = %49, %45
  %60 = phi i1 [ false, %45 ], [ %58, %49 ]
  br i1 %60, label %61, label %64

61:                                               ; preds = %59
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  %63 = getelementptr inbounds i32, ptr %62, i32 1
  store ptr %63, ptr %13, align 8, !tbaa !5
  br label %45, !llvm.loop !16

64:                                               ; preds = %59
  br label %65

65:                                               ; preds = %82, %64
  %66 = load ptr, ptr %13, align 8, !tbaa !5
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = icmp ult ptr %66, %67
  br i1 %68, label %69, label %80

69:                                               ; preds = %65
  %70 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 3
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds i32, ptr %71, i64 -1
  %73 = load i32, ptr %72, align 4, !tbaa !9
  %74 = zext i32 %73 to i64
  %75 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %70, i64 noundef %74)
  %76 = load i32, ptr %9, align 4, !tbaa !9
  %77 = call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %75, i32 noundef %76)
  %78 = load float, ptr %10, align 4, !tbaa !11
  %79 = fcmp oge float %77, %78
  br label %80

80:                                               ; preds = %69, %65
  %81 = phi i1 [ false, %65 ], [ %79, %69 ]
  br i1 %81, label %82, label %85

82:                                               ; preds = %80
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = getelementptr inbounds i32, ptr %83, i32 -1
  store ptr %84, ptr %14, align 8, !tbaa !5
  br label %65, !llvm.loop !18

85:                                               ; preds = %80
  %86 = load ptr, ptr %13, align 8, !tbaa !5
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = icmp ult ptr %86, %87
  br i1 %88, label %89, label %96

89:                                               ; preds = %85
  %90 = load ptr, ptr %14, align 8, !tbaa !5
  %91 = getelementptr inbounds i32, ptr %90, i32 -1
  store ptr %91, ptr %14, align 8, !tbaa !5
  %92 = load ptr, ptr %13, align 8, !tbaa !5
  %93 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZSt4swapIjENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %92, ptr noundef nonnull align 4 dereferenceable(4) %93) #6
  %94 = load ptr, ptr %13, align 8, !tbaa !5
  %95 = getelementptr inbounds i32, ptr %94, i32 1
  store ptr %95, ptr %13, align 8, !tbaa !5
  br label %96

96:                                               ; preds = %89, %85
  br label %40, !llvm.loop !19

97:                                               ; preds = %40
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr %13, align 8, !tbaa !5
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  %101 = icmp eq ptr %99, %100
  br i1 %101, label %105, label %102

102:                                              ; preds = %98
  %103 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 54)
  br i1 %103, label %104, label %105

104:                                              ; preds = %102
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !20
  br label %105

105:                                              ; preds = %104, %102, %98
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %108 = load ptr, ptr %13, align 8, !tbaa !5
  %109 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 4
  %110 = call noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %109)
  %111 = ptrtoint ptr %108 to i64
  %112 = ptrtoint ptr %110 to i64
  %113 = sub i64 %111, %112
  %114 = sdiv exact i64 %113, 4
  %115 = trunc i64 %114 to i32
  store i32 %115, ptr %16, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %107
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %117, i32 0, i32 0
  %119 = load i32, ptr %118, align 4, !tbaa !13
  %120 = load i32, ptr %16, align 4, !tbaa !9
  %121 = icmp ule i32 %119, %120
  br i1 %121, label %125, label %122

122:                                              ; preds = %116
  %123 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 60)
  br i1 %123, label %124, label %125

124:                                              ; preds = %122
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !21
  br label %125

125:                                              ; preds = %124, %122, %116
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %16, align 4, !tbaa !9
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !15
  %133 = icmp ule i32 %129, %132
  br i1 %133, label %137, label %134

134:                                              ; preds = %128
  %135 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 61)
  br i1 %135, label %136, label %137

136:                                              ; preds = %134
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !22
  br label %137

137:                                              ; preds = %136, %134, %128
  br label %138

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 4, !tbaa !13
  store i32 %142, ptr %19, align 4, !tbaa !9
  br label %143

143:                                              ; preds = %168, %139
  %144 = load i32, ptr %19, align 4, !tbaa !9
  %145 = load i32, ptr %16, align 4, !tbaa !9
  %146 = icmp ult i32 %144, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %171

148:                                              ; preds = %143
  br label %149

149:                                              ; preds = %148
  %150 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 3
  %151 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 4
  %152 = load i32, ptr %19, align 4, !tbaa !9
  %153 = zext i32 %152 to i64
  %154 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %151, i64 noundef %153)
  %155 = load i32, ptr %154, align 4, !tbaa !9
  %156 = zext i32 %155 to i64
  %157 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %150, i64 noundef %156)
  %158 = load i32, ptr %9, align 4, !tbaa !9
  %159 = call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %157, i32 noundef %158)
  %160 = load float, ptr %10, align 4, !tbaa !11
  %161 = fcmp olt float %159, %160
  br i1 %161, label %165, label %162

162:                                              ; preds = %149
  %163 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 63)
  br i1 %163, label %164, label %165

164:                                              ; preds = %162
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !23
  br label %165

165:                                              ; preds = %164, %162, %149
  br label %166

166:                                              ; preds = %165
  br label %167

167:                                              ; preds = %166
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %19, align 4, !tbaa !9
  %170 = add i32 %169, 1
  store i32 %170, ptr %19, align 4, !tbaa !9
  br label %143, !llvm.loop !24

171:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %172 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %172, ptr %21, align 4, !tbaa !9
  br label %173

173:                                              ; preds = %200, %171
  %174 = load i32, ptr %21, align 4, !tbaa !9
  %175 = load ptr, ptr %8, align 8, !tbaa !5
  %176 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %175, i32 0, i32 1
  %177 = load i32, ptr %176, align 4, !tbaa !15
  %178 = icmp ult i32 %174, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %203

180:                                              ; preds = %173
  br label %181

181:                                              ; preds = %180
  %182 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 3
  %183 = getelementptr inbounds %"class.JPH::TriangleSplitter", ptr %25, i32 0, i32 4
  %184 = load i32, ptr %21, align 4, !tbaa !9
  %185 = zext i32 %184 to i64
  %186 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %183, i64 noundef %185)
  %187 = load i32, ptr %186, align 4, !tbaa !9
  %188 = zext i32 %187 to i64
  %189 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %182, i64 noundef %188)
  %190 = load i32, ptr %9, align 4, !tbaa !9
  %191 = call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %189, i32 noundef %190)
  %192 = load float, ptr %10, align 4, !tbaa !11
  %193 = fcmp oge float %191, %192
  br i1 %193, label %197, label %194

194:                                              ; preds = %181
  %195 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 65)
  br i1 %195, label %196, label %197

196:                                              ; preds = %194
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #6, !srcloc !25
  br label %197

197:                                              ; preds = %196, %194, %181
  br label %198

198:                                              ; preds = %197
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  %201 = load i32, ptr %21, align 4, !tbaa !9
  %202 = add i32 %201, 1
  store i32 %202, ptr %21, align 4, !tbaa !9
  br label %173, !llvm.loop !26

203:                                              ; preds = %179
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %204 = load ptr, ptr %8, align 8, !tbaa !5
  %205 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %204, i32 0, i32 0
  %206 = load i32, ptr %205, align 4, !tbaa !13
  %207 = load i32, ptr %16, align 4, !tbaa !9
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %23, i32 noundef %206, i32 noundef %207)
  %208 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %208, ptr align 4 %23, i64 8, i1 false), !tbaa.struct !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %209 = load i32, ptr %16, align 4, !tbaa !9
  %210 = load ptr, ptr %8, align 8, !tbaa !5
  %211 = getelementptr inbounds %"struct.JPH::TriangleSplitter::Range", ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 4, !tbaa !15
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %24, i32 noundef %209, i32 noundef %212)
  %213 = load ptr, ptr %12, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %213, ptr align 4 %24, i64 8, i1 false), !tbaa.struct !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  %215 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %214)
  %216 = icmp ugt i32 %215, 0
  br i1 %216, label %217, label %221

217:                                              ; preds = %203
  %218 = load ptr, ptr %12, align 8, !tbaa !5
  %219 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %218)
  %220 = icmp ugt i32 %219, 0
  br label %221

221:                                              ; preds = %217, %203
  %222 = phi i1 [ false, %203 ], [ %220, %217 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  ret i1 %222
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8)) #5 align 2

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTSN3JPH16TriangleSplitter5RangeE", !10, i64 0, !10, i64 4}
!15 = !{!14, !10, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = !{i64 2156876044}
!21 = !{i64 2156876408}
!22 = !{i64 2156876768}
!23 = !{i64 2156877182}
!24 = distinct !{!24, !17}
!25 = !{i64 2156877598}
!26 = distinct !{!26, !17}
!27 = !{i64 0, i64 4, !9, i64 4, i64 4, !9}


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

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [58 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: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH16TriangleSplitter13SplitInternalERKNS0_5RangeEjfRS1_S4_(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(8) %1, i32 noundef %2, float noundef %3, ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5) local_unnamed_addr #2 align 2 {
  %7 = alloca %"struct.JPH::TriangleSplitter::Range", align 8
  %8 = alloca %"struct.JPH::TriangleSplitter::Range", align 8
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = tail call noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds i32, ptr %10, i64 %12
  %14 = tail call noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %15 = getelementptr inbounds i8, ptr %1, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !10
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr %14, i64 %17
  %19 = icmp ult ptr %13, %18
  br i1 %19, label %.preheader62.lr.ph, label %._crit_edge

.preheader62.lr.ph:                               ; preds = %6
  %20 = getelementptr inbounds i8, ptr %0, i64 24
  br label %.preheader62

.preheader62:                                     ; preds = %.preheader62.lr.ph, %.critedge61
  %.05466 = phi ptr [ %13, %.preheader62.lr.ph ], [ %.2, %.critedge61 ]
  %.05565 = phi ptr [ %18, %.preheader62.lr.ph ], [ %.257, %.critedge61 ]
  br label %21

21:                                               ; preds = %.preheader62, %27
  %.164 = phi ptr [ %.05466, %.preheader62 ], [ %28, %27 ]
  %22 = load i32, ptr %.164, align 4, !tbaa !11
  %23 = zext i32 %22 to i64
  %24 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %23)
  %25 = tail call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %24, i32 noundef %2)
  %26 = fcmp olt float %25, %3
  br i1 %26, label %27, label %.critedge

27:                                               ; preds = %21
  %28 = getelementptr inbounds i8, ptr %.164, i64 4
  %29 = icmp ult ptr %28, %.05565
  br i1 %29, label %21, label %.critedge, !llvm.loop !12

.critedge:                                        ; preds = %27, %21
  %.1.lcssa = phi ptr [ %28, %27 ], [ %.164, %21 ]
  br label %30

30:                                               ; preds = %32, %.critedge
  %.156 = phi ptr [ %.05565, %.critedge ], [ %33, %32 ]
  %31 = icmp ult ptr %.1.lcssa, %.156
  br i1 %31, label %32, label %.critedge61

32:                                               ; preds = %30
  %33 = getelementptr inbounds i8, ptr %.156, i64 -4
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %35 = zext i32 %34 to i64
  %36 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %35)
  %37 = tail call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %36, i32 noundef %2)
  %38 = fcmp ult float %37, %3
  br i1 %38, label %.critedge2, label %30, !llvm.loop !14

.critedge2:                                       ; preds = %32
  tail call void @_ZSt4swapIjENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %.1.lcssa, ptr noundef nonnull align 4 dereferenceable(4) %33) #5
  %39 = getelementptr inbounds i8, ptr %.1.lcssa, i64 4
  br label %.critedge61

.critedge61:                                      ; preds = %30, %.critedge2
  %.257 = phi ptr [ %33, %.critedge2 ], [ %.156, %30 ]
  %.2 = phi ptr [ %39, %.critedge2 ], [ %.1.lcssa, %30 ]
  %40 = icmp ult ptr %.2, %.257
  br i1 %40, label %.preheader62, label %._crit_edge, !llvm.loop !15

._crit_edge:                                      ; preds = %.critedge61, %6
  %.055.lcssa = phi ptr [ %18, %6 ], [ %.257, %.critedge61 ]
  %.054.lcssa = phi ptr [ %13, %6 ], [ %.2, %.critedge61 ]
  %41 = icmp eq ptr %.054.lcssa, %.055.lcssa
  br i1 %41, label %45, label %42

42:                                               ; preds = %._crit_edge
  %43 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 54)
  br i1 %43, label %44, label %45

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

45:                                               ; preds = %44, %42, %._crit_edge
  %46 = tail call noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %9)
  %47 = ptrtoint ptr %.054.lcssa to i64
  %48 = ptrtoint ptr %46 to i64
  %49 = sub i64 %47, %48
  %50 = lshr exact i64 %49, 2
  %51 = trunc i64 %50 to i32
  %52 = load i32, ptr %1, align 4, !tbaa !5
  %.not = icmp ugt i32 %52, %51
  br i1 %.not, label %53, label %56

53:                                               ; preds = %45
  %54 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 60)
  br i1 %54, label %55, label %56

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

56:                                               ; preds = %45, %53, %55
  %57 = load i32, ptr %15, align 4, !tbaa !10
  %.not59 = icmp ult i32 %57, %51
  br i1 %.not59, label %58, label %61

58:                                               ; preds = %56
  %59 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 61)
  br i1 %59, label %60, label %61

60:                                               ; preds = %58
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !18
  br label %61

61:                                               ; preds = %60, %58, %56
  %62 = load i32, ptr %1, align 4, !tbaa !5
  %63 = icmp ult i32 %62, %51
  br i1 %63, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %61
  %64 = getelementptr inbounds i8, ptr %0, i64 24
  %65 = zext i32 %62 to i64
  br label %70

.preheader:                                       ; preds = %80, %61
  %66 = load i32, ptr %15, align 4, !tbaa !10
  %67 = icmp ugt i32 %66, %51
  br i1 %67, label %.lr.ph71, label %._crit_edge72

.lr.ph71:                                         ; preds = %.preheader
  %68 = getelementptr inbounds i8, ptr %0, i64 24
  %69 = and i64 %50, 4294967295
  br label %86

70:                                               ; preds = %.lr.ph, %80
  %indvars.iv = phi i64 [ %65, %.lr.ph ], [ %indvars.iv.next, %80 ]
  %71 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %indvars.iv)
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = zext i32 %72 to i64
  %74 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %73)
  %75 = tail call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %74, i32 noundef %2)
  %76 = fcmp olt float %75, %3
  br i1 %76, label %80, label %77

77:                                               ; preds = %70
  %78 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 63)
  br i1 %78, label %79, label %80

79:                                               ; preds = %77
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !19
  br label %80

80:                                               ; preds = %70, %77, %79
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %lftr.wideiv, %51
  br i1 %exitcond.not, label %.preheader, label %70, !llvm.loop !20

._crit_edge72:                                    ; preds = %96, %.preheader
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %81 = load i32, ptr %1, align 4, !tbaa !5
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef %81, i32 noundef %51)
  %82 = load i64, ptr %7, align 8
  store i64 %82, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %83 = load i32, ptr %15, align 4, !tbaa !10
  call void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8) %8, i32 noundef %51, i32 noundef %83)
  %84 = load i64, ptr %8, align 8
  store i64 %84, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  %85 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %.not60 = icmp eq i32 %85, 0
  br i1 %.not60, label %103, label %100

86:                                               ; preds = %.lr.ph71, %96
  %indvars.iv75 = phi i64 [ %69, %.lr.ph71 ], [ %indvars.iv.next76, %96 ]
  %87 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %indvars.iv75)
  %88 = load i32, ptr %87, align 4, !tbaa !11
  %89 = zext i32 %88 to i64
  %90 = tail call noundef nonnull align 4 dereferenceable(12) ptr @_ZN3JPH5ArrayINS_6Float3ENS_12STLAllocatorIS1_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %68, i64 noundef %89)
  %91 = tail call noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12) %90, i32 noundef %2)
  %92 = fcmp ult float %91, %3
  br i1 %92, label %93, label %96

93:                                               ; preds = %86
  %94 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 65)
  br i1 %94, label %95, label %96

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

96:                                               ; preds = %86, %93, %95
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %97 = load i32, ptr %15, align 4, !tbaa !10
  %98 = zext i32 %97 to i64
  %99 = icmp ult i64 %indvars.iv.next76, %98
  br i1 %99, label %86, label %._crit_edge72, !llvm.loop !22

100:                                              ; preds = %._crit_edge72
  %101 = call noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8) %5)
  %102 = icmp ne i32 %101, 0
  br label %103

103:                                              ; preds = %100, %._crit_edge72
  %104 = phi i1 [ false, %._crit_edge72 ], [ %102, %100 ]
  ret i1 %104
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayIjNS_12STLAllocatorIjEEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH6Float3ixEi(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TriangleSplitter5RangeC2Ejj(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3JPH16TriangleSplitter5Range5CountEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress 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 = { 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 = { 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 #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, !7, i64 0}
!6 = !{!"_ZTSN3JPH16TriangleSplitter5RangeE", !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 4}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = !{i64 2156876044}
!17 = !{i64 2156876408}
!18 = !{i64 2156876768}
!19 = !{i64 2156877182}
!20 = distinct !{!20, !13}
!21 = !{i64 2156877598}
!22 = distinct !{!22, !13}


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