; LLVM IR from ggml-org/ggml :: tests (test-backend-ops)

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

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i8, align 1
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr null, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store ptr null, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %130, %2
  %22 = load i32, ptr %10, align 4, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 2, ptr %11, align 4
  br label %133

26:                                               ; preds = %21
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = load i32, ptr %10, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds ptr, ptr %27, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = call i32 @strcmp(ptr noundef %31, ptr noundef @.str) #8
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %26
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %129

35:                                               ; preds = %26
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = load i32, ptr %10, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds ptr, ptr %36, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = call i32 @strcmp(ptr noundef %40, ptr noundef @.str.1) #8
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %35
  store i32 1, ptr %6, align 4, !tbaa !11
  br label %128

44:                                               ; preds = %35
  %45 = load ptr, ptr %5, align 8, !tbaa !9
  %46 = load i32, ptr %10, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds ptr, ptr %45, i64 %47
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = call i32 @strcmp(ptr noundef %49, ptr noundef @.str.2) #8
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %44
  store i32 2, ptr %6, align 4, !tbaa !11
  br label %127

53:                                               ; preds = %44
  %54 = load ptr, ptr %5, align 8, !tbaa !9
  %55 = load i32, ptr %10, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds ptr, ptr %54, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = call i32 @strcmp(ptr noundef %58, ptr noundef @.str.3) #8
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %76

61:                                               ; preds = %53
  %62 = load i32, ptr %10, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %66, label %73

66:                                               ; preds = %61
  %67 = load ptr, ptr %5, align 8, !tbaa !9
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %10, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds ptr, ptr %67, i64 %70
  %72 = load ptr, ptr %71, align 8, !tbaa !9
  store ptr %72, ptr %7, align 8, !tbaa !9
  br label %75

73:                                               ; preds = %61
  %74 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_ZL5usagePPc(ptr noundef %74)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %133

75:                                               ; preds = %66
  br label %126

76:                                               ; preds = %53
  %77 = load ptr, ptr %5, align 8, !tbaa !9
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds ptr, ptr %77, i64 %79
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = call i32 @strcmp(ptr noundef %81, ptr noundef @.str.4) #8
  %83 = icmp eq i32 %82, 0
  br i1 %83, label %84, label %99

84:                                               ; preds = %76
  %85 = load i32, ptr %10, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %89, label %96

89:                                               ; preds = %84
  %90 = load ptr, ptr %5, align 8, !tbaa !9
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %10, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds ptr, ptr %90, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !9
  store ptr %95, ptr %8, align 8, !tbaa !9
  br label %98

96:                                               ; preds = %84
  %97 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_ZL5usagePPc(ptr noundef %97)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %133

98:                                               ; preds = %89
  br label %125

99:                                               ; preds = %76
  %100 = load ptr, ptr %5, align 8, !tbaa !9
  %101 = load i32, ptr %10, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds ptr, ptr %100, i64 %102
  %104 = load ptr, ptr %103, align 8, !tbaa !9
  %105 = call i32 @strcmp(ptr noundef %104, ptr noundef @.str.5) #8
  %106 = icmp eq i32 %105, 0
  br i1 %106, label %107, label %122

107:                                              ; preds = %99
  %108 = load i32, ptr %10, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %112, label %119

112:                                              ; preds = %107
  %113 = load ptr, ptr %5, align 8, !tbaa !9
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %10, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds ptr, ptr %113, i64 %116
  %118 = load ptr, ptr %117, align 8, !tbaa !9
  store ptr %118, ptr %9, align 8, !tbaa !9
  br label %121

119:                                              ; preds = %107
  %120 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_ZL5usagePPc(ptr noundef %120)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %133

121:                                              ; preds = %112
  br label %124

122:                                              ; preds = %99
  %123 = load ptr, ptr %5, align 8, !tbaa !9
  call void @_ZL5usagePPc(ptr noundef %123)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %133

124:                                              ; preds = %121
  br label %125

125:                                              ; preds = %124, %98
  br label %126

126:                                              ; preds = %125, %75
  br label %127

127:                                              ; preds = %126, %52
  br label %128

128:                                              ; preds = %127, %43
  br label %129

129:                                              ; preds = %128, %34
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %10, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %10, align 4, !tbaa !5
  br label %21, !llvm.loop !13

133:                                              ; preds = %122, %119, %96, %73, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  %134 = load i32, ptr %11, align 4
  switch i32 %134, label %246 [
    i32 2, label %135
  ]

135:                                              ; preds = %133
  call void @ggml_backend_load_all()
  %136 = call i64 @ggml_backend_dev_count()
  %137 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i64 noundef %136)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !15
  br label %138

138:                                              ; preds = %231, %135
  %139 = load i64, ptr %13, align 8, !tbaa !15
  %140 = call i64 @ggml_backend_dev_count()
  %141 = icmp ult i64 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %234

143:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %144 = load i64, ptr %13, align 8, !tbaa !15
  %145 = call ptr @ggml_backend_dev_get(i64 noundef %144)
  store ptr %145, ptr %14, align 8, !tbaa !9
  %146 = load i64, ptr %13, align 8, !tbaa !15
  %147 = add i64 %146, 1
  %148 = call i64 @ggml_backend_dev_count()
  %149 = load ptr, ptr %14, align 8, !tbaa !9
  %150 = call ptr @ggml_backend_dev_name(ptr noundef %149)
  %151 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i64 noundef %147, i64 noundef %148, ptr noundef %150)
  %152 = load ptr, ptr %8, align 8, !tbaa !9
  %153 = icmp ne ptr %152, null
  br i1 %153, label %154, label %164

154:                                              ; preds = %143
  %155 = load ptr, ptr %8, align 8, !tbaa !9
  %156 = load ptr, ptr %14, align 8, !tbaa !9
  %157 = call ptr @ggml_backend_dev_name(ptr noundef %156)
  %158 = call i32 @strcmp(ptr noundef %155, ptr noundef %157) #8
  %159 = icmp ne i32 %158, 0
  br i1 %159, label %160, label %164

160:                                              ; preds = %154
  %161 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  %162 = load i64, ptr %12, align 8, !tbaa !15
  %163 = add i64 %162, 1
  store i64 %163, ptr %12, align 8, !tbaa !15
  store i32 7, ptr %11, align 4
  br label %228

164:                                              ; preds = %154, %143
  %165 = load ptr, ptr %8, align 8, !tbaa !9
  %166 = icmp eq ptr %165, null
  br i1 %166, label %167, label %178

167:                                              ; preds = %164
  %168 = load ptr, ptr %14, align 8, !tbaa !9
  %169 = call i32 @ggml_backend_dev_type(ptr noundef %168)
  %170 = icmp eq i32 %169, 0
  br i1 %170, label %171, label %178

171:                                              ; preds = %167
  %172 = load i32, ptr %6, align 4, !tbaa !11
  %173 = icmp ne i32 %172, 2
  br i1 %173, label %174, label %178

174:                                              ; preds = %171
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %176 = load i64, ptr %12, align 8, !tbaa !15
  %177 = add i64 %176, 1
  store i64 %177, ptr %12, align 8, !tbaa !15
  store i32 7, ptr %11, align 4
  br label %228

178:                                              ; preds = %171, %167, %164
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %179 = load ptr, ptr %14, align 8, !tbaa !9
  %180 = call ptr @ggml_backend_dev_init(ptr noundef %179, ptr noundef null)
  store ptr %180, ptr %15, align 8, !tbaa !9
  %181 = load ptr, ptr %15, align 8, !tbaa !9
  %182 = icmp ne ptr %181, null
  br i1 %182, label %184, label %183

183:                                              ; preds = %178
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.10, i32 noundef 4745, ptr noundef @.str.11, ptr noundef @.str.12) #9
  unreachable

184:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %185 = load ptr, ptr %14, align 8, !tbaa !9
  %186 = call ptr @ggml_backend_dev_backend_reg(ptr noundef %185)
  store ptr %186, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %187 = load ptr, ptr %16, align 8, !tbaa !9
  %188 = call ptr @ggml_backend_reg_get_proc_address(ptr noundef %187, ptr noundef @.str.13)
  store ptr %188, ptr %17, align 8, !tbaa !9
  %189 = load ptr, ptr %17, align 8, !tbaa !9
  %190 = icmp ne ptr %189, null
  br i1 %190, label %191, label %195

191:                                              ; preds = %184
  %192 = load ptr, ptr %17, align 8, !tbaa !9
  %193 = load ptr, ptr %15, align 8, !tbaa !9
  %194 = call noundef i32 @_ZNSt6thread20hardware_concurrencyEv() #7
  call void %192(ptr noundef %193, i32 noundef %194)
  br label %195

195:                                              ; preds = %191, %184
  %196 = load ptr, ptr %14, align 8, !tbaa !9
  %197 = call ptr @ggml_backend_dev_description(ptr noundef %196)
  %198 = call i32 (ptr, ...) @printf(ptr noundef @.str.14, ptr noundef %197)
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %199 = load ptr, ptr %14, align 8, !tbaa !9
  call void @ggml_backend_dev_memory(ptr noundef %199, ptr noundef %18, ptr noundef %19)
  %200 = load i64, ptr %19, align 8, !tbaa !15
  %201 = udiv i64 %200, 1024
  %202 = udiv i64 %201, 1024
  %203 = load i64, ptr %18, align 8, !tbaa !15
  %204 = udiv i64 %203, 1024
  %205 = udiv i64 %204, 1024
  %206 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i64 noundef %202, i64 noundef %205)
  %207 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #7
  %208 = load ptr, ptr %15, align 8, !tbaa !9
  %209 = load i32, ptr %6, align 4, !tbaa !11
  %210 = load ptr, ptr %7, align 8, !tbaa !9
  %211 = load ptr, ptr %9, align 8, !tbaa !9
  %212 = call noundef zeroext i1 @_ZL12test_backendP12ggml_backend9test_modePKcS3_(ptr noundef %208, i32 noundef %209, ptr noundef %210, ptr noundef %211)
  %213 = zext i1 %212 to i8
  store i8 %213, ptr %20, align 1, !tbaa !17
  %214 = load ptr, ptr %15, align 8, !tbaa !9
  %215 = call ptr @ggml_backend_name(ptr noundef %214)
  %216 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, ptr noundef %215)
  %217 = load i8, ptr %20, align 1, !tbaa !17, !range !19, !noundef !20
  %218 = trunc i8 %217 to i1
  br i1 %218, label %219, label %223

219:                                              ; preds = %195
  %220 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  %221 = load i64, ptr %12, align 8, !tbaa !15
  %222 = add i64 %221, 1
  store i64 %222, ptr %12, align 8, !tbaa !15
  br label %225

223:                                              ; preds = %195
  %224 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  br label %225

225:                                              ; preds = %223, %219
  %226 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  %227 = load ptr, ptr %15, align 8, !tbaa !9
  call void @ggml_backend_free(ptr noundef %227)
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  store i32 0, ptr %11, align 4
  br label %228

228:                                              ; preds = %225, %174, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  %229 = load i32, ptr %11, align 4
  switch i32 %229, label %248 [
    i32 0, label %230
    i32 7, label %231
  ]

230:                                              ; preds = %228
  br label %231

231:                                              ; preds = %230, %228
  %232 = load i64, ptr %13, align 8, !tbaa !15
  %233 = add i64 %232, 1
  store i64 %233, ptr %13, align 8, !tbaa !15
  br label %138, !llvm.loop !21

234:                                              ; preds = %142
  call void @ggml_quantize_free()
  %235 = load i64, ptr %12, align 8, !tbaa !15
  %236 = call i64 @ggml_backend_dev_count()
  %237 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, i64 noundef %235, i64 noundef %236)
  %238 = load i64, ptr %12, align 8, !tbaa !15
  %239 = call i64 @ggml_backend_dev_count()
  %240 = icmp ne i64 %238, %239
  br i1 %240, label %241, label %243

241:                                              ; preds = %234
  %242 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %245

243:                                              ; preds = %234
  %244 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %11, align 4
  br label %245

245:                                              ; preds = %243, %241
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %246

246:                                              ; preds = %245, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %247 = load i32, ptr %3, align 4
  ret i32 %247

248:                                              ; preds = %228
  unreachable
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL5usagePPc(ptr noundef) #3

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

declare void @ggml_backend_load_all() #4

declare i32 @printf(ptr noundef, ...) #4

declare i64 @ggml_backend_dev_count() #4

declare ptr @ggml_backend_dev_get(i64 noundef) #4

declare ptr @ggml_backend_dev_name(ptr noundef) #4

declare i32 @ggml_backend_dev_type(ptr noundef) #4

declare ptr @ggml_backend_dev_init(ptr noundef, ptr noundef) #4

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

declare ptr @ggml_backend_dev_backend_reg(ptr noundef) #4

declare ptr @ggml_backend_reg_get_proc_address(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind
declare noundef i32 @_ZNSt6thread20hardware_concurrencyEv() #6

declare ptr @ggml_backend_dev_description(ptr noundef) #4

declare void @ggml_backend_dev_memory(ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL12test_backendP12ggml_backend9test_modePKcS3_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #3

declare ptr @ggml_backend_name(ptr noundef) #4

declare void @ggml_backend_free(ptr noundef) #4

declare void @ggml_quantize_free() #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 "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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS9test_mode", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %.not109 = icmp sgt i32 %0, 1
  br i1 %.not109, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %50
  %.065114 = phi i32 [ %.166, %50 ], [ 0, %2 ]
  %.067113 = phi ptr [ %.168, %50 ], [ null, %2 ]
  %.069112 = phi ptr [ %.170, %50 ], [ null, %2 ]
  %.071111 = phi ptr [ %.172, %50 ], [ null, %2 ]
  %.078110 = phi i32 [ %51, %50 ], [ 1, %2 ]
  %5 = sext i32 %.078110 to i64
  %6 = getelementptr inbounds ptr, ptr %1, i64 %5
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str) #8
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %50, label %10

10:                                               ; preds = %.lr.ph
  %11 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.1) #8
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %50, label %13

13:                                               ; preds = %10
  %14 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.2) #8
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %50, label %16

16:                                               ; preds = %13
  %17 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.3) #8
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %27

19:                                               ; preds = %16
  %20 = add nsw i32 %.078110, 1
  %21 = icmp slt i32 %20, %0
  br i1 %21, label %22, label %26

22:                                               ; preds = %19
  %23 = sext i32 %20 to i64
  %24 = getelementptr inbounds ptr, ptr %1, i64 %23
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  br label %50

26:                                               ; preds = %19
  tail call void @_ZL5usagePPc(ptr noundef nonnull %1)
  br label %.thread

27:                                               ; preds = %16
  %28 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.4) #8
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %38

30:                                               ; preds = %27
  %31 = add nsw i32 %.078110, 1
  %32 = icmp slt i32 %31, %0
  br i1 %32, label %33, label %37

33:                                               ; preds = %30
  %34 = sext i32 %31 to i64
  %35 = getelementptr inbounds ptr, ptr %1, i64 %34
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  br label %50

37:                                               ; preds = %30
  tail call void @_ZL5usagePPc(ptr noundef nonnull %1)
  br label %.thread

38:                                               ; preds = %27
  %39 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.5) #8
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %49

41:                                               ; preds = %38
  %42 = add nsw i32 %.078110, 1
  %43 = icmp slt i32 %42, %0
  br i1 %43, label %44, label %48

44:                                               ; preds = %41
  %45 = sext i32 %42 to i64
  %46 = getelementptr inbounds ptr, ptr %1, i64 %45
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  br label %50

48:                                               ; preds = %41
  tail call void @_ZL5usagePPc(ptr noundef nonnull %1)
  br label %.thread

49:                                               ; preds = %38
  tail call void @_ZL5usagePPc(ptr noundef nonnull %1)
  br label %.thread

50:                                               ; preds = %13, %10, %.lr.ph, %33, %44, %22
  %.179 = phi i32 [ %20, %22 ], [ %31, %33 ], [ %42, %44 ], [ %.078110, %.lr.ph ], [ %.078110, %10 ], [ %.078110, %13 ]
  %.172 = phi ptr [ %.071111, %22 ], [ %.071111, %33 ], [ %47, %44 ], [ %.071111, %.lr.ph ], [ %.071111, %10 ], [ %.071111, %13 ]
  %.170 = phi ptr [ %.069112, %22 ], [ %36, %33 ], [ %.069112, %44 ], [ %.069112, %.lr.ph ], [ %.069112, %10 ], [ %.069112, %13 ]
  %.168 = phi ptr [ %25, %22 ], [ %.067113, %33 ], [ %.067113, %44 ], [ %.067113, %.lr.ph ], [ %.067113, %10 ], [ %.067113, %13 ]
  %.166 = phi i32 [ %.065114, %22 ], [ %.065114, %33 ], [ %.065114, %44 ], [ 0, %.lr.ph ], [ 1, %10 ], [ 2, %13 ]
  %51 = add nsw i32 %.179, 1
  %.not = icmp slt i32 %51, %0
  br i1 %.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %50, %2
  %.071.lcssa = phi ptr [ null, %2 ], [ %.172, %50 ]
  %.069.lcssa = phi ptr [ null, %2 ], [ %.170, %50 ]
  %.067.lcssa = phi ptr [ null, %2 ], [ %.168, %50 ]
  %.065.lcssa = phi i32 [ 0, %2 ], [ %.166, %50 ]
  tail call void @ggml_backend_load_all()
  %52 = tail call i64 @ggml_backend_dev_count()
  %53 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %52)
  %54 = tail call i64 @ggml_backend_dev_count()
  %.not124 = icmp eq i64 %54, 0
  br i1 %.not124, label %._crit_edge122, label %.lr.ph121

.lr.ph121:                                        ; preds = %._crit_edge
  %cond = icmp eq ptr %.069.lcssa, null
  %55 = icmp ne i32 %.065.lcssa, 2
  br label %59

._crit_edge122:                                   ; preds = %104, %._crit_edge
  %.074.lcssa = phi i64 [ 0, %._crit_edge ], [ %.276, %104 ]
  call void @ggml_quantize_free()
  %56 = call i64 @ggml_backend_dev_count()
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, i64 noundef %.074.lcssa, i64 noundef %56)
  %58 = call i64 @ggml_backend_dev_count()
  %.not86 = icmp eq i64 %.074.lcssa, %58
  br i1 %.not86, label %109, label %107

59:                                               ; preds = %.lr.ph121, %104
  %.073119 = phi i64 [ 0, %.lr.ph121 ], [ %61, %104 ]
  %.074118 = phi i64 [ 0, %.lr.ph121 ], [ %.276, %104 ]
  %60 = call ptr @ggml_backend_dev_get(i64 noundef %.073119)
  %61 = add nuw i64 %.073119, 1
  %62 = call i64 @ggml_backend_dev_count()
  %63 = call ptr @ggml_backend_dev_name(ptr noundef %60)
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i64 noundef %61, i64 noundef %62, ptr noundef %63)
  br i1 %cond, label %71, label %65

65:                                               ; preds = %59
  %66 = call ptr @ggml_backend_dev_name(ptr noundef %60)
  %67 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %.069.lcssa, ptr noundef nonnull dereferenceable(1) %66) #8
  %.not88 = icmp eq i32 %67, 0
  br i1 %.not88, label %77, label %68

68:                                               ; preds = %65
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %70 = add i64 %.074118, 1
  br label %104

71:                                               ; preds = %59
  %72 = call i32 @ggml_backend_dev_type(ptr noundef %60)
  %73 = icmp eq i32 %72, 0
  %or.cond = select i1 %73, i1 %55, i1 false
  br i1 %or.cond, label %74, label %77

74:                                               ; preds = %71
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %76 = add i64 %.074118, 1
  br label %104

77:                                               ; preds = %65, %71
  %78 = call ptr @ggml_backend_dev_init(ptr noundef %60, ptr noundef null)
  %.not89 = icmp eq ptr %78, null
  br i1 %.not89, label %79, label %80

79:                                               ; preds = %77
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.10, i32 noundef 4745, ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12) #9
  unreachable

80:                                               ; preds = %77
  %81 = call ptr @ggml_backend_dev_backend_reg(ptr noundef %60)
  %82 = call ptr @ggml_backend_reg_get_proc_address(ptr noundef %81, ptr noundef nonnull @.str.13)
  %.not90 = icmp eq ptr %82, null
  br i1 %.not90, label %85, label %83

83:                                               ; preds = %80
  %84 = call noundef i32 @_ZNSt6thread20hardware_concurrencyEv() #10
  call void %82(ptr noundef nonnull %78, i32 noundef %84)
  br label %85

85:                                               ; preds = %83, %80
  %86 = call ptr @ggml_backend_dev_description(ptr noundef %60)
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14, ptr noundef %86)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #10
  call void @ggml_backend_dev_memory(ptr noundef %60, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %88 = load i64, ptr %4, align 8, !tbaa !11
  %89 = lshr i64 %88, 20
  %90 = load i64, ptr %3, align 8, !tbaa !11
  %91 = lshr i64 %90, 20
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i64 noundef %89, i64 noundef %91)
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %94 = call noundef zeroext i1 @_ZL12test_backendP12ggml_backend9test_modePKcS3_(ptr noundef nonnull %78, i32 noundef %.065.lcssa, ptr noundef %.067.lcssa, ptr noundef %.071.lcssa)
  %95 = call ptr @ggml_backend_name(ptr noundef nonnull %78)
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef %95)
  br i1 %94, label %97, label %100

97:                                               ; preds = %85
  %98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  %99 = add i64 %.074118, 1
  br label %102

100:                                              ; preds = %85
  %101 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19)
  br label %102

102:                                              ; preds = %100, %97
  %.175 = phi i64 [ %99, %97 ], [ %.074118, %100 ]
  %103 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  call void @ggml_backend_free(ptr noundef nonnull %78)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #10
  br label %104

104:                                              ; preds = %102, %74, %68
  %.276 = phi i64 [ %70, %68 ], [ %76, %74 ], [ %.175, %102 ]
  %105 = call i64 @ggml_backend_dev_count()
  %106 = icmp ult i64 %61, %105
  br i1 %106, label %59, label %._crit_edge122, !llvm.loop !13

107:                                              ; preds = %._crit_edge122
  %108 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19)
  br label %.thread

109:                                              ; preds = %._crit_edge122
  %110 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  br label %.thread

.thread:                                          ; preds = %26, %37, %48, %49, %107, %109
  %.2 = phi i32 [ 1, %107 ], [ 0, %109 ], [ 1, %49 ], [ 1, %48 ], [ 1, %37 ], [ 1, %26 ]
  ret i32 %.2
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL5usagePPc(ptr noundef) local_unnamed_addr #3

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

declare void @ggml_backend_load_all() local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

declare i64 @ggml_backend_dev_count() local_unnamed_addr #4

declare ptr @ggml_backend_dev_get(i64 noundef) local_unnamed_addr #4

declare ptr @ggml_backend_dev_name(ptr noundef) local_unnamed_addr #4

declare i32 @ggml_backend_dev_type(ptr noundef) local_unnamed_addr #4

declare ptr @ggml_backend_dev_init(ptr noundef, ptr noundef) local_unnamed_addr #4

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

declare ptr @ggml_backend_dev_backend_reg(ptr noundef) local_unnamed_addr #4

declare ptr @ggml_backend_reg_get_proc_address(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare noundef i32 @_ZNSt6thread20hardware_concurrencyEv() local_unnamed_addr #7

declare ptr @ggml_backend_dev_description(ptr noundef) local_unnamed_addr #4

declare void @ggml_backend_dev_memory(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZL12test_backendP12ggml_backend9test_modePKcS3_(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @ggml_backend_name(ptr noundef) local_unnamed_addr #4

declare void @ggml_backend_free(ptr noundef) local_unnamed_addr #4

declare void @ggml_quantize_free() local_unnamed_addr #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { nofree 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 #6 = { 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 #7 = { 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 #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn }
attributes #10 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !10}


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