; LLVM IR from huawei-noah/bolt :: inference/engine/src (bolt_c)

; 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.TensorDesc = type { i32, i32, i32, [20 x i32] }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }
%struct.ModelHandleInner = type { ptr, ptr, i32, ptr, i8 }
%struct.DataDesc = type { i32, i32, i32, [20 x i32], [128 x i8], ptr }
%struct.ResultHandleInner = type { i32, ptr, i32 }

@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@__FUNCTION__.AllocSpecificResultHandle = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef, ptr noundef, ptr noundef) #0

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z18print_model_handleP16ModelHandleInner(ptr noundef) #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) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_Z10UNI_MALLOCm(i64 noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z10UNI_MEMCPYPvPKvm(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z19TensorDesc2DataDesc10TensorDescP8DataDesc(ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z19print_result_handleP17ResultHandleInner(ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local ptr @AllocSpecificResultHandle(ptr noundef %0, i32 noundef %1, ptr noundef %2) #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %struct.TensorDesc, align 4
  %15 = alloca %"class.std::__cxx11::basic_string", align 8
  %16 = alloca %"class.std::allocator.0", align 1
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca %struct.TensorDesc, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %20, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef @__FUNCTION__.AllocSpecificResultHandle, ptr noundef @.str.1, ptr noundef %21)
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_Z18print_model_handleP16ModelHandleInner(ptr noundef %22)
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %125

25:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ModelHandleInner, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  store ptr %28, ptr %9, align 8, !tbaa !5
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef @__FUNCTION__.AllocSpecificResultHandle, ptr noundef @.str.2, ptr noundef %29)
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %124

32:                                               ; preds = %25
  %33 = call noundef ptr @_Z10UNI_MALLOCm(i64 noundef 24)
  store ptr %33, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %34 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %34, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = mul i64 232, %36
  %38 = call noundef ptr @_Z10UNI_MALLOCm(i64 noundef %37)
  store ptr %38, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %100, %32
  %40 = load i32, ptr %12, align 4, !tbaa !9
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %112

44:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load i32, ptr %12, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds ptr, ptr %45, i64 %47
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = call i64 @strlen(ptr noundef %49) #9
  %51 = icmp ult i64 %50, 127
  br i1 %51, label %52, label %59

52:                                               ; preds = %44
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds ptr, ptr %53, i64 %55
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = call i64 @strlen(ptr noundef %57) #9
  br label %60

59:                                               ; preds = %44
  br label %60

60:                                               ; preds = %59, %52
  %61 = phi i64 [ %58, %52 ], [ 127, %59 ]
  %62 = trunc i64 %61 to i32
  store i32 %62, ptr %13, align 4, !tbaa !9
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = load i32, ptr %12, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds %struct.DataDesc, ptr %63, i64 %65
  %67 = getelementptr inbounds %struct.DataDesc, ptr %66, i32 0, i32 4
  %68 = getelementptr inbounds [128 x i8], ptr %67, i64 0, i64 0
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds ptr, ptr %69, i64 %71
  %73 = load ptr, ptr %72, align 8, !tbaa !5
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = zext i32 %74 to i64
  call void @_Z10UNI_MEMCPYPvPKvm(ptr noundef %68, ptr noundef %73, i64 noundef %75)
  %76 = load i32, ptr %13, align 4, !tbaa !9
  %77 = icmp ult i32 %76, 128
  br i1 %77, label %78, label %87

78:                                               ; preds = %60
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = load i32, ptr %12, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds %struct.DataDesc, ptr %79, i64 %81
  %83 = getelementptr inbounds %struct.DataDesc, ptr %82, i32 0, i32 4
  %84 = load i32, ptr %13, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds [128 x i8], ptr %83, i64 0, i64 %85
  store i8 0, ptr %86, align 1, !tbaa !15
  br label %87

87:                                               ; preds = %78, %60
  call void @llvm.lifetime.start.p0(i64 92, ptr %14) #8
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds ptr, ptr %89, i64 %91
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #8
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #8
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %15, ptr noundef %93, ptr noundef nonnull align 1 dereferenceable(1) %16)
          to label %94 unwind label %103

94:                                               ; preds = %87
  invoke void @_ZN3CNN23get_tensor_desc_by_nameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4 %14, ptr noundef nonnull align 8 dereferenceable(5265) %88, ptr noundef %15)
          to label %95 unwind label %107

95:                                               ; preds = %94
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #8
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !16
  %96 = load ptr, ptr %11, align 8, !tbaa !5
  %97 = load i32, ptr %12, align 4, !tbaa !9
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds %struct.DataDesc, ptr %96, i64 %98
  call void @_Z19TensorDesc2DataDesc10TensorDescP8DataDesc(ptr noundef byval(%struct.TensorDesc) align 8 %19, ptr noundef %99)
  call void @llvm.lifetime.end.p0(i64 92, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %100

100:                                              ; preds = %95
  %101 = load i32, ptr %12, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !9
  br label %39, !llvm.loop !21

103:                                              ; preds = %87
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %17, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %18, align 4
  br label %111

107:                                              ; preds = %94
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %17, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %18, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %15) #8
  br label %111

111:                                              ; preds = %107, %103
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %16) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 92, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  br label %128

112:                                              ; preds = %43
  %113 = load i32, ptr %10, align 4, !tbaa !9
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.ResultHandleInner, ptr %114, i32 0, i32 0
  store i32 %113, ptr %115, align 8, !tbaa !23
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.ResultHandleInner, ptr %117, i32 0, i32 1
  store ptr %116, ptr %118, align 8, !tbaa !25
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.ModelHandleInner, ptr %119, i32 0, i32 2
  %121 = load i32, ptr %120, align 8, !tbaa !26
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.ResultHandleInner, ptr %122, i32 0, i32 2
  store i32 %121, ptr %123, align 8, !tbaa !27
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %124

124:                                              ; preds = %112, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %125

125:                                              ; preds = %124, %3
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_Z19print_result_handleP17ResultHandleInner(ptr noundef %126)
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  ret ptr %127

128:                                              ; preds = %111
  %129 = load ptr, ptr %17, align 8
  %130 = load i32, ptr %18, align 4
  %131 = insertvalue { ptr, i32 } poison, ptr %129, 0
  %132 = insertvalue { ptr, i32 } %131, i32 %130, 1
  resume { ptr, i32 } %132
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

declare void @_ZN3CNN23get_tensor_desc_by_nameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4, ptr noundef nonnull align 8 dereferenceable(5265), ptr noundef) #7

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

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_ZTS16ModelHandleInner", !6, i64 0, !6, i64 8, !13, i64 16, !6, i64 24, !14, i64 32}
!13 = !{!"_ZTS13HARDWARE_TYPE", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{i64 0, i64 4, !17, i64 4, i64 4, !19, i64 8, i64 4, !9, i64 12, i64 80, !15}
!17 = !{!18, !18, i64 0}
!18 = !{!"_ZTS8DataType", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"_ZTS10DataFormat", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!24, !10, i64 0}
!24 = !{!"_ZTS17ResultHandleInner", !10, i64 0, !6, i64 8, !13, i64 16}
!25 = !{!24, !6, i64 8}
!26 = !{!12, !13, i64 16}
!27 = !{!24, !13, i64 16}


; 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.TensorDesc = type { i32, i32, i32, [20 x i32] }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }
%struct.DataDesc = type { i32, i32, i32, [20 x i32], [128 x i8], ptr }

@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@__FUNCTION__.AllocSpecificResultHandle = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z18print_model_handleP16ModelHandleInner(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_Z10UNI_MALLOCm(i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z10UNI_MEMCPYPvPKvm(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z19TensorDesc2DataDesc10TensorDescP8DataDesc(ptr noundef byval(%struct.TensorDesc) align 8, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z19print_result_handleP17ResultHandleInner(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @AllocSpecificResultHandle(ptr noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca %struct.TensorDesc, align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca %"class.std::allocator.0", align 1
  tail call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef nonnull @__FUNCTION__.AllocSpecificResultHandle, ptr noundef nonnull @.str.1, ptr noundef %0)
  tail call void @_Z18print_model_handleP16ModelHandleInner(ptr noundef %0)
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %34, label %7

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  tail call void @_Z18assert_not_nullptrPKcS0_PKv(ptr noundef nonnull @__FUNCTION__.AllocSpecificResultHandle, ptr noundef nonnull @.str.2, ptr noundef %9)
  %.not46 = icmp eq ptr %9, null
  br i1 %.not46, label %34, label %10

10:                                               ; preds = %7
  %11 = tail call noundef ptr @_Z10UNI_MALLOCm(i64 noundef 24)
  %12 = sext i32 %1 to i64
  %13 = mul nsw i64 %12, 232
  %14 = tail call noundef ptr @_Z10UNI_MALLOCm(i64 noundef %13)
  %15 = icmp sgt i32 %1, 0
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %10
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %28, %10
  store i32 %1, ptr %11, align 8, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %11, i64 8
  store ptr %14, ptr %16, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load i32, ptr %17, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %11, i64 16
  store i32 %18, ptr %19, align 8, !tbaa !17
  br label %34

.lr.ph:                                           ; preds = %.lr.ph.preheader, %28
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %28 ]
  %20 = getelementptr inbounds ptr, ptr %2, i64 %indvars.iv
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %22 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %21) #8
  %spec.select = call i64 @llvm.umin.i64(i64 %22, i64 127)
  %23 = getelementptr inbounds %struct.DataDesc, ptr %14, i64 %indvars.iv
  %24 = getelementptr inbounds i8, ptr %23, i64 92
  call void @_Z10UNI_MEMCPYPvPKvm(ptr noundef nonnull %24, ptr noundef %21, i64 noundef %spec.select)
  %25 = getelementptr inbounds [128 x i8], ptr %24, i64 0, i64 %spec.select
  store i8 0, ptr %25, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %4) #9
  %26 = load ptr, ptr %20, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #9
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #9
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef %26, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %27 unwind label %29

27:                                               ; preds = %.lr.ph
  invoke void @_ZN3CNN23get_tensor_desc_by_nameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind nonnull writable sret(%struct.TensorDesc) align 4 %4, ptr noundef nonnull align 8 dereferenceable(5265) %9, ptr noundef nonnull %5)
          to label %28 unwind label %31

28:                                               ; preds = %27
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #9
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #9
  call void @_Z19TensorDesc2DataDesc10TensorDescP8DataDesc(ptr noundef nonnull byval(%struct.TensorDesc) align 8 %4, ptr noundef nonnull %23)
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %4) #9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !20

29:                                               ; preds = %.lr.ph
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %33

31:                                               ; preds = %27
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #9
  br label %33

33:                                               ; preds = %31, %29
  %.pn = phi { ptr, i32 } [ %32, %31 ], [ %30, %29 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %4) #9
  resume { ptr, i32 } %.pn

34:                                               ; preds = %7, %._crit_edge, %3
  %.1 = phi ptr [ null, %3 ], [ %11, %._crit_edge ], [ null, %7 ]
  call void @_Z19print_result_handleP17ResultHandleInner(ptr noundef %.1)
  ret ptr %.1
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

declare void @_ZN3CNN23get_tensor_desc_by_nameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4, ptr noundef nonnull align 8 dereferenceable(5265), ptr noundef) local_unnamed_addr #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #7

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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 8}
!6 = !{!"_ZTS16ModelHandleInner", !7, i64 0, !7, i64 8, !10, i64 16, !7, i64 24, !11, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS13HARDWARE_TYPE", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"_ZTS17ResultHandleInner", !14, i64 0, !7, i64 8, !10, i64 16}
!14 = !{!"int", !8, i64 0}
!15 = !{!13, !7, i64 8}
!16 = !{!6, !10, i64 16}
!17 = !{!13, !10, i64 16}
!18 = !{!7, !7, i64 0}
!19 = !{!8, !8, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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