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

; 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z11vec2_equals4Vec2S_f(<2 x float> %0, <2 x float> %1, float noundef %2) #0 {
  %4 = alloca %union.Vec2, align 4
  %5 = alloca %union.Vec2, align 4
  %6 = alloca float, align 4
  %7 = getelementptr inbounds %union.Vec2, ptr %4, i32 0, i32 0
  store <2 x float> %0, ptr %7, align 4
  %8 = getelementptr inbounds %union.Vec2, ptr %5, i32 0, i32 0
  store <2 x float> %1, ptr %8, align 4
  store float %2, ptr %6, align 4, !tbaa !5
  %9 = getelementptr inbounds %struct.anon.1, ptr %4, i32 0, i32 0
  %10 = load float, ptr %9, align 4, !tbaa !9
  %11 = getelementptr inbounds %struct.anon.1, ptr %5, i32 0, i32 0
  %12 = load float, ptr %11, align 4, !tbaa !9
  %13 = fsub float %10, %12
  %14 = call float @llvm.fabs.f32(float %13)
  %15 = load float, ptr %6, align 4, !tbaa !5
  %16 = fcmp olt float %14, %15
  br i1 %16, label %17, label %26

17:                                               ; preds = %3
  %18 = getelementptr inbounds %struct.anon.1, ptr %4, i32 0, i32 1
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = getelementptr inbounds %struct.anon.1, ptr %5, i32 0, i32 1
  %21 = load float, ptr %20, align 4, !tbaa !9
  %22 = fsub float %19, %21
  %23 = call float @llvm.fabs.f32(float %22)
  %24 = load float, ptr %6, align 4, !tbaa !5
  %25 = fcmp olt float %23, %24
  br label %26

26:                                               ; preds = %17, %3
  %27 = phi i1 [ false, %3 ], [ %25, %17 ]
  ret i1 %27
}

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

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef zeroext i1 @_Z11vec2_equals4Vec2S_f(<2 x float> %0, <2 x float> %1, float noundef %2) local_unnamed_addr #0 {
  %4 = fsub <2 x float> %0, %1
  %5 = extractelement <2 x float> %4, i64 0
  %6 = tail call float @llvm.fabs.f32(float %5)
  %7 = fcmp olt float %6, %2
  br i1 %7, label %8, label %13

8:                                                ; preds = %3
  %9 = fsub <2 x float> %0, %1
  %10 = extractelement <2 x float> %9, i64 1
  %11 = tail call float @llvm.fabs.f32(float %10)
  %12 = fcmp olt float %11, %2
  br label %13

13:                                               ; preds = %8, %3
  %14 = phi i1 [ false, %3 ], [ %12, %8 ]
  ret i1 %14
}

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

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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) }

!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: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass,VectorCombinePass