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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.ggml_init_params = type { i64, ptr, i8 }
%struct.ggml_opt_dataset = type { ptr, ptr, ptr, ptr, i64, i64, i64, i64, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [64 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local ptr @ggml_opt_dataset_init(i64 noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %struct.ggml_init_params, align 8
  %11 = alloca %struct.ggml_init_params, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  store i64 %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !5
  store i64 %3, ptr %8, align 8, !tbaa !5
  %14 = load i64, ptr %5, align 8, !tbaa !5
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %4
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str, i32 noundef 77, ptr noundef @.str.1, ptr noundef @.str.2) #8
  unreachable

17:                                               ; preds = %4
  %18 = load i64, ptr %6, align 8, !tbaa !5
  %19 = icmp sge i64 %18, 0
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str, i32 noundef 78, ptr noundef @.str.1, ptr noundef @.str.3) #8
  unreachable

21:                                               ; preds = %17
  %22 = load i64, ptr %7, align 8, !tbaa !5
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str, i32 noundef 79, ptr noundef @.str.1, ptr noundef @.str.4) #8
  unreachable

25:                                               ; preds = %21
  %26 = load i64, ptr %8, align 8, !tbaa !5
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str, i32 noundef 80, ptr noundef @.str.1, ptr noundef @.str.5) #8
  unreachable

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %30 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 88) #10
  call void @_ZN16ggml_opt_datasetC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %30) #9
  store ptr %30, ptr %9, align 8, !tbaa !9
  %31 = load i64, ptr %7, align 8, !tbaa !5
  %32 = load ptr, ptr %9, align 8, !tbaa !9
  %33 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %32, i32 0, i32 4
  store i64 %31, ptr %33, align 8, !tbaa !11
  %34 = load i64, ptr %8, align 8, !tbaa !5
  %35 = load ptr, ptr %9, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %35, i32 0, i32 5
  store i64 %34, ptr %36, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #9
  %37 = getelementptr inbounds %struct.ggml_init_params, ptr %10, i32 0, i32 0
  %38 = call i64 @ggml_tensor_overhead()
  %39 = mul i64 2, %38
  store i64 %39, ptr %37, align 8, !tbaa !18
  %40 = getelementptr inbounds %struct.ggml_init_params, ptr %10, i32 0, i32 1
  store ptr null, ptr %40, align 8, !tbaa !21
  %41 = getelementptr inbounds %struct.ggml_init_params, ptr %10, i32 0, i32 2
  store i8 1, ptr %41, align 8, !tbaa !22
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %10, i64 24, i1 false), !tbaa.struct !23
  %42 = call ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %11)
  %43 = load ptr, ptr %9, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %43, i32 0, i32 0
  store ptr %42, ptr %44, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #9
  %45 = load ptr, ptr %9, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %45, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !25
  %48 = load i64, ptr %5, align 8, !tbaa !5
  %49 = load i64, ptr %7, align 8, !tbaa !5
  %50 = call ptr @ggml_new_tensor_2d(ptr noundef %47, i32 noundef 0, i64 noundef %48, i64 noundef %49)
  %51 = load ptr, ptr %9, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %51, i32 0, i32 2
  store ptr %50, ptr %52, align 8, !tbaa !26
  %53 = load ptr, ptr %9, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %53, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !26
  %56 = call i64 @ggml_nbytes(ptr noundef %55)
  %57 = load i64, ptr %8, align 8, !tbaa !5
  %58 = mul i64 %56, %57
  %59 = load i64, ptr %7, align 8, !tbaa !5
  %60 = udiv i64 %58, %59
  %61 = load ptr, ptr %9, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %61, i32 0, i32 6
  store i64 %60, ptr %62, align 8, !tbaa !27
  %63 = load i64, ptr %6, align 8, !tbaa !5
  %64 = icmp sgt i64 %63, 0
  br i1 %64, label %65, label %84

65:                                               ; preds = %29
  %66 = load ptr, ptr %9, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !25
  %69 = load i64, ptr %6, align 8, !tbaa !5
  %70 = load i64, ptr %7, align 8, !tbaa !5
  %71 = call ptr @ggml_new_tensor_2d(ptr noundef %68, i32 noundef 0, i64 noundef %69, i64 noundef %70)
  %72 = load ptr, ptr %9, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %72, i32 0, i32 3
  store ptr %71, ptr %73, align 8, !tbaa !28
  %74 = load ptr, ptr %9, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %74, i32 0, i32 3
  %76 = load ptr, ptr %75, align 8, !tbaa !28
  %77 = call i64 @ggml_nbytes(ptr noundef %76)
  %78 = load i64, ptr %8, align 8, !tbaa !5
  %79 = mul i64 %77, %78
  %80 = load i64, ptr %7, align 8, !tbaa !5
  %81 = udiv i64 %79, %80
  %82 = load ptr, ptr %9, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %82, i32 0, i32 7
  store i64 %81, ptr %83, align 8, !tbaa !29
  br label %89

84:                                               ; preds = %29
  %85 = load ptr, ptr %9, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %85, i32 0, i32 3
  store ptr null, ptr %86, align 8, !tbaa !28
  %87 = load ptr, ptr %9, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %87, i32 0, i32 7
  store i64 0, ptr %88, align 8, !tbaa !29
  br label %89

89:                                               ; preds = %84, %65
  %90 = load ptr, ptr %9, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !25
  %93 = call ptr @ggml_backend_cpu_buffer_type()
  %94 = call ptr @ggml_backend_alloc_ctx_tensors_from_buft(ptr noundef %92, ptr noundef %93)
  %95 = load ptr, ptr %9, align 8, !tbaa !9
  %96 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %95, i32 0, i32 1
  store ptr %94, ptr %96, align 8, !tbaa !30
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  %97 = load i64, ptr %7, align 8, !tbaa !5
  %98 = load i64, ptr %8, align 8, !tbaa !5
  %99 = sdiv i64 %97, %98
  store i64 %99, ptr %12, align 8, !tbaa !5
  %100 = load ptr, ptr %9, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %100, i32 0, i32 8
  %102 = load i64, ptr %12, align 8, !tbaa !5
  call void @_ZNSt6vectorIlSaIlEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %101, i64 noundef %102)
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #9
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %103

103:                                              ; preds = %114, %89
  %104 = load i64, ptr %13, align 8, !tbaa !5
  %105 = load i64, ptr %12, align 8, !tbaa !5
  %106 = icmp slt i64 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #9
  br label %117

108:                                              ; preds = %103
  %109 = load i64, ptr %13, align 8, !tbaa !5
  %110 = load ptr, ptr %9, align 8, !tbaa !9
  %111 = getelementptr inbounds %struct.ggml_opt_dataset, ptr %110, i32 0, i32 8
  %112 = load i64, ptr %13, align 8, !tbaa !5
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %111, i64 noundef %112) #9
  store i64 %109, ptr %113, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %108
  %115 = load i64, ptr %13, align 8, !tbaa !5
  %116 = add nsw i64 %115, 1
  store i64 %116, ptr %13, align 8, !tbaa !5
  br label %103, !llvm.loop !31

117:                                              ; preds = %107
  %118 = load ptr, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  ret ptr %118
}

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #3

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

declare i64 @ggml_tensor_overhead() #5

declare ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8) #5

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

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

declare ptr @ggml_new_tensor_2d(ptr noundef, i32 noundef, i64 noundef, i64 noundef) #5

declare i64 @ggml_nbytes(ptr noundef) #5

declare ptr @ggml_backend_alloc_ctx_tensors_from_buft(ptr noundef, ptr noundef) #5

declare ptr @ggml_backend_cpu_buffer_type() #5

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #7 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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { noreturn }
attributes #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }

!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 = !{!"long", !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, !6, i64 32}
!12 = !{!"_ZTS16ggml_opt_dataset", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !13, i64 64}
!13 = !{!"_ZTSSt6vectorIlSaIlEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIlSaIlEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!17 = !{!12, !6, i64 40}
!18 = !{!19, !6, i64 0}
!19 = !{!"_ZTS16ggml_init_params", !6, i64 0, !10, i64 8, !20, i64 16}
!20 = !{!"bool", !7, i64 0}
!21 = !{!19, !10, i64 8}
!22 = !{!19, !20, i64 16}
!23 = !{i64 0, i64 8, !5, i64 8, i64 8, !9, i64 16, i64 1, !24}
!24 = !{!20, !20, i64 0}
!25 = !{!12, !10, i64 0}
!26 = !{!12, !10, i64 16}
!27 = !{!12, !6, i64 48}
!28 = !{!12, !10, i64 24}
!29 = !{!12, !6, i64 56}
!30 = !{!12, !10, i64 8}
!31 = distinct !{!31, !32}
!32 = !{!"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"

%struct.ggml_init_params = type { i64, ptr, i8 }

@.str = external hidden unnamed_addr constant [64 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef nonnull ptr @ggml_opt_dataset_init(i64 noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3) local_unnamed_addr #0 {
  %5 = alloca %struct.ggml_init_params, align 8
  %6 = icmp sgt i64 %0, 0
  br i1 %6, label %8, label %7

7:                                                ; preds = %4
  tail call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str, i32 noundef 77, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2) #6
  unreachable

8:                                                ; preds = %4
  %9 = icmp sgt i64 %1, -1
  br i1 %9, label %11, label %10

10:                                               ; preds = %8
  tail call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str, i32 noundef 78, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.3) #6
  unreachable

11:                                               ; preds = %8
  %12 = icmp sgt i64 %2, 0
  br i1 %12, label %14, label %13

13:                                               ; preds = %11
  tail call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str, i32 noundef 79, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.4) #6
  unreachable

14:                                               ; preds = %11
  %15 = icmp sgt i64 %3, 0
  br i1 %15, label %17, label %16

16:                                               ; preds = %14
  tail call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str, i32 noundef 80, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.5) #6
  unreachable

17:                                               ; preds = %14
  %18 = tail call noalias noundef nonnull dereferenceable(88) ptr @_Znwm(i64 noundef 88) #7
  tail call void @_ZN16ggml_opt_datasetC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %18) #8
  %19 = getelementptr inbounds i8, ptr %18, i64 32
  store i64 %2, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %18, i64 40
  store i64 %3, ptr %20, align 8, !tbaa !15
  %21 = tail call i64 @ggml_tensor_overhead()
  %22 = shl i64 %21, 1
  store i64 %22, ptr %5, align 8, !tbaa !16
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  store ptr null, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !17
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 16
  store i8 1, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !18
  %23 = tail call ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %5)
  store ptr %23, ptr %18, align 8, !tbaa !20
  %24 = tail call ptr @ggml_new_tensor_2d(ptr noundef %23, i32 noundef 0, i64 noundef %0, i64 noundef %2)
  %25 = getelementptr inbounds i8, ptr %18, i64 16
  store ptr %24, ptr %25, align 8, !tbaa !21
  %26 = tail call i64 @ggml_nbytes(ptr noundef %24)
  %27 = mul i64 %26, %3
  %28 = udiv i64 %27, %2
  %29 = getelementptr inbounds i8, ptr %18, i64 48
  store i64 %28, ptr %29, align 8, !tbaa !22
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %37, label %30

30:                                               ; preds = %17
  %31 = load ptr, ptr %18, align 8, !tbaa !20
  %32 = tail call ptr @ggml_new_tensor_2d(ptr noundef %31, i32 noundef 0, i64 noundef %1, i64 noundef %2)
  %33 = getelementptr inbounds i8, ptr %18, i64 24
  store ptr %32, ptr %33, align 8, !tbaa !23
  %34 = tail call i64 @ggml_nbytes(ptr noundef %32)
  %35 = mul i64 %34, %3
  %36 = udiv i64 %35, %2
  br label %39

37:                                               ; preds = %17
  %38 = getelementptr inbounds i8, ptr %18, i64 24
  store ptr null, ptr %38, align 8, !tbaa !23
  br label %39

39:                                               ; preds = %37, %30
  %.sink = phi i64 [ 0, %37 ], [ %36, %30 ]
  %40 = getelementptr inbounds i8, ptr %18, i64 56
  store i64 %.sink, ptr %40, align 8
  %41 = load ptr, ptr %18, align 8, !tbaa !20
  %42 = tail call ptr @ggml_backend_cpu_buffer_type()
  %43 = tail call ptr @ggml_backend_alloc_ctx_tensors_from_buft(ptr noundef %41, ptr noundef %42)
  %44 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %43, ptr %44, align 8, !tbaa !24
  %45 = udiv i64 %2, %3
  %46 = getelementptr inbounds i8, ptr %18, i64 64
  tail call void @_ZNSt6vectorIlSaIlEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %45)
  %.not45 = icmp ugt i64 %3, %2
  br i1 %.not45, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %39
  ret ptr %18

.lr.ph:                                           ; preds = %39, %.lr.ph
  %.044 = phi i64 [ %48, %.lr.ph ], [ 0, %39 ]
  %47 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %.044) #8
  store i64 %.044, ptr %47, align 8, !tbaa !16
  %48 = add nuw nsw i64 %.044, 1
  %49 = icmp slt i64 %48, %45
  br i1 %49, label %.lr.ph, label %._crit_edge, !llvm.loop !25
}

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN16ggml_opt_datasetC2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #3 align 2

declare i64 @ggml_tensor_overhead() local_unnamed_addr #4

declare ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8) local_unnamed_addr #4

declare ptr @ggml_new_tensor_2d(ptr noundef, i32 noundef, i64 noundef, i64 noundef) local_unnamed_addr #4

declare i64 @ggml_nbytes(ptr noundef) local_unnamed_addr #4

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

declare ptr @ggml_backend_cpu_buffer_type() local_unnamed_addr #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #5 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 = { 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 #2 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint 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 #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 = { 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 #6 = { noreturn }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { 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, !10, i64 32}
!6 = !{!"_ZTS16ggml_opt_dataset", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !11, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"_ZTSSt6vectorIlSaIlEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIlSaIlEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!6, !10, i64 40}
!16 = !{!10, !10, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !8, i64 0}
!20 = !{!6, !7, i64 0}
!21 = !{!6, !7, i64 16}
!22 = !{!6, !10, i64 48}
!23 = !{!6, !7, i64 24}
!24 = !{!6, !7, i64 8}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass