; LLVM IR from ermig1979/Simd :: src/Simd/SimdBaseDescrInt.ll (ZN4Simd4Base8DescrIntC2Emm)

; 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.Simd::Base::DescrInt" = type { %"struct.Simd::Deletable", ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64, i64, float, ptr, i64, i64, ptr, ptr, ptr, ptr, ptr, i64, i64, i64 }
%"struct.Simd::Deletable" = type { ptr }

@_ZTVN4Simd4Base8DescrIntE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetEncode32fEm(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetEncode16fEm(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetDecode32fEm(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetDecode16fEm(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base17GetCosineDistanceEm(i64 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base8DescrIntC2Emm(ptr noundef nonnull align 8 dereferenceable(184) %0, i64 noundef %1, i64 noundef %2) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8
  call void @_ZN4Simd9DeletableC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN4Simd4Base8DescrIntE, i32 0, i32 0, i32 2), ptr %9, align 8, !tbaa !11
  %10 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 8
  %11 = load i64, ptr %5, align 8, !tbaa !9
  store i64 %11, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 9
  %13 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %13, ptr %12, align 8, !tbaa !17
  %14 = load i64, ptr %5, align 8, !tbaa !9
  %15 = load i64, ptr %6, align 8, !tbaa !9
  %16 = mul i64 %14, %15
  %17 = invoke noundef i64 @_ZN4Simd5DivHiEmm(i64 noundef %16, i64 noundef 8)
          to label %18 unwind label %61

18:                                               ; preds = %3
  %19 = add i64 16, %17
  %20 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 10
  store i64 %19, ptr %20, align 8, !tbaa !18
  %21 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 9
  %22 = load i64, ptr %21, align 8, !tbaa !17
  %23 = trunc i64 %22 to i32
  %24 = shl i32 1, %23
  %25 = sub nsw i32 %24, 1
  %26 = sitofp i32 %25 to float
  %27 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 11
  store float %26, ptr %27, align 8, !tbaa !19
  %28 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 1
  store ptr @_ZN4Simd4BaseL9MinMax32fEPKfmRfS3_, ptr %28, align 8, !tbaa !20
  %29 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 2
  store ptr @_ZN4Simd4BaseL9MinMax16fEPKtmRfS3_, ptr %29, align 8, !tbaa !21
  %30 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 9
  %31 = load i64, ptr %30, align 8, !tbaa !17
  %32 = call noundef ptr @_ZN4Simd4Base12GetEncode32fEm(i64 noundef %31)
  %33 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 3
  store ptr %32, ptr %33, align 8, !tbaa !22
  %34 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 9
  %35 = load i64, ptr %34, align 8, !tbaa !17
  %36 = call noundef ptr @_ZN4Simd4Base12GetEncode16fEm(i64 noundef %35)
  %37 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 4
  store ptr %36, ptr %37, align 8, !tbaa !23
  %38 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 9
  %39 = load i64, ptr %38, align 8, !tbaa !17
  %40 = call noundef ptr @_ZN4Simd4Base12GetDecode32fEm(i64 noundef %39)
  %41 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 5
  store ptr %40, ptr %41, align 8, !tbaa !24
  %42 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 9
  %43 = load i64, ptr %42, align 8, !tbaa !17
  %44 = call noundef ptr @_ZN4Simd4Base12GetDecode16fEm(i64 noundef %43)
  %45 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 6
  store ptr %44, ptr %45, align 8, !tbaa !25
  %46 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 9
  %47 = load i64, ptr %46, align 8, !tbaa !17
  %48 = call noundef ptr @_ZN4Simd4Base17GetCosineDistanceEm(i64 noundef %47)
  %49 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 7
  store ptr %48, ptr %49, align 8, !tbaa !26
  %50 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 12
  store ptr null, ptr %50, align 8, !tbaa !27
  %51 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 13
  store i64 0, ptr %51, align 8, !tbaa !28
  %52 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 14
  store i64 0, ptr %52, align 8, !tbaa !29
  %53 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 15
  store ptr null, ptr %53, align 8, !tbaa !30
  %54 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 16
  store ptr null, ptr %54, align 8, !tbaa !31
  %55 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 17
  store ptr null, ptr %55, align 8, !tbaa !32
  %56 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 18
  store ptr null, ptr %56, align 8, !tbaa !33
  %57 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 19
  store ptr null, ptr %57, align 8, !tbaa !34
  %58 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 22
  store i64 0, ptr %58, align 8, !tbaa !35
  %59 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 20
  store i64 0, ptr %59, align 8, !tbaa !36
  %60 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %9, i32 0, i32 21
  store i64 0, ptr %60, align 8, !tbaa !37
  ret void

61:                                               ; preds = %3
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %7, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %8, align 4
  call void @_ZN4Simd9DeletableD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #4
  br label %65

65:                                               ; preds = %61
  %66 = load ptr, ptr %7, align 8
  %67 = load i32, ptr %8, align 4
  %68 = insertvalue { ptr, i32 } poison, ptr %66, 0
  %69 = insertvalue { ptr, i32 } %68, i32 %67, 1
  resume { ptr, i32 } %69
}

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd5DivHiEmm(i64 noundef, i64 noundef) #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL9MinMax32fEPKfmRfS3_(ptr noundef, i64 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL9MinMax16fEPKtmRfS3_(ptr noundef, i64 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

attributes #0 = { 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 #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 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 = { alwaysinline 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !10, i64 64}
!14 = !{!"_ZTSN4Simd4Base8DescrIntE", !15, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !16, i64 88, !6, i64 96, !10, i64 104, !10, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !10, i64 160, !10, i64 168, !10, i64 176}
!15 = !{!"_ZTSN4Simd9DeletableE"}
!16 = !{!"float", !7, i64 0}
!17 = !{!14, !10, i64 72}
!18 = !{!14, !10, i64 80}
!19 = !{!14, !16, i64 88}
!20 = !{!14, !6, i64 8}
!21 = !{!14, !6, i64 16}
!22 = !{!14, !6, i64 24}
!23 = !{!14, !6, i64 32}
!24 = !{!14, !6, i64 40}
!25 = !{!14, !6, i64 48}
!26 = !{!14, !6, i64 56}
!27 = !{!14, !6, i64 96}
!28 = !{!14, !10, i64 104}
!29 = !{!14, !10, i64 112}
!30 = !{!14, !6, i64 120}
!31 = !{!14, !6, i64 128}
!32 = !{!14, !6, i64 136}
!33 = !{!14, !6, i64 144}
!34 = !{!14, !6, i64 152}
!35 = !{!14, !10, i64 176}
!36 = !{!14, !10, i64 160}
!37 = !{!14, !10, i64 168}


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

@_ZTVN4Simd4Base8DescrIntE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetEncode32fEm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetEncode16fEm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetDecode32fEm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base12GetDecode16fEm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN4Simd4Base17GetCosineDistanceEm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN4Simd4Base8DescrIntC2Emm(ptr noundef nonnull align 8 dereferenceable(184) %0, i64 noundef %1, i64 noundef %2) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN4Simd9DeletableC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #5
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN4Simd4Base8DescrIntE, i64 16), ptr %0, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  store i64 %1, ptr %4, align 8, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 %2, ptr %5, align 8, !tbaa !15
  %6 = mul i64 %2, %1
  %7 = tail call noundef i64 @_ZN4Simd5DivHiEmm(i64 noundef %6, i64 noundef 8)
  %8 = add i64 %7, 16
  %9 = getelementptr inbounds i8, ptr %0, i64 80
  store i64 %8, ptr %9, align 8, !tbaa !16
  %10 = load i64, ptr %5, align 8, !tbaa !15
  %11 = trunc i64 %10 to i32
  %notmask = shl nsw i32 -1, %11
  %12 = xor i32 %notmask, -1
  %13 = uitofp nneg i32 %12 to float
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  store float %13, ptr %14, align 8, !tbaa !17
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr @_ZN4Simd4BaseL9MinMax32fEPKfmRfS3_, ptr %15, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr @_ZN4Simd4BaseL9MinMax16fEPKtmRfS3_, ptr %16, align 8, !tbaa !19
  %17 = tail call noundef ptr @_ZN4Simd4Base12GetEncode32fEm(i64 noundef %10)
  %18 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %17, ptr %18, align 8, !tbaa !20
  %19 = load i64, ptr %5, align 8, !tbaa !15
  %20 = tail call noundef ptr @_ZN4Simd4Base12GetEncode16fEm(i64 noundef %19)
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %20, ptr %21, align 8, !tbaa !21
  %22 = load i64, ptr %5, align 8, !tbaa !15
  %23 = tail call noundef ptr @_ZN4Simd4Base12GetDecode32fEm(i64 noundef %22)
  %24 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %23, ptr %24, align 8, !tbaa !22
  %25 = load i64, ptr %5, align 8, !tbaa !15
  %26 = tail call noundef ptr @_ZN4Simd4Base12GetDecode16fEm(i64 noundef %25)
  %27 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %26, ptr %27, align 8, !tbaa !23
  %28 = load i64, ptr %5, align 8, !tbaa !15
  %29 = tail call noundef ptr @_ZN4Simd4Base17GetCosineDistanceEm(i64 noundef %28)
  %30 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %29, ptr %30, align 8, !tbaa !24
  %31 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(88) %31, i8 0, i64 88, i1 false)
  ret void
}

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN4Simd5DivHiEmm(i64 noundef, i64 noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL9MinMax32fEPKfmRfS3_(ptr noundef, i64 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL9MinMax16fEPKtmRfS3_(ptr noundef, i64 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { 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 #1 = { 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 #2 = { alwaysinline 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !13, i64 64}
!9 = !{!"_ZTSN4Simd4Base8DescrIntE", !10, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !14, i64 88, !11, i64 96, !13, i64 104, !13, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !13, i64 160, !13, i64 168, !13, i64 176}
!10 = !{!"_ZTSN4Simd9DeletableE"}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"long", !12, i64 0}
!14 = !{!"float", !12, i64 0}
!15 = !{!9, !13, i64 72}
!16 = !{!9, !13, i64 80}
!17 = !{!9, !14, i64 88}
!18 = !{!9, !11, i64 8}
!19 = !{!9, !11, i64 16}
!20 = !{!9, !11, i64 24}
!21 = !{!9, !11, i64 32}
!22 = !{!9, !11, i64 40}
!23 = !{!9, !11, i64 48}
!24 = !{!9, !11, i64 56}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass