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

; 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 }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.6" }
%"struct.std::_Head_base.6" = type { ptr }
%struct.rpc_msg_get_tensor_req = type { %struct.rpc_tensor, i64, i64 }
%struct.rpc_tensor = type <{ i64, i32, i64, [4 x i32], [4 x i32], i32, [16 x i32], i32, [10 x i64], i64, i64, i64, [64 x i8], [4 x i8] }>
%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.3 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [33 x i8], align 1
@__func__._ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [101 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

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

declare i64 @ggml_tensor_overhead() #2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneI12ggml_context20ggml_context_deleterEbRKSt10unique_ptrIT_T0_EDn(ptr noundef nonnull align 8 dereferenceable(8), ptr) #4

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef, ptr noundef) #6 align 2

declare void @ggml_log_internal(i32 noundef, ptr noundef, ...) #2

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

declare ptr @ggml_backend_buffer_get_base(ptr noundef) #2

declare i64 @ggml_backend_buffer_get_size(ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 1 dereferenceable(312) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #6 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.ggml_init_params, align 8
  %9 = alloca %"class.std::unique_ptr", align 8
  %10 = alloca %struct.ggml_init_params, align 8
  %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 i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #7
  %20 = getelementptr inbounds %struct.ggml_init_params, ptr %8, i32 0, i32 0
  %21 = call i64 @ggml_tensor_overhead()
  store i64 %21, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.ggml_init_params, ptr %8, i32 0, i32 1
  store ptr null, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds %struct.ggml_init_params, ptr %8, i32 0, i32 2
  store i8 1, ptr %23, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %8, i64 24, i1 false), !tbaa.struct !15
  %24 = call ptr @ggml_init(ptr noundef byval(%struct.ggml_init_params) align 8 %10)
  call void @_ZNSt10unique_ptrI12ggml_context20ggml_context_deleterEC2IS1_vEEPS0_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef %24) #7
  %25 = call noundef zeroext i1 @_ZStneI12ggml_context20ggml_context_deleterEbRKSt10unique_ptrIT_T0_EDn(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr null) #7
  br i1 %25, label %32, label %26

26:                                               ; preds = %3
  invoke void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.3, i32 noundef 1191, ptr noundef @.str.4, ptr noundef @.str.5) #8
          to label %27 unwind label %28

27:                                               ; preds = %26
  unreachable

28:                                               ; preds = %26
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %11, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %12, align 4
  br label %146

32:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %33 = call noundef ptr @_ZNKSt10unique_ptrI12ggml_context20ggml_context_deleterE3getEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  store ptr %33, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %35, i32 0, i32 0
  %37 = invoke noundef ptr @_ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor(ptr noundef nonnull align 8 dereferenceable(72) %19, ptr noundef %34, ptr noundef %36)
          to label %38 unwind label %43

38:                                               ; preds = %32
  store ptr %37, ptr %14, align 8, !tbaa !5
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %47

41:                                               ; preds = %38
  invoke void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef @.str.13, ptr noundef @__func__._ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE)
          to label %42 unwind label %43

42:                                               ; preds = %41
  store i1 false, ptr %4, align 1
  store i32 1, ptr %15, align 4
  br label %143

43:                                               ; preds = %127, %41, %32
  %44 = landingpad { ptr, i32 }
          cleanup
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %11, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %12, align 4
  br label %145

47:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %48 = load ptr, ptr %14, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ggml_tensor, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !18
  %51 = invoke ptr @ggml_backend_buffer_get_base(ptr noundef %50)
          to label %52 unwind label %111

52:                                               ; preds = %47
  %53 = ptrtoint ptr %51 to i64
  store i64 %53, ptr %16, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %54 = load i64, ptr %16, align 8, !tbaa !16
  %55 = load ptr, ptr %14, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ggml_tensor, ptr %55, i32 0, i32 1
  %57 = load ptr, ptr %56, align 8, !tbaa !18
  %58 = invoke i64 @ggml_backend_buffer_get_size(ptr noundef %57)
          to label %59 unwind label %115

59:                                               ; preds = %52
  %60 = add i64 %54, %58
  store i64 %60, ptr %17, align 8, !tbaa !16
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds %struct.rpc_tensor, ptr %62, i32 0, i32 11
  %64 = load i64, ptr %63, align 1, !tbaa !23
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %65, i32 0, i32 1
  %67 = load i64, ptr %66, align 1, !tbaa !26
  %68 = add i64 %64, %67
  %69 = load i64, ptr %16, align 8, !tbaa !16
  %70 = icmp ult i64 %68, %69
  br i1 %70, label %97, label %71

71:                                               ; preds = %59
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds %struct.rpc_tensor, ptr %73, i32 0, i32 11
  %75 = load i64, ptr %74, align 1, !tbaa !23
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %76, i32 0, i32 1
  %78 = load i64, ptr %77, align 1, !tbaa !26
  %79 = add i64 %75, %78
  %80 = load i64, ptr %17, align 8, !tbaa !16
  %81 = icmp uge i64 %79, %80
  br i1 %81, label %97, label %82

82:                                               ; preds = %71
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %83, i32 0, i32 2
  %85 = load i64, ptr %84, align 1, !tbaa !27
  %86 = load i64, ptr %17, align 8, !tbaa !16
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %87, i32 0, i32 0
  %89 = getelementptr inbounds %struct.rpc_tensor, ptr %88, i32 0, i32 11
  %90 = load i64, ptr %89, align 1, !tbaa !23
  %91 = sub i64 %86, %90
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %92, i32 0, i32 1
  %94 = load i64, ptr %93, align 1, !tbaa !26
  %95 = sub i64 %91, %94
  %96 = icmp ugt i64 %85, %95
  br i1 %96, label %97, label %119

97:                                               ; preds = %82, %71, %59
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds %struct.rpc_tensor, ptr %99, i32 0, i32 11
  %101 = load i64, ptr %100, align 1, !tbaa !23
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %102, i32 0, i32 1
  %104 = load i64, ptr %103, align 1, !tbaa !26
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %105, i32 0, i32 2
  %107 = load i64, ptr %106, align 1, !tbaa !27
  %108 = load i64, ptr %16, align 8, !tbaa !16
  %109 = load i64, ptr %17, align 8, !tbaa !16
  invoke void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef @.str.21, ptr noundef @__func__._ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE, i64 noundef %101, i64 noundef %104, i64 noundef %107, i64 noundef %108, i64 noundef %109)
          to label %110 unwind label %115

110:                                              ; preds = %97
  store i1 false, ptr %4, align 1
  store i32 1, ptr %15, align 4
  br label %120

111:                                              ; preds = %47
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %11, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %12, align 4
  br label %138

115:                                              ; preds = %97, %52
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %11, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  br label %138

119:                                              ; preds = %82
  store i32 0, ptr %15, align 4
  br label %120

120:                                              ; preds = %119, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  %121 = load i32, ptr %15, align 4
  switch i32 %121, label %143 [
    i32 0, label %122
  ]

122:                                              ; preds = %120
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %124, i32 0, i32 2
  %126 = load i64, ptr %125, align 1, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #7
  store i8 0, ptr %18, align 1, !tbaa !28
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEmRKh(ptr noundef nonnull align 8 dereferenceable(24) %123, i64 noundef %126, ptr noundef nonnull align 1 dereferenceable(1) %18)
          to label %127 unwind label %139

127:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #7
  %128 = load ptr, ptr %14, align 8, !tbaa !5
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %129) #7
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %131, i32 0, i32 1
  %133 = load i64, ptr %132, align 1, !tbaa !26
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.rpc_msg_get_tensor_req, ptr %134, i32 0, i32 2
  %136 = load i64, ptr %135, align 1, !tbaa !27
  invoke void @ggml_backend_tensor_get(ptr noundef %128, ptr noundef %130, i64 noundef %133, i64 noundef %136)
          to label %137 unwind label %43

137:                                              ; preds = %127
  store i1 true, ptr %4, align 1
  store i32 1, ptr %15, align 4
  br label %143

138:                                              ; preds = %115, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %145

139:                                              ; preds = %122
  %140 = landingpad { ptr, i32 }
          cleanup
  %141 = extractvalue { ptr, i32 } %140, 0
  store ptr %141, ptr %11, align 8
  %142 = extractvalue { ptr, i32 } %140, 1
  store i32 %142, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #7
  br label %145

143:                                              ; preds = %137, %120, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @_ZNSt10unique_ptrI12ggml_context20ggml_context_deleterED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #7
  %144 = load i1, ptr %4, align 1
  ret i1 %144

145:                                              ; preds = %139, %138, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %146

146:                                              ; preds = %145, %28
  call void @_ZNSt10unique_ptrI12ggml_context20ggml_context_deleterED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #7
  br label %147

147:                                              ; preds = %146
  %148 = load ptr, ptr %11, align 8
  %149 = load i32, ptr %12, align 4
  %150 = insertvalue { ptr, i32 } poison, ptr %148, 0
  %151 = insertvalue { ptr, i32 } %150, i32 %149, 1
  resume { ptr, i32 } %151
}

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS16ggml_init_params", !11, i64 0, !6, i64 8, !12, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !12, i64 16}
!15 = !{i64 0, i64 8, !16, i64 8, i64 8, !5, i64 16, i64 1, !17}
!16 = !{!11, !11, i64 0}
!17 = !{!12, !12, i64 0}
!18 = !{!19, !6, i64 8}
!19 = !{!"_ZTS11ggml_tensor", !20, i64 0, !6, i64 8, !7, i64 16, !7, i64 48, !21, i64 80, !7, i64 84, !22, i64 148, !7, i64 152, !6, i64 232, !11, i64 240, !6, i64 248, !7, i64 256, !6, i64 320, !7, i64 328}
!20 = !{!"_ZTS9ggml_type", !7, i64 0}
!21 = !{!"_ZTS7ggml_op", !7, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!24, !11, i64 220}
!24 = !{!"_ZTS22rpc_msg_get_tensor_req", !25, i64 0, !11, i64 296, !11, i64 304}
!25 = !{!"_ZTS10rpc_tensor", !11, i64 0, !22, i64 8, !11, i64 12, !7, i64 20, !7, i64 36, !22, i64 52, !7, i64 56, !22, i64 120, !7, i64 124, !11, i64 204, !11, i64 212, !11, i64 220, !7, i64 228, !7, i64 292}
!26 = !{!24, !11, i64 296}
!27 = !{!24, !11, i64 304}
!28 = !{!7, !7, i64 0}


; 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 }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.6" }
%"struct.std::_Head_base.6" = type { ptr }

@.str.3 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [33 x i8], align 1
@__func__._ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE = external hidden unnamed_addr constant [11 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [101 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 nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrI12ggml_context20ggml_context_deleterEC2IS1_vEEPS0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneI12ggml_context20ggml_context_deleterEbRKSt10unique_ptrIT_T0_EDn(ptr noundef nonnull align 8 dereferenceable(8), ptr) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor(ptr noundef nonnull align 8 dereferenceable(72), ptr noundef, ptr noundef) local_unnamed_addr #5 align 2

declare void @ggml_log_internal(i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

declare ptr @ggml_backend_buffer_get_base(ptr noundef) local_unnamed_addr #1

declare i64 @ggml_backend_buffer_get_size(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef nonnull align 1 dereferenceable(312) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::unique_ptr", align 8
  %5 = alloca %struct.ggml_init_params, align 8
  %6 = alloca i8, align 1
  %7 = tail call i64 @ggml_tensor_overhead()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  store i64 %7, ptr %5, align 8, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  store ptr null, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !9
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 16
  store i8 1, ptr %.sroa.6.0..sroa_idx, align 8, !tbaa !11
  %8 = tail call ptr @ggml_init(ptr noundef nonnull byval(%struct.ggml_init_params) align 8 %5)
  call void @_ZNSt10unique_ptrI12ggml_context20ggml_context_deleterEC2IS1_vEEPS0_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %8) #6
  %9 = call noundef zeroext i1 @_ZStneI12ggml_context20ggml_context_deleterEbRKSt10unique_ptrIT_T0_EDn(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr null) #6
  br i1 %9, label %14, label %10

10:                                               ; preds = %3
  invoke void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.3, i32 noundef 1191, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.5) #7
          to label %11 unwind label %12

11:                                               ; preds = %10
  unreachable

12:                                               ; preds = %10
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %53

14:                                               ; preds = %3
  %15 = call noundef ptr @_ZNKSt10unique_ptrI12ggml_context20ggml_context_deleterE3getEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %16 = invoke noundef ptr @_ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef %15, ptr noundef nonnull %1)
          to label %17 unwind label %20

17:                                               ; preds = %14
  %18 = icmp eq ptr %16, null
  br i1 %18, label %19, label %22

19:                                               ; preds = %17
  invoke void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef nonnull @.str.13, ptr noundef nonnull @__func__._ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE)
          to label %.critedge unwind label %20

20:                                               ; preds = %47, %19, %14
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %53

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %16, i64 8
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = invoke ptr @ggml_backend_buffer_get_base(ptr noundef %24)
          to label %26 unwind label %42

26:                                               ; preds = %22
  %27 = ptrtoint ptr %25 to i64
  %28 = load ptr, ptr %23, align 8, !tbaa !13
  %29 = invoke i64 @ggml_backend_buffer_get_size(ptr noundef %28)
          to label %30 unwind label %44

30:                                               ; preds = %26
  %31 = add i64 %29, %27
  %32 = getelementptr inbounds i8, ptr %1, i64 220
  %33 = load i64, ptr %32, align 1, !tbaa !18
  %34 = getelementptr inbounds i8, ptr %1, i64 296
  %35 = load i64, ptr %34, align 1, !tbaa !21
  %36 = add i64 %35, %33
  %37 = icmp ult i64 %36, %27
  %.not = icmp uge i64 %36, %31
  %or.cond.not46 = select i1 %37, i1 true, i1 %.not
  %38 = getelementptr inbounds i8, ptr %1, i64 304
  %39 = load i64, ptr %38, align 1, !tbaa !22
  %40 = sub i64 %31, %36
  %41 = icmp ugt i64 %39, %40
  %or.cond44 = select i1 %or.cond.not46, i1 true, i1 %41
  br i1 %or.cond44, label %._crit_edge, label %46

._crit_edge:                                      ; preds = %30
  invoke void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef nonnull @.str.21, ptr noundef nonnull @__func__._ZN10rpc_server10get_tensorERK22rpc_msg_get_tensor_reqRSt6vectorIhSaIhEE, i64 noundef %33, i64 noundef %35, i64 noundef %39, i64 noundef %27, i64 noundef %31)
          to label %.critedge unwind label %44

42:                                               ; preds = %22
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %53

44:                                               ; preds = %._crit_edge, %26
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %53

46:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #6
  store i8 0, ptr %6, align 1, !tbaa !23
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEmRKh(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %39, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %47 unwind label %51

47:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #6
  %48 = call noundef ptr @_ZNSt6vectorIhSaIhEE4dataEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %49 = load i64, ptr %34, align 1, !tbaa !21
  %50 = load i64, ptr %38, align 1, !tbaa !22
  invoke void @ggml_backend_tensor_get(ptr noundef nonnull %16, ptr noundef %48, i64 noundef %49, i64 noundef %50)
          to label %.critedge unwind label %20

51:                                               ; preds = %46
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #6
  br label %53

.critedge:                                        ; preds = %._crit_edge, %47, %19
  %.1 = phi i1 [ false, %19 ], [ true, %47 ], [ false, %._crit_edge ]
  call void @_ZNSt10unique_ptrI12ggml_context20ggml_context_deleterED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret i1 %.1

53:                                               ; preds = %20, %51, %44, %42, %12
  %.pn40.pn = phi { ptr, i32 } [ %13, %12 ], [ %21, %20 ], [ %52, %51 ], [ %45, %44 ], [ %43, %42 ]
  call void @_ZNSt10unique_ptrI12ggml_context20ggml_context_deleterED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn40.pn
}

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

declare void @ggml_backend_tensor_get(ptr noundef, ptr noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

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 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 #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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTS11ggml_tensor", !15, i64 0, !10, i64 8, !7, i64 16, !7, i64 48, !16, i64 80, !7, i64 84, !17, i64 148, !7, i64 152, !10, i64 232, !6, i64 240, !10, i64 248, !7, i64 256, !10, i64 320, !7, i64 328}
!15 = !{!"_ZTS9ggml_type", !7, i64 0}
!16 = !{!"_ZTS7ggml_op", !7, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = !{!19, !6, i64 220}
!19 = !{!"_ZTS22rpc_msg_get_tensor_req", !20, i64 0, !6, i64 296, !6, i64 304}
!20 = !{!"_ZTS10rpc_tensor", !6, i64 0, !17, i64 8, !6, i64 12, !7, i64 20, !7, i64 36, !17, i64 52, !7, i64 56, !17, i64 120, !7, i64 124, !6, i64 204, !6, i64 212, !6, i64 220, !7, i64 228, !7, i64 292}
!21 = !{!19, !6, i64 296}
!22 = !{!19, !6, i64 304}
!23 = !{!7, !7, i64 0}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass