; LLVM IR from ggml-org/ggml :: tests/test-conv2d.ll (Z11build_graphRK10test_model)

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

%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = 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 }
%struct.ggml_init_params = type { i64, ptr, i8 }
%"class.std::allocator.7" = type { i8 }
%struct.test_model = type { ptr, ptr, ptr, ptr, ptr }

@_ZZ11build_graphRK10test_modelE8buf_size = external hidden global i64, align 8
@_ZGVZ11build_graphRK10test_modelE8buf_size = external hidden global i64, align 8
@_ZZ11build_graphRK10test_modelE3buf = external hidden global %"class.std::vector.5", align 8
@_ZGVZ11build_graphRK10test_modelE3buf = external hidden global i64, align 8
@__dso_handle = external hidden global i8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1

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

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) #0

declare i64 @ggml_tensor_overhead() #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z11build_graphRK10test_model(ptr noundef nonnull align 8 dereferenceable(40) %0) #3 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::allocator.7", align 1
  %6 = alloca %struct.ggml_init_params, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.ggml_init_params, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %18 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE8buf_size acquire, align 8
  %19 = icmp eq i8 %18, 0
  br i1 %19, label %20, label %30, !prof !9

20:                                               ; preds = %1
  %21 = call i32 @__cxa_guard_acquire(ptr @_ZGVZ11build_graphRK10test_modelE8buf_size) #4
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %30

23:                                               ; preds = %20
  %24 = invoke i64 @ggml_tensor_overhead()
          to label %25 unwind label %87

25:                                               ; preds = %23
  %26 = mul i64 %24, 2048
  %27 = invoke i64 @ggml_graph_overhead()
          to label %28 unwind label %87

28:                                               ; preds = %25
  %29 = add i64 %26, %27
  store i64 %29, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !10
  call void @__cxa_guard_release(ptr @_ZGVZ11build_graphRK10test_modelE8buf_size) #4
  br label %30

30:                                               ; preds = %28, %20, %1
  %31 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE3buf acquire, align 8
  %32 = icmp eq i8 %31, 0
  br i1 %32, label %33, label %40, !prof !9

33:                                               ; preds = %30
  %34 = call i32 @__cxa_guard_acquire(ptr @_ZGVZ11build_graphRK10test_modelE3buf) #4
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %40

36:                                               ; preds = %33
  %37 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf, i64 noundef %37, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %38 unwind label %91

38:                                               ; preds = %36
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  %39 = call i32 @__cxa_atexit(ptr @_ZNSt6vectorIhSaIhEED2Ev, ptr @_ZZ11build_graphRK10test_modelE3buf, ptr @__dso_handle) #4
  call void @__cxa_guard_release(ptr @_ZGVZ11build_graphRK10test_modelE3buf) #4
  br label %40

40:                                               ; preds = %38, %33, %30
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #4
  %41 = getelementptr inbounds %struct.ggml_init_params, ptr %6, i32 0, i32 0
  %42 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !10
  store i64 %42, ptr %41, align 8, !tbaa !12
  %43 = getelementptr inbounds %struct.ggml_init_params, ptr %6, i32 0, i32 1
  %44 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf) #4
  store ptr %44, ptr %43, align 8, !tbaa !15
  %45 = getelementptr inbounds %struct.ggml_init_params, ptr %6, i32 0, i32 2
  store i8 1, ptr %45, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %8, ptr align 8 %6, i64 24, i1 false), !tbaa.struct !17
  %46 = call ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %8)
  store ptr %46, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = call ptr @ggml_new_graph(ptr noundef %47)
  store ptr %48, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 1, ptr %11, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 1, ptr %12, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 1, ptr %13, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 1, ptr %14, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 1, ptr %15, align 4, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.test_model, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !21
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.test_model, ptr %53, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !23
  %56 = load i32, ptr %10, align 4, !tbaa !19
  %57 = load i32, ptr %11, align 4, !tbaa !19
  %58 = load i32, ptr %12, align 4, !tbaa !19
  %59 = load i32, ptr %13, align 4, !tbaa !19
  %60 = load i32, ptr %14, align 4, !tbaa !19
  %61 = load i32, ptr %15, align 4, !tbaa !19
  %62 = call ptr @ggml_im2col(ptr noundef %49, ptr noundef %52, ptr noundef %55, i32 noundef %56, i32 noundef %57, i32 noundef %58, i32 noundef %59, i32 noundef %60, i32 noundef %61, i1 noundef zeroext true, i32 noundef 1)
  store ptr %62, ptr %16, align 8, !tbaa !5
  %63 = load ptr, ptr %16, align 8, !tbaa !5
  %64 = call ptr @ggml_set_name(ptr noundef %63, ptr noundef @.str.2)
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load ptr, ptr %16, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %65, ptr noundef %66)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.test_model, ptr %68, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !21
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.test_model, ptr %71, i32 0, i32 1
  %73 = load ptr, ptr %72, align 8, !tbaa !23
  %74 = load i32, ptr %10, align 4, !tbaa !19
  %75 = load i32, ptr %11, align 4, !tbaa !19
  %76 = load i32, ptr %12, align 4, !tbaa !19
  %77 = load i32, ptr %13, align 4, !tbaa !19
  %78 = load i32, ptr %14, align 4, !tbaa !19
  %79 = load i32, ptr %15, align 4, !tbaa !19
  %80 = call ptr @ggml_conv_2d(ptr noundef %67, ptr noundef %70, ptr noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef %76, i32 noundef %77, i32 noundef %78, i32 noundef %79)
  store ptr %80, ptr %17, align 8, !tbaa !5
  %81 = load ptr, ptr %17, align 8, !tbaa !5
  %82 = call ptr @ggml_set_name(ptr noundef %81, ptr noundef @.str.3)
  %83 = load ptr, ptr %9, align 8, !tbaa !5
  %84 = load ptr, ptr %17, align 8, !tbaa !5
  call void @ggml_build_forward_expand(ptr noundef %83, ptr noundef %84)
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  call void @ggml_free(ptr noundef %85)
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #4
  ret ptr %86

87:                                               ; preds = %25, %23
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %3, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %4, align 4
  call void @__cxa_guard_abort(ptr @_ZGVZ11build_graphRK10test_modelE8buf_size) #4
  br label %95

91:                                               ; preds = %36
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %3, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %4, align 4
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @__cxa_guard_abort(ptr @_ZGVZ11build_graphRK10test_modelE3buf) #4
  br label %95

95:                                               ; preds = %91, %87
  %96 = load ptr, ptr %3, align 8
  %97 = load i32, ptr %4, align 4
  %98 = insertvalue { ptr, i32 } poison, ptr %96, 0
  %99 = insertvalue { ptr, i32 } %98, i32 %97, 1
  resume { ptr, i32 } %99
}

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #4

declare i64 @ggml_graph_overhead() #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #5 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 #3 align 2

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

; Function Attrs: nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) #4

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

declare ptr @ggml_new_graph(ptr noundef) #1

declare ptr @ggml_im2col(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i32 noundef) #1

declare ptr @ggml_set_name(ptr noundef, ptr noundef) #1

declare void @ggml_build_forward_expand(ptr noundef, ptr noundef) #1

declare ptr @ggml_conv_2d(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

declare void @ggml_free(ptr noundef) #1

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

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

!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 = !{!"branch_weights", i32 1, i32 1048575}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_ZTS16ggml_init_params", !11, i64 0, !6, i64 8, !14, i64 16}
!14 = !{!"bool", !7, i64 0}
!15 = !{!13, !6, i64 8}
!16 = !{!13, !14, i64 16}
!17 = !{i64 0, i64 8, !10, i64 8, i64 8, !5, i64 16, i64 1, !18}
!18 = !{!14, !14, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"int", !7, i64 0}
!21 = !{!22, !6, i64 0}
!22 = !{!"_ZTS10test_model", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!23 = !{!22, !6, i64 8}


; 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.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = 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 }
%struct.ggml_init_params = type { i64, ptr, i8 }
%"class.std::allocator.7" = type { i8 }

@_ZZ11build_graphRK10test_modelE8buf_size = external hidden local_unnamed_addr global i64, align 8
@_ZGVZ11build_graphRK10test_modelE8buf_size = external hidden global i64, align 8
@_ZZ11build_graphRK10test_modelE3buf = external hidden global %"class.std::vector.5", align 8
@_ZGVZ11build_graphRK10test_modelE3buf = external hidden global i64, align 8
@__dso_handle = external hidden global i8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1

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

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) #0

declare i64 @ggml_tensor_overhead() local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z11build_graphRK10test_model(ptr nocapture noundef nonnull readonly align 8 dereferenceable(40) %0) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::allocator.7", align 1
  %3 = alloca %struct.ggml_init_params, align 8
  %4 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE8buf_size acquire, align 8
  %5 = icmp eq i8 %4, 0
  br i1 %5, label %6, label %15, !prof !5

6:                                                ; preds = %1
  %7 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZ11build_graphRK10test_modelE8buf_size) #5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %15, label %8

8:                                                ; preds = %6
  %9 = invoke i64 @ggml_tensor_overhead()
          to label %10 unwind label %38

10:                                               ; preds = %8
  %11 = invoke i64 @ggml_graph_overhead()
          to label %12 unwind label %38

12:                                               ; preds = %10
  %13 = shl i64 %9, 11
  %14 = add i64 %11, %13
  store i64 %14, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !6
  tail call void @__cxa_guard_release(ptr nonnull @_ZGVZ11build_graphRK10test_modelE8buf_size) #5
  br label %15

15:                                               ; preds = %12, %6, %1
  %16 = load atomic i8, ptr @_ZGVZ11build_graphRK10test_modelE3buf acquire, align 8
  %17 = icmp eq i8 %16, 0
  br i1 %17, label %18, label %24, !prof !5

18:                                               ; preds = %15
  %19 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZ11build_graphRK10test_modelE3buf) #5
  %.not29 = icmp eq i32 %19, 0
  br i1 %.not29, label %24, label %20

20:                                               ; preds = %18
  %21 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf, i64 noundef %21, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %22 unwind label %40

22:                                               ; preds = %20
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  %23 = call i32 @__cxa_atexit(ptr nonnull @_ZNSt6vectorIhSaIhEED2Ev, ptr nonnull @_ZZ11build_graphRK10test_modelE3buf, ptr nonnull @__dso_handle) #5
  call void @__cxa_guard_release(ptr nonnull @_ZGVZ11build_graphRK10test_modelE3buf) #5
  br label %24

24:                                               ; preds = %22, %18, %15
  %25 = load i64, ptr @_ZZ11build_graphRK10test_modelE8buf_size, align 8, !tbaa !6
  %26 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) @_ZZ11build_graphRK10test_modelE3buf) #5
  store i64 %25, ptr %3, align 8, !tbaa !6
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %26, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !10
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 16
  store i8 1, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !12
  %27 = call ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %3)
  %28 = call ptr @ggml_new_graph(ptr noundef %27)
  %29 = load ptr, ptr %0, align 8, !tbaa !14
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  %32 = call ptr @ggml_im2col(ptr noundef %27, ptr noundef %29, ptr noundef %31, i32 noundef 1, i32 noundef 1, i32 noundef 1, i32 noundef 1, i32 noundef 1, i32 noundef 1, i1 noundef zeroext true, i32 noundef 1)
  %33 = call ptr @ggml_set_name(ptr noundef %32, ptr noundef nonnull @.str.2)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %32)
  %34 = load ptr, ptr %0, align 8, !tbaa !14
  %35 = load ptr, ptr %30, align 8, !tbaa !16
  %36 = call ptr @ggml_conv_2d(ptr noundef %27, ptr noundef %34, ptr noundef %35, i32 noundef 1, i32 noundef 1, i32 noundef 1, i32 noundef 1, i32 noundef 1, i32 noundef 1)
  %37 = call ptr @ggml_set_name(ptr noundef %36, ptr noundef nonnull @.str.3)
  call void @ggml_build_forward_expand(ptr noundef %28, ptr noundef %36)
  call void @ggml_free(ptr noundef %27)
  ret ptr %28

38:                                               ; preds = %10, %8
  %39 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_guard_abort(ptr nonnull @_ZGVZ11build_graphRK10test_modelE8buf_size) #5
  br label %42

40:                                               ; preds = %20
  %41 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  call void @__cxa_guard_abort(ptr nonnull @_ZGVZ11build_graphRK10test_modelE3buf) #5
  br label %42

42:                                               ; preds = %40, %38
  %.pn = phi { ptr, i32 } [ %41, %40 ], [ %39, %38 ]
  resume { ptr, i32 } %.pn
}

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #3

declare i64 @ggml_graph_overhead() local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #3

; 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 #2 align 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: nofree nounwind
declare i32 @__cxa_atexit(ptr, ptr, ptr) 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

declare ptr @ggml_new_graph(ptr noundef) local_unnamed_addr #1

declare ptr @ggml_im2col(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext, i32 noundef) local_unnamed_addr #1

declare ptr @ggml_set_name(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @ggml_build_forward_expand(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @ggml_conv_2d(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @ggml_free(ptr noundef) local_unnamed_addr #1

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { nofree nounwind }
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 = { 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 = !{!"branch_weights", i32 1, i32 1048575}
!6 = !{!7, !7, i64 0}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!15, !11, i64 0}
!15 = !{!"_ZTS10test_model", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!16 = !{!15, !11, i64 8}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass