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

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

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.ggml_backend_compare_graph_backend = external hidden unnamed_addr constant [130 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [49 x i8], align 1

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

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

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

; 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
declare dso_local i32 @ggml_backend_graph_compute(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL20ggml_are_same_layoutPK11ggml_tensorS1_(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @ggml_backend_graph_copy(ptr dead_on_unwind noalias writable sret(%struct.ggml_backend_graph_copy) align 8, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @ggml_backend_graph_copy_free(ptr noundef byval(%struct.ggml_backend_graph_copy) align 8) #3

; Function Attrs: mustprogress uwtable
define dso_local zeroext i1 @ggml_backend_compare_graph_backend(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #3 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca %struct.ggml_backend_graph_copy, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca %struct.ggml_cgraph, align 8
  %20 = alloca %struct.ggml_cgraph, align 8
  %21 = alloca %struct.ggml_backend_graph_copy, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #6
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  call void @ggml_backend_graph_copy(ptr dead_on_unwind writable sret(%struct.ggml_backend_graph_copy) align 8 %12, ptr noundef %22, ptr noundef %23)
  %24 = getelementptr inbounds %struct.ggml_backend_graph_copy, ptr %12, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %5
  store i1 false, ptr %6, align 1
  store i32 1, ptr %13, align 4
  br label %116

28:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %29, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %30 = getelementptr inbounds %struct.ggml_backend_graph_copy, ptr %12, i32 0, i32 3
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  store ptr %31, ptr %15, align 8, !tbaa !5
  %32 = load ptr, ptr %14, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ggml_cgraph, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !12
  %35 = load ptr, ptr %15, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.ggml_cgraph, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !12
  %38 = icmp eq i32 %34, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %28
  br label %42

40:                                               ; preds = %28
  call void @__assert_fail(ptr noundef @.str.40, ptr noundef @.str.1, i32 noundef 1826, ptr noundef @__PRETTY_FUNCTION__.ggml_backend_compare_graph_backend) #7
  unreachable

41:                                               ; No predecessors!
  br label %42

42:                                               ; preds = %41, %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !18
  br label %43

43:                                               ; preds = %111, %42
  %44 = load i32, ptr %16, align 4, !tbaa !18
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ggml_cgraph, ptr %45, i32 0, i32 1
  %47 = load i32, ptr %46, align 4, !tbaa !12
  %48 = icmp slt i32 %44, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %43
  store i32 2, ptr %13, align 4
  br label %114

50:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ggml_cgraph, ptr %51, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = load i32, ptr %16, align 4, !tbaa !18
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds ptr, ptr %53, i64 %55
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  store ptr %57, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %58 = load ptr, ptr %15, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.ggml_cgraph, ptr %58, i32 0, i32 3
  %60 = load ptr, ptr %59, align 8, !tbaa !19
  %61 = load i32, ptr %16, align 4, !tbaa !18
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  store ptr %64, ptr %18, align 8, !tbaa !5
  %65 = load ptr, ptr %17, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ggml_tensor, ptr %65, i32 0, i32 4
  %67 = load i32, ptr %66, align 8, !tbaa !20
  %68 = load ptr, ptr %18, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.ggml_tensor, ptr %68, i32 0, i32 4
  %70 = load i32, ptr %69, align 8, !tbaa !20
  %71 = icmp eq i32 %67, %70
  br i1 %71, label %72, label %76

72:                                               ; preds = %50
  %73 = load ptr, ptr %17, align 8, !tbaa !5
  %74 = load ptr, ptr %18, align 8, !tbaa !5
  %75 = call noundef zeroext i1 @_ZL20ggml_are_same_layoutPK11ggml_tensorS1_(ptr noundef %73, ptr noundef %74)
  br label %76

76:                                               ; preds = %72, %50
  %77 = phi i1 [ false, %50 ], [ %75, %72 ]
  br i1 %77, label %78, label %79

78:                                               ; preds = %76
  br label %81

79:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.41, ptr noundef @.str.1, i32 noundef 1832, ptr noundef @__PRETTY_FUNCTION__.ggml_backend_compare_graph_backend) #7
  unreachable

80:                                               ; No predecessors!
  br label %81

81:                                               ; preds = %80, %78
  call void @llvm.lifetime.start.p0(i64 80, ptr %19) #6
  %82 = load ptr, ptr %14, align 8, !tbaa !5
  %83 = load i32, ptr %16, align 4, !tbaa !18
  %84 = load i32, ptr %16, align 4, !tbaa !18
  %85 = add nsw i32 %84, 1
  call void @ggml_graph_view(ptr dead_on_unwind writable sret(%struct.ggml_cgraph) align 8 %19, ptr noundef %82, i32 noundef %83, i32 noundef %85)
  call void @llvm.lifetime.start.p0(i64 80, ptr %20) #6
  %86 = load ptr, ptr %15, align 8, !tbaa !5
  %87 = load i32, ptr %16, align 4, !tbaa !18
  %88 = load i32, ptr %16, align 4, !tbaa !18
  %89 = add nsw i32 %88, 1
  call void @ggml_graph_view(ptr dead_on_unwind writable sret(%struct.ggml_cgraph) align 8 %20, ptr noundef %86, i32 noundef %87, i32 noundef %89)
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = call i32 @ggml_backend_graph_compute(ptr noundef %90, ptr noundef %19)
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = call i32 @ggml_backend_graph_compute(ptr noundef %92, ptr noundef %20)
  %94 = load ptr, ptr %17, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.ggml_tensor, ptr %94, i32 0, i32 4
  %96 = load i32, ptr %95, align 8, !tbaa !20
  %97 = call noundef zeroext i1 @_ZL15ggml_is_view_op7ggml_op(i32 noundef %96)
  br i1 %97, label %98, label %99

98:                                               ; preds = %81
  store i32 4, ptr %13, align 4
  br label %108

99:                                               ; preds = %81
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = load i32, ptr %16, align 4, !tbaa !18
  %102 = load ptr, ptr %17, align 8, !tbaa !5
  %103 = load ptr, ptr %18, align 8, !tbaa !5
  %104 = load ptr, ptr %11, align 8, !tbaa !5
  %105 = call noundef zeroext i1 %100(i32 noundef %101, ptr noundef %102, ptr noundef %103, ptr noundef %104)
  br i1 %105, label %107, label %106

106:                                              ; preds = %99
  store i32 2, ptr %13, align 4
  br label %108

107:                                              ; preds = %99
  store i32 0, ptr %13, align 4
  br label %108

108:                                              ; preds = %107, %106, %98
  call void @llvm.lifetime.end.p0(i64 80, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  %109 = load i32, ptr %13, align 4
  switch i32 %109, label %114 [
    i32 0, label %110
    i32 4, label %111
  ]

110:                                              ; preds = %108
  br label %111

111:                                              ; preds = %110, %108
  %112 = load i32, ptr %16, align 4, !tbaa !18
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %16, align 4, !tbaa !18
  br label %43, !llvm.loop !24

114:                                              ; preds = %108, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %115

115:                                              ; preds = %114
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %12, i64 32, i1 false), !tbaa.struct !26
  call void @ggml_backend_graph_copy_free(ptr noundef byval(%struct.ggml_backend_graph_copy) align 8 %21)
  store i1 true, ptr %6, align 1
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %116

116:                                              ; preds = %115, %27
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #6
  %117 = load i1, ptr %6, align 1
  ret i1 %117
}

declare void @ggml_graph_view(ptr dead_on_unwind writable sret(%struct.ggml_cgraph) align 8, ptr noundef, i32 noundef, i32 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL15ggml_is_view_op7ggml_op(i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 #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 = { 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 = { nounwind }
attributes #7 = { 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 0}
!10 = !{!"_ZTS23ggml_backend_graph_copy", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!10, !6, i64 24}
!12 = !{!13, !14, i64 4}
!13 = !{!"_ZTS11ggml_cgraph", !14, i64 0, !14, i64 4, !14, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !17, i64 72}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS13ggml_hash_set", !16, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTS22ggml_cgraph_eval_order", !7, i64 0}
!18 = !{!14, !14, i64 0}
!19 = !{!13, !6, i64 16}
!20 = !{!21, !23, i64 80}
!21 = !{!"_ZTS11ggml_tensor", !22, i64 0, !6, i64 8, !7, i64 16, !7, i64 48, !23, i64 80, !7, i64 84, !14, i64 148, !7, i64 152, !6, i64 232, !16, i64 240, !6, i64 248, !7, i64 256, !6, i64 320, !7, i64 328}
!22 = !{!"_ZTS9ggml_type", !7, i64 0}
!23 = !{!"_ZTS7ggml_op", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5}


; 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_backend_graph_copy = type { ptr, ptr, ptr, ptr }
%struct.ggml_cgraph = type { i32, i32, i32, ptr, ptr, ptr, ptr, %struct.ggml_hash_set, i32 }
%struct.ggml_hash_set = type { i64, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [27 x i8], align 1
@__PRETTY_FUNCTION__.ggml_backend_compare_graph_backend = external hidden unnamed_addr constant [130 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [49 x i8], align 1

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i32 @ggml_backend_graph_compute(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @ggml_backend_graph_copy(ptr dead_on_unwind noalias writable sret(%struct.ggml_backend_graph_copy) align 8, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @ggml_backend_graph_copy_free(ptr noundef byval(%struct.ggml_backend_graph_copy) align 8) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @ggml_backend_compare_graph_backend(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, ptr noundef %4) local_unnamed_addr #2 {
  %6 = alloca %struct.ggml_backend_graph_copy, align 8
  %7 = alloca %struct.ggml_cgraph, align 8
  %8 = alloca %struct.ggml_cgraph, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #5
  call void @ggml_backend_graph_copy(ptr dead_on_unwind nonnull writable sret(%struct.ggml_backend_graph_copy) align 8 %6, ptr noundef %1, ptr noundef %2)
  %9 = load ptr, ptr %6, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %49

11:                                               ; preds = %5
  %12 = getelementptr inbounds i8, ptr %6, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !10
  %14 = getelementptr inbounds i8, ptr %2, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = getelementptr inbounds i8, ptr %13, i64 4
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = icmp eq i32 %15, %17
  br i1 %18, label %.preheader, label %22

.preheader:                                       ; preds = %11
  %19 = icmp sgt i32 %15, 0
  br i1 %19, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader
  %20 = getelementptr inbounds i8, ptr %2, i64 16
  %21 = getelementptr inbounds i8, ptr %13, i64 16
  br label %23

22:                                               ; preds = %11
  call void @__assert_fail(ptr noundef nonnull @.str.40, ptr noundef nonnull @.str.1, i32 noundef 1826, ptr noundef nonnull @__PRETTY_FUNCTION__.ggml_backend_compare_graph_backend) #6
  unreachable

23:                                               ; preds = %.lr.ph, %select.unfold
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %select.unfold ]
  %24 = load ptr, ptr %20, align 8, !tbaa !17
  %25 = getelementptr inbounds ptr, ptr %24, i64 %indvars.iv
  %26 = load ptr, ptr %25, align 8, !tbaa !18
  %27 = load ptr, ptr %21, align 8, !tbaa !17
  %28 = getelementptr inbounds ptr, ptr %27, i64 %indvars.iv
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %30 = getelementptr inbounds i8, ptr %26, i64 80
  %31 = load i32, ptr %30, align 8, !tbaa !19
  %32 = getelementptr inbounds i8, ptr %29, i64 80
  %33 = load i32, ptr %32, align 8, !tbaa !19
  %34 = icmp eq i32 %31, %33
  br i1 %34, label %35, label %.critedge

35:                                               ; preds = %23
  %36 = call noundef zeroext i1 @_ZL20ggml_are_same_layoutPK11ggml_tensorS1_(ptr noundef nonnull %26, ptr noundef nonnull %29)
  br i1 %36, label %37, label %.critedge

.critedge:                                        ; preds = %23, %35
  call void @__assert_fail(ptr noundef nonnull @.str.41, ptr noundef nonnull @.str.1, i32 noundef 1832, ptr noundef nonnull @__PRETTY_FUNCTION__.ggml_backend_compare_graph_backend) #6
  unreachable

37:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %7) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %indvars = trunc i64 %indvars.iv.next to i32
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  call void @ggml_graph_view(ptr dead_on_unwind nonnull writable sret(%struct.ggml_cgraph) align 8 %7, ptr noundef nonnull %2, i32 noundef %38, i32 noundef %indvars)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %8) #5
  call void @ggml_graph_view(ptr dead_on_unwind nonnull writable sret(%struct.ggml_cgraph) align 8 %8, ptr noundef nonnull %13, i32 noundef %38, i32 noundef %indvars)
  %39 = call i32 @ggml_backend_graph_compute(ptr noundef %0, ptr noundef nonnull %7)
  %40 = call i32 @ggml_backend_graph_compute(ptr noundef %1, ptr noundef nonnull %8)
  %41 = load i32, ptr %30, align 8, !tbaa !19
  %42 = call noundef zeroext i1 @_ZL15ggml_is_view_op7ggml_op(i32 noundef %41)
  br i1 %42, label %select.unfold, label %43

43:                                               ; preds = %37
  %44 = call noundef zeroext i1 %3(i32 noundef %38, ptr noundef nonnull %26, ptr noundef nonnull %29, ptr noundef %4)
  br i1 %44, label %select.unfold, label %45

45:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #5
  br label %.loopexit

select.unfold:                                    ; preds = %43, %37
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %7) #5
  %46 = load i32, ptr %14, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = icmp slt i64 %indvars.iv.next, %47
  br i1 %48, label %23, label %.loopexit, !llvm.loop !23

.loopexit:                                        ; preds = %select.unfold, %.preheader, %45
  call void @ggml_backend_graph_copy_free(ptr noundef nonnull byval(%struct.ggml_backend_graph_copy) align 8 %6)
  br label %49

49:                                               ; preds = %5, %.loopexit
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #5
  ret i1 %10
}

declare void @ggml_graph_view(ptr dead_on_unwind writable sret(%struct.ggml_cgraph) align 8, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL15ggml_is_view_op7ggml_op(i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noreturn 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 #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 = { 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 = { nounwind }
attributes #6 = { 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, !7, i64 0}
!6 = !{!"_ZTS23ggml_backend_graph_copy", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 24}
!11 = !{!12, !13, i64 4}
!12 = !{!"_ZTS11ggml_cgraph", !13, i64 0, !13, i64 4, !13, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !14, i64 48, !16, i64 72}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTS13ggml_hash_set", !15, i64 0, !7, i64 8, !7, i64 16}
!15 = !{!"long", !8, i64 0}
!16 = !{!"_ZTS22ggml_cgraph_eval_order", !8, i64 0}
!17 = !{!12, !7, i64 16}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !22, i64 80}
!20 = !{!"_ZTS11ggml_tensor", !21, i64 0, !7, i64 8, !8, i64 16, !8, i64 48, !22, i64 80, !8, i64 84, !13, i64 148, !8, i64 152, !7, i64 232, !15, i64 240, !7, i64 248, !8, i64 256, !7, i64 320, !8, i64 328}
!21 = !{!"_ZTS9ggml_type", !8, i64 0}
!22 = !{!"_ZTS7ggml_op", !8, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass