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

; 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 }
%"class.jet::Plane2" = type { %"class.jet::Surface2.base", %"class.jet::Vector", %"class.jet::Vector" }
%"class.jet::Surface2.base" = type <{ ptr, %"class.jet::Transform2", i8 }>
%"class.jet::Transform2" = type { %"class.jet::Vector", double, double, double }
%"class.jet::Box2" = type { %"class.jet::Surface2.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 @_ZN3jet6VectorIdLm2EEC2Edd(ptr noundef nonnull align 8 dereferenceable(16), 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm2EE8containsERKNS_6VectorIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

declare void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(40), i1 noundef zeroext) unnamed_addr #3

declare void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 8 dereferenceable(16)) #3

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3jet4Box218closestNormalLocalERKNS_6VectorIdLm2EEE(ptr dead_on_unwind noalias writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(88) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [4 x %"class.jet::Plane2"], 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::Transform2", align 8
  %13 = alloca %"class.jet::Vector", align 8
  %14 = alloca %"class.jet::Transform2", align 8
  %15 = alloca %"class.jet::Vector", align 8
  %16 = alloca %"class.jet::Transform2", align 8
  %17 = alloca %"class.jet::Vector", align 8
  %18 = alloca %"class.jet::Transform2", align 8
  %19 = alloca i1, align 1
  %20 = alloca %"class.jet::Vector", align 8
  %21 = alloca double, align 8
  %22 = alloca %"class.jet::Vector", align 8
  %23 = alloca i32, align 4
  %24 = alloca %"class.jet::Vector", align 8
  %25 = alloca double, align 8
  %26 = alloca %"class.jet::Vector", align 8
  %27 = alloca i32, align 4
  %28 = alloca %"class.jet::Vector", align 8
  %29 = alloca %"class.jet::Vector", align 8
  %30 = alloca double, align 8
  %31 = alloca i32, align 4
  %32 = 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
  %33 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 352, ptr %7) #6
  store i1 true, ptr %19, align 1
  store ptr %7, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  invoke void @_ZN3jet6VectorIdLm2EEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %9, double noundef 1.000000e+00, double noundef 0.000000e+00)
          to label %34 unwind label %76

34:                                               ; preds = %3
  %35 = getelementptr inbounds %"class.jet::Box2", ptr %33, i32 0, i32 1
  %36 = getelementptr inbounds %"class.jet::BoundingBox", ptr %35, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 40, ptr %12) #6
  invoke void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %12)
          to label %37 unwind label %80

37:                                               ; preds = %34
  invoke void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %7, ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 8 dereferenceable(40) %12, i1 noundef zeroext false)
          to label %38 unwind label %80

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

40:                                               ; preds = %38
  %41 = getelementptr inbounds %"class.jet::Box2", ptr %33, i32 0, i32 1
  %42 = getelementptr inbounds %"class.jet::BoundingBox", ptr %41, i32 0, i32 1
  call void @llvm.lifetime.start.p0(i64 40, ptr %14) #6
  invoke void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %14)
          to label %43 unwind label %88

43:                                               ; preds = %40
  invoke void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %39, ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(40) %14, i1 noundef zeroext false)
          to label %44 unwind label %88

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

46:                                               ; preds = %44
  %47 = getelementptr inbounds %"class.jet::Box2", ptr %33, i32 0, i32 1
  %48 = getelementptr inbounds %"class.jet::BoundingBox", ptr %47, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 40, ptr %16) #6
  invoke void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %16)
          to label %49 unwind label %96

49:                                               ; preds = %46
  invoke void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %45, ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %48, ptr noundef nonnull align 8 dereferenceable(40) %16, i1 noundef zeroext false)
          to label %50 unwind label %96

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

52:                                               ; preds = %50
  %53 = getelementptr inbounds %"class.jet::Box2", ptr %33, i32 0, i32 1
  %54 = getelementptr inbounds %"class.jet::BoundingBox", ptr %53, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 40, ptr %18) #6
  invoke void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %18)
          to label %55 unwind label %104

55:                                               ; preds = %52
  invoke void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %51, ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull align 8 dereferenceable(40) %18, i1 noundef zeroext false)
          to label %56 unwind label %104

56:                                               ; preds = %55
  store i1 false, ptr %19, align 1
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  %57 = getelementptr inbounds %"class.jet::Box2", ptr %33, i32 0, i32 1
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = invoke noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm2EE8containsERKNS_6VectorIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(32) %57, ptr noundef nonnull align 8 dereferenceable(16) %58)
          to label %60 unwind label %125

60:                                               ; preds = %56
  br i1 %59, label %61, label %179

61:                                               ; preds = %60
  %62 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i64 0, i64 0
  %63 = getelementptr inbounds %"class.jet::Plane2", ptr %62, i32 0, i32 1
  invoke void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %63)
          to label %64 unwind label %125

64:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #6
  %65 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i64 0, i64 0
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %20, ptr noundef nonnull align 8 dereferenceable(49) %65, ptr noundef nonnull align 8 dereferenceable(16) %66)
          to label %67 unwind label %129

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #6
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %22, ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %68)
          to label %69 unwind label %133

69:                                               ; preds = %67
  %70 = invoke noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16) %22)
          to label %71 unwind label %133

71:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #6
  store double %70, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  store i32 1, ptr %23, align 4, !tbaa !11
  br label %72

72:                                               ; preds = %171, %71
  %73 = load i32, ptr %23, align 4, !tbaa !11
  %74 = icmp slt i32 %73, 4
  br i1 %74, label %137, label %75

75:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %176

76:                                               ; preds = %3
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %10, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %11, align 4
  br label %114

80:                                               ; preds = %37, %34
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %10, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %11, align 4
  br label %113

84:                                               ; preds = %38
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %10, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %11, align 4
  br label %112

88:                                               ; preds = %43, %40
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %10, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %11, align 4
  br label %111

92:                                               ; preds = %44
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %10, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %11, align 4
  br label %110

96:                                               ; preds = %49, %46
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %10, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %11, align 4
  br label %109

100:                                              ; preds = %50
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %10, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %11, align 4
  br label %108

104:                                              ; preds = %55, %52
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %10, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #6
  br label %108

108:                                              ; preds = %104, %100
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #6
  br label %109

109:                                              ; preds = %108, %96
  call void @llvm.lifetime.end.p0(i64 40, ptr %16) #6
  br label %110

110:                                              ; preds = %109, %92
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #6
  br label %111

111:                                              ; preds = %110, %88
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #6
  br label %112

112:                                              ; preds = %111, %84
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %113

113:                                              ; preds = %112, %80
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #6
  br label %114

114:                                              ; preds = %113, %76
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  %115 = load i1, ptr %19, align 1
  br i1 %115, label %116, label %124

116:                                              ; preds = %114
  %117 = load ptr, ptr %8, align 8
  %118 = icmp eq ptr %7, %117
  br i1 %118, label %123, label %119

119:                                              ; preds = %119, %116
  %120 = phi ptr [ %117, %116 ], [ %121, %119 ]
  %121 = getelementptr inbounds %"class.jet::Plane2", ptr %120, i64 -1
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %121) #6
  %122 = icmp eq ptr %121, %7
  br i1 %122, label %123, label %119

123:                                              ; preds = %119, %116
  br label %124

124:                                              ; preds = %123, %114
  br label %255

125:                                              ; preds = %61, %56
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %10, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %11, align 4
  br label %247

129:                                              ; preds = %64
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %10, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %11, align 4
  br label %178

133:                                              ; preds = %69, %67
  %134 = landingpad { ptr, i32 }
          cleanup
  %135 = extractvalue { ptr, i32 } %134, 0
  store ptr %135, ptr %10, align 8
  %136 = extractvalue { ptr, i32 } %134, 1
  store i32 %136, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #6
  br label %177

137:                                              ; preds = %72
  call void @llvm.lifetime.start.p0(i64 16, ptr %24) #6
  %138 = load i32, ptr %23, align 4, !tbaa !11
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i64 0, i64 %139
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %24, ptr noundef nonnull align 8 dereferenceable(49) %140, ptr noundef nonnull align 8 dereferenceable(16) %141)
          to label %142 unwind label %158

142:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #6
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %26, ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %143)
          to label %144 unwind label %162

144:                                              ; preds = %142
  %145 = invoke noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16) %26)
          to label %146 unwind label %162

146:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #6
  store double %145, ptr %25, align 8, !tbaa !9
  %147 = load double, ptr %25, align 8, !tbaa !9
  %148 = load double, ptr %21, align 8, !tbaa !9
  %149 = fcmp olt double %147, %148
  br i1 %149, label %150, label %170

150:                                              ; preds = %146
  %151 = load i32, ptr %23, align 4, !tbaa !11
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i64 0, i64 %152
  %154 = getelementptr inbounds %"class.jet::Plane2", ptr %153, i32 0, i32 1
  %155 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %154)
          to label %156 unwind label %166

156:                                              ; preds = %150
  %157 = load double, ptr %25, align 8, !tbaa !9
  store double %157, ptr %21, align 8, !tbaa !9
  br label %170

158:                                              ; preds = %137
  %159 = landingpad { ptr, i32 }
          cleanup
  %160 = extractvalue { ptr, i32 } %159, 0
  store ptr %160, ptr %10, align 8
  %161 = extractvalue { ptr, i32 } %159, 1
  store i32 %161, ptr %11, align 4
  br label %175

162:                                              ; preds = %144, %142
  %163 = landingpad { ptr, i32 }
          cleanup
  %164 = extractvalue { ptr, i32 } %163, 0
  store ptr %164, ptr %10, align 8
  %165 = extractvalue { ptr, i32 } %163, 1
  store i32 %165, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #6
  br label %174

166:                                              ; preds = %150
  %167 = landingpad { ptr, i32 }
          cleanup
  %168 = extractvalue { ptr, i32 } %167, 0
  store ptr %168, ptr %10, align 8
  %169 = extractvalue { ptr, i32 } %167, 1
  store i32 %169, ptr %11, align 4
  br label %174

170:                                              ; preds = %156, %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #6
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %23, align 4, !tbaa !11
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %23, align 4, !tbaa !11
  br label %72, !llvm.loop !13

174:                                              ; preds = %166, %162
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  br label %175

175:                                              ; preds = %174, %158
  call void @llvm.lifetime.end.p0(i64 16, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %177

176:                                              ; preds = %75
  store i32 1, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  br label %239

177:                                              ; preds = %175, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %178

178:                                              ; preds = %177, %129
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  br label %247

179:                                              ; preds = %60
  call void @llvm.lifetime.start.p0(i64 16, ptr %28) #6
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = getelementptr inbounds %"class.jet::Box2", ptr %33, i32 0, i32 1
  %182 = getelementptr inbounds %"class.jet::BoundingBox", ptr %181, i32 0, i32 0
  %183 = getelementptr inbounds %"class.jet::Box2", ptr %33, i32 0, i32 1
  %184 = getelementptr inbounds %"class.jet::BoundingBox", ptr %183, i32 0, i32 1
  invoke void @_ZN3jet5clampIdEENS_6VectorIT_Lm2EEERKS3_S5_S5_(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %28, ptr noundef nonnull align 8 dereferenceable(16) %180, ptr noundef nonnull align 8 dereferenceable(16) %182, ptr noundef nonnull align 8 dereferenceable(16) %184)
          to label %185 unwind label %197

185:                                              ; preds = %179
  call void @llvm.lifetime.start.p0(i64 16, ptr %29) #6
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8 %29, ptr noundef nonnull align 8 dereferenceable(16) %186, ptr noundef nonnull align 8 dereferenceable(16) %28)
          to label %187 unwind label %201

187:                                              ; preds = %185
  %188 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i64 0, i64 0
  %189 = getelementptr inbounds %"class.jet::Plane2", ptr %188, i32 0, i32 1
  invoke void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %189)
          to label %190 unwind label %201

190:                                              ; preds = %187
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #6
  %191 = invoke noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %29)
          to label %192 unwind label %205

192:                                              ; preds = %190
  store double %191, ptr %30, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  store i32 1, ptr %31, align 4, !tbaa !11
  br label %193

193:                                              ; preds = %232, %192
  %194 = load i32, ptr %31, align 4, !tbaa !11
  %195 = icmp slt i32 %194, 4
  br i1 %195, label %209, label %196

196:                                              ; preds = %193
  store i32 5, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  br label %235

197:                                              ; preds = %179
  %198 = landingpad { ptr, i32 }
          cleanup
  %199 = extractvalue { ptr, i32 } %198, 0
  store ptr %199, ptr %10, align 8
  %200 = extractvalue { ptr, i32 } %198, 1
  store i32 %200, ptr %11, align 4
  br label %238

201:                                              ; preds = %187, %185
  %202 = landingpad { ptr, i32 }
          cleanup
  %203 = extractvalue { ptr, i32 } %202, 0
  store ptr %203, ptr %10, align 8
  %204 = extractvalue { ptr, i32 } %202, 1
  store i32 %204, ptr %11, align 4
  br label %237

205:                                              ; preds = %190
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %10, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %11, align 4
  br label %236

209:                                              ; preds = %193
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #6
  %210 = load i32, ptr %31, align 4, !tbaa !11
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i64 0, i64 %211
  %213 = getelementptr inbounds %"class.jet::Plane2", ptr %212, i32 0, i32 1
  %214 = invoke noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %213, ptr noundef nonnull align 8 dereferenceable(16) %29)
          to label %215 unwind label %227

215:                                              ; preds = %209
  store double %214, ptr %32, align 8, !tbaa !9
  %216 = load double, ptr %32, align 8, !tbaa !9
  %217 = load double, ptr %30, align 8, !tbaa !9
  %218 = fcmp ogt double %216, %217
  br i1 %218, label %219, label %231

219:                                              ; preds = %215
  %220 = load i32, ptr %31, align 4, !tbaa !11
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i64 0, i64 %221
  %223 = getelementptr inbounds %"class.jet::Plane2", ptr %222, i32 0, i32 1
  %224 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %223)
          to label %225 unwind label %227

225:                                              ; preds = %219
  %226 = load double, ptr %32, align 8, !tbaa !9
  store double %226, ptr %30, align 8, !tbaa !9
  br label %231

227:                                              ; preds = %219, %209
  %228 = landingpad { ptr, i32 }
          cleanup
  %229 = extractvalue { ptr, i32 } %228, 0
  store ptr %229, ptr %10, align 8
  %230 = extractvalue { ptr, i32 } %228, 1
  store i32 %230, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  br label %236

231:                                              ; preds = %225, %215
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #6
  br label %232

232:                                              ; preds = %231
  %233 = load i32, ptr %31, align 4, !tbaa !11
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %31, align 4, !tbaa !11
  br label %193, !llvm.loop !15

235:                                              ; preds = %196
  store i32 1, ptr %27, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #6
  br label %239

236:                                              ; preds = %227, %205
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  br label %237

237:                                              ; preds = %236, %201
  call void @llvm.lifetime.end.p0(i64 16, ptr %29) #6
  br label %238

238:                                              ; preds = %237, %197
  call void @llvm.lifetime.end.p0(i64 16, ptr %28) #6
  br label %247

239:                                              ; preds = %235, %176
  %240 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i32 0, i32 0
  %241 = getelementptr inbounds %"class.jet::Plane2", ptr %240, i64 4
  br label %242

242:                                              ; preds = %242, %239
  %243 = phi ptr [ %241, %239 ], [ %244, %242 ]
  %244 = getelementptr inbounds %"class.jet::Plane2", ptr %243, i64 -1
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %244) #6
  %245 = icmp eq ptr %244, %240
  br i1 %245, label %246, label %242

246:                                              ; preds = %242
  call void @llvm.lifetime.end.p0(i64 352, ptr %7) #6
  ret void

247:                                              ; preds = %238, %178, %125
  %248 = getelementptr inbounds [4 x %"class.jet::Plane2"], ptr %7, i32 0, i32 0
  %249 = getelementptr inbounds %"class.jet::Plane2", ptr %248, i64 4
  br label %250

250:                                              ; preds = %250, %247
  %251 = phi ptr [ %249, %247 ], [ %252, %250 ]
  %252 = getelementptr inbounds %"class.jet::Plane2", ptr %251, i64 -1
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %252) #6
  %253 = icmp eq ptr %252, %248
  br i1 %253, label %254, label %250

254:                                              ; preds = %250
  br label %255

255:                                              ; preds = %254, %124
  call void @llvm.lifetime.end.p0(i64 352, ptr %7) #6
  br label %256

256:                                              ; preds = %255
  %257 = load ptr, ptr %10, align 8
  %258 = load i32, ptr %11, align 4
  %259 = insertvalue { ptr, i32 } poison, ptr %257, 0
  %260 = insertvalue { ptr, i32 } %259, i32 %258, 1
  resume { ptr, i32 } %260
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: nounwind
declare void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(49)) 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 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 "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"}
!15 = distinct !{!15, !14}


; 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 }
%"class.jet::Plane2" = type { %"class.jet::Surface2.base", %"class.jet::Vector", %"class.jet::Vector" }
%"class.jet::Surface2.base" = type <{ ptr, %"class.jet::Transform2", i8 }>
%"class.jet::Transform2" = type { %"class.jet::Vector", double, double, 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 @_ZN3jet6VectorIdLm2EEC2Edd(ptr noundef nonnull align 8 dereferenceable(16), 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm2EE8containsERKNS_6VectorIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

declare void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(40), i1 noundef zeroext) unnamed_addr #3

declare void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind writable sret(%"class.jet::Vector") align 8, ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3jet4Box218closestNormalLocalERKNS_6VectorIdLm2EEE(ptr dead_on_unwind noalias writable sret(%"class.jet::Vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(88) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca [4 x %"class.jet::Plane2"], align 16
  %5 = alloca %"class.jet::Vector", align 8
  %6 = alloca %"class.jet::Transform2", align 8
  %7 = alloca %"class.jet::Vector", align 8
  %8 = alloca %"class.jet::Transform2", align 8
  %9 = alloca %"class.jet::Vector", align 8
  %10 = alloca %"class.jet::Transform2", align 8
  %11 = alloca %"class.jet::Vector", align 8
  %12 = alloca %"class.jet::Transform2", align 8
  %13 = alloca %"class.jet::Vector", align 8
  %14 = alloca %"class.jet::Vector", align 8
  %15 = alloca %"class.jet::Vector", align 8
  %16 = alloca %"class.jet::Vector", align 8
  %17 = alloca %"class.jet::Vector", align 8
  %18 = alloca %"class.jet::Vector", align 8
  call void @llvm.lifetime.start.p0(i64 352, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @_ZN3jet6VectorIdLm2EEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %5, double noundef 1.000000e+00, double noundef 0.000000e+00)
  %19 = getelementptr inbounds i8, ptr %1, i64 56
  %20 = getelementptr inbounds i8, ptr %1, i64 72
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #6
  call void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %6)
  call void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %4, ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(40) %6, i1 noundef zeroext false)
  %21 = getelementptr inbounds i8, ptr %4, i64 88
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  call void @_ZN3jet6VectorIdLm2EEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %7, double noundef 0.000000e+00, double noundef 1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %8) #6
  invoke void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8)
          to label %22 unwind label %36

22:                                               ; preds = %3
  invoke void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %21, ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(40) %8, i1 noundef zeroext false)
          to label %23 unwind label %36

23:                                               ; preds = %22
  %24 = getelementptr inbounds i8, ptr %4, i64 176
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #6
  call void @_ZN3jet6VectorIdLm2EEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %9, double noundef -1.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %10) #6
  invoke void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10)
          to label %25 unwind label %38

25:                                               ; preds = %23
  invoke void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %24, ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(40) %10, i1 noundef zeroext false)
          to label %26 unwind label %38

26:                                               ; preds = %25
  %27 = getelementptr inbounds i8, ptr %4, i64 264
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #6
  call void @_ZN3jet6VectorIdLm2EEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %11, double noundef 0.000000e+00, double noundef -1.000000e+00)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %12) #6
  invoke void @_ZN3jet10Transform2C2Ev(ptr noundef nonnull align 8 dereferenceable(40) %12)
          to label %28 unwind label %40

28:                                               ; preds = %26
  invoke void @_ZN3jet6Plane2C1ERKNS_6VectorIdLm2EEES4_RKNS_10Transform2Eb(ptr noundef nonnull align 8 dereferenceable(88) %27, ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(40) %12, i1 noundef zeroext false)
          to label %29 unwind label %40

29:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  %30 = call noundef zeroext i1 @_ZNK3jet11BoundingBoxIdLm2EE8containsERKNS_6VectorIdLm2EEE(ptr noundef nonnull align 8 dereferenceable(32) %19, ptr noundef nonnull align 8 dereferenceable(16) %2)
  br i1 %30, label %31, label %84

31:                                               ; preds = %29
  %32 = getelementptr inbounds i8, ptr %4, i64 56
  call void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %32)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #6
  invoke void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %13, ptr noundef nonnull align 8 dereferenceable(49) %4, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %33 unwind label %48

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #6
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %14, ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %34 unwind label %50

34:                                               ; preds = %33
  %35 = call noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16) %14)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #6
  invoke void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %15, ptr noundef nonnull align 8 dereferenceable(49) %21, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %52 unwind label %59

36:                                               ; preds = %22, %3
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %43

38:                                               ; preds = %25, %23
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %42

40:                                               ; preds = %28, %26
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #6
  br label %42

42:                                               ; preds = %40, %38
  %.pn = phi { ptr, i32 } [ %41, %40 ], [ %39, %38 ]
  %.0 = phi ptr [ %27, %40 ], [ %24, %38 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #6
  br label %43

43:                                               ; preds = %36, %42
  %.pn.pn = phi { ptr, i32 } [ %.pn, %42 ], [ %37, %36 ]
  %.1 = phi ptr [ %.0, %42 ], [ %21, %36 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  br label %44

44:                                               ; preds = %43, %44
  %45 = phi ptr [ %46, %44 ], [ %.1, %43 ]
  %46 = getelementptr inbounds i8, ptr %45, i64 -88
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %46) #6
  %47 = icmp eq ptr %46, %4
  br i1 %47, label %.loopexit, label %44

48:                                               ; preds = %31
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %83

50:                                               ; preds = %33
  %51 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #6
  br label %83

52:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %16) #6
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %16, ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %53 unwind label %61

53:                                               ; preds = %52
  %54 = call noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16) %16)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #6
  %55 = fcmp olt double %54, %35
  br i1 %55, label %56, label %65

56:                                               ; preds = %53
  %57 = getelementptr inbounds i8, ptr %4, i64 144
  %58 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %57)
          to label %65 unwind label %63

59:                                               ; preds = %73, %65, %34
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %82

61:                                               ; preds = %74, %66, %52
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #6
  br label %82

63:                                               ; preds = %78, %70, %56
  %64 = landingpad { ptr, i32 }
          cleanup
  br label %82

65:                                               ; preds = %56, %53
  %.134 = phi double [ %35, %53 ], [ %54, %56 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #6
  invoke void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %15, ptr noundef nonnull align 8 dereferenceable(49) %24, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %66 unwind label %59

66:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %16) #6
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %16, ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %67 unwind label %61

67:                                               ; preds = %66
  %68 = call noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16) %16)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #6
  %69 = fcmp olt double %68, %.134
  br i1 %69, label %70, label %73

70:                                               ; preds = %67
  %71 = getelementptr inbounds i8, ptr %4, i64 232
  %72 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %71)
          to label %73 unwind label %63

73:                                               ; preds = %70, %67
  %.134.1 = phi double [ %.134, %67 ], [ %68, %70 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #6
  invoke void @_ZNK3jet8Surface212closestPointERKNS_6VectorIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %15, ptr noundef nonnull align 8 dereferenceable(49) %27, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %74 unwind label %59

74:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %16) #6
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %16, ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %75 unwind label %61

75:                                               ; preds = %74
  %76 = call noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16) %16)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %16) #6
  %77 = fcmp olt double %76, %.134.1
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = getelementptr inbounds i8, ptr %4, i64 320
  %80 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %79)
          to label %81 unwind label %63

81:                                               ; preds = %78, %75
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %115

82:                                               ; preds = %61, %63, %59
  %.pn55.pn = phi { ptr, i32 } [ %60, %59 ], [ %64, %63 ], [ %62, %61 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #6
  br label %83

83:                                               ; preds = %50, %82, %48
  %.pn55.pn.pn.pn = phi { ptr, i32 } [ %49, %48 ], [ %.pn55.pn, %82 ], [ %51, %50 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %.loopexit.loopexit

84:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %17) #6
  invoke void @_ZN3jet5clampIdEENS_6VectorIT_Lm2EEERKS3_S5_S5_(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %17, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(16) %20)
          to label %85 unwind label %92

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %18) #6
  invoke void @_ZN3jetmiIdEENS_6VectorIT_Lm2EEERKS3_S5_(ptr dead_on_unwind nonnull writable sret(%"class.jet::Vector") align 8 %18, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %17)
          to label %86 unwind label %94

86:                                               ; preds = %85
  %87 = getelementptr inbounds i8, ptr %4, i64 56
  call void @_ZN3jet6VectorIdLm2EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %87)
  %88 = call noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %18)
  %89 = getelementptr inbounds i8, ptr %4, i64 144
  %90 = call noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %89, ptr noundef nonnull align 8 dereferenceable(16) %18)
  %91 = fcmp ogt double %90, %88
  br i1 %91, label %96, label %100

92:                                               ; preds = %84
  %93 = landingpad { ptr, i32 }
          cleanup
  br label %114

94:                                               ; preds = %85
  %95 = landingpad { ptr, i32 }
          cleanup
  br label %113

96:                                               ; preds = %86
  %97 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %89)
          to label %100 unwind label %98

98:                                               ; preds = %110, %104, %96
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %113

100:                                              ; preds = %96, %86
  %.128 = phi double [ %88, %86 ], [ %90, %96 ]
  %101 = getelementptr inbounds i8, ptr %4, i64 232
  %102 = call noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %101, ptr noundef nonnull align 8 dereferenceable(16) %18)
  %103 = fcmp ogt double %102, %.128
  br i1 %103, label %104, label %106

104:                                              ; preds = %100
  %105 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %101)
          to label %106 unwind label %98

106:                                              ; preds = %104, %100
  %.128.1 = phi double [ %.128, %100 ], [ %102, %104 ]
  %107 = getelementptr inbounds i8, ptr %4, i64 320
  %108 = call noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %107, ptr noundef nonnull align 8 dereferenceable(16) %18)
  %109 = fcmp ogt double %108, %.128.1
  br i1 %109, label %110, label %112

110:                                              ; preds = %106
  %111 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZN3jet6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %107)
          to label %112 unwind label %98

112:                                              ; preds = %110, %106
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %18) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %115

113:                                              ; preds = %98, %94
  %.pn52 = phi { ptr, i32 } [ %99, %98 ], [ %95, %94 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %18) #6
  br label %114

114:                                              ; preds = %113, %92
  %.pn52.pn = phi { ptr, i32 } [ %.pn52, %113 ], [ %93, %92 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %17) #6
  br label %.loopexit.loopexit

115:                                              ; preds = %112, %81
  %116 = getelementptr inbounds i8, ptr %4, i64 264
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %116) #6
  %117 = getelementptr inbounds i8, ptr %4, i64 176
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %117) #6
  %118 = getelementptr inbounds i8, ptr %4, i64 88
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %118) #6
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %4) #6
  call void @llvm.lifetime.end.p0(i64 352, ptr nonnull %4) #6
  ret void

.loopexit.loopexit:                               ; preds = %114, %83
  %.pn55.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn55.pn.pn.pn, %83 ], [ %.pn52.pn, %114 ]
  %119 = getelementptr inbounds i8, ptr %4, i64 264
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %119) #6
  %120 = getelementptr inbounds i8, ptr %4, i64 176
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %120) #6
  %121 = getelementptr inbounds i8, ptr %4, i64 88
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %121) #6
  call void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(88) %4) #6
  br label %.loopexit

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3jet6VectorIdLm2EE13lengthSquaredEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK3jet6VectorIdLm2EE3dotERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZN3jet8Surface2D2Ev(ptr noundef nonnull align 8 dereferenceable(49)) 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 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 "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