; LLVM IR from ashishzero/karma :: src/modules/core/lin_maths.ll (Z29nearest_point_origin_triangle4Vec2S_S_)

; 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"

%union.Vec2 = type { %struct.anon.1 }
%struct.anon.1 = type { float, float }

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_Z8vec2_dot4Vec2S_(<2 x float>, <2 x float>) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zmi4Vec2S_(<2 x float>, <2 x float>) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zpl4Vec2S_(<2 x float>, <2 x float>) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zmlf4Vec2(float noundef, <2 x float>) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zml4Vec2f(<2 x float>, float noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_Z29nearest_point_origin_triangle4Vec2S_S_(<2 x float> %0, <2 x float> %1, <2 x float> %2) #6 {
  %4 = alloca %union.Vec2, align 4
  %5 = alloca %union.Vec2, align 4
  %6 = alloca %union.Vec2, align 4
  %7 = alloca %union.Vec2, align 4
  %8 = alloca %union.Vec2, align 4
  %9 = alloca %union.Vec2, align 4
  %10 = alloca %union.Vec2, align 4
  %11 = alloca %union.Vec2, align 4
  %12 = alloca %union.Vec2, align 4
  %13 = alloca %union.Vec2, align 4
  %14 = alloca %union.Vec2, align 4
  %15 = alloca float, align 4
  %16 = alloca %union.Vec2, align 4
  %17 = alloca %union.Vec2, align 4
  %18 = alloca float, align 4
  %19 = alloca %union.Vec2, align 4
  %20 = alloca %union.Vec2, align 4
  %21 = alloca i32, align 4
  %22 = alloca %union.Vec2, align 4
  %23 = alloca float, align 4
  %24 = alloca %union.Vec2, align 4
  %25 = alloca %union.Vec2, align 4
  %26 = alloca float, align 4
  %27 = alloca %union.Vec2, align 4
  %28 = alloca %union.Vec2, align 4
  %29 = alloca float, align 4
  %30 = alloca float, align 4
  %31 = alloca %union.Vec2, align 4
  %32 = alloca %union.Vec2, align 4
  %33 = alloca %union.Vec2, align 4
  %34 = alloca %union.Vec2, align 4
  %35 = alloca float, align 4
  %36 = alloca %union.Vec2, align 4
  %37 = alloca %union.Vec2, align 4
  %38 = alloca float, align 4
  %39 = alloca %union.Vec2, align 4
  %40 = alloca %union.Vec2, align 4
  %41 = alloca float, align 4
  %42 = alloca float, align 4
  %43 = alloca %union.Vec2, align 4
  %44 = alloca %union.Vec2, align 4
  %45 = alloca %union.Vec2, align 4
  %46 = alloca float, align 4
  %47 = alloca float, align 4
  %48 = alloca %union.Vec2, align 4
  %49 = alloca %union.Vec2, align 4
  %50 = alloca %union.Vec2, align 4
  %51 = alloca %union.Vec2, align 4
  %52 = alloca %union.Vec2, align 4
  %53 = alloca float, align 4
  %54 = alloca float, align 4
  %55 = alloca float, align 4
  %56 = alloca %union.Vec2, align 4
  %57 = alloca %union.Vec2, align 4
  %58 = alloca %union.Vec2, align 4
  %59 = alloca %union.Vec2, align 4
  %60 = alloca %union.Vec2, align 4
  %61 = alloca %union.Vec2, align 4
  %62 = getelementptr inbounds %union.Vec2, ptr %5, i32 0, i32 0
  store <2 x float> %0, ptr %62, align 4
  %63 = getelementptr inbounds %union.Vec2, ptr %6, i32 0, i32 0
  store <2 x float> %1, ptr %63, align 4
  %64 = getelementptr inbounds %union.Vec2, ptr %7, i32 0, i32 0
  store <2 x float> %2, ptr %64, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !5
  %65 = getelementptr inbounds %union.Vec2, ptr %9, i32 0, i32 0
  %66 = load <2 x float>, ptr %65, align 4
  %67 = getelementptr inbounds %union.Vec2, ptr %10, i32 0, i32 0
  %68 = load <2 x float>, ptr %67, align 4
  %69 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %66, <2 x float> %68)
  %70 = getelementptr inbounds %union.Vec2, ptr %8, i32 0, i32 0
  store <2 x float> %69, ptr %70, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !5
  %71 = getelementptr inbounds %union.Vec2, ptr %12, i32 0, i32 0
  %72 = load <2 x float>, ptr %71, align 4
  %73 = getelementptr inbounds %union.Vec2, ptr %13, i32 0, i32 0
  %74 = load <2 x float>, ptr %73, align 4
  %75 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %72, <2 x float> %74)
  %76 = getelementptr inbounds %union.Vec2, ptr %11, i32 0, i32 0
  store <2 x float> %75, ptr %76, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %77 = call <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8) %5)
  %78 = getelementptr inbounds %union.Vec2, ptr %14, i32 0, i32 0
  store <2 x float> %77, ptr %78, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %14, i64 8, i1 false), !tbaa.struct !5
  %79 = getelementptr inbounds %union.Vec2, ptr %16, i32 0, i32 0
  %80 = load <2 x float>, ptr %79, align 4
  %81 = getelementptr inbounds %union.Vec2, ptr %17, i32 0, i32 0
  %82 = load <2 x float>, ptr %81, align 4
  %83 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %80, <2 x float> %82)
  store float %83, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %14, i64 8, i1 false), !tbaa.struct !5
  %84 = getelementptr inbounds %union.Vec2, ptr %19, i32 0, i32 0
  %85 = load <2 x float>, ptr %84, align 4
  %86 = getelementptr inbounds %union.Vec2, ptr %20, i32 0, i32 0
  %87 = load <2 x float>, ptr %86, align 4
  %88 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %85, <2 x float> %87)
  store float %88, ptr %18, align 4, !tbaa !9
  %89 = load float, ptr %15, align 4, !tbaa !9
  %90 = fcmp ole float %89, 0.000000e+00
  br i1 %90, label %91, label %95

91:                                               ; preds = %3
  %92 = load float, ptr %18, align 4, !tbaa !9
  %93 = fcmp ole float %92, 0.000000e+00
  br i1 %93, label %94, label %95

94:                                               ; preds = %91
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !5
  store i32 1, ptr %21, align 4
  br label %290

95:                                               ; preds = %91, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %96 = call <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8) %6)
  %97 = getelementptr inbounds %union.Vec2, ptr %22, i32 0, i32 0
  store <2 x float> %96, ptr %97, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %22, i64 8, i1 false), !tbaa.struct !5
  %98 = getelementptr inbounds %union.Vec2, ptr %24, i32 0, i32 0
  %99 = load <2 x float>, ptr %98, align 4
  %100 = getelementptr inbounds %union.Vec2, ptr %25, i32 0, i32 0
  %101 = load <2 x float>, ptr %100, align 4
  %102 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %99, <2 x float> %101)
  store float %102, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %22, i64 8, i1 false), !tbaa.struct !5
  %103 = getelementptr inbounds %union.Vec2, ptr %27, i32 0, i32 0
  %104 = load <2 x float>, ptr %103, align 4
  %105 = getelementptr inbounds %union.Vec2, ptr %28, i32 0, i32 0
  %106 = load <2 x float>, ptr %105, align 4
  %107 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %104, <2 x float> %106)
  store float %107, ptr %26, align 4, !tbaa !9
  %108 = load float, ptr %23, align 4, !tbaa !9
  %109 = fcmp oge float %108, 0.000000e+00
  br i1 %109, label %110, label %115

110:                                              ; preds = %95
  %111 = load float, ptr %26, align 4, !tbaa !9
  %112 = load float, ptr %23, align 4, !tbaa !9
  %113 = fcmp ole float %111, %112
  br i1 %113, label %114, label %115

114:                                              ; preds = %110
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !5
  store i32 1, ptr %21, align 4
  br label %289

115:                                              ; preds = %110, %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #7
  %116 = load float, ptr %15, align 4, !tbaa !9
  %117 = load float, ptr %26, align 4, !tbaa !9
  %118 = load float, ptr %23, align 4, !tbaa !9
  %119 = load float, ptr %18, align 4, !tbaa !9
  %120 = fmul float %118, %119
  %121 = fneg float %120
  %122 = call float @llvm.fmuladd.f32(float %116, float %117, float %121)
  store float %122, ptr %29, align 4, !tbaa !9
  %123 = load float, ptr %29, align 4, !tbaa !9
  %124 = fcmp ole float %123, 0.000000e+00
  br i1 %124, label %125, label %148

125:                                              ; preds = %115
  %126 = load float, ptr %15, align 4, !tbaa !9
  %127 = fcmp oge float %126, 0.000000e+00
  br i1 %127, label %128, label %148

128:                                              ; preds = %125
  %129 = load float, ptr %23, align 4, !tbaa !9
  %130 = fcmp ole float %129, 0.000000e+00
  br i1 %130, label %131, label %148

131:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #7
  %132 = load float, ptr %15, align 4, !tbaa !9
  %133 = load float, ptr %15, align 4, !tbaa !9
  %134 = load float, ptr %23, align 4, !tbaa !9
  %135 = fsub float %133, %134
  %136 = fdiv float %132, %135
  store float %136, ptr %30, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !5
  %137 = load float, ptr %30, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !5
  %138 = getelementptr inbounds %union.Vec2, ptr %33, i32 0, i32 0
  %139 = load <2 x float>, ptr %138, align 4
  %140 = call <2 x float> @_Zmlf4Vec2(float noundef %137, <2 x float> %139)
  %141 = getelementptr inbounds %union.Vec2, ptr %32, i32 0, i32 0
  store <2 x float> %140, ptr %141, align 4
  %142 = getelementptr inbounds %union.Vec2, ptr %31, i32 0, i32 0
  %143 = load <2 x float>, ptr %142, align 4
  %144 = getelementptr inbounds %union.Vec2, ptr %32, i32 0, i32 0
  %145 = load <2 x float>, ptr %144, align 4
  %146 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %143, <2 x float> %145)
  %147 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  store <2 x float> %146, ptr %147, align 4
  store i32 1, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  br label %288

148:                                              ; preds = %128, %125, %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  %149 = call <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8) %7)
  %150 = getelementptr inbounds %union.Vec2, ptr %34, i32 0, i32 0
  store <2 x float> %149, ptr %150, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %34, i64 8, i1 false), !tbaa.struct !5
  %151 = getelementptr inbounds %union.Vec2, ptr %36, i32 0, i32 0
  %152 = load <2 x float>, ptr %151, align 4
  %153 = getelementptr inbounds %union.Vec2, ptr %37, i32 0, i32 0
  %154 = load <2 x float>, ptr %153, align 4
  %155 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %152, <2 x float> %154)
  store float %155, ptr %35, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %34, i64 8, i1 false), !tbaa.struct !5
  %156 = getelementptr inbounds %union.Vec2, ptr %39, i32 0, i32 0
  %157 = load <2 x float>, ptr %156, align 4
  %158 = getelementptr inbounds %union.Vec2, ptr %40, i32 0, i32 0
  %159 = load <2 x float>, ptr %158, align 4
  %160 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %157, <2 x float> %159)
  store float %160, ptr %38, align 4, !tbaa !9
  %161 = load float, ptr %38, align 4, !tbaa !9
  %162 = fcmp oge float %161, 0.000000e+00
  br i1 %162, label %163, label %168

163:                                              ; preds = %148
  %164 = load float, ptr %35, align 4, !tbaa !9
  %165 = load float, ptr %38, align 4, !tbaa !9
  %166 = fcmp ole float %164, %165
  br i1 %166, label %167, label %168

167:                                              ; preds = %163
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !5
  store i32 1, ptr %21, align 4
  br label %287

168:                                              ; preds = %163, %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #7
  %169 = load float, ptr %35, align 4, !tbaa !9
  %170 = load float, ptr %18, align 4, !tbaa !9
  %171 = load float, ptr %15, align 4, !tbaa !9
  %172 = load float, ptr %38, align 4, !tbaa !9
  %173 = fmul float %171, %172
  %174 = fneg float %173
  %175 = call float @llvm.fmuladd.f32(float %169, float %170, float %174)
  store float %175, ptr %41, align 4, !tbaa !9
  %176 = load float, ptr %41, align 4, !tbaa !9
  %177 = fcmp ole float %176, 0.000000e+00
  br i1 %177, label %178, label %201

178:                                              ; preds = %168
  %179 = load float, ptr %18, align 4, !tbaa !9
  %180 = fcmp oge float %179, 0.000000e+00
  br i1 %180, label %181, label %201

181:                                              ; preds = %178
  %182 = load float, ptr %38, align 4, !tbaa !9
  %183 = fcmp ole float %182, 0.000000e+00
  br i1 %183, label %184, label %201

184:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 4, ptr %42) #7
  %185 = load float, ptr %18, align 4, !tbaa !9
  %186 = load float, ptr %18, align 4, !tbaa !9
  %187 = load float, ptr %38, align 4, !tbaa !9
  %188 = fsub float %186, %187
  %189 = fdiv float %185, %188
  store float %189, ptr %42, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %43, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !5
  %190 = load float, ptr %42, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %45, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !5
  %191 = getelementptr inbounds %union.Vec2, ptr %45, i32 0, i32 0
  %192 = load <2 x float>, ptr %191, align 4
  %193 = call <2 x float> @_Zmlf4Vec2(float noundef %190, <2 x float> %192)
  %194 = getelementptr inbounds %union.Vec2, ptr %44, i32 0, i32 0
  store <2 x float> %193, ptr %194, align 4
  %195 = getelementptr inbounds %union.Vec2, ptr %43, i32 0, i32 0
  %196 = load <2 x float>, ptr %195, align 4
  %197 = getelementptr inbounds %union.Vec2, ptr %44, i32 0, i32 0
  %198 = load <2 x float>, ptr %197, align 4
  %199 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %196, <2 x float> %198)
  %200 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  store <2 x float> %199, ptr %200, align 4
  store i32 1, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %42) #7
  br label %286

201:                                              ; preds = %181, %178, %168
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #7
  %202 = load float, ptr %23, align 4, !tbaa !9
  %203 = load float, ptr %38, align 4, !tbaa !9
  %204 = load float, ptr %35, align 4, !tbaa !9
  %205 = load float, ptr %26, align 4, !tbaa !9
  %206 = fmul float %204, %205
  %207 = fneg float %206
  %208 = call float @llvm.fmuladd.f32(float %202, float %203, float %207)
  store float %208, ptr %46, align 4, !tbaa !9
  %209 = load float, ptr %46, align 4, !tbaa !9
  %210 = fcmp ole float %209, 0.000000e+00
  br i1 %210, label %211, label %250

211:                                              ; preds = %201
  %212 = load float, ptr %26, align 4, !tbaa !9
  %213 = load float, ptr %23, align 4, !tbaa !9
  %214 = fsub float %212, %213
  %215 = fcmp oge float %214, 0.000000e+00
  br i1 %215, label %216, label %250

216:                                              ; preds = %211
  %217 = load float, ptr %35, align 4, !tbaa !9
  %218 = load float, ptr %38, align 4, !tbaa !9
  %219 = fsub float %217, %218
  %220 = fcmp oge float %219, 0.000000e+00
  br i1 %220, label %221, label %250

221:                                              ; preds = %216
  call void @llvm.lifetime.start.p0(i64 4, ptr %47) #7
  %222 = load float, ptr %26, align 4, !tbaa !9
  %223 = load float, ptr %23, align 4, !tbaa !9
  %224 = fsub float %222, %223
  %225 = load float, ptr %26, align 4, !tbaa !9
  %226 = load float, ptr %23, align 4, !tbaa !9
  %227 = fsub float %225, %226
  %228 = load float, ptr %35, align 4, !tbaa !9
  %229 = load float, ptr %38, align 4, !tbaa !9
  %230 = fsub float %228, %229
  %231 = fadd float %227, %230
  %232 = fdiv float %224, %231
  store float %232, ptr %47, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %48, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !5
  %233 = load float, ptr %47, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %51, ptr align 4 %7, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %52, ptr align 4 %6, i64 8, i1 false), !tbaa.struct !5
  %234 = getelementptr inbounds %union.Vec2, ptr %51, i32 0, i32 0
  %235 = load <2 x float>, ptr %234, align 4
  %236 = getelementptr inbounds %union.Vec2, ptr %52, i32 0, i32 0
  %237 = load <2 x float>, ptr %236, align 4
  %238 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %235, <2 x float> %237)
  %239 = getelementptr inbounds %union.Vec2, ptr %50, i32 0, i32 0
  store <2 x float> %238, ptr %239, align 4
  %240 = getelementptr inbounds %union.Vec2, ptr %50, i32 0, i32 0
  %241 = load <2 x float>, ptr %240, align 4
  %242 = call <2 x float> @_Zmlf4Vec2(float noundef %233, <2 x float> %241)
  %243 = getelementptr inbounds %union.Vec2, ptr %49, i32 0, i32 0
  store <2 x float> %242, ptr %243, align 4
  %244 = getelementptr inbounds %union.Vec2, ptr %48, i32 0, i32 0
  %245 = load <2 x float>, ptr %244, align 4
  %246 = getelementptr inbounds %union.Vec2, ptr %49, i32 0, i32 0
  %247 = load <2 x float>, ptr %246, align 4
  %248 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %245, <2 x float> %247)
  %249 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  store <2 x float> %248, ptr %249, align 4
  store i32 1, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %47) #7
  br label %285

250:                                              ; preds = %216, %211, %201
  call void @llvm.lifetime.start.p0(i64 4, ptr %53) #7
  %251 = load float, ptr %46, align 4, !tbaa !9
  %252 = load float, ptr %41, align 4, !tbaa !9
  %253 = fadd float %251, %252
  %254 = load float, ptr %29, align 4, !tbaa !9
  %255 = fadd float %253, %254
  %256 = fdiv float 1.000000e+00, %255
  store float %256, ptr %53, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %54) #7
  %257 = load float, ptr %41, align 4, !tbaa !9
  %258 = load float, ptr %53, align 4, !tbaa !9
  %259 = fmul float %257, %258
  store float %259, ptr %54, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %55) #7
  %260 = load float, ptr %29, align 4, !tbaa !9
  %261 = load float, ptr %53, align 4, !tbaa !9
  %262 = fmul float %260, %261
  store float %262, ptr %55, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %57, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %59, ptr align 4 %8, i64 8, i1 false), !tbaa.struct !5
  %263 = load float, ptr %54, align 4, !tbaa !9
  %264 = getelementptr inbounds %union.Vec2, ptr %59, i32 0, i32 0
  %265 = load <2 x float>, ptr %264, align 4
  %266 = call <2 x float> @_Zml4Vec2f(<2 x float> %265, float noundef %263)
  %267 = getelementptr inbounds %union.Vec2, ptr %58, i32 0, i32 0
  store <2 x float> %266, ptr %267, align 4
  %268 = getelementptr inbounds %union.Vec2, ptr %57, i32 0, i32 0
  %269 = load <2 x float>, ptr %268, align 4
  %270 = getelementptr inbounds %union.Vec2, ptr %58, i32 0, i32 0
  %271 = load <2 x float>, ptr %270, align 4
  %272 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %269, <2 x float> %271)
  %273 = getelementptr inbounds %union.Vec2, ptr %56, i32 0, i32 0
  store <2 x float> %272, ptr %273, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %61, ptr align 4 %11, i64 8, i1 false), !tbaa.struct !5
  %274 = load float, ptr %55, align 4, !tbaa !9
  %275 = getelementptr inbounds %union.Vec2, ptr %61, i32 0, i32 0
  %276 = load <2 x float>, ptr %275, align 4
  %277 = call <2 x float> @_Zml4Vec2f(<2 x float> %276, float noundef %274)
  %278 = getelementptr inbounds %union.Vec2, ptr %60, i32 0, i32 0
  store <2 x float> %277, ptr %278, align 4
  %279 = getelementptr inbounds %union.Vec2, ptr %56, i32 0, i32 0
  %280 = load <2 x float>, ptr %279, align 4
  %281 = getelementptr inbounds %union.Vec2, ptr %60, i32 0, i32 0
  %282 = load <2 x float>, ptr %281, align 4
  %283 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %280, <2 x float> %282)
  %284 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  store <2 x float> %283, ptr %284, align 4
  store i32 1, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %55) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %54) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %53) #7
  br label %285

285:                                              ; preds = %250, %221
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #7
  br label %286

286:                                              ; preds = %285, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #7
  br label %287

287:                                              ; preds = %286, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  br label %288

288:                                              ; preds = %287, %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #7
  br label %289

289:                                              ; preds = %288, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %290

290:                                              ; preds = %289, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  %291 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  %292 = load <2 x float>, ptr %291, align 4
  ret <2 x float> %292
}

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{i64 0, i64 8, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


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

%union.Vec2 = type { %struct.anon.1 }
%struct.anon.1 = type { float, float }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_Z8vec2_dot4Vec2S_(<2 x float>, <2 x float>) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zmi4Vec2S_(<2 x float>, <2 x float>) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zpl4Vec2S_(<2 x float>, <2 x float>) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zmlf4Vec2(float noundef, <2 x float>) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local <2 x float> @_Zml4Vec2f(<2 x float>, float noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local <2 x float> @_Z29nearest_point_origin_triangle4Vec2S_S_(<2 x float> %0, <2 x float> %1, <2 x float> %2) local_unnamed_addr #4 {
  %4 = alloca %union.Vec2, align 8
  %5 = alloca %union.Vec2, align 8
  %6 = alloca %union.Vec2, align 8
  store <2 x float> %0, ptr %4, align 8
  store <2 x float> %1, ptr %5, align 8
  store <2 x float> %2, ptr %6, align 8
  %7 = tail call <2 x float> @_Zmi4Vec2S_(<2 x float> %1, <2 x float> %0)
  %8 = tail call <2 x float> @_Zmi4Vec2S_(<2 x float> %2, <2 x float> %0)
  %9 = call <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %10 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %7, <2 x float> %9)
  %11 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %8, <2 x float> %9)
  %12 = fcmp ole float %10, 0.000000e+00
  %13 = fcmp ole float %11, 0.000000e+00
  %or.cond = and i1 %12, %13
  br i1 %or.cond, label %14, label %15

14:                                               ; preds = %3
  %.sroa.0112.0.copyload = load <2 x float>, ptr %4, align 8, !tbaa !5
  br label %80

15:                                               ; preds = %3
  %16 = call <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8) %5)
  %17 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %7, <2 x float> %16)
  %18 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %8, <2 x float> %16)
  %19 = fcmp ult float %17, 0.000000e+00
  %20 = fcmp ugt float %18, %17
  %or.cond121 = or i1 %19, %20
  br i1 %or.cond121, label %22, label %21

21:                                               ; preds = %15
  %.sroa.0112.0.copyload113 = load <2 x float>, ptr %5, align 8, !tbaa !5
  br label %80

22:                                               ; preds = %15
  %23 = fneg float %17
  %24 = fmul float %11, %23
  %25 = call float @llvm.fmuladd.f32(float %10, float %18, float %24)
  %26 = fcmp ole float %25, 0.000000e+00
  %27 = fcmp oge float %10, 0.000000e+00
  %or.cond3 = and i1 %27, %26
  %28 = fcmp ole float %17, 0.000000e+00
  %or.cond5 = and i1 %28, %or.cond3
  br i1 %or.cond5, label %29, label %34

29:                                               ; preds = %22
  %30 = fsub float %10, %17
  %31 = fdiv float %10, %30
  %.sroa.054.0.copyload = load <2 x float>, ptr %4, align 8, !tbaa !5
  %32 = call <2 x float> @_Zmlf4Vec2(float noundef %31, <2 x float> %7)
  %33 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %.sroa.054.0.copyload, <2 x float> %32)
  br label %80

34:                                               ; preds = %22
  %35 = call <2 x float> @_ZngRK4Vec2(ptr noundef nonnull align 4 dereferenceable(8) %6)
  %36 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %7, <2 x float> %35)
  %37 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %8, <2 x float> %35)
  %38 = fcmp ult float %37, 0.000000e+00
  %39 = fcmp ugt float %36, %37
  %or.cond122 = or i1 %38, %39
  br i1 %or.cond122, label %41, label %40

40:                                               ; preds = %34
  %.sroa.0112.0.copyload114 = load <2 x float>, ptr %6, align 8, !tbaa !5
  br label %80

41:                                               ; preds = %34
  %42 = fneg float %10
  %43 = fmul float %37, %42
  %44 = call float @llvm.fmuladd.f32(float %36, float %11, float %43)
  %45 = fcmp ole float %44, 0.000000e+00
  %46 = fcmp oge float %11, 0.000000e+00
  %or.cond7 = and i1 %46, %45
  %47 = fcmp ole float %37, 0.000000e+00
  %or.cond9 = and i1 %47, %or.cond7
  br i1 %or.cond9, label %48, label %53

48:                                               ; preds = %41
  %49 = fsub float %11, %37
  %50 = fdiv float %11, %49
  %.sroa.028.0.copyload = load <2 x float>, ptr %4, align 8, !tbaa !5
  %51 = call <2 x float> @_Zmlf4Vec2(float noundef %50, <2 x float> %8)
  %52 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %.sroa.028.0.copyload, <2 x float> %51)
  br label %80

53:                                               ; preds = %41
  %54 = fneg float %36
  %55 = fmul float %18, %54
  %56 = call float @llvm.fmuladd.f32(float %17, float %37, float %55)
  %57 = fcmp ugt float %56, 0.000000e+00
  br i1 %57, label %70, label %58

58:                                               ; preds = %53
  %59 = fsub float %18, %17
  %60 = fcmp ult float %59, 0.000000e+00
  br i1 %60, label %70, label %61

61:                                               ; preds = %58
  %62 = fsub float %36, %37
  %63 = fcmp ult float %62, 0.000000e+00
  br i1 %63, label %70, label %64

64:                                               ; preds = %61
  %65 = fadd float %59, %62
  %66 = fdiv float %59, %65
  %.sroa.022.0.copyload = load <2 x float>, ptr %5, align 8, !tbaa !5
  %.sroa.019.0.copyload = load <2 x float>, ptr %6, align 8, !tbaa !5
  %67 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %.sroa.019.0.copyload, <2 x float> %.sroa.022.0.copyload)
  %68 = call <2 x float> @_Zmlf4Vec2(float noundef %66, <2 x float> %67)
  %69 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %.sroa.022.0.copyload, <2 x float> %68)
  br label %80

70:                                               ; preds = %61, %58, %53
  %71 = fadd float %56, %44
  %72 = fadd float %25, %71
  %73 = fdiv float 1.000000e+00, %72
  %74 = fmul float %44, %73
  %75 = fmul float %25, %73
  %.sroa.013.0.copyload = load <2 x float>, ptr %4, align 8, !tbaa !5
  %76 = call <2 x float> @_Zml4Vec2f(<2 x float> %7, float noundef %74)
  %77 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %.sroa.013.0.copyload, <2 x float> %76)
  %78 = call <2 x float> @_Zml4Vec2f(<2 x float> %8, float noundef %75)
  %79 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %77, <2 x float> %78)
  br label %80

80:                                               ; preds = %21, %40, %64, %70, %48, %29, %14
  %.sroa.0112.5 = phi <2 x float> [ %.sroa.0112.0.copyload, %14 ], [ %.sroa.0112.0.copyload113, %21 ], [ %33, %29 ], [ %.sroa.0112.0.copyload114, %40 ], [ %52, %48 ], [ %69, %64 ], [ %79, %70 ]
  ret <2 x float> %.sroa.0112.5
}

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass