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

; 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.std::__detail::_Node_iterator.28" = type { %"struct.std::__detail::_Node_iterator_base.29" }
%"struct.std::__detail::_Node_iterator_base.29" = type { ptr }
%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] }
%class.rpc_server = type { ptr, ptr, %"class.std::unordered_set" }
%"class.std::unordered_set" = type { %"class.std::_Hashtable.7" }
%"class.std::_Hashtable.7" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

@.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.9 = external hidden unnamed_addr constant [39 x i8], align 1
@__func__._ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [89 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef %1, ptr noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::__detail::_Node_iterator.28", align 8
  %12 = alloca %"struct.std::__detail::_Node_iterator.28", align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  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
  %17 = load ptr, ptr %5, align 8
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.rpc_tensor, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 1, !tbaa !9
  %21 = icmp uge i32 %20, 39
  br i1 %21, label %22, label %26

22:                                               ; preds = %3
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.rpc_tensor, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 1, !tbaa !9
  call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef @.str.9, ptr noundef @__func__._ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor, i32 noundef %25)
  store ptr null, ptr %4, align 8
  br label %197

26:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.rpc_tensor, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 1, !tbaa !9
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.rpc_tensor, ptr %31, i32 0, i32 3
  %33 = getelementptr inbounds [4 x i32], ptr %32, i64 0, i64 0
  %34 = load i32, ptr %33, align 1, !tbaa !13
  %35 = zext i32 %34 to i64
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.rpc_tensor, ptr %36, i32 0, i32 3
  %38 = getelementptr inbounds [4 x i32], ptr %37, i64 0, i64 1
  %39 = load i32, ptr %38, align 1, !tbaa !13
  %40 = zext i32 %39 to i64
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.rpc_tensor, ptr %41, i32 0, i32 3
  %43 = getelementptr inbounds [4 x i32], ptr %42, i64 0, i64 2
  %44 = load i32, ptr %43, align 1, !tbaa !13
  %45 = zext i32 %44 to i64
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.rpc_tensor, ptr %46, i32 0, i32 3
  %48 = getelementptr inbounds [4 x i32], ptr %47, i64 0, i64 3
  %49 = load i32, ptr %48, align 1, !tbaa !13
  %50 = zext i32 %49 to i64
  %51 = call ptr @ggml_new_tensor_4d(ptr noundef %27, i32 noundef %30, i64 noundef %35, i64 noundef %40, i64 noundef %45, i64 noundef %50)
  store ptr %51, ptr %8, align 8, !tbaa !5
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %58

54:                                               ; preds = %26
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.rpc_tensor, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 1, !tbaa !9
  call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef @.str.10, ptr noundef @__func__._ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor, i32 noundef %57)
  store ptr null, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %196

58:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !13
  br label %59

59:                                               ; preds = %76, %58
  %60 = load i32, ptr %10, align 4, !tbaa !13
  %61 = icmp ult i32 %60, 4
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %79

63:                                               ; preds = %59
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.rpc_tensor, ptr %64, i32 0, i32 4
  %66 = load i32, ptr %10, align 4, !tbaa !13
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds [4 x i32], ptr %65, i64 0, i64 %67
  %69 = load i32, ptr %68, align 1, !tbaa !13
  %70 = zext i32 %69 to i64
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ggml_tensor, ptr %71, i32 0, i32 3
  %73 = load i32, ptr %10, align 4, !tbaa !13
  %74 = zext i32 %73 to i64
  %75 = getelementptr inbounds [4 x i64], ptr %72, i64 0, i64 %74
  store i64 %70, ptr %75, align 8, !tbaa !14
  br label %76

76:                                               ; preds = %63
  %77 = load i32, ptr %10, align 4, !tbaa !13
  %78 = add i32 %77, 1
  store i32 %78, ptr %10, align 4, !tbaa !13
  br label %59, !llvm.loop !15

79:                                               ; preds = %62
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.rpc_tensor, ptr %80, i32 0, i32 2
  %82 = load i64, ptr %81, align 1, !tbaa !17
  %83 = inttoptr i64 %82 to ptr
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ggml_tensor, ptr %84, i32 0, i32 1
  store ptr %83, ptr %85, align 8, !tbaa !18
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.ggml_tensor, ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !18
  %89 = icmp ne ptr %88, null
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  br i1 %89, label %90, label %102

90:                                               ; preds = %79
  %91 = getelementptr inbounds %class.rpc_server, ptr %17, i32 0, i32 2
  %92 = load ptr, ptr %8, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.ggml_tensor, ptr %92, i32 0, i32 1
  %94 = call ptr @_ZNSt13unordered_setIP19ggml_backend_bufferSt4hashIS1_ESt8equal_toIS1_ESaIS1_EE4findERKS1_(ptr noundef nonnull align 8 dereferenceable(56) %91, ptr noundef nonnull align 8 dereferenceable(8) %93)
  %95 = getelementptr inbounds %"struct.std::__detail::_Node_iterator.28", ptr %11, i32 0, i32 0
  %96 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base.29", ptr %95, i32 0, i32 0
  store ptr %94, ptr %96, align 8
  %97 = getelementptr inbounds %class.rpc_server, ptr %17, i32 0, i32 2
  %98 = call ptr @_ZNSt13unordered_setIP19ggml_backend_bufferSt4hashIS1_ESt8equal_toIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(56) %97) #5
  %99 = getelementptr inbounds %"struct.std::__detail::_Node_iterator.28", ptr %12, i32 0, i32 0
  %100 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base.29", ptr %99, i32 0, i32 0
  store ptr %98, ptr %100, align 8
  %101 = call noundef zeroext i1 @_ZNSt8__detaileqERKNS_19_Node_iterator_baseIP19ggml_backend_bufferLb0EEES5_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  br label %102

102:                                              ; preds = %90, %79
  %103 = phi i1 [ false, %79 ], [ %101, %90 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br i1 %103, label %104, label %107

104:                                              ; preds = %102
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ggml_tensor, ptr %105, i32 0, i32 1
  store ptr null, ptr %106, align 8, !tbaa !18
  br label %107

107:                                              ; preds = %104, %102
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.ggml_tensor, ptr %108, i32 0, i32 1
  %110 = load ptr, ptr %109, align 8, !tbaa !18
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %152

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = call i64 @ggml_nbytes(ptr noundef %113)
  store i64 %114, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.ggml_tensor, ptr %115, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8, !tbaa !18
  %118 = call ptr @ggml_backend_buffer_get_base(ptr noundef %117)
  %119 = ptrtoint ptr %118 to i64
  store i64 %119, ptr %14, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.ggml_tensor, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !18
  %123 = call i64 @ggml_backend_buffer_get_size(ptr noundef %122)
  store i64 %123, ptr %15, align 8, !tbaa !14
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.rpc_tensor, ptr %124, i32 0, i32 11
  %126 = load i64, ptr %125, align 1, !tbaa !22
  %127 = load i64, ptr %13, align 8, !tbaa !14
  %128 = add i64 %126, %127
  %129 = load ptr, ptr %7, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.rpc_tensor, ptr %129, i32 0, i32 11
  %131 = load i64, ptr %130, align 1, !tbaa !22
  %132 = icmp uge i64 %128, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %112
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.3, i32 noundef 1018, ptr noundef @.str.4, ptr noundef @.str.11) #6
  unreachable

134:                                              ; preds = %112
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.rpc_tensor, ptr %135, i32 0, i32 11
  %137 = load i64, ptr %136, align 1, !tbaa !22
  %138 = load i64, ptr %14, align 8, !tbaa !14
  %139 = icmp uge i64 %137, %138
  br i1 %139, label %140, label %150

140:                                              ; preds = %134
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.rpc_tensor, ptr %141, i32 0, i32 11
  %143 = load i64, ptr %142, align 1, !tbaa !22
  %144 = load i64, ptr %13, align 8, !tbaa !14
  %145 = add i64 %143, %144
  %146 = load i64, ptr %14, align 8, !tbaa !14
  %147 = load i64, ptr %15, align 8, !tbaa !14
  %148 = add i64 %146, %147
  %149 = icmp ule i64 %145, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %140, %134
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef @.str.3, i32 noundef 1019, ptr noundef @.str.4, ptr noundef @.str.12) #6
  unreachable

151:                                              ; preds = %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %152

152:                                              ; preds = %151, %107
  %153 = load ptr, ptr %7, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.rpc_tensor, ptr %153, i32 0, i32 5
  %155 = load i32, ptr %154, align 1, !tbaa !23
  %156 = load ptr, ptr %8, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.ggml_tensor, ptr %156, i32 0, i32 4
  store i32 %155, ptr %157, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !13
  br label %158

158:                                              ; preds = %175, %152
  %159 = load i32, ptr %16, align 4, !tbaa !13
  %160 = zext i32 %159 to i64
  %161 = icmp ult i64 %160, 16
  br i1 %161, label %163, label %162

162:                                              ; preds = %158
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %178

163:                                              ; preds = %158
  %164 = load ptr, ptr %7, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.rpc_tensor, ptr %164, i32 0, i32 6
  %166 = load i32, ptr %16, align 4, !tbaa !13
  %167 = zext i32 %166 to i64
  %168 = getelementptr inbounds [16 x i32], ptr %165, i64 0, i64 %167
  %169 = load i32, ptr %168, align 1, !tbaa !13
  %170 = load ptr, ptr %8, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.ggml_tensor, ptr %170, i32 0, i32 5
  %172 = load i32, ptr %16, align 4, !tbaa !13
  %173 = zext i32 %172 to i64
  %174 = getelementptr inbounds [16 x i32], ptr %171, i64 0, i64 %173
  store i32 %169, ptr %174, align 4, !tbaa !13
  br label %175

175:                                              ; preds = %163
  %176 = load i32, ptr %16, align 4, !tbaa !13
  %177 = add i32 %176, 1
  store i32 %177, ptr %16, align 4, !tbaa !13
  br label %158, !llvm.loop !25

178:                                              ; preds = %162
  %179 = load ptr, ptr %7, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.rpc_tensor, ptr %179, i32 0, i32 7
  %181 = load i32, ptr %180, align 1, !tbaa !26
  %182 = load ptr, ptr %8, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.ggml_tensor, ptr %182, i32 0, i32 6
  store i32 %181, ptr %183, align 4, !tbaa !27
  %184 = load ptr, ptr %7, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.rpc_tensor, ptr %184, i32 0, i32 11
  %186 = load i64, ptr %185, align 1, !tbaa !22
  %187 = inttoptr i64 %186 to ptr
  %188 = load ptr, ptr %8, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.ggml_tensor, ptr %188, i32 0, i32 10
  store ptr %187, ptr %189, align 8, !tbaa !28
  %190 = load ptr, ptr %8, align 8, !tbaa !5
  %191 = load ptr, ptr %7, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.rpc_tensor, ptr %191, i32 0, i32 12
  %193 = getelementptr inbounds [64 x i8], ptr %192, i64 0, i64 0
  %194 = call ptr @ggml_set_name(ptr noundef %190, ptr noundef %193)
  %195 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %195, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %196

196:                                              ; preds = %178, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %197

197:                                              ; preds = %196, %22
  %198 = load ptr, ptr %4, align 8
  ret ptr %198
}

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

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

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

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

declare ptr @ggml_backend_buffer_get_base(ptr noundef) #3

declare ptr @ggml_new_tensor_4d(ptr noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) #3

declare i64 @ggml_nbytes(ptr noundef) #3

declare i64 @ggml_backend_buffer_get_size(ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 = { nounwind }
attributes #6 = { 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, !12, i64 8}
!10 = !{!"_ZTS10rpc_tensor", !11, i64 0, !12, i64 8, !11, i64 12, !7, i64 20, !7, i64 36, !12, i64 52, !7, i64 56, !12, i64 120, !7, i64 124, !11, i64 204, !11, i64 212, !11, i64 220, !7, i64 228, !7, i64 292}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!11, !11, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!10, !11, i64 12}
!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, !12, 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 = !{!10, !11, i64 220}
!23 = !{!10, !12, i64 52}
!24 = !{!19, !21, i64 80}
!25 = distinct !{!25, !16}
!26 = !{!10, !12, i64 120}
!27 = !{!19, !12, i64 148}
!28 = !{!19, !6, i64 248}


; 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.std::__detail::_Node_iterator.28" = type { %"struct.std::__detail::_Node_iterator_base.29" }
%"struct.std::__detail::_Node_iterator_base.29" = 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.9 = external hidden unnamed_addr constant [39 x i8], align 1
@__func__._ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [89 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor(ptr noundef nonnull align 8 dereferenceable(72) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %"struct.std::__detail::_Node_iterator.28", align 8
  %5 = alloca %"struct.std::__detail::_Node_iterator.28", align 8
  %6 = getelementptr inbounds i8, ptr %2, i64 8
  %7 = load i32, ptr %6, align 1, !tbaa !5
  %8 = icmp ugt i32 %7, 38
  br i1 %8, label %9, label %10

9:                                                ; preds = %3
  tail call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef nonnull @.str.9, ptr noundef nonnull @__func__._ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor, i32 noundef %7)
  br label %117

10:                                               ; preds = %3
  %11 = getelementptr inbounds i8, ptr %2, i64 20
  %12 = load i32, ptr %11, align 1, !tbaa !11
  %13 = zext i32 %12 to i64
  %14 = getelementptr inbounds i8, ptr %2, i64 24
  %15 = load i32, ptr %14, align 1, !tbaa !11
  %16 = zext i32 %15 to i64
  %17 = getelementptr inbounds i8, ptr %2, i64 28
  %18 = load i32, ptr %17, align 1, !tbaa !11
  %19 = zext i32 %18 to i64
  %20 = getelementptr inbounds i8, ptr %2, i64 32
  %21 = load i32, ptr %20, align 1, !tbaa !11
  %22 = zext i32 %21 to i64
  %23 = tail call ptr @ggml_new_tensor_4d(ptr noundef %1, i32 noundef %7, i64 noundef %13, i64 noundef %16, i64 noundef %19, i64 noundef %22)
  %24 = icmp eq ptr %23, null
  br i1 %24, label %37, label %.preheader

.preheader:                                       ; preds = %10
  %25 = getelementptr inbounds i8, ptr %2, i64 36
  %26 = getelementptr inbounds i8, ptr %23, i64 48
  %27 = load <2 x i32>, ptr %25, align 1, !tbaa !11
  %28 = zext <2 x i32> %27 to <2 x i64>
  store <2 x i64> %28, ptr %26, align 8, !tbaa !12
  %29 = getelementptr inbounds i8, ptr %2, i64 44
  %30 = getelementptr inbounds i8, ptr %23, i64 64
  %31 = load <2 x i32>, ptr %29, align 1, !tbaa !11
  %32 = zext <2 x i32> %31 to <2 x i64>
  store <2 x i64> %32, ptr %30, align 8, !tbaa !12
  %33 = getelementptr inbounds i8, ptr %2, i64 12
  %34 = load i64, ptr %33, align 1, !tbaa !13
  %35 = inttoptr i64 %34 to ptr
  %36 = getelementptr inbounds i8, ptr %23, i64 8
  store ptr %35, ptr %36, align 8, !tbaa !14
  %.not = icmp eq i64 %34, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  br i1 %.not, label %.critedge, label %39

37:                                               ; preds = %10
  %38 = load i32, ptr %6, align 1, !tbaa !5
  tail call void (i32, ptr, ...) @ggml_log_internal(i32 noundef 4, ptr noundef nonnull @.str.10, ptr noundef nonnull @__func__._ZN10rpc_server18deserialize_tensorEP12ggml_contextPK10rpc_tensor, i32 noundef %38)
  br label %117

39:                                               ; preds = %.preheader
  %40 = getelementptr inbounds i8, ptr %0, i64 16
  %41 = tail call ptr @_ZNSt13unordered_setIP19ggml_backend_bufferSt4hashIS1_ESt8equal_toIS1_ESaIS1_EE4findERKS1_(ptr noundef nonnull align 8 dereferenceable(56) %40, ptr noundef nonnull align 8 dereferenceable(8) %36)
  store ptr %41, ptr %4, align 8
  %42 = tail call ptr @_ZNSt13unordered_setIP19ggml_backend_bufferSt4hashIS1_ESt8equal_toIS1_ESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(56) %40) #5
  store ptr %42, ptr %5, align 8
  %43 = call noundef zeroext i1 @_ZNSt8__detaileqERKNS_19_Node_iterator_baseIP19ggml_backend_bufferLb0EEES5_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br i1 %43, label %.thread, label %._crit_edge

._crit_edge:                                      ; preds = %39
  %.pr.pre = load ptr, ptr %36, align 8, !tbaa !14
  br label %44

.thread:                                          ; preds = %39
  store ptr null, ptr %36, align 8, !tbaa !14
  br label %59

.critedge:                                        ; preds = %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %44

44:                                               ; preds = %._crit_edge, %.critedge
  %.pr = phi ptr [ %.pr.pre, %._crit_edge ], [ %35, %.critedge ]
  %.not59 = icmp eq ptr %.pr, null
  br i1 %.not59, label %59, label %45

45:                                               ; preds = %44
  %46 = call i64 @ggml_nbytes(ptr noundef nonnull %23)
  %47 = load ptr, ptr %36, align 8, !tbaa !14
  %48 = call ptr @ggml_backend_buffer_get_base(ptr noundef %47)
  %49 = load ptr, ptr %36, align 8, !tbaa !14
  %50 = call i64 @ggml_backend_buffer_get_size(ptr noundef %49)
  %51 = getelementptr inbounds i8, ptr %2, i64 220
  %52 = load i64, ptr %51, align 1, !tbaa !19
  %53 = add i64 %52, %46
  %.not60 = icmp ult i64 %53, %52
  br i1 %.not60, label %54, label %55

54:                                               ; preds = %45
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.3, i32 noundef 1018, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.11) #6
  unreachable

55:                                               ; preds = %45
  %56 = ptrtoint ptr %48 to i64
  %.not61 = icmp ult i64 %52, %56
  %57 = add i64 %50, %56
  %.not62 = icmp ugt i64 %53, %57
  %or.cond = select i1 %.not61, i1 true, i1 %.not62
  br i1 %or.cond, label %58, label %59

58:                                               ; preds = %55
  call void (ptr, i32, ptr, ...) @ggml_abort(ptr noundef nonnull @.str.3, i32 noundef 1019, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.12) #6
  unreachable

59:                                               ; preds = %.thread, %55, %44
  %60 = getelementptr inbounds i8, ptr %2, i64 52
  %61 = getelementptr inbounds i8, ptr %23, i64 80
  %62 = load <2 x i32>, ptr %60, align 1, !tbaa !11
  store <2 x i32> %62, ptr %61, align 8, !tbaa !20
  %63 = getelementptr inbounds i8, ptr %2, i64 60
  %64 = load i32, ptr %63, align 1, !tbaa !11
  %65 = getelementptr inbounds i8, ptr %23, i64 88
  store i32 %64, ptr %65, align 4, !tbaa !11
  %66 = getelementptr inbounds i8, ptr %2, i64 64
  %67 = load i32, ptr %66, align 1, !tbaa !11
  %68 = getelementptr inbounds i8, ptr %23, i64 92
  store i32 %67, ptr %68, align 4, !tbaa !11
  %69 = getelementptr inbounds i8, ptr %2, i64 68
  %70 = load i32, ptr %69, align 1, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %23, i64 96
  store i32 %70, ptr %71, align 4, !tbaa !11
  %72 = getelementptr inbounds i8, ptr %2, i64 72
  %73 = load i32, ptr %72, align 1, !tbaa !11
  %74 = getelementptr inbounds i8, ptr %23, i64 100
  store i32 %73, ptr %74, align 4, !tbaa !11
  %75 = getelementptr inbounds i8, ptr %2, i64 76
  %76 = load i32, ptr %75, align 1, !tbaa !11
  %77 = getelementptr inbounds i8, ptr %23, i64 104
  store i32 %76, ptr %77, align 4, !tbaa !11
  %78 = getelementptr inbounds i8, ptr %2, i64 80
  %79 = load i32, ptr %78, align 1, !tbaa !11
  %80 = getelementptr inbounds i8, ptr %23, i64 108
  store i32 %79, ptr %80, align 4, !tbaa !11
  %81 = getelementptr inbounds i8, ptr %2, i64 84
  %82 = load i32, ptr %81, align 1, !tbaa !11
  %83 = getelementptr inbounds i8, ptr %23, i64 112
  store i32 %82, ptr %83, align 4, !tbaa !11
  %84 = getelementptr inbounds i8, ptr %2, i64 88
  %85 = load i32, ptr %84, align 1, !tbaa !11
  %86 = getelementptr inbounds i8, ptr %23, i64 116
  store i32 %85, ptr %86, align 4, !tbaa !11
  %87 = getelementptr inbounds i8, ptr %2, i64 92
  %88 = load i32, ptr %87, align 1, !tbaa !11
  %89 = getelementptr inbounds i8, ptr %23, i64 120
  store i32 %88, ptr %89, align 4, !tbaa !11
  %90 = getelementptr inbounds i8, ptr %2, i64 96
  %91 = load i32, ptr %90, align 1, !tbaa !11
  %92 = getelementptr inbounds i8, ptr %23, i64 124
  store i32 %91, ptr %92, align 4, !tbaa !11
  %93 = getelementptr inbounds i8, ptr %2, i64 100
  %94 = load i32, ptr %93, align 1, !tbaa !11
  %95 = getelementptr inbounds i8, ptr %23, i64 128
  store i32 %94, ptr %95, align 4, !tbaa !11
  %96 = getelementptr inbounds i8, ptr %2, i64 104
  %97 = load i32, ptr %96, align 1, !tbaa !11
  %98 = getelementptr inbounds i8, ptr %23, i64 132
  store i32 %97, ptr %98, align 4, !tbaa !11
  %99 = getelementptr inbounds i8, ptr %2, i64 108
  %100 = load i32, ptr %99, align 1, !tbaa !11
  %101 = getelementptr inbounds i8, ptr %23, i64 136
  store i32 %100, ptr %101, align 4, !tbaa !11
  %102 = getelementptr inbounds i8, ptr %2, i64 112
  %103 = load i32, ptr %102, align 1, !tbaa !11
  %104 = getelementptr inbounds i8, ptr %23, i64 140
  store i32 %103, ptr %104, align 4, !tbaa !11
  %105 = getelementptr inbounds i8, ptr %2, i64 116
  %106 = load i32, ptr %105, align 1, !tbaa !11
  %107 = getelementptr inbounds i8, ptr %23, i64 144
  store i32 %106, ptr %107, align 4, !tbaa !11
  %108 = getelementptr inbounds i8, ptr %2, i64 120
  %109 = load i32, ptr %108, align 1, !tbaa !21
  %110 = getelementptr inbounds i8, ptr %23, i64 148
  store i32 %109, ptr %110, align 4, !tbaa !22
  %111 = getelementptr inbounds i8, ptr %2, i64 220
  %112 = load i64, ptr %111, align 1, !tbaa !19
  %113 = inttoptr i64 %112 to ptr
  %114 = getelementptr inbounds i8, ptr %23, i64 248
  store ptr %113, ptr %114, align 8, !tbaa !23
  %115 = getelementptr inbounds i8, ptr %2, i64 228
  %116 = call ptr @ggml_set_name(ptr noundef nonnull %23, ptr noundef nonnull %115)
  br label %117

117:                                              ; preds = %37, %59, %9
  %.1 = phi ptr [ null, %9 ], [ null, %37 ], [ %23, %59 ]
  ret ptr %.1
}

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

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

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

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

declare ptr @ggml_backend_buffer_get_base(ptr noundef) local_unnamed_addr #3

declare ptr @ggml_new_tensor_4d(ptr noundef, i32 noundef, i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #3

declare i64 @ggml_nbytes(ptr noundef) local_unnamed_addr #3

declare i64 @ggml_backend_buffer_get_size(ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 = { nounwind }
attributes #6 = { 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, !10, i64 8}
!6 = !{!"_ZTS10rpc_tensor", !7, i64 0, !10, i64 8, !7, i64 12, !8, i64 20, !8, i64 36, !10, i64 52, !8, i64 56, !10, i64 120, !8, i64 124, !7, i64 204, !7, i64 212, !7, i64 220, !8, i64 228, !8, i64 292}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !7, i64 12}
!14 = !{!15, !17, i64 8}
!15 = !{!"_ZTS11ggml_tensor", !16, i64 0, !17, i64 8, !8, i64 16, !8, i64 48, !18, i64 80, !8, i64 84, !10, i64 148, !8, i64 152, !17, i64 232, !7, i64 240, !17, i64 248, !8, i64 256, !17, i64 320, !8, i64 328}
!16 = !{!"_ZTS9ggml_type", !8, i64 0}
!17 = !{!"any pointer", !8, i64 0}
!18 = !{!"_ZTS7ggml_op", !8, i64 0}
!19 = !{!6, !7, i64 220}
!20 = !{!8, !8, i64 0}
!21 = !{!6, !10, i64 120}
!22 = !{!15, !10, i64 148}
!23 = !{!15, !17, i64 248}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass