; LLVM IR from ggml-org/ggml :: examples/magika (main)

; 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.gguf_init_params = type { i8, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.1" = type { i8 }
%struct.magika_model = type { %struct.magika_hparams, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.magika_hparams = type { i32, i32, i32, i32, i32, i32, float, i32 }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [45 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef, ptr noundef) #0

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

declare ptr @ggml_get_tensor(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(152) %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.gguf_init_params, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.gguf_init_params, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i64, align 8
  %20 = alloca %"class.std::vector", align 8
  %21 = alloca %"class.std::allocator.1", align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.magika_model, ptr %22, i32 0, i32 15
  store ptr %23, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #8
  %24 = getelementptr inbounds %struct.gguf_init_params, ptr %7, i32 0, i32 0
  store i8 1, ptr %24, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct.gguf_init_params, ptr %7, i32 0, i32 1
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %26, ptr %25, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %27) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %7, i64 16, i1 false), !tbaa.struct !13
  %29 = getelementptr inbounds { i8, ptr }, ptr %9, i32 0, i32 0
  %30 = load i8, ptr %29, align 8
  %31 = getelementptr inbounds { i8, ptr }, ptr %9, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8
  %33 = call ptr @gguf_init_from_file(ptr noundef %28, i8 %30, ptr %32)
  store ptr %33, ptr %8, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %39, label %36

36:                                               ; preds = %2
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef @.str.2, ptr noundef @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %249

39:                                               ; preds = %2
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.magika_model, ptr %42, i32 0, i32 13
  %44 = load ptr, ptr %43, align 8, !tbaa !15
  %45 = call ptr @ggml_backend_alloc_ctx_tensors(ptr noundef %41, ptr noundef %44)
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.magika_model, ptr %46, i32 0, i32 14
  store ptr %45, ptr %47, align 8, !tbaa !20
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.magika_model, ptr %48, i32 0, i32 14
  %50 = load ptr, ptr %49, align 8, !tbaa !20
  %51 = icmp ne ptr %50, null
  br i1 %51, label %56, label %52

52:                                               ; preds = %39
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.3, ptr noundef @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  call void @gguf_free(ptr noundef %55)
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %249

56:                                               ; preds = %39
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %58, ptr noundef @.str.4)
          to label %60 unwind label %129

60:                                               ; preds = %56
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.magika_model, ptr %61, i32 0, i32 1
  store ptr %59, ptr %62, align 8, !tbaa !21
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %64, ptr noundef @.str.5)
          to label %66 unwind label %129

66:                                               ; preds = %60
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.magika_model, ptr %67, i32 0, i32 2
  store ptr %65, ptr %68, align 8, !tbaa !22
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %70, ptr noundef @.str.6)
          to label %72 unwind label %129

72:                                               ; preds = %66
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.magika_model, ptr %73, i32 0, i32 3
  store ptr %71, ptr %74, align 8, !tbaa !23
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  %77 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %76, ptr noundef @.str.7)
          to label %78 unwind label %129

78:                                               ; preds = %72
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.magika_model, ptr %79, i32 0, i32 4
  store ptr %77, ptr %80, align 8, !tbaa !24
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %82, ptr noundef @.str.8)
          to label %84 unwind label %129

84:                                               ; preds = %78
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.magika_model, ptr %85, i32 0, i32 5
  store ptr %83, ptr %86, align 8, !tbaa !25
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load ptr, ptr %87, align 8, !tbaa !5
  %89 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %88, ptr noundef @.str.9)
          to label %90 unwind label %129

90:                                               ; preds = %84
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.magika_model, ptr %91, i32 0, i32 6
  store ptr %89, ptr %92, align 8, !tbaa !26
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  %95 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %94, ptr noundef @.str.10)
          to label %96 unwind label %129

96:                                               ; preds = %90
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.magika_model, ptr %97, i32 0, i32 7
  store ptr %95, ptr %98, align 8, !tbaa !27
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load ptr, ptr %99, align 8, !tbaa !5
  %101 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %100, ptr noundef @.str.11)
          to label %102 unwind label %129

102:                                              ; preds = %96
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.magika_model, ptr %103, i32 0, i32 8
  store ptr %101, ptr %104, align 8, !tbaa !28
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = load ptr, ptr %105, align 8, !tbaa !5
  %107 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %106, ptr noundef @.str.12)
          to label %108 unwind label %129

108:                                              ; preds = %102
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.magika_model, ptr %109, i32 0, i32 9
  store ptr %107, ptr %110, align 8, !tbaa !29
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = load ptr, ptr %111, align 8, !tbaa !5
  %113 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %112, ptr noundef @.str.13)
          to label %114 unwind label %129

114:                                              ; preds = %108
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.magika_model, ptr %115, i32 0, i32 10
  store ptr %113, ptr %116, align 8, !tbaa !30
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = load ptr, ptr %117, align 8, !tbaa !5
  %119 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %118, ptr noundef @.str.14)
          to label %120 unwind label %129

120:                                              ; preds = %114
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.magika_model, ptr %121, i32 0, i32 11
  store ptr %119, ptr %122, align 8, !tbaa !31
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  %125 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %124, ptr noundef @.str.15)
          to label %126 unwind label %129

126:                                              ; preds = %120
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.magika_model, ptr %127, i32 0, i32 12
  store ptr %125, ptr %128, align 8, !tbaa !32
  br label %154

129:                                              ; preds = %120, %114, %108, %102, %96, %90, %84, %78, %72, %66, %60, %56
  %130 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %11, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %12, align 4
  br label %133

133:                                              ; preds = %129
  %134 = load i32, ptr %12, align 4
  %135 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #8
  %136 = icmp eq i32 %134, %135
  br i1 %136, label %137, label %251

137:                                              ; preds = %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %138 = load ptr, ptr %11, align 8
  %139 = call ptr @__cxa_begin_catch(ptr %138) #8
  store ptr %139, ptr %13, align 8
  %140 = load ptr, ptr @stderr, align 8, !tbaa !5
  %141 = load ptr, ptr %13, align 8, !tbaa !5
  %142 = load ptr, ptr %141, align 8, !tbaa !33
  %143 = getelementptr inbounds ptr, ptr %142, i64 2
  %144 = load ptr, ptr %143, align 8
  %145 = call noundef ptr %144(ptr noundef nonnull align 8 dereferenceable(8) %141) #8
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %140, ptr noundef @.str.16, ptr noundef @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model, ptr noundef %145) #8
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @gguf_free(ptr noundef %147)
          to label %148 unwind label %149

148:                                              ; preds = %137
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  call void @__cxa_end_catch()
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %249

149:                                              ; preds = %137
  %150 = landingpad { ptr, i32 }
          cleanup
  %151 = extractvalue { ptr, i32 } %150, 0
  store ptr %151, ptr %11, align 8
  %152 = extractvalue { ptr, i32 } %150, 1
  store i32 %152, ptr %12, align 4
  invoke void @__cxa_end_catch()
          to label %153 unwind label %257

153:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %251

154:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %155 = load ptr, ptr %4, align 8, !tbaa !5
  %156 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %155) #8
  %157 = call noalias ptr @fopen(ptr noundef %156, ptr noundef @.str.17)
  store ptr %157, ptr %14, align 8, !tbaa !5
  %158 = load ptr, ptr %14, align 8, !tbaa !5
  %159 = icmp ne ptr %158, null
  br i1 %159, label %164, label %160

160:                                              ; preds = %154
  %161 = load ptr, ptr @stderr, align 8, !tbaa !5
  %162 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %161, ptr noundef @.str.18, ptr noundef @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  %163 = load ptr, ptr %8, align 8, !tbaa !5
  call void @gguf_free(ptr noundef %163)
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %248

164:                                              ; preds = %154
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  %166 = call i64 @gguf_get_n_tensors(ptr noundef %165)
  %167 = trunc i64 %166 to i32
  store i32 %167, ptr %15, align 4, !tbaa !35
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !35
  br label %168

168:                                              ; preds = %237, %164
  %169 = load i32, ptr %16, align 4, !tbaa !35
  %170 = load i32, ptr %15, align 4, !tbaa !35
  %171 = icmp slt i32 %169, %170
  br i1 %171, label %173, label %172

172:                                              ; preds = %168
  store i32 2, ptr %10, align 4
  br label %241

173:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %174 = load ptr, ptr %8, align 8, !tbaa !5
  %175 = load i32, ptr %16, align 4, !tbaa !35
  %176 = sext i32 %175 to i64
  %177 = call ptr @gguf_get_tensor_name(ptr noundef %174, i64 noundef %176)
  store ptr %177, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = load ptr, ptr %178, align 8, !tbaa !5
  %180 = load ptr, ptr %17, align 8, !tbaa !5
  %181 = call ptr @ggml_get_tensor(ptr noundef %179, ptr noundef %180)
  store ptr %181, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %182 = load ptr, ptr %8, align 8, !tbaa !5
  %183 = call i64 @gguf_get_data_offset(ptr noundef %182)
  %184 = load ptr, ptr %8, align 8, !tbaa !5
  %185 = load i32, ptr %16, align 4, !tbaa !35
  %186 = sext i32 %185 to i64
  %187 = call i64 @gguf_get_tensor_offset(ptr noundef %184, i64 noundef %186)
  %188 = add i64 %183, %187
  store i64 %188, ptr %19, align 8, !tbaa !36
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #8
  %189 = load ptr, ptr %18, align 8, !tbaa !5
  %190 = call i64 @ggml_nbytes(ptr noundef %189)
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #8
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #8
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %190, ptr noundef nonnull align 1 dereferenceable(1) %21)
          to label %191 unwind label %205

191:                                              ; preds = %173
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #8
  %192 = load ptr, ptr %14, align 8, !tbaa !5
  %193 = load i64, ptr %19, align 8, !tbaa !36
  %194 = invoke i32 @fseek(ptr noundef %192, i64 noundef %193, i32 noundef 0)
          to label %195 unwind label %209

195:                                              ; preds = %191
  %196 = icmp ne i32 %194, 0
  br i1 %196, label %197, label %213

197:                                              ; preds = %195
  %198 = load ptr, ptr @stderr, align 8, !tbaa !5
  %199 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %198, ptr noundef @.str.19, ptr noundef @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  %200 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @gguf_free(ptr noundef %200)
          to label %201 unwind label %209

201:                                              ; preds = %197
  %202 = load ptr, ptr %14, align 8, !tbaa !5
  %203 = invoke i32 @fclose(ptr noundef %202)
          to label %204 unwind label %209

204:                                              ; preds = %201
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %234

205:                                              ; preds = %173
  %206 = landingpad { ptr, i32 }
          cleanup
  %207 = extractvalue { ptr, i32 } %206, 0
  store ptr %207, ptr %11, align 8
  %208 = extractvalue { ptr, i32 } %206, 1
  store i32 %208, ptr %12, align 4
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %21) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #8
  br label %240

209:                                              ; preds = %229, %225, %221, %213, %201, %197, %191
  %210 = landingpad { ptr, i32 }
          cleanup
  %211 = extractvalue { ptr, i32 } %210, 0
  store ptr %211, ptr %11, align 8
  %212 = extractvalue { ptr, i32 } %210, 1
  store i32 %212, ptr %12, align 4
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  br label %240

213:                                              ; preds = %195
  %214 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  %215 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  %216 = load ptr, ptr %14, align 8, !tbaa !5
  %217 = invoke i64 @fread(ptr noundef %214, i64 noundef 1, i64 noundef %215, ptr noundef %216)
          to label %218 unwind label %209

218:                                              ; preds = %213
  %219 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  %220 = icmp ne i64 %217, %219
  br i1 %220, label %221, label %229

221:                                              ; preds = %218
  %222 = load ptr, ptr @stderr, align 8, !tbaa !5
  %223 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %222, ptr noundef @.str.20, ptr noundef @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  %224 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @gguf_free(ptr noundef %224)
          to label %225 unwind label %209

225:                                              ; preds = %221
  %226 = load ptr, ptr %14, align 8, !tbaa !5
  %227 = invoke i32 @fclose(ptr noundef %226)
          to label %228 unwind label %209

228:                                              ; preds = %225
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %234

229:                                              ; preds = %218
  %230 = load ptr, ptr %18, align 8, !tbaa !5
  %231 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  %232 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  invoke void @ggml_backend_tensor_set(ptr noundef %230, ptr noundef %231, i64 noundef 0, i64 noundef %232)
          to label %233 unwind label %209

233:                                              ; preds = %229
  store i32 0, ptr %10, align 4
  br label %234

234:                                              ; preds = %233, %228, %204
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  %235 = load i32, ptr %10, align 4
  switch i32 %235, label %241 [
    i32 0, label %236
  ]

236:                                              ; preds = %234
  br label %237

237:                                              ; preds = %236
  %238 = load i32, ptr %16, align 4, !tbaa !35
  %239 = add nsw i32 %238, 1
  store i32 %239, ptr %16, align 4, !tbaa !35
  br label %168, !llvm.loop !38

240:                                              ; preds = %209, %205
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %251

241:                                              ; preds = %234, %172
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  %242 = load i32, ptr %10, align 4
  switch i32 %242, label %247 [
    i32 2, label %243
  ]

243:                                              ; preds = %241
  %244 = load ptr, ptr %14, align 8, !tbaa !5
  %245 = call i32 @fclose(ptr noundef %244)
  %246 = load ptr, ptr %8, align 8, !tbaa !5
  call void @gguf_free(ptr noundef %246)
  store i1 true, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %247

247:                                              ; preds = %243, %241
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %248

248:                                              ; preds = %247, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %249

249:                                              ; preds = %248, %148, %52, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %250 = load i1, ptr %3, align 1
  ret i1 %250

251:                                              ; preds = %240, %153, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  br label %252

252:                                              ; preds = %251
  %253 = load ptr, ptr %11, align 8
  %254 = load i32, ptr %12, align 4
  %255 = insertvalue { ptr, i32 } poison, ptr %253, 0
  %256 = insertvalue { ptr, i32 } %255, i32 %254, 1
  resume { ptr, i32 } %256

257:                                              ; preds = %149
  %258 = landingpad { ptr, i32 }
          catch ptr null
  %259 = extractvalue { ptr, i32 } %258, 0
  call void @__clang_call_terminate(ptr %259) #9
  unreachable
}

declare ptr @gguf_init_from_file(ptr noundef, i8, ptr) #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; 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) #5

declare ptr @ggml_backend_alloc_ctx_tensors(ptr noundef, ptr noundef) #2

declare void @gguf_free(ptr noundef) #2

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #6

declare ptr @__cxa_begin_catch(ptr)

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #7

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

declare i64 @gguf_get_n_tensors(ptr noundef) #2

declare ptr @gguf_get_tensor_name(ptr noundef, i64 noundef) #2

declare i64 @gguf_get_data_offset(ptr noundef) #2

declare i64 @gguf_get_tensor_offset(ptr noundef, i64 noundef) #2

declare i64 @ggml_nbytes(ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #2

declare i32 @fclose(ptr noundef) #2

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

declare void @ggml_backend_tensor_set(ptr noundef, ptr noundef, i64 noundef, i64 noundef) #2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS16gguf_init_params", !11, i64 0, !6, i64 8}
!11 = !{!"bool", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{i64 0, i64 1, !14, i64 8, i64 8, !5}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !6, i64 128}
!16 = !{!"_ZTS12magika_model", !17, i64 0, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144}
!17 = !{!"_ZTS14magika_hparams", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16, !18, i64 20, !19, i64 24, !18, i64 28}
!18 = !{!"int", !7, i64 0}
!19 = !{!"float", !7, i64 0}
!20 = !{!16, !6, i64 136}
!21 = !{!16, !6, i64 32}
!22 = !{!16, !6, i64 40}
!23 = !{!16, !6, i64 48}
!24 = !{!16, !6, i64 56}
!25 = !{!16, !6, i64 64}
!26 = !{!16, !6, i64 72}
!27 = !{!16, !6, i64 80}
!28 = !{!16, !6, i64 88}
!29 = !{!16, !6, i64 96}
!30 = !{!16, !6, i64 104}
!31 = !{!16, !6, i64 112}
!32 = !{!16, !6, i64 120}
!33 = !{!34, !34, i64 0}
!34 = !{!"vtable pointer", !8, i64 0}
!35 = !{!18, !18, i64 0}
!36 = !{!37, !37, i64 0}
!37 = !{!"long", !7, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator.1" = type { i8 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1
@__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [45 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef, ptr noundef) local_unnamed_addr #0

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

declare ptr @ggml_get_tensor(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(152) %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::allocator.1", align 1
  %5 = getelementptr inbounds i8, ptr %1, i64 144
  %6 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #7
  %7 = tail call ptr @gguf_init_from_file(ptr noundef %6, i8 1, ptr nonnull %5)
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %8, label %11

8:                                                ; preds = %2
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  br label %120

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %1, i64 128
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = tail call ptr @ggml_backend_alloc_ctx_tensors(ptr noundef %12, ptr noundef %14)
  %16 = getelementptr inbounds i8, ptr %1, i64 136
  store ptr %15, ptr %16, align 8, !tbaa !14
  %.not79 = icmp eq ptr %15, null
  br i1 %.not79, label %17, label %20

17:                                               ; preds = %11
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  tail call void @gguf_free(ptr noundef nonnull %7)
  br label %120

20:                                               ; preds = %11
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %21, ptr noundef nonnull @.str.4)
          to label %23 unwind label %71

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr %22, ptr %24, align 8, !tbaa !15
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %25, ptr noundef nonnull @.str.5)
          to label %27 unwind label %71

27:                                               ; preds = %23
  %28 = getelementptr inbounds i8, ptr %1, i64 40
  store ptr %26, ptr %28, align 8, !tbaa !16
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %29, ptr noundef nonnull @.str.6)
          to label %31 unwind label %71

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %1, i64 48
  store ptr %30, ptr %32, align 8, !tbaa !17
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %33, ptr noundef nonnull @.str.7)
          to label %35 unwind label %71

35:                                               ; preds = %31
  %36 = getelementptr inbounds i8, ptr %1, i64 56
  store ptr %34, ptr %36, align 8, !tbaa !18
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %37, ptr noundef nonnull @.str.8)
          to label %39 unwind label %71

39:                                               ; preds = %35
  %40 = getelementptr inbounds i8, ptr %1, i64 64
  store ptr %38, ptr %40, align 8, !tbaa !19
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %41, ptr noundef nonnull @.str.9)
          to label %43 unwind label %71

43:                                               ; preds = %39
  %44 = getelementptr inbounds i8, ptr %1, i64 72
  store ptr %42, ptr %44, align 8, !tbaa !20
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %45, ptr noundef nonnull @.str.10)
          to label %47 unwind label %71

47:                                               ; preds = %43
  %48 = getelementptr inbounds i8, ptr %1, i64 80
  store ptr %46, ptr %48, align 8, !tbaa !21
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %49, ptr noundef nonnull @.str.11)
          to label %51 unwind label %71

51:                                               ; preds = %47
  %52 = getelementptr inbounds i8, ptr %1, i64 88
  store ptr %50, ptr %52, align 8, !tbaa !22
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %53, ptr noundef nonnull @.str.12)
          to label %55 unwind label %71

55:                                               ; preds = %51
  %56 = getelementptr inbounds i8, ptr %1, i64 96
  store ptr %54, ptr %56, align 8, !tbaa !23
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %57, ptr noundef nonnull @.str.13)
          to label %59 unwind label %71

59:                                               ; preds = %55
  %60 = getelementptr inbounds i8, ptr %1, i64 104
  store ptr %58, ptr %60, align 8, !tbaa !24
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %61, ptr noundef nonnull @.str.14)
          to label %63 unwind label %71

63:                                               ; preds = %59
  %64 = getelementptr inbounds i8, ptr %1, i64 112
  store ptr %62, ptr %64, align 8, !tbaa !25
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = invoke noundef ptr @_Z18checked_get_tensorP12ggml_contextPKc(ptr noundef %65, ptr noundef nonnull @.str.15)
          to label %67 unwind label %71

67:                                               ; preds = %63
  %68 = getelementptr inbounds i8, ptr %1, i64 120
  store ptr %66, ptr %68, align 8, !tbaa !26
  %69 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #7
  %70 = tail call noalias ptr @fopen(ptr noundef %69, ptr noundef nonnull @.str.17)
  %.not80 = icmp eq ptr %70, null
  br i1 %.not80, label %88, label %91

71:                                               ; preds = %63, %59, %55, %51, %47, %43, %39, %35, %31, %27, %23, %20
  %72 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTISt9exception
  %73 = extractvalue { ptr, i32 } %72, 1
  %74 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #7
  %75 = icmp eq i32 %73, %74
  br i1 %75, label %76, label %121

76:                                               ; preds = %71
  %77 = extractvalue { ptr, i32 } %72, 0
  %78 = tail call ptr @__cxa_begin_catch(ptr %77) #7
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = load ptr, ptr %78, align 8, !tbaa !27
  %81 = getelementptr inbounds i8, ptr %80, i64 16
  %82 = load ptr, ptr %81, align 8
  %83 = tail call noundef ptr %82(ptr noundef nonnull align 8 dereferenceable(8) %78) #7
  %84 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef nonnull @.str.16, ptr noundef nonnull @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model, ptr noundef %83) #8
  invoke void @gguf_free(ptr noundef nonnull %7)
          to label %85 unwind label %86

85:                                               ; preds = %76
  tail call void @__cxa_end_catch()
  br label %120

86:                                               ; preds = %76
  %87 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %121 unwind label %122

88:                                               ; preds = %67
  %89 = load ptr, ptr @stderr, align 8, !tbaa !5
  %90 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef nonnull @.str.18, ptr noundef nonnull @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  tail call void @gguf_free(ptr noundef nonnull %7)
  br label %120

91:                                               ; preds = %67
  %92 = tail call i64 @gguf_get_n_tensors(ptr noundef nonnull %7)
  %93 = trunc i64 %92 to i32
  %.not84.not87 = icmp sgt i32 %93, 0
  br i1 %.not84.not87, label %.lr.ph.preheader, label %.critedge86

.lr.ph.preheader:                                 ; preds = %91
  %wide.trip.count = and i64 %92, 2147483647
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %116
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %116 ]
  %94 = call ptr @gguf_get_tensor_name(ptr noundef nonnull %7, i64 noundef %indvars.iv)
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = call ptr @ggml_get_tensor(ptr noundef %95, ptr noundef %94)
  %97 = call i64 @gguf_get_data_offset(ptr noundef nonnull %7)
  %98 = call i64 @gguf_get_tensor_offset(ptr noundef nonnull %7, i64 noundef %indvars.iv)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  %99 = call i64 @ggml_nbytes(ptr noundef %96)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #7
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %99, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %100 unwind label %105

100:                                              ; preds = %.lr.ph
  %101 = add i64 %98, %97
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  %102 = call i32 @fseek(ptr noundef nonnull %70, i64 noundef %101, i32 noundef 0)
  %.not81 = icmp eq i32 %102, 0
  br i1 %.not81, label %108, label %.invoke

.invoke:                                          ; preds = %100, %108
  %.str.20.sink = phi ptr [ @.str.20, %108 ], [ @.str.19, %100 ]
  %103 = load ptr, ptr @stderr, align 8, !tbaa !5
  %104 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef nonnull %.str.20.sink, ptr noundef nonnull @__func__._Z17magika_model_loadRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEER12magika_model) #8
  invoke void @gguf_free(ptr noundef nonnull %7)
          to label %.critedge unwind label %.loopexit.split-lp

105:                                              ; preds = %.lr.ph
  %106 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #7
  br label %117

.loopexit:                                        ; preds = %113
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %107

.loopexit.split-lp:                               ; preds = %.invoke
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %107

107:                                              ; preds = %.loopexit.split-lp, %.loopexit
  %lpad.phi = phi { ptr, i32 } [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  br label %117

108:                                              ; preds = %100
  %109 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %110 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %111 = call i64 @fread(ptr noundef %109, i64 noundef 1, i64 noundef %110, ptr noundef nonnull %70)
  %112 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %.not82 = icmp eq i64 %111, %112
  br i1 %.not82, label %113, label %.invoke

113:                                              ; preds = %108
  %114 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %115 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  invoke void @ggml_backend_tensor_set(ptr noundef %96, ptr noundef %114, i64 noundef 0, i64 noundef %115)
          to label %116 unwind label %.loopexit

116:                                              ; preds = %113
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge86, label %.lr.ph, !llvm.loop !29

117:                                              ; preds = %107, %105
  %.pn = phi { ptr, i32 } [ %lpad.phi, %107 ], [ %106, %105 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  br label %121

.critedge:                                        ; preds = %.invoke
  %118 = call i32 @fclose(ptr noundef nonnull %70)
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  br label %120

.critedge86:                                      ; preds = %116, %91
  %119 = call i32 @fclose(ptr noundef nonnull %70)
  call void @gguf_free(ptr noundef nonnull %7)
  br label %120

120:                                              ; preds = %.critedge, %88, %.critedge86, %85, %17, %8
  %.5 = phi i1 [ false, %85 ], [ false, %17 ], [ false, %8 ], [ false, %88 ], [ false, %.critedge ], [ true, %.critedge86 ]
  ret i1 %.5

121:                                              ; preds = %86, %117, %71
  %.merged = phi { ptr, i32 } [ %.pn, %117 ], [ %72, %71 ], [ %87, %86 ]
  resume { ptr, i32 } %.merged

122:                                              ; preds = %86
  %123 = landingpad { ptr, i32 }
          catch ptr null
  %124 = extractvalue { ptr, i32 } %123, 0
  tail call void @__clang_call_terminate(ptr %124) #9
  unreachable
}

declare ptr @gguf_init_from_file(ptr noundef, i8, ptr) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4 align 2

declare ptr @ggml_backend_alloc_ctx_tensors(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @gguf_free(ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #5

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

declare i64 @gguf_get_n_tensors(ptr noundef) local_unnamed_addr #2

declare ptr @gguf_get_tensor_name(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i64 @gguf_get_data_offset(ptr noundef) local_unnamed_addr #2

declare i64 @gguf_get_tensor_offset(ptr noundef, i64 noundef) local_unnamed_addr #2

declare i64 @ggml_nbytes(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

declare void @ggml_backend_tensor_set(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 128}
!10 = !{!"_ZTS12magika_model", !11, i64 0, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144}
!11 = !{!"_ZTS14magika_hparams", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !13, i64 24, !12, i64 28}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!10, !6, i64 136}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !6, i64 56}
!19 = !{!10, !6, i64 64}
!20 = !{!10, !6, i64 72}
!21 = !{!10, !6, i64 80}
!22 = !{!10, !6, i64 88}
!23 = !{!10, !6, i64 96}
!24 = !{!10, !6, i64 104}
!25 = !{!10, !6, i64 112}
!26 = !{!10, !6, i64 120}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !8, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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