; LLVM IR from jrouwe/JoltPhysics :: Jolt/Geometry (ConvexHullBuilder)

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

%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"struct.JPH::AssertLastParam" = type { i8 }
%struct.StackEntry = type { ptr, ptr }
%"class.JPH::ConvexHullBuilder::FullEdge" = type { ptr, i32, i32 }
%"class.JPH::ConvexHullBuilder::Face" = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Array", ptr, float, i8, [11 x i8] }>
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::ConvexHullBuilder::Edge" = type <{ ptr, ptr, ptr, i32, [4 x i8] }>

@.str.1 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [69 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: 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) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH17ConvexHullBuilder8FindEdgeEPNS0_4FaceENS_4Vec3ERNS_5ArrayINS0_8FullEdgeENS_12STLAllocatorIS5_EEEE(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %1, double %2, double %3, ptr noundef nonnull align 8 dereferenceable(24) %4) #3 align 2 {
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"struct.JPH::AssertLastParam", align 1
  %11 = alloca %"class.JPH::Vec3", align 16
  %12 = alloca %"struct.JPH::AssertLastParam", align 1
  %13 = alloca i32, align 4
  %14 = alloca [128 x %struct.StackEntry], align 16
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = alloca %"struct.JPH::AssertLastParam", align 1
  %24 = alloca ptr, align 8
  %25 = alloca %"class.JPH::ConvexHullBuilder::FullEdge", align 8
  %26 = alloca i32, align 4
  %27 = alloca %"struct.JPH::AssertLastParam", align 1
  %28 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 0
  store double %2, ptr %28, align 16
  %29 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 1
  store double %3, ptr %29, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %4, ptr %9, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8
  br label %31

31:                                               ; preds = %5
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZNK3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %32)
  br i1 %33, label %37, label %34

34:                                               ; preds = %31
  %35 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.19, ptr noundef @.str.1, i32 noundef 776)
  br i1 %35, label %36, label %37

36:                                               ; preds = %34
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !9
  br label %37

37:                                               ; preds = %36, %34, %31
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %6, i64 16, i1 false), !tbaa.struct !10
  %41 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %42 = load double, ptr %41, align 16
  %43 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %44 = load double, ptr %43, align 8
  %45 = call noundef zeroext i1 @_ZNK3JPH17ConvexHullBuilder4Face8IsFacingENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(69) %40, double %42, double %44)
  br i1 %45, label %49, label %46

46:                                               ; preds = %39
  %47 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.20, ptr noundef @.str.1, i32 noundef 779)
  br i1 %47, label %48, label %49

48:                                               ; preds = %46
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !12
  br label %49

49:                                               ; preds = %48, %46, %39
  br label %50

50:                                               ; preds = %49
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %51, i32 0, i32 5
  store i8 1, ptr %52, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 128, ptr %13, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 2048, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !20
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %53, i32 0, i32 3
  %55 = load ptr, ptr %54, align 8, !tbaa !22
  %56 = getelementptr inbounds [128 x %struct.StackEntry], ptr %14, i64 0, i64 0
  %57 = getelementptr inbounds %struct.StackEntry, ptr %56, i32 0, i32 0
  store ptr %55, ptr %57, align 16, !tbaa !23
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %58, i32 0, i32 3
  %60 = load ptr, ptr %59, align 8, !tbaa !22
  %61 = ptrtoint ptr %60 to i64
  %62 = or i64 %61, 1
  %63 = inttoptr i64 %62 to ptr
  %64 = getelementptr inbounds [128 x %struct.StackEntry], ptr %14, i64 0, i64 0
  %65 = getelementptr inbounds %struct.StackEntry, ptr %64, i32 0, i32 1
  store ptr %63, ptr %65, align 8, !tbaa !25
  br label %66

66:                                               ; preds = %160, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %67 = load i32, ptr %15, align 4, !tbaa !20
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [128 x %struct.StackEntry], ptr %14, i64 0, i64 %68
  store ptr %69, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %70 = load ptr, ptr %16, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.StackEntry, ptr %70, i32 0, i32 1
  %72 = load ptr, ptr %71, align 8, !tbaa !25
  store ptr %72, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %73 = load ptr, ptr %17, align 8, !tbaa !5
  %74 = ptrtoint ptr %73 to i64
  %75 = and i64 %74, -2
  %76 = inttoptr i64 %75 to ptr
  store ptr %76, ptr %18, align 8, !tbaa !5
  %77 = load ptr, ptr %18, align 8, !tbaa !5
  %78 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %77, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !26
  %80 = load ptr, ptr %16, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.StackEntry, ptr %80, i32 0, i32 1
  store ptr %79, ptr %81, align 8, !tbaa !25
  %82 = load ptr, ptr %17, align 8, !tbaa !5
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.StackEntry, ptr %83, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !23
  %86 = icmp eq ptr %82, %85
  br i1 %86, label %87, label %96

87:                                               ; preds = %66
  %88 = load ptr, ptr %18, align 8, !tbaa !5
  %89 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !28
  call void @_ZN3JPH17ConvexHullBuilder11sUnlinkFaceEPNS0_4FaceE(ptr noundef %90)
  %91 = load i32, ptr %15, align 4, !tbaa !20
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %15, align 4, !tbaa !20
  %93 = icmp slt i32 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %87
  store i32 6, ptr %19, align 4
  br label %158

95:                                               ; preds = %87
  br label %157

96:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %97 = load ptr, ptr %18, align 8, !tbaa !5
  %98 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %97, i32 0, i32 2
  %99 = load ptr, ptr %98, align 8, !tbaa !29
  store ptr %99, ptr %20, align 8, !tbaa !5
  %100 = load ptr, ptr %20, align 8, !tbaa !5
  %101 = icmp ne ptr %100, null
  br i1 %101, label %102, label %156

102:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %103 = load ptr, ptr %20, align 8, !tbaa !5
  %104 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !28
  store ptr %105, ptr %21, align 8, !tbaa !5
  %106 = load ptr, ptr %21, align 8, !tbaa !5
  %107 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %106, i32 0, i32 5
  %108 = load i8, ptr %107, align 4, !tbaa !13, !range !30, !noundef !31
  %109 = trunc i8 %108 to i1
  br i1 %109, label %155, label %110

110:                                              ; preds = %102
  %111 = load ptr, ptr %21, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 %6, i64 16, i1 false), !tbaa.struct !10
  %112 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %113 = load double, ptr %112, align 16
  %114 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %115 = load double, ptr %114, align 8
  %116 = call noundef zeroext i1 @_ZNK3JPH17ConvexHullBuilder4Face8IsFacingENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(69) %111, double %113, double %115)
  br i1 %116, label %117, label %142

117:                                              ; preds = %110
  %118 = load ptr, ptr %21, align 8, !tbaa !5
  %119 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Face", ptr %118, i32 0, i32 5
  store i8 1, ptr %119, align 4, !tbaa !13
  %120 = load i32, ptr %15, align 4, !tbaa !20
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %15, align 4, !tbaa !20
  br label %122

122:                                              ; preds = %117
  %123 = load i32, ptr %15, align 4, !tbaa !20
  %124 = icmp slt i32 %123, 128
  br i1 %124, label %128, label %125

125:                                              ; preds = %122
  %126 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.21, ptr noundef @.str.1, i32 noundef 836)
  br i1 %126, label %127, label %128

127:                                              ; preds = %125
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !32
  br label %128

128:                                              ; preds = %127, %125, %122
  br label %129

129:                                              ; preds = %128
  br label %130

130:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  %131 = load i32, ptr %15, align 4, !tbaa !20
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [128 x %struct.StackEntry], ptr %14, i64 0, i64 %132
  store ptr %133, ptr %24, align 8, !tbaa !5
  %134 = load ptr, ptr %20, align 8, !tbaa !5
  %135 = load ptr, ptr %24, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.StackEntry, ptr %135, i32 0, i32 0
  store ptr %134, ptr %136, align 8, !tbaa !23
  %137 = load ptr, ptr %20, align 8, !tbaa !5
  %138 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %137, i32 0, i32 1
  %139 = load ptr, ptr %138, align 8, !tbaa !26
  %140 = load ptr, ptr %24, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.StackEntry, ptr %140, i32 0, i32 1
  store ptr %139, ptr %141, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  br label %154

142:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #5
  %143 = load ptr, ptr %20, align 8, !tbaa !5
  %144 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::FullEdge", ptr %25, i32 0, i32 0
  store ptr %143, ptr %144, align 8, !tbaa !33
  %145 = load ptr, ptr %18, align 8, !tbaa !5
  %146 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %145, i32 0, i32 3
  %147 = load i32, ptr %146, align 8, !tbaa !35
  %148 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::FullEdge", ptr %25, i32 0, i32 1
  store i32 %147, ptr %148, align 8, !tbaa !36
  %149 = load ptr, ptr %20, align 8, !tbaa !5
  %150 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::Edge", ptr %149, i32 0, i32 3
  %151 = load i32, ptr %150, align 8, !tbaa !35
  %152 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::FullEdge", ptr %25, i32 0, i32 2
  store i32 %151, ptr %152, align 4, !tbaa !37
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %153, ptr noundef nonnull align 8 dereferenceable(16) %25)
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #5
  br label %154

154:                                              ; preds = %142, %130
  br label %155

155:                                              ; preds = %154, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  br label %156

156:                                              ; preds = %155, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %157

157:                                              ; preds = %156, %95
  store i32 0, ptr %19, align 4
  br label %158

158:                                              ; preds = %157, %94
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %159 = load i32, ptr %19, align 4
  switch i32 %159, label %198 [
    i32 0, label %160
    i32 6, label %161
  ]

160:                                              ; preds = %158
  br label %66, !llvm.loop !38

161:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 0, ptr %26, align 4, !tbaa !20
  br label %162

162:                                              ; preds = %194, %161
  %163 = load i32, ptr %26, align 4, !tbaa !20
  %164 = load ptr, ptr %9, align 8, !tbaa !5
  %165 = call noundef i64 @_ZNK3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %164)
  %166 = trunc i64 %165 to i32
  %167 = icmp slt i32 %163, %166
  br i1 %167, label %169, label %168

168:                                              ; preds = %162
  store i32 10, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %197

169:                                              ; preds = %162
  br label %170

170:                                              ; preds = %169
  %171 = load ptr, ptr %9, align 8, !tbaa !5
  %172 = load i32, ptr %26, align 4, !tbaa !20
  %173 = sext i32 %172 to i64
  %174 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %171, i64 noundef %173)
  %175 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::FullEdge", ptr %174, i32 0, i32 2
  %176 = load i32, ptr %175, align 4, !tbaa !37
  %177 = load ptr, ptr %9, align 8, !tbaa !5
  %178 = load i32, ptr %26, align 4, !tbaa !20
  %179 = add nsw i32 %178, 1
  %180 = sext i32 %179 to i64
  %181 = load ptr, ptr %9, align 8, !tbaa !5
  %182 = call noundef i64 @_ZNK3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %181)
  %183 = urem i64 %180, %182
  %184 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %177, i64 noundef %183)
  %185 = getelementptr inbounds %"class.JPH::ConvexHullBuilder::FullEdge", ptr %184, i32 0, i32 1
  %186 = load i32, ptr %185, align 8, !tbaa !36
  %187 = icmp eq i32 %176, %186
  br i1 %187, label %191, label %188

188:                                              ; preds = %170
  %189 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str.22, ptr noundef @.str.1, i32 noundef 858)
  br i1 %189, label %190, label %191

190:                                              ; preds = %188
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #5, !srcloc !40
  br label %191

191:                                              ; preds = %190, %188, %170
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  br label %194

194:                                              ; preds = %193
  %195 = load i32, ptr %26, align 4, !tbaa !20
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %26, align 4, !tbaa !20
  br label %162, !llvm.loop !41

197:                                              ; preds = %168
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  ret void

198:                                              ; preds = %158
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH17ConvexHullBuilder11sUnlinkFaceEPNS0_4FaceE(ptr noundef) #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH17ConvexHullBuilder4Face8IsFacingENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(69), double, double) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 = !{i64 2157048941}
!10 = !{i64 0, i64 16, !11}
!11 = !{!7, !7, i64 0}
!12 = !{i64 2157049301}
!13 = !{!14, !19, i64 68}
!14 = !{!"_ZTSN3JPH17ConvexHullBuilder4FaceE", !15, i64 0, !15, i64 16, !16, i64 32, !6, i64 56, !18, i64 64, !19, i64 68}
!15 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!16 = !{!"_ZTSN3JPH5ArrayIiNS_12STLAllocatorIiEEEE", !17, i64 0, !17, i64 8, !6, i64 16}
!17 = !{!"long", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}
!22 = !{!14, !6, i64 56}
!23 = !{!24, !6, i64 0}
!24 = !{!"_ZTSZNK3JPH17ConvexHullBuilder8FindEdgeEPNS0_4FaceENS_4Vec3ERNS_5ArrayINS0_8FullEdgeENS_12STLAllocatorIS5_EEEEE10StackEntry", !6, i64 0, !6, i64 8}
!25 = !{!24, !6, i64 8}
!26 = !{!27, !6, i64 8}
!27 = !{!"_ZTSN3JPH17ConvexHullBuilder4EdgeE", !6, i64 0, !6, i64 8, !6, i64 16, !21, i64 24}
!28 = !{!27, !6, i64 0}
!29 = !{!27, !6, i64 16}
!30 = !{i8 0, i8 2}
!31 = !{}
!32 = !{i64 2157049657}
!33 = !{!34, !6, i64 0}
!34 = !{!"_ZTSN3JPH17ConvexHullBuilder8FullEdgeE", !6, i64 0, !21, i64 8, !21, i64 12}
!35 = !{!27, !21, i64 24}
!36 = !{!34, !21, i64 8}
!37 = !{!34, !21, i64 12}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{i64 2157050089}
!41 = distinct !{!41, !39}


; 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.StackEntry = type { ptr, ptr }
%"class.JPH::ConvexHullBuilder::FullEdge" = type { ptr, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [69 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 zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH17ConvexHullBuilder8FindEdgeEPNS0_4FaceENS_4Vec3ERNS_5ArrayINS0_8FullEdgeENS_12STLAllocatorIS5_EEEE(ptr nocapture noundef nonnull readnone align 8 dereferenceable(56) %0, ptr noundef %1, double %2, double %3, ptr noundef nonnull align 8 dereferenceable(24) %4) local_unnamed_addr #2 align 2 {
  %6 = alloca [128 x %struct.StackEntry], align 16
  %7 = alloca %"class.JPH::ConvexHullBuilder::FullEdge", align 8
  %8 = tail call noundef zeroext i1 @_ZNK3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  br i1 %8, label %12, label %9

9:                                                ; preds = %5
  %10 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.1, i32 noundef 776)
  br i1 %10, label %11, label %12

11:                                               ; preds = %9
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #4, !srcloc !5
  br label %12

12:                                               ; preds = %11, %9, %5
  %13 = tail call noundef zeroext i1 @_ZNK3JPH17ConvexHullBuilder4Face8IsFacingENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(69) %1, double %2, double %3)
  br i1 %13, label %17, label %14

14:                                               ; preds = %12
  %15 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.1, i32 noundef 779)
  br i1 %15, label %16, label %17

16:                                               ; preds = %14
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #4, !srcloc !6
  br label %17

17:                                               ; preds = %12, %14, %16
  %18 = getelementptr inbounds i8, ptr %1, i64 68
  store i8 1, ptr %18, align 4, !tbaa !7
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %6) #4
  %19 = getelementptr inbounds i8, ptr %1, i64 56
  %20 = load ptr, ptr %19, align 8, !tbaa !17
  store ptr %20, ptr %6, align 16, !tbaa !18
  %21 = ptrtoint ptr %20 to i64
  %22 = or i64 %21, 1
  %23 = inttoptr i64 %22 to ptr
  %24 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %23, ptr %24, align 8, !tbaa !20
  %25 = getelementptr inbounds i8, ptr %7, i64 8
  %26 = getelementptr inbounds i8, ptr %7, i64 12
  br label %.outer

.outer:                                           ; preds = %.outer.backedge, %17
  %.043.ph = phi i32 [ 0, %17 ], [ %.043.ph.be, %.outer.backedge ]
  %27 = sext i32 %.043.ph to i64
  %28 = getelementptr inbounds [128 x %struct.StackEntry], ptr %6, i64 0, i64 %27
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = load ptr, ptr %28, align 16, !tbaa !18
  %.promoted = load ptr, ptr %29, align 8, !tbaa !20
  %31 = ptrtoint ptr %.promoted to i64
  %32 = and i64 %31, -2
  %33 = inttoptr i64 %32 to ptr
  %34 = getelementptr inbounds i8, ptr %33, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %36 = icmp eq ptr %.promoted, %30
  br i1 %36, label %._crit_edge62, label %.lr.ph61

._crit_edge62:                                    ; preds = %.backedge, %.outer
  %.lcssa57 = phi ptr [ %33, %.outer ], [ %70, %.backedge ]
  %.lcssa = phi ptr [ %35, %.outer ], [ %72, %.backedge ]
  store ptr %.lcssa, ptr %29, align 8, !tbaa !20
  %37 = load ptr, ptr %.lcssa57, align 8, !tbaa !24
  call void @_ZN3JPH17ConvexHullBuilder11sUnlinkFaceEPNS0_4FaceE(ptr noundef %37)
  %38 = add nsw i32 %.043.ph, -1
  %.inv = icmp sgt i32 %.043.ph, 0
  br i1 %.inv, label %.outer.backedge, label %.preheader

.lr.ph61:                                         ; preds = %.outer, %.backedge
  %39 = phi ptr [ %72, %.backedge ], [ %35, %.outer ]
  %40 = phi ptr [ %70, %.backedge ], [ %33, %.outer ]
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load ptr, ptr %41, align 8, !tbaa !25
  %.not = icmp eq ptr %42, null
  br i1 %.not, label %.backedge, label %43

43:                                               ; preds = %.lr.ph61
  %44 = load ptr, ptr %42, align 8, !tbaa !24
  %45 = getelementptr inbounds i8, ptr %44, i64 68
  %46 = load i8, ptr %45, align 4, !tbaa !7, !range !26, !noundef !27
  %47 = trunc nuw i8 %46 to i1
  br i1 %47, label %.backedge, label %48

48:                                               ; preds = %43
  %49 = call noundef zeroext i1 @_ZNK3JPH17ConvexHullBuilder4Face8IsFacingENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(69) %44, double %2, double %3)
  br i1 %49, label %50, label %63

50:                                               ; preds = %48
  store ptr %39, ptr %29, align 8, !tbaa !20
  %51 = getelementptr inbounds i8, ptr %44, i64 68
  store i8 1, ptr %51, align 4, !tbaa !7
  %52 = add nsw i32 %.043.ph, 1
  %53 = icmp slt i32 %.043.ph, 127
  br i1 %53, label %57, label %54

54:                                               ; preds = %50
  %55 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.1, i32 noundef 836)
  br i1 %55, label %56, label %57

56:                                               ; preds = %54
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #4, !srcloc !28
  br label %57

57:                                               ; preds = %56, %54, %50
  %58 = sext i32 %52 to i64
  %59 = getelementptr inbounds [128 x %struct.StackEntry], ptr %6, i64 0, i64 %58
  store ptr %42, ptr %59, align 16, !tbaa !18
  %60 = getelementptr inbounds i8, ptr %42, i64 8
  %61 = load ptr, ptr %60, align 8, !tbaa !21
  %62 = getelementptr inbounds i8, ptr %59, i64 8
  store ptr %61, ptr %62, align 8, !tbaa !20
  br label %.outer.backedge

.outer.backedge:                                  ; preds = %57, %._crit_edge62
  %.043.ph.be = phi i32 [ %38, %._crit_edge62 ], [ %52, %57 ]
  br label %.outer

63:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  store ptr %42, ptr %7, align 8, !tbaa !29
  %64 = getelementptr inbounds i8, ptr %40, i64 24
  %65 = load i32, ptr %64, align 8, !tbaa !31
  store i32 %65, ptr %25, align 8, !tbaa !32
  %66 = getelementptr inbounds i8, ptr %42, i64 24
  %67 = load i32, ptr %66, align 8, !tbaa !31
  store i32 %67, ptr %26, align 4, !tbaa !33
  call void @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  br label %.backedge

.backedge:                                        ; preds = %.lr.ph61, %43, %63
  %68 = ptrtoint ptr %39 to i64
  %69 = and i64 %68, -2
  %70 = inttoptr i64 %69 to ptr
  %71 = getelementptr inbounds i8, ptr %70, i64 8
  %72 = load ptr, ptr %71, align 8, !tbaa !21
  %73 = icmp eq ptr %39, %30
  br i1 %73, label %._crit_edge62, label %.lr.ph61

.preheader:                                       ; preds = %._crit_edge62
  %74 = call noundef i64 @_ZNK3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %75 = trunc i64 %74 to i32
  %76 = icmp sgt i32 %75, 0
  br i1 %76, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %89, %.preheader
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %6) #4
  ret void

.lr.ph:                                           ; preds = %.preheader, %89
  %indvars.iv = phi i64 [ %indvars.iv.next, %89 ], [ 0, %.preheader ]
  %77 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %indvars.iv)
  %78 = getelementptr inbounds i8, ptr %77, i64 12
  %79 = load i32, ptr %78, align 4, !tbaa !33
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %80 = call noundef i64 @_ZNK3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %81 = urem i64 %indvars.iv.next, %80
  %82 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %81)
  %83 = getelementptr inbounds i8, ptr %82, i64 8
  %84 = load i32, ptr %83, align 8, !tbaa !32
  %85 = icmp eq i32 %79, %84
  br i1 %85, label %89, label %86

86:                                               ; preds = %.lr.ph
  %87 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str.22, ptr noundef nonnull @.str.1, i32 noundef 858)
  br i1 %87, label %88, label %89

88:                                               ; preds = %86
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #4, !srcloc !34
  br label %89

89:                                               ; preds = %.lr.ph, %86, %88
  %90 = call noundef i64 @_ZNK3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %sext = shl i64 %90, 32
  %91 = ashr exact i64 %sext, 32
  %92 = icmp slt i64 %indvars.iv.next, %91
  br i1 %92, label %.lr.ph, label %._crit_edge, !llvm.loop !35
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH17ConvexHullBuilder11sUnlinkFaceEPNS0_4FaceE(ptr noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH17ConvexHullBuilder4Face8IsFacingENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(69), double, double) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH5ArrayINS_17ConvexHullBuilder8FullEdgeENS_12STLAllocatorIS2_EEE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 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 = { 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 = !{i64 2157048941}
!6 = !{i64 2157049301}
!7 = !{!8, !16, i64 68}
!8 = !{!"_ZTSN3JPH17ConvexHullBuilder4FaceE", !9, i64 0, !9, i64 16, !12, i64 32, !14, i64 56, !15, i64 64, !16, i64 68}
!9 = !{!"_ZTSN3JPH4Vec3E", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN3JPH5ArrayIiNS_12STLAllocatorIiEEEE", !13, i64 0, !13, i64 8, !14, i64 16}
!13 = !{!"long", !10, i64 0}
!14 = !{!"any pointer", !10, i64 0}
!15 = !{!"float", !10, i64 0}
!16 = !{!"bool", !10, i64 0}
!17 = !{!8, !14, i64 56}
!18 = !{!19, !14, i64 0}
!19 = !{!"_ZTSZNK3JPH17ConvexHullBuilder8FindEdgeEPNS0_4FaceENS_4Vec3ERNS_5ArrayINS0_8FullEdgeENS_12STLAllocatorIS5_EEEEE10StackEntry", !14, i64 0, !14, i64 8}
!20 = !{!19, !14, i64 8}
!21 = !{!22, !14, i64 8}
!22 = !{!"_ZTSN3JPH17ConvexHullBuilder4EdgeE", !14, i64 0, !14, i64 8, !14, i64 16, !23, i64 24}
!23 = !{!"int", !10, i64 0}
!24 = !{!22, !14, i64 0}
!25 = !{!22, !14, i64 16}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{i64 2157049657}
!29 = !{!30, !14, i64 0}
!30 = !{!"_ZTSN3JPH17ConvexHullBuilder8FullEdgeE", !14, i64 0, !23, i64 8, !23, i64 12}
!31 = !{!22, !23, i64 24}
!32 = !{!30, !23, i64 8}
!33 = !{!30, !23, i64 12}
!34 = !{i64 2157050089}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


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