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

; 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.Simd::Array.0" = type { ptr, i64 }
%"struct.Simd::Array.1" = type { ptr, i64 }
%"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 }

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4Simd4Base8DescrInt21CosineDistancesUnpackEmmPKPKhS5_Pf(ptr noundef nonnull align 8 dereferenceable(184) %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca %"struct.Simd::Array.0", align 8
  %18 = alloca %"struct.Simd::Array.0", align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca %"struct.Simd::Array.1", align 8
  %22 = alloca %"struct.Simd::Array.1", align 8
  %23 = alloca i64, align 8
  %24 = alloca i32, align 4
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store i64 %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %29 = call noundef i64 @_ZN4Simd4Base10AlgCacheL2Ev()
  %30 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 22
  %31 = load i64, ptr %30, align 8, !tbaa !11
  %32 = udiv i64 %29, %31
  %33 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 20
  %34 = load i64, ptr %33, align 8, !tbaa !15
  %35 = call noundef i64 @_ZN4Simd10AlignLoAnyEmm(i64 noundef %32, i64 noundef %34)
  store i64 %35, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %36 = call noundef i64 @_ZN4Simd4Base10AlgCacheL3Ev()
  %37 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 22
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = udiv i64 %36, %38
  %40 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 21
  %41 = load i64, ptr %40, align 8, !tbaa !16
  %42 = call noundef i64 @_ZN4Simd10AlignLoAnyEmm(i64 noundef %39, i64 noundef %41)
  store i64 %42, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %43 = load i64, ptr %13, align 8, !tbaa !9
  %44 = trunc i64 %43 to i32
  %45 = load i64, ptr %8, align 8, !tbaa !9
  %46 = trunc i64 %45 to i32
  %47 = call noundef i32 @_ZN4Simd4Base3MinEii(i32 noundef %44, i32 noundef %46)
  %48 = sext i32 %47 to i64
  store i64 %48, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %49 = load i64, ptr %14, align 8, !tbaa !9
  %50 = trunc i64 %49 to i32
  %51 = load i64, ptr %9, align 8, !tbaa !9
  %52 = trunc i64 %51 to i32
  %53 = call noundef i32 @_ZN4Simd4Base3MinEii(i32 noundef %50, i32 noundef %52)
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 21
  %56 = load i64, ptr %55, align 8, !tbaa !16
  %57 = call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %54, i64 noundef %56)
  store i64 %57, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #4
  %58 = load i64, ptr %15, align 8, !tbaa !9
  %59 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 22
  %60 = load i64, ptr %59, align 8, !tbaa !11
  %61 = mul i64 %58, %60
  call void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %17, i64 noundef %61, i1 noundef zeroext false, i64 noundef 8)
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #4
  %62 = load i64, ptr %16, align 8, !tbaa !9
  %63 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 22
  %64 = load i64, ptr %63, align 8, !tbaa !11
  %65 = mul i64 %62, %64
  invoke void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %18, i64 noundef %65, i1 noundef zeroext false, i64 noundef 8)
          to label %66 unwind label %78

66:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #4
  %67 = load i64, ptr %15, align 8, !tbaa !9
  %68 = mul i64 %67, 4
  invoke void @_ZN4Simd5ArrayIfEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %21, i64 noundef %68, i1 noundef zeroext false, i64 noundef 8)
          to label %69 unwind label %82

69:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #4
  %70 = load i64, ptr %16, align 8, !tbaa !9
  %71 = mul i64 %70, 4
  invoke void @_ZN4Simd5ArrayIfEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %22, i64 noundef %71, i1 noundef zeroext false, i64 noundef 8)
          to label %72 unwind label %86

72:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  store i64 0, ptr %23, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %192, %72
  %74 = load i64, ptr %23, align 8, !tbaa !9
  %75 = load i64, ptr %8, align 8, !tbaa !9
  %76 = icmp ult i64 %74, %75
  br i1 %76, label %90, label %77

77:                                               ; preds = %73
  store i32 2, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  br label %197

78:                                               ; preds = %6
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %19, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %20, align 4
  br label %200

82:                                               ; preds = %66
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %19, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %20, align 4
  br label %199

86:                                               ; preds = %69
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %19, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %20, align 4
  br label %198

90:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  %91 = load i64, ptr %8, align 8, !tbaa !9
  %92 = load i64, ptr %23, align 8, !tbaa !9
  %93 = load i64, ptr %13, align 8, !tbaa !9
  %94 = add i64 %92, %93
  %95 = invoke noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %91, i64 noundef %94)
          to label %96 unwind label %126

96:                                               ; preds = %90
  %97 = load i64, ptr %23, align 8, !tbaa !9
  %98 = sub i64 %95, %97
  store i64 %98, ptr %25, align 8, !tbaa !9
  %99 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 15
  %100 = load ptr, ptr %99, align 8, !tbaa !17
  %101 = load i64, ptr %25, align 8, !tbaa !9
  %102 = load ptr, ptr %10, align 8, !tbaa !5
  %103 = load i64, ptr %23, align 8, !tbaa !9
  %104 = getelementptr inbounds ptr, ptr %102, i64 %103
  %105 = getelementptr inbounds %"struct.Simd::Array.1", ptr %21, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !18
  invoke void %100(i64 noundef %101, ptr noundef %104, ptr noundef %106, i64 noundef 1)
          to label %107 unwind label %126

107:                                              ; preds = %96
  %108 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 17
  %109 = load ptr, ptr %108, align 8, !tbaa !20
  %110 = load i64, ptr %25, align 8, !tbaa !9
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = load i64, ptr %23, align 8, !tbaa !9
  %113 = getelementptr inbounds ptr, ptr %111, i64 %112
  %114 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 8
  %115 = load i64, ptr %114, align 8, !tbaa !21
  %116 = getelementptr inbounds %"struct.Simd::Array.0", ptr %17, i32 0, i32 0
  %117 = load ptr, ptr %116, align 8, !tbaa !22
  %118 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 22
  %119 = load i64, ptr %118, align 8, !tbaa !11
  invoke void %109(i64 noundef %110, ptr noundef %113, i64 noundef %115, ptr noundef %117, i64 noundef %119)
          to label %120 unwind label %126

120:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  store i64 0, ptr %26, align 8, !tbaa !9
  br label %121

121:                                              ; preds = %183, %120
  %122 = load i64, ptr %26, align 8, !tbaa !9
  %123 = load i64, ptr %9, align 8, !tbaa !9
  %124 = icmp ult i64 %122, %123
  br i1 %124, label %130, label %125

125:                                              ; preds = %121
  store i32 5, ptr %24, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  br label %191

126:                                              ; preds = %107, %96, %90
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %19, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %20, align 4
  br label %196

130:                                              ; preds = %121
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  %131 = load i64, ptr %9, align 8, !tbaa !9
  %132 = load i64, ptr %26, align 8, !tbaa !9
  %133 = load i64, ptr %14, align 8, !tbaa !9
  %134 = add i64 %132, %133
  %135 = invoke noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %131, i64 noundef %134)
          to label %136 unwind label %187

136:                                              ; preds = %130
  %137 = load i64, ptr %26, align 8, !tbaa !9
  %138 = sub i64 %135, %137
  store i64 %138, ptr %27, align 8, !tbaa !9
  %139 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 16
  %140 = load ptr, ptr %139, align 8, !tbaa !24
  %141 = load i64, ptr %27, align 8, !tbaa !9
  %142 = load ptr, ptr %11, align 8, !tbaa !5
  %143 = load i64, ptr %26, align 8, !tbaa !9
  %144 = getelementptr inbounds ptr, ptr %142, i64 %143
  %145 = getelementptr inbounds %"struct.Simd::Array.1", ptr %22, i32 0, i32 0
  %146 = load ptr, ptr %145, align 8, !tbaa !18
  %147 = load i64, ptr %27, align 8, !tbaa !9
  invoke void %140(i64 noundef %141, ptr noundef %144, ptr noundef %146, i64 noundef %147)
          to label %148 unwind label %187

148:                                              ; preds = %136
  %149 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 18
  %150 = load ptr, ptr %149, align 8, !tbaa !25
  %151 = load i64, ptr %27, align 8, !tbaa !9
  %152 = load ptr, ptr %11, align 8, !tbaa !5
  %153 = load i64, ptr %26, align 8, !tbaa !9
  %154 = getelementptr inbounds ptr, ptr %152, i64 %153
  %155 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 8
  %156 = load i64, ptr %155, align 8, !tbaa !21
  %157 = getelementptr inbounds %"struct.Simd::Array.0", ptr %18, i32 0, i32 0
  %158 = load ptr, ptr %157, align 8, !tbaa !22
  invoke void %150(i64 noundef %151, ptr noundef %154, i64 noundef %156, ptr noundef %158, i64 noundef 1)
          to label %159 unwind label %187

159:                                              ; preds = %148
  %160 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 19
  %161 = load ptr, ptr %160, align 8, !tbaa !26
  %162 = load i64, ptr %25, align 8, !tbaa !9
  %163 = load i64, ptr %27, align 8, !tbaa !9
  %164 = getelementptr inbounds %"class.Simd::Base::DescrInt", ptr %28, i32 0, i32 8
  %165 = load i64, ptr %164, align 8, !tbaa !21
  %166 = getelementptr inbounds %"struct.Simd::Array.0", ptr %17, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !22
  %168 = getelementptr inbounds %"struct.Simd::Array.1", ptr %21, i32 0, i32 0
  %169 = load ptr, ptr %168, align 8, !tbaa !18
  %170 = getelementptr inbounds %"struct.Simd::Array.0", ptr %18, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !22
  %172 = getelementptr inbounds %"struct.Simd::Array.1", ptr %22, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !18
  %174 = load ptr, ptr %12, align 8, !tbaa !5
  %175 = load i64, ptr %23, align 8, !tbaa !9
  %176 = load i64, ptr %9, align 8, !tbaa !9
  %177 = mul i64 %175, %176
  %178 = getelementptr inbounds float, ptr %174, i64 %177
  %179 = load i64, ptr %26, align 8, !tbaa !9
  %180 = getelementptr inbounds float, ptr %178, i64 %179
  %181 = load i64, ptr %9, align 8, !tbaa !9
  invoke void %161(i64 noundef %162, i64 noundef %163, i64 noundef %165, ptr noundef %167, ptr noundef %169, ptr noundef %171, ptr noundef %173, ptr noundef %180, i64 noundef %181)
          to label %182 unwind label %187

182:                                              ; preds = %159
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  br label %183

183:                                              ; preds = %182
  %184 = load i64, ptr %14, align 8, !tbaa !9
  %185 = load i64, ptr %26, align 8, !tbaa !9
  %186 = add i64 %185, %184
  store i64 %186, ptr %26, align 8, !tbaa !9
  br label %121, !llvm.loop !27

187:                                              ; preds = %159, %148, %136, %130
  %188 = landingpad { ptr, i32 }
          cleanup
  %189 = extractvalue { ptr, i32 } %188, 0
  store ptr %189, ptr %19, align 8
  %190 = extractvalue { ptr, i32 } %188, 1
  store i32 %190, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  br label %196

191:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  br label %192

192:                                              ; preds = %191
  %193 = load i64, ptr %13, align 8, !tbaa !9
  %194 = load i64, ptr %23, align 8, !tbaa !9
  %195 = add i64 %194, %193
  store i64 %195, ptr %23, align 8, !tbaa !9
  br label %73, !llvm.loop !29

196:                                              ; preds = %187, %126
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %22) #4
  br label %198

197:                                              ; preds = %77
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %22) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #4
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %21) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  ret void

198:                                              ; preds = %196, %86
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #4
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %21) #4
  br label %199

199:                                              ; preds = %198, %82
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %18) #4
  br label %200

200:                                              ; preds = %199, %78
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %17) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %201

201:                                              ; preds = %200
  %202 = load ptr, ptr %19, align 8
  %203 = load i32, ptr %20, align 4
  %204 = insertvalue { ptr, i32 } poison, ptr %202, 0
  %205 = insertvalue { ptr, i32 } %204, i32 %203, 1
  resume { ptr, i32 } %205
}

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

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

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

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4Simd4Base3MinEii(i32 noundef, i32 noundef) #2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIfEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #3 align 2

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 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 = { 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 = { alwaysinline 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 = { 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, !10, i64 176}
!12 = !{!"_ZTSN4Simd4Base8DescrIntE", !13, 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, !14, 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}
!13 = !{!"_ZTSN4Simd9DeletableE"}
!14 = !{!"float", !7, i64 0}
!15 = !{!12, !10, i64 160}
!16 = !{!12, !10, i64 168}
!17 = !{!12, !6, i64 120}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTSN4Simd5ArrayIfEE", !6, i64 0, !10, i64 8}
!20 = !{!12, !6, i64 136}
!21 = !{!12, !10, i64 64}
!22 = !{!23, !6, i64 0}
!23 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !10, i64 8}
!24 = !{!12, !6, i64 128}
!25 = !{!12, !6, i64 144}
!26 = !{!12, !6, i64 152}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}


; 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.Simd::Array.0" = type { ptr, i64 }
%"struct.Simd::Array.1" = type { ptr, i64 }

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK4Simd4Base8DescrInt21CosineDistancesUnpackEmmPKPKhS5_Pf(ptr nocapture noundef nonnull readonly align 8 dereferenceable(184) %0, i64 noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"struct.Simd::Array.0", align 8
  %8 = alloca %"struct.Simd::Array.0", align 8
  %9 = alloca %"struct.Simd::Array.1", align 8
  %10 = alloca %"struct.Simd::Array.1", align 8
  %11 = tail call noundef i64 @_ZN4Simd4Base10AlgCacheL2Ev()
  %12 = getelementptr inbounds i8, ptr %0, i64 176
  %13 = load i64, ptr %12, align 8, !tbaa !5
  %14 = udiv i64 %11, %13
  %15 = getelementptr inbounds i8, ptr %0, i64 160
  %16 = load i64, ptr %15, align 8, !tbaa !13
  %17 = tail call noundef i64 @_ZN4Simd10AlignLoAnyEmm(i64 noundef %14, i64 noundef %16)
  %18 = tail call noundef i64 @_ZN4Simd4Base10AlgCacheL3Ev()
  %19 = load i64, ptr %12, align 8, !tbaa !5
  %20 = udiv i64 %18, %19
  %21 = getelementptr inbounds i8, ptr %0, i64 168
  %22 = load i64, ptr %21, align 8, !tbaa !14
  %23 = tail call noundef i64 @_ZN4Simd10AlignLoAnyEmm(i64 noundef %20, i64 noundef %22)
  %24 = trunc i64 %17 to i32
  %25 = trunc i64 %1 to i32
  %26 = tail call noundef i32 @_ZN4Simd4Base3MinEii(i32 noundef %24, i32 noundef %25)
  %27 = sext i32 %26 to i64
  %28 = trunc i64 %23 to i32
  %29 = trunc i64 %2 to i32
  %30 = tail call noundef i32 @_ZN4Simd4Base3MinEii(i32 noundef %28, i32 noundef %29)
  %31 = sext i32 %30 to i64
  %32 = load i64, ptr %21, align 8, !tbaa !14
  %33 = tail call noundef i64 @_ZN4Simd7AlignHiEmm(i64 noundef %31, i64 noundef %32)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  %34 = load i64, ptr %12, align 8, !tbaa !5
  %35 = mul i64 %34, %27
  call void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %7, i64 noundef %35, i1 noundef zeroext false, i64 noundef 8)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #4
  %36 = load i64, ptr %12, align 8, !tbaa !5
  %37 = mul i64 %36, %33
  invoke void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %8, i64 noundef %37, i1 noundef zeroext false, i64 noundef 8)
          to label %38 unwind label %49

38:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  %39 = shl nsw i64 %27, 2
  invoke void @_ZN4Simd5ArrayIfEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %9, i64 noundef %39, i1 noundef zeroext false, i64 noundef 8)
          to label %40 unwind label %51

40:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #4
  %41 = shl i64 %33, 2
  invoke void @_ZN4Simd5ArrayIfEC2Embm(ptr noundef nonnull align 8 dereferenceable(16) %10, i64 noundef %41, i1 noundef zeroext false, i64 noundef 8)
          to label %.preheader58 unwind label %53

.preheader58:                                     ; preds = %40
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader58
  %42 = getelementptr inbounds i8, ptr %0, i64 120
  %43 = getelementptr inbounds i8, ptr %0, i64 136
  %44 = getelementptr inbounds i8, ptr %0, i64 64
  %45 = getelementptr inbounds i8, ptr %0, i64 128
  %46 = getelementptr inbounds i8, ptr %0, i64 144
  %47 = getelementptr inbounds i8, ptr %0, i64 152
  br label %55

.loopexit:                                        ; preds = %69
  %48 = icmp ult i64 %56, %1
  br i1 %48, label %55, label %._crit_edge, !llvm.loop !15

._crit_edge:                                      ; preds = %.loopexit, %.preheader58
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #4
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  ret void

49:                                               ; preds = %6
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %97

51:                                               ; preds = %38
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %96

53:                                               ; preds = %40
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %95

55:                                               ; preds = %.lr.ph, %.loopexit
  %.05159 = phi i64 [ 0, %.lr.ph ], [ %56, %.loopexit ]
  %56 = add i64 %.05159, %17
  %57 = call noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %1, i64 noundef %56)
  %58 = sub i64 %57, %.05159
  %59 = load ptr, ptr %42, align 8, !tbaa !17
  %60 = getelementptr inbounds ptr, ptr %3, i64 %.05159
  %61 = load ptr, ptr %9, align 8, !tbaa !18
  invoke void %59(i64 noundef %58, ptr noundef %60, ptr noundef %61, i64 noundef 1)
          to label %62 unwind label %71

62:                                               ; preds = %55
  %63 = load ptr, ptr %43, align 8, !tbaa !20
  %64 = load i64, ptr %44, align 8, !tbaa !21
  %65 = load ptr, ptr %7, align 8, !tbaa !22
  %66 = load i64, ptr %12, align 8, !tbaa !5
  invoke void %63(i64 noundef %58, ptr noundef %60, i64 noundef %64, ptr noundef %65, i64 noundef %66)
          to label %.preheader unwind label %71

.preheader:                                       ; preds = %62
  %67 = mul i64 %.05159, %2
  %68 = getelementptr inbounds float, ptr %5, i64 %67
  br label %69

69:                                               ; preds = %.preheader, %84
  %.046 = phi i64 [ %74, %84 ], [ 0, %.preheader ]
  %70 = icmp ult i64 %.046, %2
  br i1 %70, label %73, label %.loopexit

71:                                               ; preds = %62, %55
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %94

73:                                               ; preds = %69
  %74 = add i64 %.046, %23
  %75 = call noundef i64 @_ZN4Simd3MinImEET_S1_S1_(i64 noundef %2, i64 noundef %74)
  %76 = sub i64 %75, %.046
  %77 = load ptr, ptr %45, align 8, !tbaa !24
  %78 = getelementptr inbounds ptr, ptr %4, i64 %.046
  %79 = load ptr, ptr %10, align 8, !tbaa !18
  invoke void %77(i64 noundef %76, ptr noundef %78, ptr noundef %79, i64 noundef %76)
          to label %80 unwind label %92

80:                                               ; preds = %73
  %81 = load ptr, ptr %46, align 8, !tbaa !25
  %82 = load i64, ptr %44, align 8, !tbaa !21
  %83 = load ptr, ptr %8, align 8, !tbaa !22
  invoke void %81(i64 noundef %76, ptr noundef %78, i64 noundef %82, ptr noundef %83, i64 noundef 1)
          to label %84 unwind label %92

84:                                               ; preds = %80
  %85 = load ptr, ptr %47, align 8, !tbaa !26
  %86 = load i64, ptr %44, align 8, !tbaa !21
  %87 = load ptr, ptr %7, align 8, !tbaa !22
  %88 = load ptr, ptr %9, align 8, !tbaa !18
  %89 = load ptr, ptr %8, align 8, !tbaa !22
  %90 = load ptr, ptr %10, align 8, !tbaa !18
  %91 = getelementptr inbounds float, ptr %68, i64 %.046
  invoke void %85(i64 noundef %58, i64 noundef %76, i64 noundef %86, ptr noundef %87, ptr noundef %88, ptr noundef %89, ptr noundef %90, ptr noundef %91, i64 noundef %2)
          to label %69 unwind label %92, !llvm.loop !27

92:                                               ; preds = %84, %80, %73
  %93 = landingpad { ptr, i32 }
          cleanup
  br label %94

94:                                               ; preds = %92, %71
  %.pn = phi { ptr, i32 } [ %93, %92 ], [ %72, %71 ]
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #4
  br label %95

95:                                               ; preds = %94, %53
  %.pn.pn = phi { ptr, i32 } [ %.pn, %94 ], [ %54, %53 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #4
  call void @_ZN4Simd5ArrayIfED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  br label %96

96:                                               ; preds = %95, %51
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %95 ], [ %52, %51 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #4
  br label %97

97:                                               ; preds = %96, %49
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %96 ], [ %50, %49 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  call void @_ZN4Simd5ArrayIhED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  resume { ptr, i32 } %.pn.pn.pn.pn
}

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

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

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

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

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIhEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local void @_ZN4Simd5ArrayIfEC2Embm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i1 noundef zeroext, i64 noundef) unnamed_addr #3 align 2

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

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

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass