; LLVM IR from ChenyangZhang-cs/iMLBench :: MLP/co-run&zero-copy/src/tensor.ll (ZN5clnet8GradientEPNS_6TensorES1_)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<clnet::Tensor *, clnet::Tensor *, std::_Identity<clnet::Tensor *>, std::less<clnet::Tensor *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<clnet::Tensor *, clnet::Tensor *, std::_Identity<clnet::Tensor *>, std::less<clnet::Tensor *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.13 = type { ptr }
%"struct.clnet::Tensor" = type { ptr, %"class.std::vector.1", %"class.std::vector", %"class.std::__cxx11::basic_string", %"class.std::vector", i64, ptr, ptr, i64 }
%"class.std::vector.1" = type { %"struct.std::_Vector_base.2" }
%"struct.std::_Vector_base.2" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<clnet::Tensor *, std::allocator<clnet::Tensor *>>::_Vector_impl" }
%"struct.std::_Vector_base<clnet::Tensor *, std::allocator<clnet::Tensor *>>::_Vector_impl" = type { %"struct.std::_Vector_base<clnet::Tensor *, std::allocator<clnet::Tensor *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<clnet::Tensor *, std::allocator<clnet::Tensor *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZN5clnet20CLNET_TENSOR_GLOBALSE = external dso_local global i64, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN5clnet8GradientEPNS_6TensorES1_(ptr noundef %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca %"class.std::set", align 8
  %11 = alloca %"class.std::function", align 8
  %12 = alloca %class.anon.13, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  br label %109

19:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.clnet::Tensor", ptr %20, i32 0, i32 7
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  store ptr %22, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %90

25:                                               ; preds = %19
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %88

28:                                               ; preds = %25
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.clnet::Tensor", ptr %29, i32 0, i32 7
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = icmp ne ptr %31, %32
  br i1 %33, label %34, label %88

34:                                               ; preds = %28
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %"struct.clnet::Tensor", ptr %35, i32 0, i32 7
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %61

39:                                               ; preds = %34
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.clnet::Tensor", ptr %40, i32 0, i32 2
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.clnet::Tensor", ptr %42, i32 0, i32 7
  call void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %41, ptr noundef nonnull align 8 dereferenceable(8) %43)
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  %44 = load i64, ptr @_ZN5clnet20CLNET_TENSOR_GLOBALSE, align 8, !tbaa !23
  %45 = and i64 %44, 512
  %46 = icmp ne i64 %45, 0
  %47 = zext i1 %46 to i8
  store i8 %47, ptr %7, align 1, !tbaa !24
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.clnet::Tensor", ptr %48, i32 0, i32 7
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds %"struct.clnet::Tensor", ptr %50, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %52 = load i8, ptr %7, align 1, !tbaa !24, !range !26, !noundef !27
  %53 = trunc i8 %52 to i1
  br i1 %53, label %54, label %58

54:                                               ; preds = %39
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.clnet::Tensor", ptr %55, i32 0, i32 7
  %57 = load ptr, ptr %56, align 8, !tbaa !9
  br label %59

58:                                               ; preds = %39
  br label %59

59:                                               ; preds = %58, %54
  %60 = phi ptr [ %57, %54 ], [ null, %58 ]
  store ptr %60, ptr %8, align 8, !tbaa !5
  call void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  br label %61

61:                                               ; preds = %59, %34
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.clnet::Tensor", ptr %63, i32 0, i32 7
  store ptr %62, ptr %64, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  store i8 0, ptr %9, align 1, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 48, ptr %10) #3
  call void @_ZNSt3setIPN5clnet6TensorESt4lessIS2_ESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #3
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %67 = getelementptr inbounds %class.anon.13, ptr %12, i32 0, i32 0
  store ptr %9, ptr %67, align 8, !tbaa !5
  call void @"_ZNSt8functionIFvPN5clnet6TensorEPvEEC2IZNS0_8GradientES2_S2_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #3
  %68 = load ptr, ptr %65, align 8, !tbaa !28
  %69 = getelementptr inbounds ptr, ptr %68, i64 5
  %70 = load ptr, ptr %69, align 8
  invoke void %70(ptr noundef nonnull align 8 dereferenceable(144) %65, ptr noundef %10, ptr noundef %66, ptr noundef %11)
          to label %71 unwind label %78

71:                                               ; preds = %61
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %72 = load i8, ptr %9, align 1, !tbaa !24, !range !26, !noundef !27
  %73 = trunc i8 %72 to i1
  br i1 %73, label %86, label %74

74:                                               ; preds = %71
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %"struct.clnet::Tensor", ptr %75, i32 0, i32 2
  invoke void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %76, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %77 unwind label %82

77:                                               ; preds = %74
  br label %86

78:                                               ; preds = %61
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %13, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %14, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %87

82:                                               ; preds = %74
  %83 = landingpad { ptr, i32 }
          cleanup
  %84 = extractvalue { ptr, i32 } %83, 0
  store ptr %84, ptr %13, align 8
  %85 = extractvalue { ptr, i32 } %83, 1
  store i32 %85, ptr %14, align 4
  br label %87

86:                                               ; preds = %77, %71
  call void @_ZNSt3setIPN5clnet6TensorESt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  br label %88

87:                                               ; preds = %82, %78
  call void @_ZNSt3setIPN5clnet6TensorESt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %10) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %111

88:                                               ; preds = %86, %28, %25
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %89, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %108

90:                                               ; preds = %19
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = load ptr, ptr %91, align 8, !tbaa !28
  %94 = getelementptr inbounds ptr, ptr %93, i64 2
  %95 = load ptr, ptr %94, align 8
  %96 = call noundef ptr %95(ptr noundef nonnull align 8 dereferenceable(144) %91, ptr noundef %92)
  store ptr %96, ptr %6, align 8, !tbaa !5
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %99, label %100

99:                                               ; preds = %90
  store ptr null, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %108

100:                                              ; preds = %90
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %"struct.clnet::Tensor", ptr %102, i32 0, i32 7
  store ptr %101, ptr %103, align 8, !tbaa !9
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = load ptr, ptr %4, align 8, !tbaa !5
  %106 = getelementptr inbounds %"struct.clnet::Tensor", ptr %105, i32 0, i32 7
  store ptr %104, ptr %106, align 8, !tbaa !9
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %107, ptr %3, align 8
  store i32 1, ptr %15, align 4
  br label %108

108:                                              ; preds = %100, %99, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %109

109:                                              ; preds = %108, %18
  %110 = load ptr, ptr %3, align 8
  ret ptr %110

111:                                              ; preds = %87
  %112 = load ptr, ptr %13, align 8
  %113 = load i32, ptr %14, align 4
  %114 = insertvalue { ptr, i32 } poison, ptr %112, 0
  %115 = insertvalue { ptr, i32 } %114, i32 %113, 1
  resume { ptr, i32 } %115
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvPN5clnet6TensorEPvEEC2IZNS0_8GradientES2_S2_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

attributes #0 = { 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 #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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 128}
!10 = !{!"_ZTSN5clnet6TensorE", !11, i64 8, !15, i64 32, !19, i64 56, !15, i64 88, !22, i64 112, !6, i64 120, !6, i64 128, !22, i64 136}
!11 = !{!"_ZTSSt6vectorIxSaIxEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIxSaIxEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIxSaIxEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIxSaIxEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"_ZTSSt6vectorIPN5clnet6TensorESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIPN5clnet6TensorESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN5clnet6TensorESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPN5clnet6TensorESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !21, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"long long", !7, i64 0}
!23 = !{!21, !21, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"bool", !7, i64 0}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!29, !29, i64 0}
!29 = !{!"vtable pointer", !8, 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"

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<clnet::Tensor *, clnet::Tensor *, std::_Identity<clnet::Tensor *>, std::less<clnet::Tensor *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<clnet::Tensor *, clnet::Tensor *, std::_Identity<clnet::Tensor *>, std::less<clnet::Tensor *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.13 = type { ptr }

@_ZN5clnet20CLNET_TENSOR_GLOBALSE = external dso_local local_unnamed_addr global i64, align 8

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN5clnet8GradientEPNS_6TensorES1_(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca %"class.std::set", align 8
  %7 = alloca %"class.std::function", align 8
  %8 = alloca %class.anon.13, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %9 = icmp eq ptr %0, null
  br i1 %9, label %47, label %10

10:                                               ; preds = %2
  %11 = getelementptr inbounds i8, ptr %0, i64 128
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %39, label %13

13:                                               ; preds = %10
  %.not28 = icmp eq ptr %1, null
  br i1 %.not28, label %47, label %14

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %12, i64 128
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %.not29 = icmp eq ptr %16, %1
  br i1 %.not29, label %47, label %17

17:                                               ; preds = %14
  %.not30 = icmp eq ptr %16, null
  br i1 %.not30, label %24, label %18

18:                                               ; preds = %17
  %19 = getelementptr inbounds i8, ptr %1, i64 32
  tail call void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %20 = load i64, ptr @_ZN5clnet20CLNET_TENSOR_GLOBALSE, align 8, !tbaa !23
  %21 = and i64 %20, 512
  %.not31 = icmp eq i64 %21, 0
  %22 = load ptr, ptr %15, align 8, !tbaa !9
  %23 = getelementptr inbounds i8, ptr %22, i64 32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %spec.select = select i1 %.not31, ptr null, ptr %22
  store ptr %spec.select, ptr %4, align 8, !tbaa !5
  call void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %24

24:                                               ; preds = %18, %17
  store ptr %1, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #3
  store i8 0, ptr %5, align 1, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #3
  call void @_ZNSt3setIPN5clnet6TensorESt4lessIS2_ESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  store ptr %5, ptr %8, align 8, !tbaa !5
  call void @"_ZNSt8functionIFvPN5clnet6TensorEPvEEC2IZNS0_8GradientES2_S2_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #3
  %25 = load ptr, ptr %1, align 8, !tbaa !26
  %26 = getelementptr inbounds i8, ptr %25, i64 40
  %27 = load ptr, ptr %26, align 8
  invoke void %27(ptr noundef nonnull align 8 dereferenceable(144) %1, ptr noundef nonnull %6, ptr noundef nonnull %12, ptr noundef nonnull %7)
          to label %28 unwind label %33

28:                                               ; preds = %24
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  %29 = load i8, ptr %5, align 1, !tbaa !24, !range !28, !noundef !29
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %37, label %31

31:                                               ; preds = %28
  %32 = getelementptr inbounds i8, ptr %12, i64 32
  invoke void @_ZNSt6vectorIPN5clnet6TensorESaIS2_EE9push_backERKS2_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %37 unwind label %35

33:                                               ; preds = %24
  %34 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  br label %38

35:                                               ; preds = %31
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %38

37:                                               ; preds = %31, %28
  call void @_ZNSt3setIPN5clnet6TensorESt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  br label %47

38:                                               ; preds = %35, %33
  %.pn = phi { ptr, i32 } [ %36, %35 ], [ %34, %33 ]
  call void @_ZNSt3setIPN5clnet6TensorESt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  resume { ptr, i32 } %.pn

39:                                               ; preds = %10
  %40 = load ptr, ptr %0, align 8, !tbaa !26
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %42 = load ptr, ptr %41, align 8
  %43 = tail call noundef ptr %42(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef %1)
  %44 = icmp eq ptr %43, null
  br i1 %44, label %47, label %45

45:                                               ; preds = %39
  %46 = getelementptr inbounds i8, ptr %43, i64 128
  store ptr %1, ptr %46, align 8, !tbaa !9
  store ptr %43, ptr %11, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %45, %37, %14, %13, %39, %2
  %.1 = phi ptr [ null, %2 ], [ %43, %45 ], [ %12, %37 ], [ %12, %14 ], [ %12, %13 ], [ null, %39 ]
  ret ptr %.1
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvPN5clnet6TensorEPvEEC2IZNS0_8GradientES2_S2_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

attributes #0 = { 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 #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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 128}
!10 = !{!"_ZTSN5clnet6TensorE", !11, i64 8, !15, i64 32, !19, i64 56, !15, i64 88, !22, i64 112, !6, i64 120, !6, i64 128, !22, i64 136}
!11 = !{!"_ZTSSt6vectorIxSaIxEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIxSaIxEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIxSaIxEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIxSaIxEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"_ZTSSt6vectorIPN5clnet6TensorESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIPN5clnet6TensorESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN5clnet6TensorESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPN5clnet6TensorESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !20, i64 0, !21, i64 8, !7, i64 16}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!21 = !{!"long", !7, i64 0}
!22 = !{!"long long", !7, i64 0}
!23 = !{!21, !21, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"bool", !7, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}
!28 = !{i8 0, i8 2}
!29 = !{}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass