; LLVM IR from doyubkim/fluid-engine-dev :: src/jet/box3.ll (ZNK3jet4Box317closestPointLocalERKNS_6VectorIdLm3EEE)

; 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.jet::Vector" = type { double, double, double }
%"class.jet::Plane3" = type { %"class.jet::Surface3.base", %"class.jet::Vector", %"class.jet::Vector" }
%"class.jet::Surface3.base" = type <{ ptr, %"class.jet::Transform3", i8 }>
%"class.jet::Transform3" = type { %"class.jet::Vector", %"class.jet::Quaternion", %"class.jet::Matrix", %"class.jet::Matrix" }
%"class.jet::Quaternion" = type { double, double, double, double }
%"class.jet::Matrix" = type { %"struct.std::array" }
%"struct.std::array" = type { [9 x double] }
%"class.jet::Box3" = type { %"class.jet::Surface3.base", %"class.jet::BoundingBox" }
%"class.jet::BoundingBox" = type { %"class.jet::Vector", %"class.jet::Vector" }

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #1 align 2

; 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 void @_ZNK3jet4Box317closestPointLocalERKNS_6VectorIdLm3EEE(ptr dead_on_unwind noalias writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(264) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [6 x %"class.jet::Plane3"], align 16
  %8 = alloca ptr, align 8
  %9 = alloca %"class.jet::Vector", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.jet::Transform3", align 8
  %13 = alloca %"class.jet::Vector", align 8
  %14 = alloca %"class.jet::Transform3", align 8
  %15 = alloca %"class.jet::Vector", align 8
  %16 = alloca %"class.jet::Transform3", align 8
  %17 = alloca %"class.jet::Vector", align 8
  %18 = alloca %"class.jet::Transform3", align 8
  %19 = alloca %"class.jet::Vector", align 8
  %20 = alloca %"class.jet::Transform3", align 8
  %21 = alloca %"class.jet::Vector", align 8
  %22 = alloca %"class.jet::Transform3", align 8
  %23 = alloca i1, align 1
  %24 = alloca double, align 8
  %25 = alloca i32, align 4
  %26 = alloca %"class.jet::Vector", align 8
  %27 = alloca double, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8
  %29 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = call noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm3EE8containsERKNS_6VectorIdLm3EEE(ptr noundef nonnull align 8 dereferenceable(48) %29, ptr noundef nonnull align 8 dereferenceable(24) %30)
  br i1 %31, label %32, label %202

32:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1584, ptr %7) #6
  store i1 true, ptr %23, align 1
  store ptr %7, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #6
  invoke void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %9, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
          to label %33 unwind label %78

33:                                               ; preds = %32
  %34 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %35 = getelementptr inbounds %"class.jet::BoundingBox", ptr %34, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 200, ptr %12) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %12)
          to label %36 unwind label %82

36:                                               ; preds = %33
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 8 dereferenceable(200) %12, i1 noundef zeroext false)
          to label %37 unwind label %82

37:                                               ; preds = %36
  %38 = getelementptr inbounds %"class.jet::Plane3", ptr %7, i64 1
  store ptr %38, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #6
  invoke void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %13, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00)
          to label %39 unwind label %86

39:                                               ; preds = %37
  %40 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %41 = getelementptr inbounds %"class.jet::BoundingBox", ptr %40, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 200, ptr %14) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %14)
          to label %42 unwind label %90

42:                                               ; preds = %39
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %38, ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(24) %41, ptr noundef nonnull align 8 dereferenceable(200) %14, i1 noundef zeroext false)
          to label %43 unwind label %90

43:                                               ; preds = %42
  %44 = getelementptr inbounds %"class.jet::Plane3", ptr %7, i64 2
  store ptr %44, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #6
  invoke void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %15, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00)
          to label %45 unwind label %94

45:                                               ; preds = %43
  %46 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %47 = getelementptr inbounds %"class.jet::BoundingBox", ptr %46, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 200, ptr %16) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %16)
          to label %48 unwind label %98

48:                                               ; preds = %45
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %44, ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(200) %16, i1 noundef zeroext false)
          to label %49 unwind label %98

49:                                               ; preds = %48
  %50 = getelementptr inbounds %"class.jet::Plane3", ptr %7, i64 3
  store ptr %50, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #6
  invoke void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %17, double noundef -1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
          to label %51 unwind label %102

51:                                               ; preds = %49
  %52 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %53 = getelementptr inbounds %"class.jet::BoundingBox", ptr %52, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 200, ptr %18) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %18)
          to label %54 unwind label %106

54:                                               ; preds = %51
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %50, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %53, ptr noundef nonnull align 8 dereferenceable(200) %18, i1 noundef zeroext false)
          to label %55 unwind label %106

55:                                               ; preds = %54
  %56 = getelementptr inbounds %"class.jet::Plane3", ptr %7, i64 4
  store ptr %56, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #6
  invoke void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %19, double noundef 0.000000e+00, double noundef -1.000000e+00, double noundef 0.000000e+00)
          to label %57 unwind label %110

57:                                               ; preds = %55
  %58 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %59 = getelementptr inbounds %"class.jet::BoundingBox", ptr %58, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 200, ptr %20) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %20)
          to label %60 unwind label %114

60:                                               ; preds = %57
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %56, ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(24) %59, ptr noundef nonnull align 8 dereferenceable(200) %20, i1 noundef zeroext false)
          to label %61 unwind label %114

61:                                               ; preds = %60
  %62 = getelementptr inbounds %"class.jet::Plane3", ptr %7, i64 5
  store ptr %62, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #6
  invoke void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %21, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef -1.000000e+00)
          to label %63 unwind label %118

63:                                               ; preds = %61
  %64 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %65 = getelementptr inbounds %"class.jet::BoundingBox", ptr %64, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 200, ptr %22) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %22)
          to label %66 unwind label %122

66:                                               ; preds = %63
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %62, ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(24) %65, ptr noundef nonnull align 8 dereferenceable(200) %22, i1 noundef zeroext false)
          to label %67 unwind label %122

67:                                               ; preds = %66
  store i1 false, ptr %23, align 1
  call void @llvm.lifetime.end.p0(i64 200, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  %68 = getelementptr inbounds [6 x %"class.jet::Plane3"], ptr %7, i64 0, i64 0
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(209) %68, ptr noundef nonnull align 8 dereferenceable(24) %69)
          to label %70 unwind label %147

70:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %71)
          to label %73 unwind label %151

73:                                               ; preds = %70
  store double %72, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  store i32 1, ptr %25, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %180, %73
  %75 = load i32, ptr %25, align 4, !tbaa !11
  %76 = icmp slt i32 %75, 6
  br i1 %76, label %155, label %77

77:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %184

78:                                               ; preds = %32
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %10, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %11, align 4
  br label %136

82:                                               ; preds = %36, %33
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %10, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %11, align 4
  br label %135

86:                                               ; preds = %37
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %10, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %11, align 4
  br label %134

90:                                               ; preds = %42, %39
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %10, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %11, align 4
  br label %133

94:                                               ; preds = %43
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %10, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %11, align 4
  br label %132

98:                                               ; preds = %48, %45
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %10, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %11, align 4
  br label %131

102:                                              ; preds = %49
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %10, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %11, align 4
  br label %130

106:                                              ; preds = %54, %51
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %10, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %11, align 4
  br label %129

110:                                              ; preds = %55
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %10, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %11, align 4
  br label %128

114:                                              ; preds = %60, %57
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %10, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %11, align 4
  br label %127

118:                                              ; preds = %61
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %10, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %11, align 4
  br label %126

122:                                              ; preds = %66, %63
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %10, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 200, ptr %22) #6
  br label %126

126:                                              ; preds = %122, %118
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #6
  br label %127

127:                                              ; preds = %126, %114
  call void @llvm.lifetime.end.p0(i64 200, ptr %20) #6
  br label %128

128:                                              ; preds = %127, %110
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  br label %129

129:                                              ; preds = %128, %106
  call void @llvm.lifetime.end.p0(i64 200, ptr %18) #6
  br label %130

130:                                              ; preds = %129, %102
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  br label %131

131:                                              ; preds = %130, %98
  call void @llvm.lifetime.end.p0(i64 200, ptr %16) #6
  br label %132

132:                                              ; preds = %131, %94
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  br label %133

133:                                              ; preds = %132, %90
  call void @llvm.lifetime.end.p0(i64 200, ptr %14) #6
  br label %134

134:                                              ; preds = %133, %86
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #6
  br label %135

135:                                              ; preds = %134, %82
  call void @llvm.lifetime.end.p0(i64 200, ptr %12) #6
  br label %136

136:                                              ; preds = %135, %78
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #6
  %137 = load i1, ptr %23, align 1
  br i1 %137, label %138, label %146

138:                                              ; preds = %136
  %139 = load ptr, ptr %8, align 8
  %140 = icmp eq ptr %7, %139
  br i1 %140, label %145, label %141

141:                                              ; preds = %141, %138
  %142 = phi ptr [ %139, %138 ], [ %143, %141 ]
  %143 = getelementptr inbounds %"class.jet::Plane3", ptr %142, i64 -1
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %143) #6
  %144 = icmp eq ptr %143, %7
  br i1 %144, label %145, label %141

145:                                              ; preds = %141, %138
  br label %146

146:                                              ; preds = %145, %136
  br label %201

147:                                              ; preds = %67
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %10, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %11, align 4
  br label %193

151:                                              ; preds = %70
  %152 = landingpad { ptr, i32 }
          cleanup
  %153 = extractvalue { ptr, i32 } %152, 0
  store ptr %153, ptr %10, align 8
  %154 = extractvalue { ptr, i32 } %152, 1
  store i32 %154, ptr %11, align 4
  br label %187

155:                                              ; preds = %74
  call void @llvm.lifetime.start.p0(i64 24, ptr %26) #6
  %156 = load i32, ptr %25, align 4, !tbaa !11
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [6 x %"class.jet::Plane3"], ptr %7, i64 0, i64 %157
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %26, ptr noundef nonnull align 8 dereferenceable(209) %158, ptr noundef nonnull align 8 dereferenceable(24) %159)
          to label %160 unwind label %171

160:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  %162 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %26, ptr noundef nonnull align 8 dereferenceable(24) %161)
          to label %163 unwind label %175

163:                                              ; preds = %160
  store double %162, ptr %27, align 8, !tbaa !9
  %164 = load double, ptr %27, align 8, !tbaa !9
  %165 = load double, ptr %24, align 8, !tbaa !9
  %166 = fcmp olt double %164, %165
  br i1 %166, label %167, label %179

167:                                              ; preds = %163
  %168 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3jet6VectorIdLm3EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %26)
          to label %169 unwind label %175

169:                                              ; preds = %167
  %170 = load double, ptr %27, align 8, !tbaa !9
  store double %170, ptr %24, align 8, !tbaa !9
  br label %179

171:                                              ; preds = %155
  %172 = landingpad { ptr, i32 }
          cleanup
  %173 = extractvalue { ptr, i32 } %172, 0
  store ptr %173, ptr %10, align 8
  %174 = extractvalue { ptr, i32 } %172, 1
  store i32 %174, ptr %11, align 4
  br label %183

175:                                              ; preds = %167, %160
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %10, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  br label %183

179:                                              ; preds = %169, %163
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %26) #6
  br label %180

180:                                              ; preds = %179
  %181 = load i32, ptr %25, align 4, !tbaa !11
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %25, align 4, !tbaa !11
  br label %74, !llvm.loop !13

183:                                              ; preds = %175, %171
  call void @llvm.lifetime.end.p0(i64 24, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %187

184:                                              ; preds = %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  %185 = getelementptr inbounds [6 x %"class.jet::Plane3"], ptr %7, i32 0, i32 0
  %186 = getelementptr inbounds %"class.jet::Plane3", ptr %185, i64 6
  br label %188

187:                                              ; preds = %183, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %193

188:                                              ; preds = %188, %184
  %189 = phi ptr [ %186, %184 ], [ %190, %188 ]
  %190 = getelementptr inbounds %"class.jet::Plane3", ptr %189, i64 -1
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %190) #6
  %191 = icmp eq ptr %190, %185
  br i1 %191, label %192, label %188

192:                                              ; preds = %188
  call void @llvm.lifetime.end.p0(i64 1584, ptr %7) #6
  br label %208

193:                                              ; preds = %187, %147
  %194 = getelementptr inbounds [6 x %"class.jet::Plane3"], ptr %7, i32 0, i32 0
  %195 = getelementptr inbounds %"class.jet::Plane3", ptr %194, i64 6
  br label %196

196:                                              ; preds = %196, %193
  %197 = phi ptr [ %195, %193 ], [ %198, %196 ]
  %198 = getelementptr inbounds %"class.jet::Plane3", ptr %197, i64 -1
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %198) #6
  %199 = icmp eq ptr %198, %194
  br i1 %199, label %200, label %196

200:                                              ; preds = %196
  br label %201

201:                                              ; preds = %200, %146
  call void @llvm.lifetime.end.p0(i64 1584, ptr %7) #6
  br label %209

202:                                              ; preds = %3
  %203 = load ptr, ptr %6, align 8, !tbaa !5
  %204 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %205 = getelementptr inbounds %"class.jet::BoundingBox", ptr %204, i32 0, i32 0
  %206 = getelementptr inbounds %"class.jet::Box3", ptr %28, i32 0, i32 1
  %207 = getelementptr inbounds %"class.jet::BoundingBox", ptr %206, i32 0, i32 1
  call void @_ZN3jet5clampIdEENS_6VectorIT_Lm3EEERKS3_S5_S5_(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %203, ptr noundef nonnull align 8 dereferenceable(24) %205, ptr noundef nonnull align 8 dereferenceable(24) %207)
  br label %208

208:                                              ; preds = %202, %192
  ret void

209:                                              ; preds = %201
  %210 = load ptr, ptr %10, align 8
  %211 = load i32, ptr %11, align 4
  %212 = insertvalue { ptr, i32 } poison, ptr %210, 0
  %213 = insertvalue { ptr, i32 } %212, i32 %211, 1
  resume { ptr, i32 } %213
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm3EE8containsERKNS_6VectorIdLm3EEE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

declare void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(200), i1 noundef zeroext) unnamed_addr #4

declare void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(209), ptr noundef nonnull align 8 dereferenceable(24)) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3jet5clampIdEENS_6VectorIT_Lm3EEERKS3_S5_S5_(ptr dead_on_unwind noalias writable sret(%"class.jet::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2

; Function Attrs: nounwind
declare void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(209)) unnamed_addr #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
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 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 = { "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 "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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.jet::Vector" = type { double, double, double }
%"class.jet::Plane3" = type { %"class.jet::Surface3.base", %"class.jet::Vector", %"class.jet::Vector" }
%"class.jet::Surface3.base" = type <{ ptr, %"class.jet::Transform3", i8 }>
%"class.jet::Transform3" = type { %"class.jet::Vector", %"class.jet::Quaternion", %"class.jet::Matrix", %"class.jet::Matrix" }
%"class.jet::Quaternion" = type { double, double, double, double }
%"class.jet::Matrix" = type { %"struct.std::array" }
%"struct.std::array" = type { [9 x double] }

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24), double noundef, double noundef, double noundef) unnamed_addr #1 align 2

; 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 void @_ZNK3jet4Box317closestPointLocalERKNS_6VectorIdLm3EEE(ptr dead_on_unwind noalias writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(264) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca [6 x %"class.jet::Plane3"], align 16
  %5 = alloca %"class.jet::Vector", align 8
  %6 = alloca %"class.jet::Transform3", align 8
  %7 = alloca %"class.jet::Vector", align 8
  %8 = alloca %"class.jet::Transform3", align 8
  %9 = alloca %"class.jet::Vector", align 8
  %10 = alloca %"class.jet::Transform3", align 8
  %11 = alloca %"class.jet::Vector", align 8
  %12 = alloca %"class.jet::Transform3", align 8
  %13 = alloca %"class.jet::Vector", align 8
  %14 = alloca %"class.jet::Transform3", align 8
  %15 = alloca %"class.jet::Vector", align 8
  %16 = alloca %"class.jet::Transform3", align 8
  %17 = alloca %"class.jet::Vector", align 8
  %18 = getelementptr inbounds i8, ptr %1, i64 216
  %19 = tail call noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm3EE8containsERKNS_6VectorIdLm3EEE(ptr noundef nonnull align 8 dereferenceable(48) %18, ptr noundef nonnull align 8 dereferenceable(24) %2)
  br i1 %19, label %20, label %107

20:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1584, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %5, double noundef 1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  %21 = getelementptr inbounds i8, ptr %1, i64 240
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %6) #6
  call void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %6)
  call void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(200) %6, i1 noundef zeroext false)
  %22 = getelementptr inbounds i8, ptr %4, i64 264
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %7, double noundef 0.000000e+00, double noundef 1.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %8) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %8)
          to label %23 unwind label %39

23:                                               ; preds = %20
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(200) %8, i1 noundef zeroext false)
          to label %24 unwind label %39

24:                                               ; preds = %23
  %25 = getelementptr inbounds i8, ptr %4, i64 528
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  call void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %9, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef 1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %10) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %10)
          to label %26 unwind label %41

26:                                               ; preds = %24
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %25, ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(200) %10, i1 noundef zeroext false)
          to label %27 unwind label %41

27:                                               ; preds = %26
  %28 = getelementptr inbounds i8, ptr %4, i64 792
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #6
  call void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %11, double noundef -1.000000e+00, double noundef 0.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %12) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %12)
          to label %29 unwind label %43

29:                                               ; preds = %27
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %28, ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(200) %12, i1 noundef zeroext false)
          to label %30 unwind label %43

30:                                               ; preds = %29
  %31 = getelementptr inbounds i8, ptr %4, i64 1056
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #6
  call void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %13, double noundef 0.000000e+00, double noundef -1.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %14) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %14)
          to label %32 unwind label %45

32:                                               ; preds = %30
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %31, ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(200) %14, i1 noundef zeroext false)
          to label %33 unwind label %45

33:                                               ; preds = %32
  %34 = getelementptr inbounds i8, ptr %4, i64 1320
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %15) #6
  call void @_ZN3jet6VectorIdLm3EEC2Eddd(ptr noundef nonnull align 8 dereferenceable(24) %15, double noundef 0.000000e+00, double noundef 0.000000e+00, double noundef -1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %16) #6
  invoke void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200) %16)
          to label %35 unwind label %47

35:                                               ; preds = %33
  invoke void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264) %34, ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(200) %16, i1 noundef zeroext false)
          to label %36 unwind label %47

36:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(209) %4, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %37 unwind label %57

37:                                               ; preds = %36
  %38 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %.preheader.preheader unwind label %59

.preheader.preheader:                             ; preds = %37
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #6
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %17, ptr noundef nonnull align 8 dereferenceable(209) %22, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %61 unwind label %67

39:                                               ; preds = %23, %20
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %52

41:                                               ; preds = %26, %24
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %51

43:                                               ; preds = %29, %27
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %50

45:                                               ; preds = %32, %30
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %49

47:                                               ; preds = %35, %33
  %48 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %15) #6
  br label %49

49:                                               ; preds = %47, %45
  %.pn = phi { ptr, i32 } [ %48, %47 ], [ %46, %45 ]
  %.0 = phi ptr [ %34, %47 ], [ %31, %45 ]
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #6
  br label %50

50:                                               ; preds = %49, %43
  %.pn.pn = phi { ptr, i32 } [ %.pn, %49 ], [ %44, %43 ]
  %.1 = phi ptr [ %.0, %49 ], [ %28, %43 ]
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  br label %51

51:                                               ; preds = %50, %41
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %50 ], [ %42, %41 ]
  %.2 = phi ptr [ %.1, %50 ], [ %25, %41 ]
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  br label %52

52:                                               ; preds = %39, %51
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %51 ], [ %40, %39 ]
  %.3 = phi ptr [ %.2, %51 ], [ %22, %39 ]
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  br label %53

53:                                               ; preds = %52, %53
  %54 = phi ptr [ %55, %53 ], [ %.3, %52 ]
  %55 = getelementptr inbounds i8, ptr %54, i64 -264
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %55) #6
  %56 = icmp eq ptr %55, %4
  br i1 %56, label %.loopexit, label %53

57:                                               ; preds = %36
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.loopexit

59:                                               ; preds = %37
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit.loopexit

61:                                               ; preds = %.preheader.preheader
  %62 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %63 unwind label %69

63:                                               ; preds = %61
  %64 = fcmp olt double %62, %38
  br i1 %64, label %65, label %.preheader.1

65:                                               ; preds = %63
  %66 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3jet6VectorIdLm3EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %.preheader.1 unwind label %69

67:                                               ; preds = %.preheader.4, %.preheader.3, %.preheader.2, %.preheader.1, %.preheader.preheader
  %68 = landingpad { ptr, i32 }
          cleanup
  br label %101

69:                                               ; preds = %93, %89, %87, %83, %81, %77, %75, %71, %65, %61
  %70 = landingpad { ptr, i32 }
          cleanup
  br label %101

.preheader.1:                                     ; preds = %65, %63
  %.119 = phi double [ %38, %63 ], [ %62, %65 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #6
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %17, ptr noundef nonnull align 8 dereferenceable(209) %25, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %71 unwind label %67

71:                                               ; preds = %.preheader.1
  %72 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %73 unwind label %69

73:                                               ; preds = %71
  %74 = fcmp olt double %72, %.119
  br i1 %74, label %75, label %.preheader.2

75:                                               ; preds = %73
  %76 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3jet6VectorIdLm3EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %.preheader.2 unwind label %69

.preheader.2:                                     ; preds = %75, %73
  %.119.1 = phi double [ %.119, %73 ], [ %72, %75 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #6
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %17, ptr noundef nonnull align 8 dereferenceable(209) %28, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %77 unwind label %67

77:                                               ; preds = %.preheader.2
  %78 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %79 unwind label %69

79:                                               ; preds = %77
  %80 = fcmp olt double %78, %.119.1
  br i1 %80, label %81, label %.preheader.3

81:                                               ; preds = %79
  %82 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3jet6VectorIdLm3EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %.preheader.3 unwind label %69

.preheader.3:                                     ; preds = %81, %79
  %.119.2 = phi double [ %.119.1, %79 ], [ %78, %81 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #6
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %17, ptr noundef nonnull align 8 dereferenceable(209) %31, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %83 unwind label %67

83:                                               ; preds = %.preheader.3
  %84 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %85 unwind label %69

85:                                               ; preds = %83
  %86 = fcmp olt double %84, %.119.2
  br i1 %86, label %87, label %.preheader.4

87:                                               ; preds = %85
  %88 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3jet6VectorIdLm3EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %.preheader.4 unwind label %69

.preheader.4:                                     ; preds = %87, %85
  %.119.3 = phi double [ %.119.2, %85 ], [ %84, %87 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #6
  invoke void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %17, ptr noundef nonnull align 8 dereferenceable(209) %34, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %89 unwind label %67

89:                                               ; preds = %.preheader.4
  %90 = invoke noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %91 unwind label %69

91:                                               ; preds = %89
  %92 = fcmp olt double %90, %.119.3
  br i1 %92, label %93, label %95

93:                                               ; preds = %91
  %94 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3jet6VectorIdLm3EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %95 unwind label %69

95:                                               ; preds = %93, %91
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #6
  %96 = getelementptr inbounds i8, ptr %4, i64 1320
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %96) #6
  %97 = getelementptr inbounds i8, ptr %4, i64 1056
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %97) #6
  %98 = getelementptr inbounds i8, ptr %4, i64 792
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %98) #6
  %99 = getelementptr inbounds i8, ptr %4, i64 528
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %99) #6
  %100 = getelementptr inbounds i8, ptr %4, i64 264
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %100) #6
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %4) #6
  call void @llvm.lifetime.end.p0(i64 1584, ptr nonnull %4) #6
  br label %109

101:                                              ; preds = %69, %67
  %.pn41 = phi { ptr, i32 } [ %70, %69 ], [ %68, %67 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #6
  br label %.loopexit.loopexit

.loopexit.loopexit:                               ; preds = %59, %101, %57
  %.pn41.pn.pn = phi { ptr, i32 } [ %58, %57 ], [ %.pn41, %101 ], [ %60, %59 ]
  %102 = getelementptr inbounds i8, ptr %4, i64 1320
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %102) #6
  %103 = getelementptr inbounds i8, ptr %4, i64 1056
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %103) #6
  %104 = getelementptr inbounds i8, ptr %4, i64 792
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %104) #6
  %105 = getelementptr inbounds i8, ptr %4, i64 528
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %105) #6
  %106 = getelementptr inbounds i8, ptr %4, i64 264
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %106) #6
  call void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(264) %4) #6
  br label %.loopexit

.loopexit:                                        ; preds = %53, %.loopexit.loopexit
  %.pn41.pn.pn.pn = phi { ptr, i32 } [ %.pn41.pn.pn, %.loopexit.loopexit ], [ %.pn.pn.pn.pn, %53 ]
  call void @llvm.lifetime.end.p0(i64 1584, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn41.pn.pn.pn

107:                                              ; preds = %3
  %108 = getelementptr inbounds i8, ptr %1, i64 240
  tail call void @_ZN3jet5clampIdEENS_6VectorIT_Lm3EEERKS3_S5_S5_(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %18, ptr noundef nonnull align 8 dereferenceable(24) %108)
  br label %109

109:                                              ; preds = %107, %95
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm3EE8containsERKNS_6VectorIdLm3EEE(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3jet10Transform3C2Ev(ptr noundef nonnull align 8 dereferenceable(200)) unnamed_addr #3 align 2

declare void @_ZN3jet6Plane3C1ERKNS_6VectorIdLm3EEES4_RKNS_10Transform3Eb(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(200), i1 noundef zeroext) unnamed_addr #4

declare void @_ZNK3jet8Surface312closestPointERKNS_6VectorIdLm3EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(209), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK3jet6VectorIdLm3EE17distanceSquaredToERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN3jet6VectorIdLm3EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3jet5clampIdEENS_6VectorIT_Lm3EEERKS3_S5_S5_(ptr dead_on_unwind noalias writable sret(%"class.jet::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN3jet8Surface3D2Ev(ptr noundef nonnull align 8 dereferenceable(209)) unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
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 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 = { "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 "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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass