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

; 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.ggml_hash_set = type { i64, ptr, ptr }
%struct.ggml_cgraph = type { i32, i32, i32, ptr, ptr, ptr, ptr, %struct.ggml_hash_set, i32 }
%struct.ggml_gallocr = type { ptr, ptr, ptr, i32, %struct.ggml_hash_set, ptr, ptr, i32, ptr, i32 }
%struct.node_alloc = type { %struct.tensor_alloc, [10 x %struct.tensor_alloc] }
%struct.tensor_alloc = type { i32, i64, i64 }
%struct.ggml_tensor = type { i32, ptr, [4 x i64], [4 x i64], i32, [16 x i32], i32, [10 x ptr], ptr, i64, ptr, [64 x i8], ptr, [8 x i8] }
%struct.hash_node = type { i32, i32, i32, i64, i8 }
%struct.leaf_alloc = type { %struct.tensor_alloc }

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [61 x i8], align 1
@__func__.ggml_gallocr_reserve_n = external hidden unnamed_addr constant [23 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [46 x i8], align 1

; 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 i64 @ggml_backend_buffer_get_size(ptr noundef) #1

declare void @ggml_log_internal(i32 noundef, ptr noundef, ...) #1

; Function Attrs: noreturn
declare void @ggml_abort(ptr noundef, i32 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

declare void @ggml_backend_buffer_free(ptr noundef) #1

declare void @ggml_hash_set_free(ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @ggml_gallocr_reserve_n(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #5 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca %struct.ggml_hash_set, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ggml_cgraph, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !9
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ggml_cgraph, ptr %31, i32 0, i32 2
  %33 = load i32, ptr %32, align 8, !tbaa !14
  %34 = add nsw i32 %30, %33
  %35 = sext i32 %34 to i64
  store i64 %35, ptr %10, align 8, !tbaa !15
  %36 = load i64, ptr %10, align 8, !tbaa !15
  %37 = udiv i64 %36, 4
  %38 = load i64, ptr %10, align 8, !tbaa !15
  %39 = add i64 %38, %37
  store i64 %39, ptr %10, align 8, !tbaa !15
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.ggml_gallocr, ptr %40, i32 0, i32 4
  %42 = getelementptr inbounds %struct.ggml_hash_set, ptr %41, i32 0, i32 0
  %43 = load i64, ptr %42, align 8, !tbaa !16
  %44 = load i64, ptr %10, align 8, !tbaa !15
  %45 = icmp ult i64 %43, %44
  br i1 %45, label %46, label %76

46:                                               ; preds = %4
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ggml_gallocr, ptr %47, i32 0, i32 4
  call void @ggml_hash_set_free(ptr noundef %48)
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ggml_gallocr, ptr %49, i32 0, i32 4
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #8
  %51 = load i64, ptr %10, align 8, !tbaa !15
  call void @ggml_hash_set_new(ptr dead_on_unwind writable sret(%struct.ggml_hash_set) align 8 %11, i64 noundef %51)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %50, ptr align 8 %11, i64 24, i1 false), !tbaa.struct !18
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #8
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ggml_gallocr, ptr %52, i32 0, i32 4
  %54 = getelementptr inbounds %struct.ggml_hash_set, ptr %53, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !19
  %56 = icmp ne ptr %55, null
  br i1 %56, label %58, label %57

57:                                               ; preds = %46
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.1, i32 noundef 682, ptr noundef @.str.5, ptr noundef @.str.10) #9
  unreachable

58:                                               ; preds = %46
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ggml_gallocr, ptr %59, i32 0, i32 5
  %61 = load ptr, ptr %60, align 8, !tbaa !20
  call void @free(ptr noundef %61) #8
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ggml_gallocr, ptr %62, i32 0, i32 4
  %64 = getelementptr inbounds %struct.ggml_hash_set, ptr %63, i32 0, i32 0
  %65 = load i64, ptr %64, align 8, !tbaa !16
  %66 = mul i64 32, %65
  %67 = call noalias ptr @malloc(i64 noundef %66) #10
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.ggml_gallocr, ptr %68, i32 0, i32 5
  store ptr %67, ptr %69, align 8, !tbaa !20
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.ggml_gallocr, ptr %70, i32 0, i32 5
  %72 = load ptr, ptr %71, align 8, !tbaa !20
  %73 = icmp ne ptr %72, null
  br i1 %73, label %75, label %74

74:                                               ; preds = %58
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.1, i32 noundef 686, ptr noundef @.str.5, ptr noundef @.str.11) #9
  unreachable

75:                                               ; preds = %58
  br label %76

76:                                               ; preds = %75, %4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !21
  br label %77

77:                                               ; preds = %92, %76
  %78 = load i32, ptr %12, align 4, !tbaa !21
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ggml_gallocr, ptr %79, i32 0, i32 3
  %81 = load i32, ptr %80, align 8, !tbaa !22
  %82 = icmp slt i32 %78, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %95

84:                                               ; preds = %77
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.ggml_gallocr, ptr %85, i32 0, i32 2
  %87 = load ptr, ptr %86, align 8, !tbaa !23
  %88 = load i32, ptr %12, align 4, !tbaa !21
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds ptr, ptr %87, i64 %89
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  call void @ggml_dyn_tallocr_reset(ptr noundef %91)
  br label %92

92:                                               ; preds = %84
  %93 = load i32, ptr %12, align 4, !tbaa !21
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %12, align 4, !tbaa !21
  br label %77, !llvm.loop !24

95:                                               ; preds = %83
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  call void @ggml_gallocr_alloc_graph_impl(ptr noundef %96, ptr noundef %97, ptr noundef %98, ptr noundef %99)
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.ggml_gallocr, ptr %100, i32 0, i32 7
  %102 = load i32, ptr %101, align 8, !tbaa !26
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ggml_cgraph, ptr %103, i32 0, i32 1
  %105 = load i32, ptr %104, align 4, !tbaa !9
  %106 = icmp slt i32 %102, %105
  br i1 %106, label %107, label %124

107:                                              ; preds = %95
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.ggml_gallocr, ptr %108, i32 0, i32 6
  %110 = load ptr, ptr %109, align 8, !tbaa !27
  call void @free(ptr noundef %110) #8
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.ggml_cgraph, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = sext i32 %113 to i64
  %115 = call noalias ptr @calloc(i64 noundef %114, i64 noundef 264) #11
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.ggml_gallocr, ptr %116, i32 0, i32 6
  store ptr %115, ptr %117, align 8, !tbaa !27
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.ggml_gallocr, ptr %118, i32 0, i32 6
  %120 = load ptr, ptr %119, align 8, !tbaa !27
  %121 = icmp ne ptr %120, null
  br i1 %121, label %123, label %122

122:                                              ; preds = %107
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.1, i32 noundef 701, ptr noundef @.str.5, ptr noundef @.str.12) #9
  unreachable

123:                                              ; preds = %107
  br label %124

124:                                              ; preds = %123, %95
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.ggml_cgraph, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %128 = load ptr, ptr %6, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.ggml_gallocr, ptr %128, i32 0, i32 7
  store i32 %127, ptr %129, align 8, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !21
  br label %130

130:                                              ; preds = %287, %124
  %131 = load i32, ptr %13, align 4, !tbaa !21
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.ggml_cgraph, ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 4, !tbaa !9
  %135 = icmp slt i32 %131, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %130
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %290

137:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.ggml_cgraph, ptr %138, i32 0, i32 3
  %140 = load ptr, ptr %139, align 8, !tbaa !28
  %141 = load i32, ptr %13, align 4, !tbaa !21
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds ptr, ptr %140, i64 %142
  %144 = load ptr, ptr %143, align 8, !tbaa !5
  store ptr %144, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.ggml_gallocr, ptr %145, i32 0, i32 6
  %147 = load ptr, ptr %146, align 8, !tbaa !27
  %148 = load i32, ptr %13, align 4, !tbaa !21
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds %struct.node_alloc, ptr %147, i64 %149
  store ptr %150, ptr %16, align 8, !tbaa !5
  %151 = load ptr, ptr %15, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.ggml_tensor, ptr %151, i32 0, i32 8
  %153 = load ptr, ptr %152, align 8, !tbaa !29
  %154 = icmp ne ptr %153, null
  br i1 %154, label %160, label %155

155:                                              ; preds = %137
  %156 = load ptr, ptr %15, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.ggml_tensor, ptr %156, i32 0, i32 10
  %158 = load ptr, ptr %157, align 8, !tbaa !31
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %170

160:                                              ; preds = %155, %137
  %161 = load ptr, ptr %16, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.node_alloc, ptr %161, i32 0, i32 0
  %163 = getelementptr inbounds %struct.tensor_alloc, ptr %162, i32 0, i32 0
  store i32 -1, ptr %163, align 8, !tbaa !32
  %164 = load ptr, ptr %16, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.node_alloc, ptr %164, i32 0, i32 0
  %166 = getelementptr inbounds %struct.tensor_alloc, ptr %165, i32 0, i32 1
  store i64 -1, ptr %166, align 8, !tbaa !35
  %167 = load ptr, ptr %16, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.node_alloc, ptr %167, i32 0, i32 0
  %169 = getelementptr inbounds %struct.tensor_alloc, ptr %168, i32 0, i32 2
  store i64 0, ptr %169, align 8, !tbaa !36
  br label %200

170:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = load ptr, ptr %15, align 8, !tbaa !5
  %173 = call ptr @ggml_gallocr_hash_get(ptr noundef %171, ptr noundef %172)
  store ptr %173, ptr %17, align 8, !tbaa !5
  %174 = load ptr, ptr %17, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.hash_node, ptr %174, i32 0, i32 2
  %176 = load i32, ptr %175, align 8, !tbaa !37
  %177 = load ptr, ptr %16, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.node_alloc, ptr %177, i32 0, i32 0
  %179 = getelementptr inbounds %struct.tensor_alloc, ptr %178, i32 0, i32 0
  store i32 %176, ptr %179, align 8, !tbaa !32
  %180 = load ptr, ptr %17, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.hash_node, ptr %180, i32 0, i32 3
  %182 = load i64, ptr %181, align 8, !tbaa !40
  %183 = load ptr, ptr %16, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.node_alloc, ptr %183, i32 0, i32 0
  %185 = getelementptr inbounds %struct.tensor_alloc, ptr %184, i32 0, i32 1
  store i64 %182, ptr %185, align 8, !tbaa !35
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.ggml_gallocr, ptr %186, i32 0, i32 0
  %188 = load ptr, ptr %187, align 8, !tbaa !41
  %189 = load ptr, ptr %17, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.hash_node, ptr %189, i32 0, i32 2
  %191 = load i32, ptr %190, align 8, !tbaa !37
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds ptr, ptr %188, i64 %192
  %194 = load ptr, ptr %193, align 8, !tbaa !5
  %195 = load ptr, ptr %15, align 8, !tbaa !5
  %196 = call i64 @ggml_backend_buft_get_alloc_size(ptr noundef %194, ptr noundef %195)
  %197 = load ptr, ptr %16, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.node_alloc, ptr %197, i32 0, i32 0
  %199 = getelementptr inbounds %struct.tensor_alloc, ptr %198, i32 0, i32 2
  store i64 %196, ptr %199, align 8, !tbaa !36
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %200

200:                                              ; preds = %170, %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !21
  br label %201

201:                                              ; preds = %283, %200
  %202 = load i32, ptr %18, align 4, !tbaa !21
  %203 = icmp slt i32 %202, 10
  br i1 %203, label %205, label %204

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

205:                                              ; preds = %201
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %206 = load ptr, ptr %15, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.ggml_tensor, ptr %206, i32 0, i32 7
  %208 = load i32, ptr %18, align 4, !tbaa !21
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds [10 x ptr], ptr %207, i64 0, i64 %209
  %211 = load ptr, ptr %210, align 8, !tbaa !5
  store ptr %211, ptr %19, align 8, !tbaa !5
  %212 = load ptr, ptr %19, align 8, !tbaa !5
  %213 = icmp ne ptr %212, null
  br i1 %213, label %214, label %224

214:                                              ; preds = %205
  %215 = load ptr, ptr %19, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.ggml_tensor, ptr %215, i32 0, i32 8
  %217 = load ptr, ptr %216, align 8, !tbaa !29
  %218 = icmp ne ptr %217, null
  br i1 %218, label %224, label %219

219:                                              ; preds = %214
  %220 = load ptr, ptr %19, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.ggml_tensor, ptr %220, i32 0, i32 10
  %222 = load ptr, ptr %221, align 8, !tbaa !31
  %223 = icmp ne ptr %222, null
  br i1 %223, label %224, label %243

224:                                              ; preds = %219, %214, %205
  %225 = load ptr, ptr %16, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.node_alloc, ptr %225, i32 0, i32 1
  %227 = load i32, ptr %18, align 4, !tbaa !21
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %226, i64 0, i64 %228
  %230 = getelementptr inbounds %struct.tensor_alloc, ptr %229, i32 0, i32 0
  store i32 -1, ptr %230, align 8, !tbaa !42
  %231 = load ptr, ptr %16, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.node_alloc, ptr %231, i32 0, i32 1
  %233 = load i32, ptr %18, align 4, !tbaa !21
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %232, i64 0, i64 %234
  %236 = getelementptr inbounds %struct.tensor_alloc, ptr %235, i32 0, i32 1
  store i64 -1, ptr %236, align 8, !tbaa !43
  %237 = load ptr, ptr %16, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.node_alloc, ptr %237, i32 0, i32 1
  %239 = load i32, ptr %18, align 4, !tbaa !21
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %238, i64 0, i64 %240
  %242 = getelementptr inbounds %struct.tensor_alloc, ptr %241, i32 0, i32 2
  store i64 0, ptr %242, align 8, !tbaa !44
  br label %282

243:                                              ; preds = %219
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %244 = load ptr, ptr %6, align 8, !tbaa !5
  %245 = load ptr, ptr %19, align 8, !tbaa !5
  %246 = call ptr @ggml_gallocr_hash_get(ptr noundef %244, ptr noundef %245)
  store ptr %246, ptr %20, align 8, !tbaa !5
  %247 = load ptr, ptr %20, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.hash_node, ptr %247, i32 0, i32 2
  %249 = load i32, ptr %248, align 8, !tbaa !37
  %250 = load ptr, ptr %16, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.node_alloc, ptr %250, i32 0, i32 1
  %252 = load i32, ptr %18, align 4, !tbaa !21
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %251, i64 0, i64 %253
  %255 = getelementptr inbounds %struct.tensor_alloc, ptr %254, i32 0, i32 0
  store i32 %249, ptr %255, align 8, !tbaa !42
  %256 = load ptr, ptr %20, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.hash_node, ptr %256, i32 0, i32 3
  %258 = load i64, ptr %257, align 8, !tbaa !40
  %259 = load ptr, ptr %16, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.node_alloc, ptr %259, i32 0, i32 1
  %261 = load i32, ptr %18, align 4, !tbaa !21
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %260, i64 0, i64 %262
  %264 = getelementptr inbounds %struct.tensor_alloc, ptr %263, i32 0, i32 1
  store i64 %258, ptr %264, align 8, !tbaa !43
  %265 = load ptr, ptr %6, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct.ggml_gallocr, ptr %265, i32 0, i32 0
  %267 = load ptr, ptr %266, align 8, !tbaa !41
  %268 = load ptr, ptr %20, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.hash_node, ptr %268, i32 0, i32 2
  %270 = load i32, ptr %269, align 8, !tbaa !37
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds ptr, ptr %267, i64 %271
  %273 = load ptr, ptr %272, align 8, !tbaa !5
  %274 = load ptr, ptr %19, align 8, !tbaa !5
  %275 = call i64 @ggml_backend_buft_get_alloc_size(ptr noundef %273, ptr noundef %274)
  %276 = load ptr, ptr %16, align 8, !tbaa !5
  %277 = getelementptr inbounds %struct.node_alloc, ptr %276, i32 0, i32 1
  %278 = load i32, ptr %18, align 4, !tbaa !21
  %279 = sext i32 %278 to i64
  %280 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %277, i64 0, i64 %279
  %281 = getelementptr inbounds %struct.tensor_alloc, ptr %280, i32 0, i32 2
  store i64 %275, ptr %281, align 8, !tbaa !44
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %282

282:                                              ; preds = %243, %224
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %283

283:                                              ; preds = %282
  %284 = load i32, ptr %18, align 4, !tbaa !21
  %285 = add nsw i32 %284, 1
  store i32 %285, ptr %18, align 4, !tbaa !21
  br label %201, !llvm.loop !45

286:                                              ; preds = %204
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %287

287:                                              ; preds = %286
  %288 = load i32, ptr %13, align 4, !tbaa !21
  %289 = add nsw i32 %288, 1
  store i32 %289, ptr %13, align 4, !tbaa !21
  br label %130, !llvm.loop !46

290:                                              ; preds = %136
  %291 = load ptr, ptr %6, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct.ggml_gallocr, ptr %291, i32 0, i32 9
  %293 = load i32, ptr %292, align 8, !tbaa !47
  %294 = load ptr, ptr %7, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.ggml_cgraph, ptr %294, i32 0, i32 2
  %296 = load i32, ptr %295, align 8, !tbaa !14
  %297 = icmp slt i32 %293, %296
  br i1 %297, label %298, label %315

298:                                              ; preds = %290
  %299 = load ptr, ptr %6, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.ggml_gallocr, ptr %299, i32 0, i32 8
  %301 = load ptr, ptr %300, align 8, !tbaa !48
  call void @free(ptr noundef %301) #8
  %302 = load ptr, ptr %7, align 8, !tbaa !5
  %303 = getelementptr inbounds %struct.ggml_cgraph, ptr %302, i32 0, i32 2
  %304 = load i32, ptr %303, align 8, !tbaa !14
  %305 = sext i32 %304 to i64
  %306 = call noalias ptr @calloc(i64 noundef %305, i64 noundef 24) #11
  %307 = load ptr, ptr %6, align 8, !tbaa !5
  %308 = getelementptr inbounds %struct.ggml_gallocr, ptr %307, i32 0, i32 8
  store ptr %306, ptr %308, align 8, !tbaa !48
  %309 = load ptr, ptr %6, align 8, !tbaa !5
  %310 = getelementptr inbounds %struct.ggml_gallocr, ptr %309, i32 0, i32 8
  %311 = load ptr, ptr %310, align 8, !tbaa !48
  %312 = icmp ne ptr %311, null
  br i1 %312, label %314, label %313

313:                                              ; preds = %298
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.1, i32 noundef 734, ptr noundef @.str.5, ptr noundef @.str.13) #9
  unreachable

314:                                              ; preds = %298
  br label %315

315:                                              ; preds = %314, %290
  %316 = load ptr, ptr %7, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct.ggml_cgraph, ptr %316, i32 0, i32 2
  %318 = load i32, ptr %317, align 8, !tbaa !14
  %319 = load ptr, ptr %6, align 8, !tbaa !5
  %320 = getelementptr inbounds %struct.ggml_gallocr, ptr %319, i32 0, i32 9
  store i32 %318, ptr %320, align 8, !tbaa !47
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 0, ptr %21, align 4, !tbaa !21
  br label %321

321:                                              ; preds = %416, %315
  %322 = load i32, ptr %21, align 4, !tbaa !21
  %323 = load ptr, ptr %7, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.ggml_cgraph, ptr %323, i32 0, i32 2
  %325 = load i32, ptr %324, align 8, !tbaa !14
  %326 = icmp slt i32 %322, %325
  br i1 %326, label %328, label %327

327:                                              ; preds = %321
  store i32 11, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %419

328:                                              ; preds = %321
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %329 = load ptr, ptr %7, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct.ggml_cgraph, ptr %329, i32 0, i32 6
  %331 = load ptr, ptr %330, align 8, !tbaa !49
  %332 = load i32, ptr %21, align 4, !tbaa !21
  %333 = sext i32 %332 to i64
  %334 = getelementptr inbounds ptr, ptr %331, i64 %333
  %335 = load ptr, ptr %334, align 8, !tbaa !5
  store ptr %335, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %336 = load ptr, ptr %6, align 8, !tbaa !5
  %337 = load ptr, ptr %22, align 8, !tbaa !5
  %338 = call ptr @ggml_gallocr_hash_get(ptr noundef %336, ptr noundef %337)
  store ptr %338, ptr %23, align 8, !tbaa !5
  %339 = load ptr, ptr %22, align 8, !tbaa !5
  %340 = getelementptr inbounds %struct.ggml_tensor, ptr %339, i32 0, i32 8
  %341 = load ptr, ptr %340, align 8, !tbaa !29
  %342 = icmp ne ptr %341, null
  br i1 %342, label %348, label %343

343:                                              ; preds = %328
  %344 = load ptr, ptr %22, align 8, !tbaa !5
  %345 = getelementptr inbounds %struct.ggml_tensor, ptr %344, i32 0, i32 10
  %346 = load ptr, ptr %345, align 8, !tbaa !31
  %347 = icmp ne ptr %346, null
  br i1 %347, label %348, label %373

348:                                              ; preds = %343, %328
  %349 = load ptr, ptr %6, align 8, !tbaa !5
  %350 = getelementptr inbounds %struct.ggml_gallocr, ptr %349, i32 0, i32 8
  %351 = load ptr, ptr %350, align 8, !tbaa !48
  %352 = load i32, ptr %21, align 4, !tbaa !21
  %353 = sext i32 %352 to i64
  %354 = getelementptr inbounds %struct.leaf_alloc, ptr %351, i64 %353
  %355 = getelementptr inbounds %struct.leaf_alloc, ptr %354, i32 0, i32 0
  %356 = getelementptr inbounds %struct.tensor_alloc, ptr %355, i32 0, i32 0
  store i32 -1, ptr %356, align 8, !tbaa !50
  %357 = load ptr, ptr %6, align 8, !tbaa !5
  %358 = getelementptr inbounds %struct.ggml_gallocr, ptr %357, i32 0, i32 8
  %359 = load ptr, ptr %358, align 8, !tbaa !48
  %360 = load i32, ptr %21, align 4, !tbaa !21
  %361 = sext i32 %360 to i64
  %362 = getelementptr inbounds %struct.leaf_alloc, ptr %359, i64 %361
  %363 = getelementptr inbounds %struct.leaf_alloc, ptr %362, i32 0, i32 0
  %364 = getelementptr inbounds %struct.tensor_alloc, ptr %363, i32 0, i32 1
  store i64 -1, ptr %364, align 8, !tbaa !52
  %365 = load ptr, ptr %6, align 8, !tbaa !5
  %366 = getelementptr inbounds %struct.ggml_gallocr, ptr %365, i32 0, i32 8
  %367 = load ptr, ptr %366, align 8, !tbaa !48
  %368 = load i32, ptr %21, align 4, !tbaa !21
  %369 = sext i32 %368 to i64
  %370 = getelementptr inbounds %struct.leaf_alloc, ptr %367, i64 %369
  %371 = getelementptr inbounds %struct.leaf_alloc, ptr %370, i32 0, i32 0
  %372 = getelementptr inbounds %struct.tensor_alloc, ptr %371, i32 0, i32 2
  store i64 0, ptr %372, align 8, !tbaa !53
  br label %415

373:                                              ; preds = %343
  %374 = load ptr, ptr %23, align 8, !tbaa !5
  %375 = getelementptr inbounds %struct.hash_node, ptr %374, i32 0, i32 2
  %376 = load i32, ptr %375, align 8, !tbaa !37
  %377 = load ptr, ptr %6, align 8, !tbaa !5
  %378 = getelementptr inbounds %struct.ggml_gallocr, ptr %377, i32 0, i32 8
  %379 = load ptr, ptr %378, align 8, !tbaa !48
  %380 = load i32, ptr %21, align 4, !tbaa !21
  %381 = sext i32 %380 to i64
  %382 = getelementptr inbounds %struct.leaf_alloc, ptr %379, i64 %381
  %383 = getelementptr inbounds %struct.leaf_alloc, ptr %382, i32 0, i32 0
  %384 = getelementptr inbounds %struct.tensor_alloc, ptr %383, i32 0, i32 0
  store i32 %376, ptr %384, align 8, !tbaa !50
  %385 = load ptr, ptr %23, align 8, !tbaa !5
  %386 = getelementptr inbounds %struct.hash_node, ptr %385, i32 0, i32 3
  %387 = load i64, ptr %386, align 8, !tbaa !40
  %388 = load ptr, ptr %6, align 8, !tbaa !5
  %389 = getelementptr inbounds %struct.ggml_gallocr, ptr %388, i32 0, i32 8
  %390 = load ptr, ptr %389, align 8, !tbaa !48
  %391 = load i32, ptr %21, align 4, !tbaa !21
  %392 = sext i32 %391 to i64
  %393 = getelementptr inbounds %struct.leaf_alloc, ptr %390, i64 %392
  %394 = getelementptr inbounds %struct.leaf_alloc, ptr %393, i32 0, i32 0
  %395 = getelementptr inbounds %struct.tensor_alloc, ptr %394, i32 0, i32 1
  store i64 %387, ptr %395, align 8, !tbaa !52
  %396 = load ptr, ptr %6, align 8, !tbaa !5
  %397 = getelementptr inbounds %struct.ggml_gallocr, ptr %396, i32 0, i32 0
  %398 = load ptr, ptr %397, align 8, !tbaa !41
  %399 = load ptr, ptr %23, align 8, !tbaa !5
  %400 = getelementptr inbounds %struct.hash_node, ptr %399, i32 0, i32 2
  %401 = load i32, ptr %400, align 8, !tbaa !37
  %402 = sext i32 %401 to i64
  %403 = getelementptr inbounds ptr, ptr %398, i64 %402
  %404 = load ptr, ptr %403, align 8, !tbaa !5
  %405 = load ptr, ptr %22, align 8, !tbaa !5
  %406 = call i64 @ggml_backend_buft_get_alloc_size(ptr noundef %404, ptr noundef %405)
  %407 = load ptr, ptr %6, align 8, !tbaa !5
  %408 = getelementptr inbounds %struct.ggml_gallocr, ptr %407, i32 0, i32 8
  %409 = load ptr, ptr %408, align 8, !tbaa !48
  %410 = load i32, ptr %21, align 4, !tbaa !21
  %411 = sext i32 %410 to i64
  %412 = getelementptr inbounds %struct.leaf_alloc, ptr %409, i64 %411
  %413 = getelementptr inbounds %struct.leaf_alloc, ptr %412, i32 0, i32 0
  %414 = getelementptr inbounds %struct.tensor_alloc, ptr %413, i32 0, i32 2
  store i64 %406, ptr %414, align 8, !tbaa !53
  br label %415

415:                                              ; preds = %373, %348
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  br label %416

416:                                              ; preds = %415
  %417 = load i32, ptr %21, align 4, !tbaa !21
  %418 = add nsw i32 %417, 1
  store i32 %418, ptr %21, align 4, !tbaa !21
  br label %321, !llvm.loop !54

419:                                              ; preds = %327
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  store i32 0, ptr %24, align 4, !tbaa !21
  br label %420

420:                                              ; preds = %578, %419
  %421 = load i32, ptr %24, align 4, !tbaa !21
  %422 = load ptr, ptr %6, align 8, !tbaa !5
  %423 = getelementptr inbounds %struct.ggml_gallocr, ptr %422, i32 0, i32 3
  %424 = load i32, ptr %423, align 8, !tbaa !22
  %425 = icmp slt i32 %421, %424
  br i1 %425, label %427, label %426

426:                                              ; preds = %420
  store i32 14, ptr %14, align 4
  br label %581

427:                                              ; preds = %420
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  store i32 0, ptr %25, align 4, !tbaa !21
  br label %428

428:                                              ; preds = %464, %427
  %429 = load i32, ptr %25, align 4, !tbaa !21
  %430 = load i32, ptr %24, align 4, !tbaa !21
  %431 = icmp slt i32 %429, %430
  br i1 %431, label %433, label %432

432:                                              ; preds = %428
  store i32 17, ptr %14, align 4
  br label %467

433:                                              ; preds = %428
  %434 = load ptr, ptr %6, align 8, !tbaa !5
  %435 = getelementptr inbounds %struct.ggml_gallocr, ptr %434, i32 0, i32 2
  %436 = load ptr, ptr %435, align 8, !tbaa !23
  %437 = load i32, ptr %25, align 4, !tbaa !21
  %438 = sext i32 %437 to i64
  %439 = getelementptr inbounds ptr, ptr %436, i64 %438
  %440 = load ptr, ptr %439, align 8, !tbaa !5
  %441 = load ptr, ptr %6, align 8, !tbaa !5
  %442 = getelementptr inbounds %struct.ggml_gallocr, ptr %441, i32 0, i32 2
  %443 = load ptr, ptr %442, align 8, !tbaa !23
  %444 = load i32, ptr %24, align 4, !tbaa !21
  %445 = sext i32 %444 to i64
  %446 = getelementptr inbounds ptr, ptr %443, i64 %445
  %447 = load ptr, ptr %446, align 8, !tbaa !5
  %448 = icmp eq ptr %440, %447
  br i1 %448, label %449, label %463

449:                                              ; preds = %433
  %450 = load ptr, ptr %6, align 8, !tbaa !5
  %451 = getelementptr inbounds %struct.ggml_gallocr, ptr %450, i32 0, i32 1
  %452 = load ptr, ptr %451, align 8, !tbaa !55
  %453 = load i32, ptr %25, align 4, !tbaa !21
  %454 = sext i32 %453 to i64
  %455 = getelementptr inbounds ptr, ptr %452, i64 %454
  %456 = load ptr, ptr %455, align 8, !tbaa !5
  %457 = load ptr, ptr %6, align 8, !tbaa !5
  %458 = getelementptr inbounds %struct.ggml_gallocr, ptr %457, i32 0, i32 1
  %459 = load ptr, ptr %458, align 8, !tbaa !55
  %460 = load i32, ptr %24, align 4, !tbaa !21
  %461 = sext i32 %460 to i64
  %462 = getelementptr inbounds ptr, ptr %459, i64 %461
  store ptr %456, ptr %462, align 8, !tbaa !5
  store i32 17, ptr %14, align 4
  br label %467

463:                                              ; preds = %433
  br label %464

464:                                              ; preds = %463
  %465 = load i32, ptr %25, align 4, !tbaa !21
  %466 = add nsw i32 %465, 1
  store i32 %466, ptr %25, align 4, !tbaa !21
  br label %428, !llvm.loop !56

467:                                              ; preds = %449, %432
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %468

468:                                              ; preds = %467
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #8
  %469 = load ptr, ptr %6, align 8, !tbaa !5
  %470 = getelementptr inbounds %struct.ggml_gallocr, ptr %469, i32 0, i32 1
  %471 = load ptr, ptr %470, align 8, !tbaa !55
  %472 = load i32, ptr %24, align 4, !tbaa !21
  %473 = sext i32 %472 to i64
  %474 = getelementptr inbounds ptr, ptr %471, i64 %473
  %475 = load ptr, ptr %474, align 8, !tbaa !5
  %476 = icmp ne ptr %475, null
  br i1 %476, label %477, label %486

477:                                              ; preds = %468
  %478 = load ptr, ptr %6, align 8, !tbaa !5
  %479 = getelementptr inbounds %struct.ggml_gallocr, ptr %478, i32 0, i32 1
  %480 = load ptr, ptr %479, align 8, !tbaa !55
  %481 = load i32, ptr %24, align 4, !tbaa !21
  %482 = sext i32 %481 to i64
  %483 = getelementptr inbounds ptr, ptr %480, i64 %482
  %484 = load ptr, ptr %483, align 8, !tbaa !5
  %485 = call i64 @ggml_backend_buffer_get_size(ptr noundef %484)
  br label %487

486:                                              ; preds = %468
  br label %487

487:                                              ; preds = %486, %477
  %488 = phi i64 [ %485, %477 ], [ 0, %486 ]
  store i64 %488, ptr %26, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #8
  %489 = load ptr, ptr %6, align 8, !tbaa !5
  %490 = getelementptr inbounds %struct.ggml_gallocr, ptr %489, i32 0, i32 2
  %491 = load ptr, ptr %490, align 8, !tbaa !23
  %492 = load i32, ptr %24, align 4, !tbaa !21
  %493 = sext i32 %492 to i64
  %494 = getelementptr inbounds ptr, ptr %491, i64 %493
  %495 = load ptr, ptr %494, align 8, !tbaa !5
  %496 = call i64 @ggml_dyn_tallocr_max_size(ptr noundef %495)
  store i64 %496, ptr %27, align 8, !tbaa !15
  %497 = load i64, ptr %27, align 8, !tbaa !15
  %498 = load i64, ptr %26, align 8, !tbaa !15
  %499 = icmp ugt i64 %497, %498
  br i1 %499, label %509, label %500

500:                                              ; preds = %487
  %501 = load ptr, ptr %6, align 8, !tbaa !5
  %502 = getelementptr inbounds %struct.ggml_gallocr, ptr %501, i32 0, i32 1
  %503 = load ptr, ptr %502, align 8, !tbaa !55
  %504 = load i32, ptr %24, align 4, !tbaa !21
  %505 = sext i32 %504 to i64
  %506 = getelementptr inbounds ptr, ptr %503, i64 %505
  %507 = load ptr, ptr %506, align 8, !tbaa !5
  %508 = icmp eq ptr %507, null
  br i1 %508, label %509, label %574

509:                                              ; preds = %500, %487
  %510 = load ptr, ptr %6, align 8, !tbaa !5
  %511 = getelementptr inbounds %struct.ggml_gallocr, ptr %510, i32 0, i32 0
  %512 = load ptr, ptr %511, align 8, !tbaa !41
  %513 = load i32, ptr %24, align 4, !tbaa !21
  %514 = sext i32 %513 to i64
  %515 = getelementptr inbounds ptr, ptr %512, i64 %514
  %516 = load ptr, ptr %515, align 8, !tbaa !5
  %517 = call ptr @ggml_backend_buft_name(ptr noundef %516)
  %518 = load i64, ptr %26, align 8, !tbaa !15
  %519 = uitofp i64 %518 to double
  %520 = fdiv double %519, 1.024000e+03
  %521 = fdiv double %520, 1.024000e+03
  %522 = load i64, ptr %27, align 8, !tbaa !15
  %523 = uitofp i64 %522 to double
  %524 = fdiv double %523, 1.024000e+03
  %525 = fdiv double %524, 1.024000e+03
  call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 1, ptr noundef @.str.14, ptr noundef @__func__.ggml_gallocr_reserve_n, ptr noundef %517, double noundef %521, double noundef %525)
  %526 = load ptr, ptr %6, align 8, !tbaa !5
  %527 = getelementptr inbounds %struct.ggml_gallocr, ptr %526, i32 0, i32 1
  %528 = load ptr, ptr %527, align 8, !tbaa !55
  %529 = load i32, ptr %24, align 4, !tbaa !21
  %530 = sext i32 %529 to i64
  %531 = getelementptr inbounds ptr, ptr %528, i64 %530
  %532 = load ptr, ptr %531, align 8, !tbaa !5
  call void @ggml_backend_buffer_free(ptr noundef %532)
  %533 = load ptr, ptr %6, align 8, !tbaa !5
  %534 = getelementptr inbounds %struct.ggml_gallocr, ptr %533, i32 0, i32 0
  %535 = load ptr, ptr %534, align 8, !tbaa !41
  %536 = load i32, ptr %24, align 4, !tbaa !21
  %537 = sext i32 %536 to i64
  %538 = getelementptr inbounds ptr, ptr %535, i64 %537
  %539 = load ptr, ptr %538, align 8, !tbaa !5
  %540 = load i64, ptr %27, align 8, !tbaa !15
  %541 = call ptr @ggml_backend_buft_alloc_buffer(ptr noundef %539, i64 noundef %540)
  %542 = load ptr, ptr %6, align 8, !tbaa !5
  %543 = getelementptr inbounds %struct.ggml_gallocr, ptr %542, i32 0, i32 1
  %544 = load ptr, ptr %543, align 8, !tbaa !55
  %545 = load i32, ptr %24, align 4, !tbaa !21
  %546 = sext i32 %545 to i64
  %547 = getelementptr inbounds ptr, ptr %544, i64 %546
  store ptr %541, ptr %547, align 8, !tbaa !5
  %548 = load ptr, ptr %6, align 8, !tbaa !5
  %549 = getelementptr inbounds %struct.ggml_gallocr, ptr %548, i32 0, i32 1
  %550 = load ptr, ptr %549, align 8, !tbaa !55
  %551 = load i32, ptr %24, align 4, !tbaa !21
  %552 = sext i32 %551 to i64
  %553 = getelementptr inbounds ptr, ptr %550, i64 %552
  %554 = load ptr, ptr %553, align 8, !tbaa !5
  %555 = icmp eq ptr %554, null
  br i1 %555, label %556, label %566

556:                                              ; preds = %509
  %557 = load ptr, ptr %6, align 8, !tbaa !5
  %558 = getelementptr inbounds %struct.ggml_gallocr, ptr %557, i32 0, i32 0
  %559 = load ptr, ptr %558, align 8, !tbaa !41
  %560 = load i32, ptr %24, align 4, !tbaa !21
  %561 = sext i32 %560 to i64
  %562 = getelementptr inbounds ptr, ptr %559, i64 %561
  %563 = load ptr, ptr %562, align 8, !tbaa !5
  %564 = call ptr @ggml_backend_buft_name(ptr noundef %563)
  %565 = load i64, ptr %27, align 8, !tbaa !15
  call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef @.str.15, ptr noundef @__func__.ggml_gallocr_reserve_n, ptr noundef %564, i64 noundef %565)
  store i1 false, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %575

566:                                              ; preds = %509
  %567 = load ptr, ptr %6, align 8, !tbaa !5
  %568 = getelementptr inbounds %struct.ggml_gallocr, ptr %567, i32 0, i32 1
  %569 = load ptr, ptr %568, align 8, !tbaa !55
  %570 = load i32, ptr %24, align 4, !tbaa !21
  %571 = sext i32 %570 to i64
  %572 = getelementptr inbounds ptr, ptr %569, i64 %571
  %573 = load ptr, ptr %572, align 8, !tbaa !5
  call void @ggml_backend_buffer_set_usage(ptr noundef %573, i32 noundef 2)
  br label %574

574:                                              ; preds = %566, %500
  store i32 0, ptr %14, align 4
  br label %575

575:                                              ; preds = %574, %556
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #8
  %576 = load i32, ptr %14, align 4
  switch i32 %576, label %581 [
    i32 0, label %577
  ]

577:                                              ; preds = %575
  br label %578

578:                                              ; preds = %577
  %579 = load i32, ptr %24, align 4, !tbaa !21
  %580 = add nsw i32 %579, 1
  store i32 %580, ptr %24, align 4, !tbaa !21
  br label %420, !llvm.loop !57

581:                                              ; preds = %575, %426
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  %582 = load i32, ptr %14, align 4
  switch i32 %582, label %584 [
    i32 14, label %583
  ]

583:                                              ; preds = %581
  store i1 true, ptr %5, align 1
  store i32 1, ptr %14, align 4
  br label %584

584:                                              ; preds = %583, %581
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %585 = load i1, ptr %5, align 1
  ret i1 %585
}

declare void @ggml_hash_set_new(ptr dead_on_unwind writable sret(%struct.ggml_hash_set) align 8, i64 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #7

; Function Attrs: nounwind uwtable
declare hidden void @ggml_dyn_tallocr_reset(ptr noundef) #5

; Function Attrs: nounwind uwtable
declare hidden void @ggml_gallocr_alloc_graph_impl(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
declare hidden ptr @ggml_gallocr_hash_get(ptr noundef, ptr noundef) #5

declare i64 @ggml_backend_buft_get_alloc_size(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden i64 @ggml_dyn_tallocr_max_size(ptr noundef) #5

declare ptr @ggml_backend_buft_name(ptr noundef) #1

declare ptr @ggml_backend_buft_alloc_buffer(ptr noundef, i64 noundef) #1

declare void @ggml_backend_buffer_set_usage(ptr noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { noreturn "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 allocsize(0,1) "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 "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 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind allocsize(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 #8 = { nounwind }
attributes #9 = { noreturn }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind allocsize(0,1) }

!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/C++ TBAA"}
!9 = !{!10, !11, i64 4}
!10 = !{!"ggml_cgraph", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !11, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"ggml_hash_set", !13, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !11, i64 8}
!15 = !{!13, !13, i64 0}
!16 = !{!17, !13, i64 32}
!17 = !{!"ggml_gallocr", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !12, i64 32, !6, i64 56, !6, i64 64, !11, i64 72, !6, i64 80, !11, i64 88}
!18 = !{i64 0, i64 8, !15, i64 8, i64 8, !5, i64 16, i64 8, !5}
!19 = !{!17, !6, i64 48}
!20 = !{!17, !6, i64 56}
!21 = !{!11, !11, i64 0}
!22 = !{!17, !11, i64 24}
!23 = !{!17, !6, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!17, !11, i64 72}
!27 = !{!17, !6, i64 64}
!28 = !{!10, !6, i64 16}
!29 = !{!30, !6, i64 232}
!30 = !{!"ggml_tensor", !11, i64 0, !6, i64 8, !7, i64 16, !7, i64 48, !11, i64 80, !7, i64 84, !11, i64 148, !7, i64 152, !6, i64 232, !13, i64 240, !6, i64 248, !7, i64 256, !6, i64 320, !7, i64 328}
!31 = !{!30, !6, i64 248}
!32 = !{!33, !11, i64 0}
!33 = !{!"node_alloc", !34, i64 0, !7, i64 24}
!34 = !{!"tensor_alloc", !11, i64 0, !13, i64 8, !13, i64 16}
!35 = !{!33, !13, i64 8}
!36 = !{!33, !13, i64 16}
!37 = !{!38, !11, i64 8}
!38 = !{!"hash_node", !11, i64 0, !11, i64 4, !11, i64 8, !13, i64 16, !39, i64 24}
!39 = !{!"_Bool", !7, i64 0}
!40 = !{!38, !13, i64 16}
!41 = !{!17, !6, i64 0}
!42 = !{!34, !11, i64 0}
!43 = !{!34, !13, i64 8}
!44 = !{!34, !13, i64 16}
!45 = distinct !{!45, !25}
!46 = distinct !{!46, !25}
!47 = !{!17, !11, i64 88}
!48 = !{!17, !6, i64 80}
!49 = !{!10, !6, i64 40}
!50 = !{!51, !11, i64 0}
!51 = !{!"leaf_alloc", !34, i64 0}
!52 = !{!51, !13, i64 8}
!53 = !{!51, !13, i64 16}
!54 = distinct !{!54, !25}
!55 = !{!17, !6, i64 8}
!56 = distinct !{!56, !25}
!57 = distinct !{!57, !25}


; 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.ggml_hash_set = type { i64, ptr, ptr }
%struct.node_alloc = type { %struct.tensor_alloc, [10 x %struct.tensor_alloc] }
%struct.tensor_alloc = type { i32, i64, i64 }
%struct.leaf_alloc = type { %struct.tensor_alloc }

@.str.1 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [61 x i8], align 1
@__func__.ggml_gallocr_reserve_n = external hidden unnamed_addr constant [23 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [46 x i8], align 1

; 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 i64 @ggml_backend_buffer_get_size(ptr noundef) local_unnamed_addr #1

declare void @ggml_log_internal(i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: noreturn
declare void @ggml_abort(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #3

declare void @ggml_backend_buffer_free(ptr noundef) local_unnamed_addr #1

declare void @ggml_hash_set_free(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @ggml_gallocr_reserve_n(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #5 {
  %5 = alloca %struct.ggml_hash_set, align 8
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !13
  %10 = add nsw i32 %9, %7
  %11 = sext i32 %10 to i64
  %12 = lshr i64 %11, 2
  %13 = add nsw i64 %12, %11
  %14 = getelementptr inbounds i8, ptr %0, i64 32
  %15 = load i64, ptr %14, align 8, !tbaa !14
  %16 = icmp ult i64 %15, %13
  br i1 %16, label %17, label %28

17:                                               ; preds = %4
  tail call void @ggml_hash_set_free(ptr noundef nonnull %14) #8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #8
  call void @ggml_hash_set_new(ptr dead_on_unwind nonnull writable sret(%struct.ggml_hash_set) align 8 %5, i64 noundef %13) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef nonnull align 8 dereferenceable(24) %5, i64 24, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #8
  %18 = getelementptr inbounds i8, ptr %0, i64 48
  %19 = load ptr, ptr %18, align 8, !tbaa !19
  %.not = icmp eq ptr %19, null
  br i1 %.not, label %20, label %21

20:                                               ; preds = %17
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.1, i32 noundef 682, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.10) #9
  unreachable

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %0, i64 56
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  call void @free(ptr noundef %23) #8
  %24 = load i64, ptr %14, align 8, !tbaa !14
  %25 = shl i64 %24, 5
  %26 = call noalias ptr @malloc(i64 noundef %25) #10
  store ptr %26, ptr %22, align 8, !tbaa !20
  %.not170 = icmp eq ptr %26, null
  br i1 %.not170, label %27, label %28

27:                                               ; preds = %21
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.1, i32 noundef 686, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.11) #9
  unreachable

28:                                               ; preds = %21, %4
  %29 = getelementptr inbounds i8, ptr %0, i64 24
  %30 = load i32, ptr %29, align 8, !tbaa !21
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %28
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  br label %37

._crit_edge:                                      ; preds = %37, %28
  call void @ggml_gallocr_alloc_graph_impl(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, ptr noundef %3)
  %33 = getelementptr inbounds i8, ptr %0, i64 72
  %34 = load i32, ptr %33, align 8, !tbaa !22
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %44, label %51

37:                                               ; preds = %.lr.ph, %37
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %37 ]
  %38 = load ptr, ptr %32, align 8, !tbaa !23
  %39 = getelementptr inbounds ptr, ptr %38, i64 %indvars.iv
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  call void @ggml_dyn_tallocr_reset(ptr noundef %40)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %41 = load i32, ptr %29, align 8, !tbaa !21
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next, %42
  br i1 %43, label %37, label %._crit_edge, !llvm.loop !24

44:                                               ; preds = %._crit_edge
  %45 = getelementptr inbounds i8, ptr %0, i64 64
  %46 = load ptr, ptr %45, align 8, !tbaa !26
  call void @free(ptr noundef %46) #8
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = call noalias ptr @calloc(i64 noundef %48, i64 noundef 264) #11
  store ptr %49, ptr %45, align 8, !tbaa !26
  %.not171 = icmp eq ptr %49, null
  br i1 %.not171, label %50, label %51

50:                                               ; preds = %44
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.1, i32 noundef 701, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.12) #9
  unreachable

51:                                               ; preds = %44, %._crit_edge
  %52 = phi i32 [ %47, %44 ], [ %35, %._crit_edge ]
  store i32 %52, ptr %33, align 8, !tbaa !22
  %53 = icmp sgt i32 %52, 0
  br i1 %53, label %.lr.ph195, label %._crit_edge196

.lr.ph195:                                        ; preds = %51
  %54 = getelementptr inbounds i8, ptr %1, i64 16
  %55 = getelementptr inbounds i8, ptr %0, i64 64
  br label %60

._crit_edge196:                                   ; preds = %89, %51
  %56 = getelementptr inbounds i8, ptr %0, i64 88
  %57 = load i32, ptr %56, align 8, !tbaa !27
  %58 = load i32, ptr %8, align 8, !tbaa !13
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %120, label %127

60:                                               ; preds = %.lr.ph195, %89
  %indvars.iv216 = phi i64 [ 0, %.lr.ph195 ], [ %indvars.iv.next217, %89 ]
  %61 = load ptr, ptr %54, align 8, !tbaa !28
  %62 = getelementptr inbounds ptr, ptr %61, i64 %indvars.iv216
  %63 = load ptr, ptr %62, align 8, !tbaa !18
  %64 = load ptr, ptr %55, align 8, !tbaa !26
  %65 = getelementptr inbounds %struct.node_alloc, ptr %64, i64 %indvars.iv216
  %66 = getelementptr inbounds i8, ptr %63, i64 232
  %67 = load ptr, ptr %66, align 8, !tbaa !29
  %.not177 = icmp eq ptr %67, null
  br i1 %.not177, label %68, label %71

68:                                               ; preds = %60
  %69 = getelementptr inbounds i8, ptr %63, i64 248
  %70 = load ptr, ptr %69, align 8, !tbaa !31
  %.not178 = icmp eq ptr %70, null
  br i1 %.not178, label %73, label %71

71:                                               ; preds = %68, %60
  store i32 -1, ptr %65, align 8, !tbaa !32
  %72 = getelementptr inbounds i8, ptr %65, i64 8
  store i64 -1, ptr %72, align 8, !tbaa !35
  br label %85

73:                                               ; preds = %68
  %74 = call ptr @ggml_gallocr_hash_get(ptr noundef nonnull %0, ptr noundef nonnull %63)
  %75 = getelementptr inbounds i8, ptr %74, i64 8
  %76 = load i32, ptr %75, align 8, !tbaa !36
  store i32 %76, ptr %65, align 8, !tbaa !32
  %77 = getelementptr inbounds i8, ptr %74, i64 16
  %78 = load i64, ptr %77, align 8, !tbaa !39
  %79 = getelementptr inbounds i8, ptr %65, i64 8
  store i64 %78, ptr %79, align 8, !tbaa !35
  %80 = load ptr, ptr %0, align 8, !tbaa !40
  %81 = sext i32 %76 to i64
  %82 = getelementptr inbounds ptr, ptr %80, i64 %81
  %83 = load ptr, ptr %82, align 8, !tbaa !18
  %84 = call i64 @ggml_backend_buft_get_alloc_size(ptr noundef %83, ptr noundef nonnull %63) #8
  br label %85

85:                                               ; preds = %73, %71
  %.sink = phi i64 [ %84, %73 ], [ 0, %71 ]
  %86 = getelementptr inbounds i8, ptr %65, i64 16
  store i64 %.sink, ptr %86, align 8, !tbaa !41
  %87 = getelementptr inbounds i8, ptr %63, i64 152
  %88 = getelementptr inbounds i8, ptr %65, i64 24
  br label %93

89:                                               ; preds = %118
  %indvars.iv.next217 = add nuw nsw i64 %indvars.iv216, 1
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next217, %91
  br i1 %92, label %60, label %._crit_edge196, !llvm.loop !42

93:                                               ; preds = %85, %118
  %indvars.iv213 = phi i64 [ 0, %85 ], [ %indvars.iv.next214, %118 ]
  %94 = getelementptr inbounds [10 x ptr], ptr %87, i64 0, i64 %indvars.iv213
  %95 = load ptr, ptr %94, align 8, !tbaa !18
  %.not179 = icmp eq ptr %95, null
  br i1 %.not179, label %102, label %96

96:                                               ; preds = %93
  %97 = getelementptr inbounds i8, ptr %95, i64 232
  %98 = load ptr, ptr %97, align 8, !tbaa !29
  %.not180 = icmp eq ptr %98, null
  br i1 %.not180, label %99, label %102

99:                                               ; preds = %96
  %100 = getelementptr inbounds i8, ptr %95, i64 248
  %101 = load ptr, ptr %100, align 8, !tbaa !31
  %.not181 = icmp eq ptr %101, null
  br i1 %.not181, label %105, label %102

102:                                              ; preds = %99, %96, %93
  %103 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %88, i64 0, i64 %indvars.iv213
  store i32 -1, ptr %103, align 8, !tbaa !43
  %104 = getelementptr inbounds i8, ptr %103, i64 8
  store i64 -1, ptr %104, align 8, !tbaa !44
  br label %118

105:                                              ; preds = %99
  %106 = call ptr @ggml_gallocr_hash_get(ptr noundef %0, ptr noundef nonnull %95)
  %107 = getelementptr inbounds i8, ptr %106, i64 8
  %108 = load i32, ptr %107, align 8, !tbaa !36
  %109 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %88, i64 0, i64 %indvars.iv213
  store i32 %108, ptr %109, align 8, !tbaa !43
  %110 = getelementptr inbounds i8, ptr %106, i64 16
  %111 = load i64, ptr %110, align 8, !tbaa !39
  %112 = getelementptr inbounds i8, ptr %109, i64 8
  store i64 %111, ptr %112, align 8, !tbaa !44
  %113 = load ptr, ptr %0, align 8, !tbaa !40
  %114 = sext i32 %108 to i64
  %115 = getelementptr inbounds ptr, ptr %113, i64 %114
  %116 = load ptr, ptr %115, align 8, !tbaa !18
  %117 = call i64 @ggml_backend_buft_get_alloc_size(ptr noundef %116, ptr noundef nonnull %95) #8
  br label %118

118:                                              ; preds = %105, %102
  %.sink232 = phi i64 [ %117, %105 ], [ 0, %102 ]
  %119 = getelementptr inbounds [10 x %struct.tensor_alloc], ptr %88, i64 0, i64 %indvars.iv213, i32 2
  store i64 %.sink232, ptr %119, align 8, !tbaa !45
  %indvars.iv.next214 = add nuw nsw i64 %indvars.iv213, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next214, 10
  br i1 %exitcond.not, label %89, label %93, !llvm.loop !46

120:                                              ; preds = %._crit_edge196
  %121 = getelementptr inbounds i8, ptr %0, i64 80
  %122 = load ptr, ptr %121, align 8, !tbaa !47
  call void @free(ptr noundef %122) #8
  %123 = load i32, ptr %8, align 8, !tbaa !13
  %124 = sext i32 %123 to i64
  %125 = call noalias ptr @calloc(i64 noundef %124, i64 noundef 24) #11
  store ptr %125, ptr %121, align 8, !tbaa !47
  %.not172 = icmp eq ptr %125, null
  br i1 %.not172, label %126, label %127

126:                                              ; preds = %120
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.1, i32 noundef 734, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.13) #9
  unreachable

127:                                              ; preds = %120, %._crit_edge196
  %128 = phi i32 [ %123, %120 ], [ %58, %._crit_edge196 ]
  store i32 %128, ptr %56, align 8, !tbaa !27
  %129 = icmp sgt i32 %128, 0
  br i1 %129, label %.lr.ph199, label %.preheader184

.lr.ph199:                                        ; preds = %127
  %130 = getelementptr inbounds i8, ptr %1, i64 40
  %131 = getelementptr inbounds i8, ptr %0, i64 80
  br label %135

.preheader184:                                    ; preds = %163, %127
  %132 = load i32, ptr %29, align 8, !tbaa !21
  %.not174202 = icmp slt i32 %132, 1
  br i1 %.not174202, label %.critedge183, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.preheader184
  %133 = getelementptr inbounds i8, ptr %0, i64 16
  %134 = getelementptr inbounds i8, ptr %0, i64 8
  br label %.preheader

135:                                              ; preds = %.lr.ph199, %163
  %indvars.iv219 = phi i64 [ 0, %.lr.ph199 ], [ %indvars.iv.next220, %163 ]
  %136 = load ptr, ptr %130, align 8, !tbaa !48
  %137 = getelementptr inbounds ptr, ptr %136, i64 %indvars.iv219
  %138 = load ptr, ptr %137, align 8, !tbaa !18
  %139 = call ptr @ggml_gallocr_hash_get(ptr noundef nonnull %0, ptr noundef %138)
  %140 = getelementptr inbounds i8, ptr %138, i64 232
  %141 = load ptr, ptr %140, align 8, !tbaa !29
  %.not175 = icmp eq ptr %141, null
  br i1 %.not175, label %142, label %145

142:                                              ; preds = %135
  %143 = getelementptr inbounds i8, ptr %138, i64 248
  %144 = load ptr, ptr %143, align 8, !tbaa !31
  %.not176 = icmp eq ptr %144, null
  br i1 %.not176, label %149, label %145

145:                                              ; preds = %142, %135
  %146 = load ptr, ptr %131, align 8, !tbaa !47
  %147 = getelementptr inbounds %struct.leaf_alloc, ptr %146, i64 %indvars.iv219
  store i32 -1, ptr %147, align 8, !tbaa !49
  %148 = getelementptr inbounds %struct.leaf_alloc, ptr %146, i64 %indvars.iv219, i32 0, i32 1
  store i64 -1, ptr %148, align 8, !tbaa !51
  br label %163

149:                                              ; preds = %142
  %150 = getelementptr inbounds i8, ptr %139, i64 8
  %151 = load i32, ptr %150, align 8, !tbaa !36
  %152 = load ptr, ptr %131, align 8, !tbaa !47
  %153 = getelementptr inbounds %struct.leaf_alloc, ptr %152, i64 %indvars.iv219
  store i32 %151, ptr %153, align 8, !tbaa !49
  %154 = getelementptr inbounds i8, ptr %139, i64 16
  %155 = load i64, ptr %154, align 8, !tbaa !39
  %156 = getelementptr inbounds %struct.leaf_alloc, ptr %152, i64 %indvars.iv219, i32 0, i32 1
  store i64 %155, ptr %156, align 8, !tbaa !51
  %157 = load ptr, ptr %0, align 8, !tbaa !40
  %158 = sext i32 %151 to i64
  %159 = getelementptr inbounds ptr, ptr %157, i64 %158
  %160 = load ptr, ptr %159, align 8, !tbaa !18
  %161 = call i64 @ggml_backend_buft_get_alloc_size(ptr noundef %160, ptr noundef nonnull %138) #8
  %162 = load ptr, ptr %131, align 8, !tbaa !47
  br label %163

163:                                              ; preds = %149, %145
  %.sink237 = phi ptr [ %162, %149 ], [ %146, %145 ]
  %.sink235 = phi i64 [ %161, %149 ], [ 0, %145 ]
  %164 = getelementptr inbounds %struct.leaf_alloc, ptr %.sink237, i64 %indvars.iv219, i32 0, i32 2
  store i64 %.sink235, ptr %164, align 8, !tbaa !52
  %indvars.iv.next220 = add nuw nsw i64 %indvars.iv219, 1
  %165 = load i32, ptr %8, align 8, !tbaa !13
  %166 = sext i32 %165 to i64
  %167 = icmp slt i64 %indvars.iv.next220, %166
  br i1 %167, label %135, label %.preheader184, !llvm.loop !53

.preheader:                                       ; preds = %.preheader.lr.ph, %227
  %indvars.iv226 = phi i64 [ 0, %.preheader.lr.ph ], [ %indvars.iv.next227, %227 ]
  %.not205 = icmp eq i64 %indvars.iv226, 0
  br i1 %.not205, label %.loopexit, label %.lr.ph201

.lr.ph201:                                        ; preds = %.preheader
  %168 = load ptr, ptr %133, align 8, !tbaa !23
  %169 = getelementptr inbounds ptr, ptr %168, i64 %indvars.iv226
  %170 = load ptr, ptr %169, align 8, !tbaa !18
  br label %172

171:                                              ; preds = %172
  %indvars.iv.next223 = add nuw nsw i64 %indvars.iv222, 1
  %exitcond225.not = icmp eq i64 %indvars.iv.next223, %indvars.iv226
  br i1 %exitcond225.not, label %.loopexit, label %172, !llvm.loop !54

172:                                              ; preds = %.lr.ph201, %171
  %indvars.iv222 = phi i64 [ 0, %.lr.ph201 ], [ %indvars.iv.next223, %171 ]
  %173 = getelementptr inbounds ptr, ptr %168, i64 %indvars.iv222
  %174 = load ptr, ptr %173, align 8, !tbaa !18
  %175 = icmp eq ptr %174, %170
  br i1 %175, label %176, label %171

176:                                              ; preds = %172
  %177 = load ptr, ptr %134, align 8, !tbaa !55
  %178 = getelementptr inbounds ptr, ptr %177, i64 %indvars.iv222
  %179 = load ptr, ptr %178, align 8, !tbaa !18
  %180 = getelementptr inbounds ptr, ptr %177, i64 %indvars.iv226
  store ptr %179, ptr %180, align 8, !tbaa !18
  br label %.loopexit

.loopexit:                                        ; preds = %171, %.preheader, %176
  %181 = load ptr, ptr %134, align 8, !tbaa !55
  %182 = getelementptr inbounds ptr, ptr %181, i64 %indvars.iv226
  %183 = load ptr, ptr %182, align 8, !tbaa !18
  %.not173 = icmp eq ptr %183, null
  br i1 %.not173, label %186, label %184

184:                                              ; preds = %.loopexit
  %185 = call i64 @ggml_backend_buffer_get_size(ptr noundef nonnull %183) #8
  br label %186

186:                                              ; preds = %.loopexit, %184
  %187 = phi i64 [ %185, %184 ], [ 0, %.loopexit ]
  %188 = load ptr, ptr %133, align 8, !tbaa !23
  %189 = getelementptr inbounds ptr, ptr %188, i64 %indvars.iv226
  %190 = load ptr, ptr %189, align 8, !tbaa !18
  %191 = call i64 @ggml_dyn_tallocr_max_size(ptr noundef %190)
  %192 = icmp ugt i64 %191, %187
  br i1 %192, label %198, label %193

193:                                              ; preds = %186
  %194 = load ptr, ptr %134, align 8, !tbaa !55
  %195 = getelementptr inbounds ptr, ptr %194, i64 %indvars.iv226
  %196 = load ptr, ptr %195, align 8, !tbaa !18
  %197 = icmp eq ptr %196, null
  br i1 %197, label %198, label %227

198:                                              ; preds = %193, %186
  %199 = load ptr, ptr %0, align 8, !tbaa !40
  %200 = getelementptr inbounds ptr, ptr %199, i64 %indvars.iv226
  %201 = load ptr, ptr %200, align 8, !tbaa !18
  %202 = call ptr @ggml_backend_buft_name(ptr noundef %201) #8
  %203 = uitofp i64 %187 to double
  %204 = fmul double %203, 0x3F50000000000000
  %205 = fmul double %204, 0x3F50000000000000
  %206 = uitofp i64 %191 to double
  %207 = fmul double %206, 0x3F50000000000000
  %208 = fmul double %207, 0x3F50000000000000
  call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 1, ptr noundef nonnull @.str.14, ptr noundef nonnull @__func__.ggml_gallocr_reserve_n, ptr noundef %202, double noundef %205, double noundef %208) #8
  %209 = load ptr, ptr %134, align 8, !tbaa !55
  %210 = getelementptr inbounds ptr, ptr %209, i64 %indvars.iv226
  %211 = load ptr, ptr %210, align 8, !tbaa !18
  call void @ggml_backend_buffer_free(ptr noundef %211) #8
  %212 = load ptr, ptr %0, align 8, !tbaa !40
  %213 = getelementptr inbounds ptr, ptr %212, i64 %indvars.iv226
  %214 = load ptr, ptr %213, align 8, !tbaa !18
  %215 = call ptr @ggml_backend_buft_alloc_buffer(ptr noundef %214, i64 noundef %191) #8
  %216 = load ptr, ptr %134, align 8, !tbaa !55
  %217 = getelementptr inbounds ptr, ptr %216, i64 %indvars.iv226
  store ptr %215, ptr %217, align 8, !tbaa !18
  %218 = load ptr, ptr %134, align 8, !tbaa !55
  %219 = getelementptr inbounds ptr, ptr %218, i64 %indvars.iv226
  %220 = load ptr, ptr %219, align 8, !tbaa !18
  %221 = icmp eq ptr %220, null
  br i1 %221, label %.critedge, label %226

.critedge:                                        ; preds = %198
  %222 = load ptr, ptr %0, align 8, !tbaa !40
  %223 = getelementptr inbounds ptr, ptr %222, i64 %indvars.iv226
  %224 = load ptr, ptr %223, align 8, !tbaa !18
  %225 = call ptr @ggml_backend_buft_name(ptr noundef %224) #8
  call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef nonnull @.str.15, ptr noundef nonnull @__func__.ggml_gallocr_reserve_n, ptr noundef %225, i64 noundef %191) #8
  br label %.critedge183

226:                                              ; preds = %198
  call void @ggml_backend_buffer_set_usage(ptr noundef nonnull %220, i32 noundef 2) #8
  br label %227

227:                                              ; preds = %226, %193
  %indvars.iv.next227 = add nuw nsw i64 %indvars.iv226, 1
  %228 = load i32, ptr %29, align 8, !tbaa !21
  %229 = sext i32 %228 to i64
  %.not174.not = icmp slt i64 %indvars.iv.next227, %229
  br i1 %.not174.not, label %.preheader, label %.critedge183, !llvm.loop !56

.critedge183:                                     ; preds = %227, %.preheader184, %.critedge
  %.not174187 = phi i1 [ false, %.critedge ], [ true, %.preheader184 ], [ true, %227 ]
  ret i1 %.not174187
}

declare void @ggml_hash_set_new(ptr dead_on_unwind writable sret(%struct.ggml_hash_set) align 8, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #7

; Function Attrs: nounwind uwtable
declare hidden void @ggml_dyn_tallocr_reset(ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden void @ggml_gallocr_alloc_graph_impl(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden ptr @ggml_gallocr_hash_get(ptr noundef, ptr noundef) local_unnamed_addr #5

declare i64 @ggml_backend_buft_get_alloc_size(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @ggml_dyn_tallocr_max_size(ptr noundef) local_unnamed_addr #5

declare ptr @ggml_backend_buft_name(ptr noundef) local_unnamed_addr #1

declare ptr @ggml_backend_buft_alloc_buffer(ptr noundef, i64 noundef) local_unnamed_addr #1

declare void @ggml_backend_buffer_set_usage(ptr noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { noreturn "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 nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind allocsize(0,1) }

!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, !7, i64 4}
!6 = !{!"ggml_cgraph", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !7, i64 72}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"ggml_hash_set", !12, i64 0, !10, i64 8, !10, i64 16}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!15, !12, i64 32}
!15 = !{!"ggml_gallocr", !10, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !10, i64 56, !10, i64 64, !7, i64 72, !10, i64 80, !7, i64 88}
!16 = !{i64 0, i64 8, !17, i64 8, i64 8, !18, i64 16, i64 8, !18}
!17 = !{!12, !12, i64 0}
!18 = !{!10, !10, i64 0}
!19 = !{!15, !10, i64 48}
!20 = !{!15, !10, i64 56}
!21 = !{!15, !7, i64 24}
!22 = !{!15, !7, i64 72}
!23 = !{!15, !10, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!15, !10, i64 64}
!27 = !{!15, !7, i64 88}
!28 = !{!6, !10, i64 16}
!29 = !{!30, !10, i64 232}
!30 = !{!"ggml_tensor", !7, i64 0, !10, i64 8, !8, i64 16, !8, i64 48, !7, i64 80, !8, i64 84, !7, i64 148, !8, i64 152, !10, i64 232, !12, i64 240, !10, i64 248, !8, i64 256, !10, i64 320, !8, i64 328}
!31 = !{!30, !10, i64 248}
!32 = !{!33, !7, i64 0}
!33 = !{!"node_alloc", !34, i64 0, !8, i64 24}
!34 = !{!"tensor_alloc", !7, i64 0, !12, i64 8, !12, i64 16}
!35 = !{!33, !12, i64 8}
!36 = !{!37, !7, i64 8}
!37 = !{!"hash_node", !7, i64 0, !7, i64 4, !7, i64 8, !12, i64 16, !38, i64 24}
!38 = !{!"_Bool", !8, i64 0}
!39 = !{!37, !12, i64 16}
!40 = !{!15, !10, i64 0}
!41 = !{!33, !12, i64 16}
!42 = distinct !{!42, !25}
!43 = !{!34, !7, i64 0}
!44 = !{!34, !12, i64 8}
!45 = !{!34, !12, i64 16}
!46 = distinct !{!46, !25}
!47 = !{!15, !10, i64 80}
!48 = !{!6, !10, i64 40}
!49 = !{!50, !7, i64 0}
!50 = !{!"leaf_alloc", !34, i64 0}
!51 = !{!50, !12, i64 8}
!52 = !{!50, !12, i64 16}
!53 = distinct !{!53, !25}
!54 = distinct !{!54, !25}
!55 = !{!15, !10, i64 8}
!56 = distinct !{!56, !25}


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