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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_Z4vec2ff(float noundef, float noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_Z8vec2_dot4Vec2S_(<2 x float>, <2 x 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: mustprogress nounwind uwtable
declare dso_local noundef float @_Z11vec2_length4Vec2(<2 x float>) #2

; 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: mustprogress uwtable
define dso_local noundef float @_Z13min_area_rectP4Vec2iS0_S0_(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #5 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %union.Vec2, align 4
  %14 = alloca %union.Vec2, align 4
  %15 = alloca %union.Vec2, align 4
  %16 = alloca %union.Vec2, align 4
  %17 = alloca %union.Vec2, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca i32, align 4
  %23 = alloca %union.Vec2, 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 %union.Vec2, align 4
  %30 = alloca %union.Vec2, align 4
  %31 = alloca float, align 4
  %32 = alloca %union.Vec2, align 4
  %33 = alloca %union.Vec2, align 4
  %34 = alloca %union.Vec2, align 4
  %35 = alloca %union.Vec2, align 4
  %36 = alloca %union.Vec2, align 4
  %37 = alloca %union.Vec2, align 4
  %38 = alloca %union.Vec2, align 4
  %39 = alloca %union.Vec2, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store float 0x47EFFFFFE0000000, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = sub nsw i32 %40, 1
  store i32 %41, ptr %11, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %183, %4
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %187

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds %union.Vec2, ptr %48, i64 %50
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %51, i64 8, i1 false), !tbaa.struct !13
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds %union.Vec2, ptr %52, i64 %54
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %55, i64 8, i1 false), !tbaa.struct !13
  %56 = getelementptr inbounds %union.Vec2, ptr %14, i32 0, i32 0
  %57 = load <2 x float>, ptr %56, align 4
  %58 = getelementptr inbounds %union.Vec2, ptr %15, i32 0, i32 0
  %59 = load <2 x float>, ptr %58, align 4
  %60 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %57, <2 x float> %59)
  %61 = getelementptr inbounds %union.Vec2, ptr %13, i32 0, i32 0
  store <2 x float> %60, ptr %61, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !13
  %62 = getelementptr inbounds %union.Vec2, ptr %16, i32 0, i32 0
  %63 = load <2 x float>, ptr %62, align 4
  %64 = call noundef float @_Z11vec2_length4Vec2(<2 x float> %63)
  %65 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZdVR4Vec2f(ptr noundef nonnull align 4 dereferenceable(8) %13, float noundef %64)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %66 = getelementptr inbounds %struct.anon.1, ptr %13, i32 0, i32 1
  %67 = load float, ptr %66, align 4, !tbaa !14
  %68 = fneg float %67
  %69 = getelementptr inbounds %struct.anon.1, ptr %13, i32 0, i32 0
  %70 = load float, ptr %69, align 4, !tbaa !14
  %71 = call <2 x float> @_Z4vec2ff(float noundef %68, float noundef %70)
  %72 = getelementptr inbounds %union.Vec2, ptr %17, i32 0, i32 0
  store <2 x float> %71, ptr %72, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store float 0.000000e+00, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store float 0.000000e+00, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store float 0.000000e+00, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store float 0.000000e+00, ptr %21, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %127, %47
  %74 = load i32, ptr %22, align 4, !tbaa !9
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %130

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = load i32, ptr %22, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %union.Vec2, ptr %79, i64 %81
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %82, i64 8, i1 false), !tbaa.struct !13
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = load i32, ptr %11, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds %union.Vec2, ptr %83, i64 %85
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %86, i64 8, i1 false), !tbaa.struct !13
  %87 = getelementptr inbounds %union.Vec2, ptr %24, i32 0, i32 0
  %88 = load <2 x float>, ptr %87, align 4
  %89 = getelementptr inbounds %union.Vec2, ptr %25, i32 0, i32 0
  %90 = load <2 x float>, ptr %89, align 4
  %91 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %88, <2 x float> %90)
  %92 = getelementptr inbounds %union.Vec2, ptr %23, i32 0, i32 0
  store <2 x float> %91, ptr %92, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %23, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !13
  %93 = getelementptr inbounds %union.Vec2, ptr %27, i32 0, i32 0
  %94 = load <2 x float>, ptr %93, align 4
  %95 = getelementptr inbounds %union.Vec2, ptr %28, i32 0, i32 0
  %96 = load <2 x float>, ptr %95, align 4
  %97 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %94, <2 x float> %96)
  store float %97, ptr %26, align 4, !tbaa !11
  %98 = load float, ptr %26, align 4, !tbaa !11
  %99 = load float, ptr %18, align 4, !tbaa !11
  %100 = fcmp olt float %98, %99
  br i1 %100, label %101, label %103

101:                                              ; preds = %78
  %102 = load float, ptr %26, align 4, !tbaa !11
  store float %102, ptr %18, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %101, %78
  %104 = load float, ptr %26, align 4, !tbaa !11
  %105 = load float, ptr %20, align 4, !tbaa !11
  %106 = fcmp ogt float %104, %105
  br i1 %106, label %107, label %109

107:                                              ; preds = %103
  %108 = load float, ptr %26, align 4, !tbaa !11
  store float %108, ptr %20, align 4, !tbaa !11
  br label %109

109:                                              ; preds = %107, %103
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %23, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !13
  %110 = getelementptr inbounds %union.Vec2, ptr %29, i32 0, i32 0
  %111 = load <2 x float>, ptr %110, align 4
  %112 = getelementptr inbounds %union.Vec2, ptr %30, i32 0, i32 0
  %113 = load <2 x float>, ptr %112, align 4
  %114 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %111, <2 x float> %113)
  store float %114, ptr %26, align 4, !tbaa !11
  %115 = load float, ptr %26, align 4, !tbaa !11
  %116 = load float, ptr %19, align 4, !tbaa !11
  %117 = fcmp olt float %115, %116
  br i1 %117, label %118, label %120

118:                                              ; preds = %109
  %119 = load float, ptr %26, align 4, !tbaa !11
  store float %119, ptr %19, align 4, !tbaa !11
  br label %120

120:                                              ; preds = %118, %109
  %121 = load float, ptr %26, align 4, !tbaa !11
  %122 = load float, ptr %21, align 4, !tbaa !11
  %123 = fcmp ogt float %121, %122
  br i1 %123, label %124, label %126

124:                                              ; preds = %120
  %125 = load float, ptr %26, align 4, !tbaa !11
  store float %125, ptr %21, align 4, !tbaa !11
  br label %126

126:                                              ; preds = %124, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %22, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %22, align 4, !tbaa !9
  br label %73, !llvm.loop !15

130:                                              ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  %131 = load float, ptr %20, align 4, !tbaa !11
  %132 = load float, ptr %18, align 4, !tbaa !11
  %133 = fsub float %131, %132
  %134 = load float, ptr %21, align 4, !tbaa !11
  %135 = load float, ptr %19, align 4, !tbaa !11
  %136 = fsub float %134, %135
  %137 = fmul float %133, %136
  store float %137, ptr %31, align 4, !tbaa !11
  %138 = load float, ptr %31, align 4, !tbaa !11
  %139 = load float, ptr %9, align 4, !tbaa !11
  %140 = fcmp olt float %138, %139
  br i1 %140, label %141, label %182

141:                                              ; preds = %130
  %142 = load float, ptr %31, align 4, !tbaa !11
  store float %142, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #6
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds %union.Vec2, ptr %143, i64 %145
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %146, i64 8, i1 false), !tbaa.struct !13
  %147 = load float, ptr %18, align 4, !tbaa !11
  %148 = load float, ptr %20, align 4, !tbaa !11
  %149 = fadd float %147, %148
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !13
  %150 = getelementptr inbounds %union.Vec2, ptr %37, i32 0, i32 0
  %151 = load <2 x float>, ptr %150, align 4
  %152 = call <2 x float> @_Zmlf4Vec2(float noundef %149, <2 x float> %151)
  %153 = getelementptr inbounds %union.Vec2, ptr %36, i32 0, i32 0
  store <2 x float> %152, ptr %153, align 4
  %154 = load float, ptr %19, align 4, !tbaa !11
  %155 = load float, ptr %21, align 4, !tbaa !11
  %156 = fadd float %154, %155
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !13
  %157 = getelementptr inbounds %union.Vec2, ptr %39, i32 0, i32 0
  %158 = load <2 x float>, ptr %157, align 4
  %159 = call <2 x float> @_Zmlf4Vec2(float noundef %156, <2 x float> %158)
  %160 = getelementptr inbounds %union.Vec2, ptr %38, i32 0, i32 0
  store <2 x float> %159, ptr %160, align 4
  %161 = getelementptr inbounds %union.Vec2, ptr %36, i32 0, i32 0
  %162 = load <2 x float>, ptr %161, align 4
  %163 = getelementptr inbounds %union.Vec2, ptr %38, i32 0, i32 0
  %164 = load <2 x float>, ptr %163, align 4
  %165 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %162, <2 x float> %164)
  %166 = getelementptr inbounds %union.Vec2, ptr %35, i32 0, i32 0
  store <2 x float> %165, ptr %166, align 4
  %167 = getelementptr inbounds %union.Vec2, ptr %35, i32 0, i32 0
  %168 = load <2 x float>, ptr %167, align 4
  %169 = call <2 x float> @_Zmlf4Vec2(float noundef 5.000000e-01, <2 x float> %168)
  %170 = getelementptr inbounds %union.Vec2, ptr %34, i32 0, i32 0
  store <2 x float> %169, ptr %170, align 4
  %171 = getelementptr inbounds %union.Vec2, ptr %33, i32 0, i32 0
  %172 = load <2 x float>, ptr %171, align 4
  %173 = getelementptr inbounds %union.Vec2, ptr %34, i32 0, i32 0
  %174 = load <2 x float>, ptr %173, align 4
  %175 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %172, <2 x float> %174)
  %176 = getelementptr inbounds %union.Vec2, ptr %32, i32 0, i32 0
  store <2 x float> %175, ptr %176, align 4
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %177, ptr align 4 %32, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #6
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  %179 = getelementptr inbounds %union.Vec2, ptr %178, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %179, ptr align 4 %13, i64 8, i1 false), !tbaa.struct !13
  %180 = load ptr, ptr %8, align 8, !tbaa !5
  %181 = getelementptr inbounds %union.Vec2, ptr %180, i64 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %181, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !13
  br label %182

182:                                              ; preds = %141, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %183

183:                                              ; preds = %182
  %184 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %184, ptr %11, align 4, !tbaa !9
  %185 = load i32, ptr %10, align 4, !tbaa !9
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %10, align 4, !tbaa !9
  br label %42, !llvm.loop !17

187:                                              ; preds = %46
  %188 = load float, ptr %9, align 4, !tbaa !11
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  ret float %188
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZdVR4Vec2f(ptr noundef nonnull align 4 dereferenceable(8), float noundef) #4

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { 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 #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{i64 0, i64 8, !14}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


; 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: inlinehint mustprogress nounwind uwtable
declare dso_local <2 x float> @_Z4vec2ff(float noundef, float noundef) local_unnamed_addr #0

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_Z13min_area_rectP4Vec2iS0_S0_(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #4 {
  %5 = alloca %union.Vec2, align 8
  %6 = icmp sgt i32 %1, 0
  br i1 %6, label %.lr.ph93, label %._crit_edge94

.lr.ph93:                                         ; preds = %4
  %7 = add nsw i32 %1, -1
  %8 = getelementptr inbounds i8, ptr %5, i64 4
  %9 = getelementptr inbounds i8, ptr %3, i64 8
  %wide.trip.count100 = zext nneg i32 %1 to i64
  br label %.lr.ph.preheader

._crit_edge94:                                    ; preds = %47, %4
  %.0.lcssa = phi float [ 0x47EFFFFFE0000000, %4 ], [ %.1, %47 ]
  ret float %.0.lcssa

.lr.ph.preheader:                                 ; preds = %47, %.lr.ph93
  %indvars.iv97 = phi i64 [ 0, %.lr.ph93 ], [ %indvars.iv.next98, %47 ]
  %.091 = phi float [ 0x47EFFFFFE0000000, %.lr.ph93 ], [ %.1, %47 ]
  %.06589 = phi i32 [ %7, %.lr.ph93 ], [ %48, %47 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %10 = getelementptr inbounds %union.Vec2, ptr %0, i64 %indvars.iv97
  %.sroa.043.0.copyload = load <2 x float>, ptr %10, align 4, !tbaa !5
  %11 = sext i32 %.06589 to i64
  %12 = getelementptr inbounds %union.Vec2, ptr %0, i64 %11
  %.sroa.042.0.copyload = load <2 x float>, ptr %12, align 4, !tbaa !5
  %13 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %.sroa.043.0.copyload, <2 x float> %.sroa.042.0.copyload)
  store <2 x float> %13, ptr %5, align 8
  %14 = call noundef float @_Z11vec2_length4Vec2(<2 x float> %13)
  %15 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZdVR4Vec2f(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %14)
  %16 = load float, ptr %8, align 4, !tbaa !5
  %17 = fneg float %16
  %18 = load float, ptr %5, align 8, !tbaa !5
  %19 = call <2 x float> @_Z4vec2ff(float noundef %17, float noundef %18)
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %20 = fsub <2 x float> %35, %34
  %shift = shufflevector <2 x float> %20, <2 x float> poison, <2 x i32> <i32 1, i32 poison>
  %21 = fmul <2 x float> %20, %shift
  %22 = extractelement <2 x float> %21, i64 0
  %23 = fcmp olt float %22, %.091
  br i1 %23, label %36, label %47

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %24 = phi <2 x float> [ zeroinitializer, %.lr.ph.preheader ], [ %35, %.lr.ph ]
  %25 = phi <2 x float> [ zeroinitializer, %.lr.ph.preheader ], [ %34, %.lr.ph ]
  %26 = getelementptr inbounds %union.Vec2, ptr %0, i64 %indvars.iv
  %.sroa.022.0.copyload = load <2 x float>, ptr %26, align 4, !tbaa !5
  %.sroa.021.0.copyload = load <2 x float>, ptr %12, align 4, !tbaa !5
  %27 = call <2 x float> @_Zmi4Vec2S_(<2 x float> %.sroa.022.0.copyload, <2 x float> %.sroa.021.0.copyload)
  %.sroa.011.0.copyload = load <2 x float>, ptr %5, align 8, !tbaa !5
  %28 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %27, <2 x float> %.sroa.011.0.copyload)
  %29 = call noundef float @_Z8vec2_dot4Vec2S_(<2 x float> %27, <2 x float> %19)
  %30 = insertelement <2 x float> poison, float %29, i64 0
  %31 = insertelement <2 x float> %30, float %28, i64 1
  %32 = fcmp olt <2 x float> %31, %25
  %33 = fcmp ogt <2 x float> %31, %24
  %34 = select <2 x i1> %32, <2 x float> %31, <2 x float> %25
  %35 = select <2 x i1> %33, <2 x float> %31, <2 x float> %24
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count100
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !8

36:                                               ; preds = %._crit_edge
  %.sroa.06.0.copyload = load <2 x float>, ptr %12, align 4, !tbaa !5
  %37 = fadd <2 x float> %35, %34
  %38 = extractelement <2 x float> %37, i64 1
  %.sroa.02.0.copyload = load <2 x float>, ptr %5, align 8, !tbaa !5
  %39 = call <2 x float> @_Zmlf4Vec2(float noundef %38, <2 x float> %.sroa.02.0.copyload)
  %40 = fadd <2 x float> %35, %34
  %41 = extractelement <2 x float> %40, i64 0
  %42 = call <2 x float> @_Zmlf4Vec2(float noundef %41, <2 x float> %19)
  %43 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %39, <2 x float> %42)
  %44 = call <2 x float> @_Zmlf4Vec2(float noundef 5.000000e-01, <2 x float> %43)
  %45 = call <2 x float> @_Zpl4Vec2S_(<2 x float> %.sroa.06.0.copyload, <2 x float> %44)
  store <2 x float> %45, ptr %2, align 4, !tbaa !5
  %46 = load i64, ptr %5, align 8, !tbaa !5
  store i64 %46, ptr %3, align 4, !tbaa !5
  store <2 x float> %19, ptr %9, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %36, %._crit_edge
  %.1 = phi float [ %22, %36 ], [ %.091, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %48 = trunc nuw nsw i64 %indvars.iv97 to i32
  %exitcond101.not = icmp eq i64 %indvars.iv.next98, %wide.trip.count100
  br i1 %exitcond101.not, label %._crit_edge94, label %.lr.ph.preheader, !llvm.loop !10
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZdVR4Vec2f(ptr noundef nonnull align 4 dereferenceable(8), float noundef) local_unnamed_addr #3

attributes #0 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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" }
attributes #5 = { nounwind }

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,VectorCombinePass