; LLVM IR from ermig1979/Simd :: src/Test/TestFloat16.ll (ZN4Test30CosineDistancesMxNa16fAutoTestEfRKNS_7FuncCDAES2_)

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

%"struct.Test::FuncCDA" = type { ptr, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEmmmfNS_7FuncCDAES0_(i64 noundef, i64 noundef, i64 noundef, float noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEfRKNS_7FuncCDAES2_(float noundef %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(40) %2) #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca float, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca %"struct.Test::FuncCDA", align 8
  %9 = alloca i1, align 1
  %10 = alloca %"struct.Test::FuncCDA", align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i1, align 1
  %14 = alloca %"struct.Test::FuncCDA", align 8
  %15 = alloca i1, align 1
  %16 = alloca %"struct.Test::FuncCDA", align 8
  %17 = alloca i1, align 1
  store float %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  store i8 1, ptr %7, align 1, !tbaa !11
  %18 = load i8, ptr %7, align 1, !tbaa !11, !range !13, !noundef !14
  %19 = trunc i8 %18 to i1
  store i1 false, ptr %9, align 1
  store i1 false, ptr %13, align 1
  br i1 %19, label %20, label %27

20:                                               ; preds = %3
  %21 = load float, ptr %4, align 4, !tbaa !5
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %8, ptr noundef nonnull align 8 dereferenceable(40) %22)
  store i1 true, ptr %9, align 1
  %23 = load ptr, ptr %6, align 8, !tbaa !9
  invoke void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %10, ptr noundef nonnull align 8 dereferenceable(40) %23)
          to label %24 unwind label %56

24:                                               ; preds = %20
  store i1 true, ptr %13, align 1
  %25 = invoke noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEmmmfNS_7FuncCDAES0_(i64 noundef 256, i64 noundef 128, i64 noundef 256, float noundef %21, ptr noundef %8, ptr noundef %10)
          to label %26 unwind label %60

26:                                               ; preds = %24
  br label %27

27:                                               ; preds = %26, %3
  %28 = phi i1 [ false, %3 ], [ %25, %26 ]
  %29 = zext i1 %28 to i8
  store i8 %29, ptr %7, align 1, !tbaa !11
  %30 = load i1, ptr %13, align 1
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #4
  br label %32

32:                                               ; preds = %31, %27
  %33 = load i1, ptr %9, align 1
  br i1 %33, label %34, label %35

34:                                               ; preds = %32
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #4
  br label %35

35:                                               ; preds = %34, %32
  %36 = load i8, ptr %7, align 1, !tbaa !11, !range !13, !noundef !14
  %37 = trunc i8 %36 to i1
  store i1 false, ptr %15, align 1
  store i1 false, ptr %17, align 1
  br i1 %37, label %38, label %45

38:                                               ; preds = %35
  %39 = load float, ptr %4, align 4, !tbaa !5
  %40 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %14, ptr noundef nonnull align 8 dereferenceable(40) %40)
  store i1 true, ptr %15, align 1
  %41 = load ptr, ptr %6, align 8, !tbaa !9
  invoke void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %16, ptr noundef nonnull align 8 dereferenceable(40) %41)
          to label %42 unwind label %71

42:                                               ; preds = %38
  store i1 true, ptr %17, align 1
  %43 = invoke noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEmmmfNS_7FuncCDAES0_(i64 noundef 128, i64 noundef 128, i64 noundef 512, float noundef %39, ptr noundef %14, ptr noundef %16)
          to label %44 unwind label %75

44:                                               ; preds = %42
  br label %45

45:                                               ; preds = %44, %35
  %46 = phi i1 [ false, %35 ], [ %43, %44 ]
  %47 = zext i1 %46 to i8
  store i8 %47, ptr %7, align 1, !tbaa !11
  %48 = load i1, ptr %17, align 1
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %16) #4
  br label %50

50:                                               ; preds = %49, %45
  %51 = load i1, ptr %15, align 1
  br i1 %51, label %52, label %53

52:                                               ; preds = %50
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #4
  br label %53

53:                                               ; preds = %52, %50
  %54 = load i8, ptr %7, align 1, !tbaa !11, !range !13, !noundef !14
  %55 = trunc i8 %54 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  ret i1 %55

56:                                               ; preds = %20
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %11, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %12, align 4
  br label %67

60:                                               ; preds = %24
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %11, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %12, align 4
  %64 = load i1, ptr %13, align 1
  br i1 %64, label %65, label %66

65:                                               ; preds = %60
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #4
  br label %66

66:                                               ; preds = %65, %60
  br label %67

67:                                               ; preds = %66, %56
  %68 = load i1, ptr %9, align 1
  br i1 %68, label %69, label %70

69:                                               ; preds = %67
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %8) #4
  br label %70

70:                                               ; preds = %69, %67
  br label %86

71:                                               ; preds = %38
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %11, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %12, align 4
  br label %82

75:                                               ; preds = %42
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %11, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %12, align 4
  %79 = load i1, ptr %17, align 1
  br i1 %79, label %80, label %81

80:                                               ; preds = %75
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %16) #4
  br label %81

81:                                               ; preds = %80, %75
  br label %82

82:                                               ; preds = %81, %71
  %83 = load i1, ptr %15, align 1
  br i1 %83, label %84, label %85

84:                                               ; preds = %82
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #4
  br label %85

85:                                               ; preds = %84, %82
  br label %86

86:                                               ; preds = %85, %70
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  br label %87

87:                                               ; preds = %86
  %88 = load ptr, ptr %11, align 8
  %89 = load i32, ptr %12, align 4
  %90 = insertvalue { ptr, i32 } poison, ptr %88, 0
  %91 = insertvalue { ptr, i32 } %90, i32 %89, 1
  resume { ptr, i32 } %91
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { inlinehint 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 #4 = { 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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!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"

%"struct.Test::FuncCDA" = type { ptr, %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEmmmfNS_7FuncCDAES0_(i64 noundef, i64 noundef, i64 noundef, float noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEfRKNS_7FuncCDAES2_(float noundef %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(40) %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"struct.Test::FuncCDA", align 8
  %5 = alloca %"struct.Test::FuncCDA", align 8
  %6 = alloca %"struct.Test::FuncCDA", align 8
  %7 = alloca %"struct.Test::FuncCDA", align 8
  call void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %1)
  invoke void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %8 unwind label %16

8:                                                ; preds = %3
  %9 = invoke noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEmmmfNS_7FuncCDAES0_(i64 noundef 256, i64 noundef 128, i64 noundef 256, float noundef %0, ptr noundef nonnull %4, ptr noundef nonnull %5)
          to label %10 unwind label %18

10:                                               ; preds = %8
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #3
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #3
  br i1 %9, label %11, label %.critedge

11:                                               ; preds = %10
  call void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %6, ptr noundef nonnull align 8 dereferenceable(40) %1)
  invoke void @_ZN4Test7FuncCDAC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %12 unwind label %20

12:                                               ; preds = %11
  %13 = invoke noundef zeroext i1 @_ZN4Test30CosineDistancesMxNa16fAutoTestEmmmfNS_7FuncCDAES0_(i64 noundef 128, i64 noundef 128, i64 noundef 512, float noundef %0, ptr noundef nonnull %6, ptr noundef nonnull %7)
          to label %14 unwind label %22

14:                                               ; preds = %12
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %7) #3
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %6) #3
  br label %.critedge

.critedge:                                        ; preds = %10, %14
  %15 = phi i1 [ %13, %14 ], [ false, %10 ]
  ret i1 %15

16:                                               ; preds = %3
  %17 = landingpad { ptr, i32 }
          cleanup
  br label %24

18:                                               ; preds = %8
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #3
  br label %24

20:                                               ; preds = %11
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %24

22:                                               ; preds = %12
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %7) #3
  br label %24

24:                                               ; preds = %22, %20, %18, %16
  %.sink = phi ptr [ %4, %16 ], [ %4, %18 ], [ %6, %20 ], [ %6, %22 ]
  %.pn26.pn = phi { ptr, i32 } [ %17, %16 ], [ %19, %18 ], [ %21, %20 ], [ %23, %22 ]
  call void @_ZN4Test7FuncCDAD2Ev(ptr noundef nonnull align 8 dereferenceable(40) %.sink) #3
  resume { ptr, i32 } %.pn26.pn
}

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

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

attributes #0 = { 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 #1 = { 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 #2 = { inlinehint 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 #3 = { 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,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass