; LLVM IR from ggml-org/ggml :: src/ggml-cpu (ggml-cpu-quants)

; 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.block_iq2_s = type { i16, [64 x i8], [8 x i8], [8 x i8] }
%struct.block_q8_K = type { float, [256 x i8], [16 x i16] }

@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@kmask_iq2xs = external hidden constant [8 x i8], align 1
@__PRETTY_FUNCTION__.ggml_vec_dot_iq2_s_q8_K = external hidden unnamed_addr constant [124 x i8], align 1
@iq2s_grid = external hidden constant [1024 x i64], align 16

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @ggml_lookup_fp16_to_fp32(i16 noundef zeroext) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @ggml_vec_dot_iq2_s_q8_K(i32 noundef %0, ptr noalias noundef %1, i64 noundef %2, ptr noalias noundef %3, i64 noundef %4, ptr noalias noundef %5, i64 noundef %6, i32 noundef %7) #4 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca float, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca float, align 4
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca ptr, align 8
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca ptr, align 8
  %39 = alloca i32, align 4
  store i32 %0, ptr %9, align 4, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !9
  store i64 %2, ptr %11, align 8, !tbaa !11
  store ptr %3, ptr %12, align 8, !tbaa !9
  store i64 %4, ptr %13, align 8, !tbaa !11
  store ptr %5, ptr %14, align 8, !tbaa !9
  store i64 %6, ptr %15, align 8, !tbaa !11
  store i32 %7, ptr %16, align 4, !tbaa !5
  %40 = load i32, ptr %9, align 4, !tbaa !5
  %41 = srem i32 %40, 256
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %8
  br label %45

44:                                               ; preds = %8
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 10452, ptr noundef @__PRETTY_FUNCTION__.ggml_vec_dot_iq2_s_q8_K) #5
  unreachable

45:                                               ; preds = %43
  %46 = load i32, ptr %16, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  br label %50

49:                                               ; preds = %45
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 10453, ptr noundef @__PRETTY_FUNCTION__.ggml_vec_dot_iq2_s_q8_K) #5
  unreachable

50:                                               ; preds = %48
  %51 = load i32, ptr %16, align 4, !tbaa !5
  %52 = load i64, ptr %13, align 8, !tbaa !11
  %53 = load i64, ptr %15, align 8, !tbaa !11
  %54 = load i64, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %55 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %55, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %56 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %56, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = sdiv i32 %57, 256
  store i32 %58, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store float 0.000000e+00, ptr %20, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %294, %50
  %60 = load i32, ptr %21, align 4, !tbaa !5
  %61 = load i32, ptr %19, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 2, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %297

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #6
  %65 = load ptr, ptr %17, align 8, !tbaa !9
  %66 = load i32, ptr %21, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds %struct.block_iq2_s, ptr %65, i64 %67
  %69 = getelementptr inbounds %struct.block_iq2_s, ptr %68, i32 0, i32 0
  %70 = load i16, ptr %69, align 2, !tbaa !15
  %71 = call float @ggml_lookup_fp16_to_fp32(i16 noundef zeroext %70)
  %72 = load ptr, ptr %18, align 8, !tbaa !9
  %73 = load i32, ptr %21, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds %struct.block_q8_K, ptr %72, i64 %74
  %76 = getelementptr inbounds %struct.block_q8_K, ptr %75, i32 0, i32 0
  %77 = load float, ptr %76, align 4, !tbaa !18
  %78 = fmul float %71, %77
  store float %78, ptr %23, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %79 = load ptr, ptr %18, align 8, !tbaa !9
  %80 = load i32, ptr %21, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %struct.block_q8_K, ptr %79, i64 %81
  %83 = getelementptr inbounds %struct.block_q8_K, ptr %82, i32 0, i32 1
  %84 = getelementptr inbounds [256 x i8], ptr %83, i64 0, i64 0
  store ptr %84, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %85 = load ptr, ptr %17, align 8, !tbaa !9
  %86 = load i32, ptr %21, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds %struct.block_iq2_s, ptr %85, i64 %87
  %89 = getelementptr inbounds %struct.block_iq2_s, ptr %88, i32 0, i32 1
  %90 = getelementptr inbounds [64 x i8], ptr %89, i64 0, i64 0
  store ptr %90, ptr %25, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %91 = load ptr, ptr %17, align 8, !tbaa !9
  %92 = load i32, ptr %21, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds %struct.block_iq2_s, ptr %91, i64 %93
  %95 = getelementptr inbounds %struct.block_iq2_s, ptr %94, i32 0, i32 2
  %96 = getelementptr inbounds [8 x i8], ptr %95, i64 0, i64 0
  store ptr %96, ptr %26, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %97 = load ptr, ptr %25, align 8, !tbaa !9
  %98 = getelementptr inbounds i8, ptr %97, i64 32
  store ptr %98, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #6
  store i32 0, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #6
  store i32 0, ptr %29, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %285, %64
  %100 = load i32, ptr %29, align 4, !tbaa !5
  %101 = icmp slt i32 %100, 8
  br i1 %101, label %103, label %102

102:                                              ; preds = %99
  store i32 5, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #6
  br label %288

103:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  %104 = load ptr, ptr %17, align 8, !tbaa !9
  %105 = load i32, ptr %21, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds %struct.block_iq2_s, ptr %104, i64 %106
  %108 = getelementptr inbounds %struct.block_iq2_s, ptr %107, i32 0, i32 3
  %109 = load i32, ptr %29, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [8 x i8], ptr %108, i64 0, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !20
  %113 = zext i8 %112 to i32
  %114 = and i32 %113, 15
  %115 = mul nsw i32 2, %114
  %116 = add nsw i32 1, %115
  store i32 %116, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  %117 = load ptr, ptr %17, align 8, !tbaa !9
  %118 = load i32, ptr %21, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds %struct.block_iq2_s, ptr %117, i64 %119
  %121 = getelementptr inbounds %struct.block_iq2_s, ptr %120, i32 0, i32 3
  %122 = load i32, ptr %29, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [8 x i8], ptr %121, i64 0, i64 %123
  %125 = load i8, ptr %124, align 1, !tbaa !20
  %126 = zext i8 %125 to i32
  %127 = ashr i32 %126, 4
  %128 = mul nsw i32 2, %127
  %129 = add nsw i32 1, %128
  store i32 %129, ptr %31, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #6
  store i32 0, ptr %32, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #6
  store i32 0, ptr %33, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #6
  store i32 0, ptr %34, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %197, %103
  %131 = load i32, ptr %34, align 4, !tbaa !5
  %132 = icmp slt i32 %131, 2
  br i1 %132, label %134, label %133

133:                                              ; preds = %130
  store i32 8, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #6
  br label %200

134:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #6
  %135 = load ptr, ptr %25, align 8, !tbaa !9
  %136 = load i32, ptr %34, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i8, ptr %135, i64 %137
  %139 = load i8, ptr %138, align 1, !tbaa !20
  %140 = zext i8 %139 to i32
  %141 = load ptr, ptr %26, align 8, !tbaa !9
  %142 = load i32, ptr %29, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds i8, ptr %141, i64 %143
  %145 = load i8, ptr %144, align 1, !tbaa !20
  %146 = zext i8 %145 to i32
  %147 = load i32, ptr %34, align 4, !tbaa !5
  %148 = mul nsw i32 2, %147
  %149 = sub nsw i32 8, %148
  %150 = shl i32 %146, %149
  %151 = and i32 %150, 768
  %152 = or i32 %140, %151
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds i64, ptr @iq2s_grid, i64 %153
  store ptr %154, ptr %35, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #6
  store i32 0, ptr %36, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %191, %134
  %156 = load i32, ptr %36, align 4, !tbaa !5
  %157 = icmp slt i32 %156, 8
  br i1 %157, label %159, label %158

158:                                              ; preds = %155
  store i32 11, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #6
  br label %194

159:                                              ; preds = %155
  %160 = load ptr, ptr %24, align 8, !tbaa !9
  %161 = load i32, ptr %36, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds i8, ptr %160, i64 %162
  %164 = load i8, ptr %163, align 1, !tbaa !20
  %165 = sext i8 %164 to i32
  %166 = load ptr, ptr %35, align 8, !tbaa !9
  %167 = load i32, ptr %36, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds i8, ptr %166, i64 %168
  %170 = load i8, ptr %169, align 1, !tbaa !20
  %171 = zext i8 %170 to i32
  %172 = mul nsw i32 %165, %171
  %173 = load ptr, ptr %27, align 8, !tbaa !9
  %174 = load i32, ptr %34, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds i8, ptr %173, i64 %175
  %177 = load i8, ptr %176, align 1, !tbaa !20
  %178 = zext i8 %177 to i32
  %179 = load i32, ptr %36, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [8 x i8], ptr @kmask_iq2xs, i64 0, i64 %180
  %182 = load i8, ptr %181, align 1, !tbaa !20
  %183 = zext i8 %182 to i32
  %184 = and i32 %178, %183
  %185 = icmp ne i32 %184, 0
  %186 = zext i1 %185 to i64
  %187 = select i1 %185, i32 -1, i32 1
  %188 = mul nsw i32 %172, %187
  %189 = load i32, ptr %32, align 4, !tbaa !5
  %190 = add nsw i32 %189, %188
  store i32 %190, ptr %32, align 4, !tbaa !5
  br label %191

191:                                              ; preds = %159
  %192 = load i32, ptr %36, align 4, !tbaa !5
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %36, align 4, !tbaa !5
  br label %155, !llvm.loop !21

194:                                              ; preds = %158
  %195 = load ptr, ptr %24, align 8, !tbaa !9
  %196 = getelementptr inbounds i8, ptr %195, i64 8
  store ptr %196, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #6
  br label %197

197:                                              ; preds = %194
  %198 = load i32, ptr %34, align 4, !tbaa !5
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %34, align 4, !tbaa !5
  br label %130, !llvm.loop !23

200:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #6
  store i32 2, ptr %37, align 4, !tbaa !5
  br label %201

201:                                              ; preds = %268, %200
  %202 = load i32, ptr %37, align 4, !tbaa !5
  %203 = icmp slt i32 %202, 4
  br i1 %203, label %205, label %204

204:                                              ; preds = %201
  store i32 14, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #6
  br label %271

205:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #6
  %206 = load ptr, ptr %25, align 8, !tbaa !9
  %207 = load i32, ptr %37, align 4, !tbaa !5
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds i8, ptr %206, i64 %208
  %210 = load i8, ptr %209, align 1, !tbaa !20
  %211 = zext i8 %210 to i32
  %212 = load ptr, ptr %26, align 8, !tbaa !9
  %213 = load i32, ptr %29, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds i8, ptr %212, i64 %214
  %216 = load i8, ptr %215, align 1, !tbaa !20
  %217 = zext i8 %216 to i32
  %218 = load i32, ptr %37, align 4, !tbaa !5
  %219 = mul nsw i32 2, %218
  %220 = sub nsw i32 8, %219
  %221 = shl i32 %217, %220
  %222 = and i32 %221, 768
  %223 = or i32 %211, %222
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds i64, ptr @iq2s_grid, i64 %224
  store ptr %225, ptr %38, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #6
  store i32 0, ptr %39, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %262, %205
  %227 = load i32, ptr %39, align 4, !tbaa !5
  %228 = icmp slt i32 %227, 8
  br i1 %228, label %230, label %229

229:                                              ; preds = %226
  store i32 17, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #6
  br label %265

230:                                              ; preds = %226
  %231 = load ptr, ptr %24, align 8, !tbaa !9
  %232 = load i32, ptr %39, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds i8, ptr %231, i64 %233
  %235 = load i8, ptr %234, align 1, !tbaa !20
  %236 = sext i8 %235 to i32
  %237 = load ptr, ptr %38, align 8, !tbaa !9
  %238 = load i32, ptr %39, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds i8, ptr %237, i64 %239
  %241 = load i8, ptr %240, align 1, !tbaa !20
  %242 = zext i8 %241 to i32
  %243 = mul nsw i32 %236, %242
  %244 = load ptr, ptr %27, align 8, !tbaa !9
  %245 = load i32, ptr %37, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds i8, ptr %244, i64 %246
  %248 = load i8, ptr %247, align 1, !tbaa !20
  %249 = zext i8 %248 to i32
  %250 = load i32, ptr %39, align 4, !tbaa !5
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [8 x i8], ptr @kmask_iq2xs, i64 0, i64 %251
  %253 = load i8, ptr %252, align 1, !tbaa !20
  %254 = zext i8 %253 to i32
  %255 = and i32 %249, %254
  %256 = icmp ne i32 %255, 0
  %257 = zext i1 %256 to i64
  %258 = select i1 %256, i32 -1, i32 1
  %259 = mul nsw i32 %243, %258
  %260 = load i32, ptr %33, align 4, !tbaa !5
  %261 = add nsw i32 %260, %259
  store i32 %261, ptr %33, align 4, !tbaa !5
  br label %262

262:                                              ; preds = %230
  %263 = load i32, ptr %39, align 4, !tbaa !5
  %264 = add nsw i32 %263, 1
  store i32 %264, ptr %39, align 4, !tbaa !5
  br label %226, !llvm.loop !24

265:                                              ; preds = %229
  %266 = load ptr, ptr %24, align 8, !tbaa !9
  %267 = getelementptr inbounds i8, ptr %266, i64 8
  store ptr %267, ptr %24, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #6
  br label %268

268:                                              ; preds = %265
  %269 = load i32, ptr %37, align 4, !tbaa !5
  %270 = add nsw i32 %269, 1
  store i32 %270, ptr %37, align 4, !tbaa !5
  br label %201, !llvm.loop !25

271:                                              ; preds = %204
  %272 = load i32, ptr %30, align 4, !tbaa !5
  %273 = load i32, ptr %32, align 4, !tbaa !5
  %274 = mul nsw i32 %272, %273
  %275 = load i32, ptr %31, align 4, !tbaa !5
  %276 = load i32, ptr %33, align 4, !tbaa !5
  %277 = mul nsw i32 %275, %276
  %278 = add nsw i32 %274, %277
  %279 = load i32, ptr %28, align 4, !tbaa !5
  %280 = add nsw i32 %279, %278
  store i32 %280, ptr %28, align 4, !tbaa !5
  %281 = load ptr, ptr %25, align 8, !tbaa !9
  %282 = getelementptr inbounds i8, ptr %281, i64 4
  store ptr %282, ptr %25, align 8, !tbaa !9
  %283 = load ptr, ptr %27, align 8, !tbaa !9
  %284 = getelementptr inbounds i8, ptr %283, i64 4
  store ptr %284, ptr %27, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  br label %285

285:                                              ; preds = %271
  %286 = load i32, ptr %29, align 4, !tbaa !5
  %287 = add nsw i32 %286, 1
  store i32 %287, ptr %29, align 4, !tbaa !5
  br label %99, !llvm.loop !26

288:                                              ; preds = %102
  %289 = load float, ptr %23, align 4, !tbaa !13
  %290 = load i32, ptr %28, align 4, !tbaa !5
  %291 = sitofp i32 %290 to float
  %292 = load float, ptr %20, align 4, !tbaa !13
  %293 = call float @llvm.fmuladd.f32(float %289, float %291, float %292)
  store float %293, ptr %20, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #6
  br label %294

294:                                              ; preds = %288
  %295 = load i32, ptr %21, align 4, !tbaa !5
  %296 = add nsw i32 %295, 1
  store i32 %296, ptr %21, align 4, !tbaa !5
  br label %59, !llvm.loop !27

297:                                              ; preds = %63
  %298 = load float, ptr %20, align 4, !tbaa !13
  %299 = fmul float 1.250000e-01, %298
  %300 = load ptr, ptr %10, align 8, !tbaa !9
  store float %299, ptr %300, align 4, !tbaa !13
  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 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  ret void
}

attributes #0 = { noreturn nounwind "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 willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { noreturn nounwind }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!16, !17, i64 0}
!16 = !{!"", !17, i64 0, !7, i64 2, !7, i64 66, !7, i64 74}
!17 = !{!"short", !7, i64 0}
!18 = !{!19, !14, i64 0}
!19 = !{!"", !14, i64 0, !7, i64 4, !7, i64 260}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !22}
!25 = distinct !{!25, !22}
!26 = distinct !{!26, !22}
!27 = distinct !{!27, !22}


; 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.block_iq2_s = type { i16, [64 x i8], [8 x i8], [8 x i8] }
%struct.block_q8_K = type { float, [256 x i8], [16 x i16] }

@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [14 x i8], align 1
@kmask_iq2xs = external hidden local_unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__.ggml_vec_dot_iq2_s_q8_K = external hidden unnamed_addr constant [124 x i8], align 1
@iq2s_grid = external hidden local_unnamed_addr constant [1024 x i64], align 16

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden float @ggml_lookup_fp16_to_fp32(i16 noundef zeroext) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @ggml_vec_dot_iq2_s_q8_K(i32 noundef %0, ptr noalias nocapture noundef writeonly %1, i64 noundef %2, ptr noalias nocapture noundef readonly %3, i64 noundef %4, ptr noalias nocapture noundef readonly %5, i64 noundef %6, i32 noundef %7) local_unnamed_addr #3 {
  %9 = and i32 %0, 255
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %12, label %11

11:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 10452, ptr noundef nonnull @__PRETTY_FUNCTION__.ggml_vec_dot_iq2_s_q8_K) #5
  unreachable

12:                                               ; preds = %8
  %13 = icmp eq i32 %7, 1
  br i1 %13, label %15, label %14

14:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 10453, ptr noundef nonnull @__PRETTY_FUNCTION__.ggml_vec_dot_iq2_s_q8_K) #5
  unreachable

15:                                               ; preds = %12
  %16 = ashr exact i32 %0, 8
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %15
  %wide.trip.count = zext nneg i32 %16 to i64
  %18 = load <4 x i8>, ptr getelementptr inbounds (i8, ptr @kmask_iq2xs, i64 2), align 1
  %19 = load <8 x i8>, ptr @kmask_iq2xs, align 1
  %20 = load <2 x i8>, ptr @kmask_iq2xs, align 1
  %21 = load <2 x i8>, ptr getelementptr inbounds (i8, ptr @kmask_iq2xs, i64 6), align 1
  %22 = shufflevector <8 x i8> %19, <8 x i8> poison, <16 x i32> <i32 poison, i32 poison, i32 2, i32 3, i32 4, i32 5, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  %23 = shufflevector <4 x i8> %18, <4 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  %24 = shufflevector <2 x i8> %21, <2 x i8> poison, <16 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  %25 = shufflevector <2 x i8> %20, <2 x i8> poison, <16 x i32> <i32 0, i32 1, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  %26 = shufflevector <4 x i8> %18, <4 x i8> poison, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
  %27 = shufflevector <8 x i8> %19, <8 x i8> %26, <8 x i32> <i32 0, i32 1, i32 8, i32 9, i32 10, i32 11, i32 6, i32 7>
  %28 = shufflevector <16 x i8> %25, <16 x i8> %22, <16 x i32> <i32 0, i32 1, i32 18, i32 19, i32 20, i32 21, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  %29 = shufflevector <16 x i8> %28, <16 x i8> %24, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 16, i32 17, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison, i32 poison>
  %30 = shufflevector <16 x i8> %29, <16 x i8> %23, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 poison, i32 poison, i32 16, i32 17, i32 18, i32 19, i32 poison, i32 poison>
  %31 = shufflevector <16 x i8> %30, <16 x i8> poison, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 0, i32 1, i32 10, i32 11, i32 12, i32 13, i32 6, i32 7>
  br label %.lr.ph

._crit_edge.loopexit:                             ; preds = %43
  %32 = fmul float %46, 1.250000e-01
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %15
  %.078.lcssa = phi float [ 0.000000e+00, %15 ], [ %32, %._crit_edge.loopexit ]
  store float %.078.lcssa, ptr %1, align 4, !tbaa !5
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader, %43
  %indvars.iv123 = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next124, %43 ]
  %.078109 = phi float [ 0.000000e+00, %.lr.ph.preheader ], [ %46, %43 ]
  %33 = getelementptr inbounds %struct.block_iq2_s, ptr %3, i64 %indvars.iv123
  %34 = load i16, ptr %33, align 2, !tbaa !9
  %35 = tail call float @ggml_lookup_fp16_to_fp32(i16 noundef zeroext %34)
  %36 = getelementptr inbounds %struct.block_q8_K, ptr %5, i64 %indvars.iv123
  %37 = load float, ptr %36, align 4, !tbaa !12
  %38 = getelementptr inbounds i8, ptr %36, i64 4
  %39 = getelementptr inbounds i8, ptr %33, i64 2
  %40 = getelementptr inbounds i8, ptr %33, i64 66
  %41 = getelementptr inbounds i8, ptr %33, i64 34
  %42 = getelementptr inbounds i8, ptr %33, i64 74
  br label %.preheader

43:                                               ; preds = %.preheader
  %44 = fmul float %35, %37
  %45 = sitofp i32 %137 to float
  %46 = tail call float @llvm.fmuladd.f32(float %44, float %45, float %.078109)
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %exitcond126.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count
  br i1 %exitcond126.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !14

.preheader:                                       ; preds = %.lr.ph, %.preheader
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %.preheader ]
  %.086107 = phi ptr [ %38, %.lr.ph ], [ %scevgep119, %.preheader ]
  %.089105 = phi i32 [ 0, %.lr.ph ], [ %137, %.preheader ]
  %.090104 = phi ptr [ %41, %.lr.ph ], [ %139, %.preheader ]
  %.091103 = phi ptr [ %39, %.lr.ph ], [ %138, %.preheader ]
  %47 = getelementptr inbounds [8 x i8], ptr %42, i64 0, i64 %indvars.iv
  %48 = load i8, ptr %47, align 1, !tbaa !16
  %49 = zext i8 %48 to i32
  %50 = shl nuw nsw i32 %49, 1
  %51 = and i32 %50, 30
  %52 = lshr i32 %49, 3
  %53 = getelementptr inbounds i8, ptr %40, i64 %indvars.iv
  %54 = load i8, ptr %53, align 1, !tbaa !16
  %55 = zext i8 %54 to i32
  %56 = load i8, ptr %.091103, align 1, !tbaa !16
  %57 = zext i8 %56 to i32
  %58 = shl nuw nsw i32 %55, 8
  %59 = and i32 %58, 768
  %60 = or disjoint i32 %59, %57
  %61 = zext nneg i32 %60 to i64
  %62 = getelementptr inbounds i64, ptr @iq2s_grid, i64 %61
  %63 = load i8, ptr %.090104, align 1, !tbaa !16
  %64 = load <8 x i8>, ptr %.086107, align 1, !tbaa !16
  %65 = sext <8 x i8> %64 to <8 x i32>
  %66 = load <8 x i8>, ptr %62, align 8, !tbaa !16
  %67 = zext <8 x i8> %66 to <8 x i32>
  %68 = mul nsw <8 x i32> %67, %65
  %69 = insertelement <8 x i8> poison, i8 %63, i64 0
  %70 = shufflevector <8 x i8> %69, <8 x i8> poison, <8 x i32> zeroinitializer
  %71 = and <8 x i8> %27, %70
  %72 = icmp eq <8 x i8> %71, zeroinitializer
  %73 = sub nsw <8 x i32> zeroinitializer, %68
  %74 = select <8 x i1> %72, <8 x i32> %68, <8 x i32> %73
  %75 = getelementptr inbounds i8, ptr %.086107, i64 8
  %76 = getelementptr inbounds i8, ptr %.091103, i64 1
  %77 = load i8, ptr %76, align 1, !tbaa !16
  %78 = zext i8 %77 to i32
  %79 = shl nuw nsw i32 %55, 6
  %80 = and i32 %79, 768
  %81 = or disjoint i32 %80, %78
  %82 = zext nneg i32 %81 to i64
  %83 = getelementptr inbounds i64, ptr @iq2s_grid, i64 %82
  %84 = getelementptr inbounds i8, ptr %.090104, i64 1
  %85 = load i8, ptr %84, align 1, !tbaa !16
  %86 = load <8 x i8>, ptr %75, align 1, !tbaa !16
  %87 = sext <8 x i8> %86 to <8 x i32>
  %88 = load <8 x i8>, ptr %83, align 8, !tbaa !16
  %89 = zext <8 x i8> %88 to <8 x i32>
  %90 = mul nsw <8 x i32> %89, %87
  %91 = insertelement <8 x i8> poison, i8 %85, i64 0
  %92 = shufflevector <8 x i8> %91, <8 x i8> poison, <8 x i32> zeroinitializer
  %93 = and <8 x i8> %19, %92
  %94 = icmp eq <8 x i8> %93, zeroinitializer
  %95 = sub nsw <8 x i32> zeroinitializer, %90
  %96 = select <8 x i1> %94, <8 x i32> %90, <8 x i32> %95
  %97 = or disjoint i32 %51, 1
  %scevgep = getelementptr i8, ptr %.086107, i64 16
  %98 = load i8, ptr %53, align 1, !tbaa !16
  %99 = zext i8 %98 to i32
  %100 = getelementptr inbounds i8, ptr %.091103, i64 2
  %101 = load i8, ptr %100, align 1, !tbaa !16
  %102 = zext i8 %101 to i32
  %103 = shl nuw nsw i32 %99, 4
  %104 = and i32 %103, 768
  %105 = or disjoint i32 %104, %102
  %106 = zext nneg i32 %105 to i64
  %107 = getelementptr inbounds i64, ptr @iq2s_grid, i64 %106
  %108 = getelementptr inbounds i8, ptr %.090104, i64 2
  %109 = load <8 x i8>, ptr %107, align 8, !tbaa !16
  %110 = getelementptr inbounds i8, ptr %.091103, i64 3
  %111 = load i8, ptr %110, align 1, !tbaa !16
  %112 = zext i8 %111 to i32
  %113 = shl nuw nsw i32 %99, 2
  %114 = and i32 %113, 768
  %115 = or disjoint i32 %114, %112
  %116 = zext nneg i32 %115 to i64
  %117 = getelementptr inbounds i64, ptr @iq2s_grid, i64 %116
  %118 = load <8 x i8>, ptr %117, align 8, !tbaa !16
  %119 = load <2 x i8>, ptr %108, align 1, !tbaa !16
  %120 = shufflevector <2 x i8> %119, <2 x i8> poison, <16 x i32> <i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1>
  %121 = load <16 x i8>, ptr %scevgep, align 1, !tbaa !16
  %122 = sext <16 x i8> %121 to <16 x i32>
  %123 = shufflevector <8 x i8> %109, <8 x i8> %118, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
  %124 = zext <16 x i8> %123 to <16 x i32>
  %125 = mul nsw <16 x i32> %124, %122
  %126 = and <16 x i8> %31, %120
  %127 = icmp eq <16 x i8> %126, zeroinitializer
  %128 = sub nsw <16 x i32> zeroinitializer, %125
  %129 = select <16 x i1> %127, <16 x i32> %125, <16 x i32> %128
  %130 = tail call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %129)
  %131 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %74)
  %132 = tail call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %96)
  %op.rdx = add i32 %131, %132
  %133 = or i32 %52, 1
  %scevgep119 = getelementptr i8, ptr %.086107, i64 32
  %134 = mul nsw i32 %op.rdx, %97
  %135 = mul nsw i32 %130, %133
  %136 = add i32 %134, %.089105
  %137 = add i32 %136, %135
  %138 = getelementptr inbounds i8, ptr %.091103, i64 4
  %139 = getelementptr inbounds i8, ptr %.090104, i64 4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 8
  br i1 %exitcond.not, label %43, label %.preheader, !llvm.loop !17
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v16i32(<16 x i32>) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v8i32(<8 x i32>) #4

attributes #0 = { noreturn nounwind "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 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { noreturn 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/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !7, i64 2, !7, i64 66, !7, i64 74}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"", !6, i64 0, !7, i64 4, !7, i64 260}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !15}


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