; LLVM IR from aspuru-guzik-group/qtorch :: src/main.ll (ZN6qtorch16ContractionTools30CostBasedContractionBruteForceEi)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.qtorch::Timer" = type <{ %"class.std::chrono::time_point", i64, i8, [7 x i8] }>
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::shared_ptr.178" = type { %"class.std::__shared_ptr.179" }
%"class.std::__shared_ptr.179" = type { ptr, %"class.std::__shared_count" }
%"class.std::mersenne_twister_engine" = type { [624 x i64], i64 }
%"class.std::vector.206" = type { %"struct.std::_Vector_base.207" }
%"struct.std::_Vector_base.207" = type { %"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%class.anon.211 = type { ptr, ptr, ptr, ptr }
%"struct.qtorch::retVal" = type <{ i32, i32, i32, [4 x i8], %"class.std::vector.9", i8, [7 x i8] }>
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }
%"class.std::initializer_list.212" = type { ptr, i64 }
%class.anon.213 = type { i8 }
%"class.qtorch::ContractionTools" = type { %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::complex", %"class.std::vector.186", %"class.std::random_device", %"class.std::shared_ptr.178", %"class.std::mersenne_twister_engine", i8, i32 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.0 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.0 = type { i64, [8 x i8] }
%"class.std::complex" = type { { double, double } }
%"class.std::vector.186" = type { %"struct.std::_Vector_base.187" }
%"struct.std::_Vector_base.187" = type { %"struct.std::_Vector_base<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>, std::allocator<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>, std::allocator<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>, std::allocator<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>, std::allocator<std::shared_ptr<std::vector<std::shared_ptr<qtorch::Node>>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::random_device" = type { %union.anon.191 }
%union.anon.191 = type { %"class.std::mersenne_twister_engine" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZN6qtorch8totTimerE = external dso_local global %"class.qtorch::Timer", align 8
@_ZN6qtorch7maxTimeE = external dso_local global double, align 8
@_ZTIN6qtorch18ContractionFailureE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.83 = external hidden unnamed_addr constant [13 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #1

declare ptr @__cxa_allocate_exception(i64)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare void @__cxa_throw(ptr, ptr, ptr)

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN6qtorch5Timer10getElapsedEv(ptr noundef nonnull align 8 dereferenceable(17)) #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6qtorch7Network13ContractNodesESt10shared_ptrINS_4NodeEES3_i(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr") align 8, ptr noundef nonnull align 8 dereferenceable(380), ptr noundef, ptr noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5 align 2

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN6qtorch7NetworkEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6qtorch16ContractionTools30CostBasedContractionBruteForceEi(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.178") align 8 %0, ptr noundef nonnull align 8 dereferenceable(10128) %1, i32 noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::shared_ptr.178", align 8
  %8 = alloca %"class.std::shared_ptr.178", align 8
  %9 = alloca %"class.std::mersenne_twister_engine", align 8
  %10 = alloca %"class.std::vector.206", align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::pair", align 4
  %19 = alloca %"class.std::mutex", align 8
  %20 = alloca %class.anon.211, align 8
  %21 = alloca i32, align 4
  %22 = alloca %"struct.qtorch::retVal", align 8
  %23 = alloca %"struct.qtorch::retVal", align 8
  %24 = alloca %"class.std::thread", align 8
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca %"struct.qtorch::retVal", align 8
  %28 = alloca %"class.std::thread", align 8
  %29 = alloca i32, align 4
  %30 = alloca ptr, align 8
  %31 = alloca %"struct.qtorch::retVal", align 8
  %32 = alloca %"class.std::initializer_list.212", align 8
  %33 = alloca [2 x %"struct.qtorch::retVal"], align 8
  %34 = alloca ptr, align 8
  %35 = alloca %class.anon.213, align 1
  %36 = alloca %"class.std::shared_ptr", align 8
  %37 = alloca %"class.std::shared_ptr", align 8
  %38 = alloca %"class.std::shared_ptr", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %39 = load ptr, ptr %5, align 8
  %40 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 7
  %41 = load i8, ptr %40, align 8, !tbaa !11, !range !27, !noundef !28
  %42 = trunc i8 %41 to i1
  br i1 %42, label %52, label %43

43:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #9
  %44 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 0
  %45 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 1
  call void @_ZSt11make_sharedIN6qtorch7NetworkEJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EESt10shared_ptrINSt9enable_ifIXntsr8is_arrayIT_EE5valueESB_E4typeEEDpOT0_(ptr dead_on_unwind writable sret(%"class.std::shared_ptr.178") align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %44, ptr noundef nonnull align 8 dereferenceable(32) %45)
  %46 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 5
  %47 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN6qtorch7NetworkEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16) %46, ptr noundef nonnull align 8 dereferenceable(16) %7) #9
  call void @_ZNSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #9
  %48 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 5
  %49 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %48) #9
  %50 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 8
  %51 = load i32, ptr %50, align 4, !tbaa !29
  call void @_ZN6qtorch7Network13SetNumThreadsEi(ptr noundef nonnull align 8 dereferenceable(380) %49, i32 noundef %51) #9
  br label %52

52:                                               ; preds = %43, %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #9
  %53 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 5
  call void @_ZNSt10shared_ptrIN6qtorch7NetworkEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %53) #9
  call void @llvm.lifetime.start.p0(i64 5000, ptr %9) #9
  %54 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %54, i64 5000, i1 false), !tbaa.struct !30
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #9
  call void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 30, ptr %11, align 4, !tbaa !9
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = add nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  invoke void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %57)
          to label %58 unwind label %64

58:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #9
  store i32 2, ptr %14, align 4, !tbaa !9
  br label %59

59:                                               ; preds = %106, %58
  %60 = load i32, ptr %14, align 4, !tbaa !9
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %68, label %63

63:                                               ; preds = %59
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %109

64:                                               ; preds = %52
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %12, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %13, align 4
  br label %248

68:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %102, %68
  %70 = load i32, ptr %16, align 4, !tbaa !9
  %71 = load i32, ptr %14, align 4, !tbaa !9
  %72 = sub nsw i32 %71, 1
  %73 = icmp sle i32 %70, %72
  br i1 %73, label %75, label %74

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

75:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  %76 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %76, ptr %17, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %94, %75
  %78 = load i32, ptr %17, align 4, !tbaa !9
  %79 = load i32, ptr %14, align 4, !tbaa !9
  %80 = sub nsw i32 %79, 1
  %81 = icmp sle i32 %78, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %77
  store i32 8, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  br label %101

83:                                               ; preds = %77
  %84 = load i32, ptr %16, align 4, !tbaa !9
  %85 = load i32, ptr %17, align 4, !tbaa !9
  %86 = icmp eq i32 %84, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %83
  br label %94

88:                                               ; preds = %83
  %89 = load i32, ptr %14, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %90) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  invoke void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %17)
          to label %92 unwind label %97

92:                                               ; preds = %88
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %91, ptr noundef nonnull align 4 dereferenceable(8) %18)
          to label %93 unwind label %97

93:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %94

94:                                               ; preds = %93, %87
  %95 = load i32, ptr %17, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %17, align 4, !tbaa !9
  br label %77, !llvm.loop !33

97:                                               ; preds = %92, %88
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %12, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #9
  br label %248

101:                                              ; preds = %82
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %16, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %16, align 4, !tbaa !9
  br label %69, !llvm.loop !35

105:                                              ; preds = %74
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %14, align 4, !tbaa !9
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %14, align 4, !tbaa !9
  br label %59, !llvm.loop !36

109:                                              ; preds = %63
  call void @llvm.lifetime.start.p0(i64 40, ptr %19) #9
  call void @_ZNSt5mutexC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %19) #9
  call void @llvm.lifetime.start.p0(i64 32, ptr %20) #9
  %110 = getelementptr inbounds %class.anon.211, ptr %20, i32 0, i32 0
  store ptr %9, ptr %110, align 8, !tbaa !5
  %111 = getelementptr inbounds %class.anon.211, ptr %20, i32 0, i32 1
  store ptr %19, ptr %111, align 8, !tbaa !5
  %112 = getelementptr inbounds %class.anon.211, ptr %20, i32 0, i32 2
  store ptr %10, ptr %112, align 8, !tbaa !5
  %113 = getelementptr inbounds %class.anon.211, ptr %20, i32 0, i32 3
  store ptr %8, ptr %113, align 8, !tbaa !5
  %114 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %115 = call noundef zeroext i1 @_ZNK6qtorch7Network9HasFailedEv(ptr noundef nonnull align 8 dereferenceable(380) %114) #9
  br i1 %115, label %116, label %117

116:                                              ; preds = %109
  call void @_ZNSt10shared_ptrIN6qtorch7NetworkEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr null) #9
  store i32 1, ptr %15, align 4
  br label %247

117:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  store i32 10, ptr %21, align 4, !tbaa !9
  br label %118

118:                                              ; preds = %205, %203, %117
  %119 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %120 = call noundef zeroext i1 @_ZN6qtorch7Network6IsDoneEv(ptr noundef nonnull align 8 dereferenceable(380) %119) #9
  br i1 %120, label %126, label %121

121:                                              ; preds = %118
  %122 = invoke noundef double @_ZN6qtorch5Timer10getElapsedEv(ptr noundef nonnull align 8 dereferenceable(17) @_ZN6qtorch8totTimerE)
          to label %123 unwind label %145

123:                                              ; preds = %121
  %124 = load double, ptr @_ZN6qtorch7maxTimeE, align 8, !tbaa !37
  %125 = fcmp olt double %122, %124
  br label %126

126:                                              ; preds = %123, %118
  %127 = phi i1 [ false, %118 ], [ %125, %123 ]
  br i1 %127, label %128, label %236

128:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 48, ptr %22) #9
  call void @_ZN6qtorch6retValC2Ev(ptr noundef nonnull align 8 dereferenceable(41) %22) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr %23) #9
  call void @_ZN6qtorch6retValC2Ev(ptr noundef nonnull align 8 dereferenceable(41) %23) #9
  %129 = getelementptr inbounds %"struct.qtorch::retVal", ptr %23, i32 0, i32 5
  store i8 0, ptr %129, align 8, !tbaa !39
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  store i32 3, ptr %25, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #9
  store ptr %23, ptr %26, align 8, !tbaa !5
  invoke void @"_ZNSt6threadC2IRZN6qtorch16ContractionTools30CostBasedContractionBruteForceEiE3$_1JiPNS1_6retValERiEvEEOT_DpOT0_"(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef nonnull align 4 dereferenceable(4) %25, ptr noundef nonnull align 8 dereferenceable(8) %26, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %130 unwind label %149

130:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr %27) #9
  call void @_ZN6qtorch6retValC2Ev(ptr noundef nonnull align 8 dereferenceable(41) %27) #9
  %131 = getelementptr inbounds %"struct.qtorch::retVal", ptr %27, i32 0, i32 5
  store i8 0, ptr %131, align 8, !tbaa !39
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #9
  store i32 3, ptr %29, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #9
  store ptr %27, ptr %30, align 8, !tbaa !5
  invoke void @"_ZNSt6threadC2IRZN6qtorch16ContractionTools30CostBasedContractionBruteForceEiE3$_1JiPNS1_6retValERiEvEEOT_DpOT0_"(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef nonnull align 4 dereferenceable(4) %29, ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 4 dereferenceable(4) %21)
          to label %132 unwind label %153

132:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %133 unwind label %157

133:                                              ; preds = %132
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %28)
          to label %134 unwind label %157

134:                                              ; preds = %133
  %135 = getelementptr inbounds %"struct.qtorch::retVal", ptr %23, i32 0, i32 5
  %136 = load i8, ptr %135, align 8, !tbaa !39, !range !27, !noundef !28
  %137 = trunc i8 %136 to i1
  br i1 %137, label %138, label %161

138:                                              ; preds = %134
  %139 = getelementptr inbounds %"struct.qtorch::retVal", ptr %27, i32 0, i32 5
  %140 = load i8, ptr %139, align 8, !tbaa !39, !range !27, !noundef !28
  %141 = trunc i8 %140 to i1
  br i1 %141, label %142, label %161

142:                                              ; preds = %138
  %143 = load i32, ptr %21, align 4, !tbaa !9
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %21, align 4, !tbaa !9
  store i32 11, ptr %15, align 4
  br label %203, !llvm.loop !45

145:                                              ; preds = %243, %121
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %12, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %13, align 4
  br label %246

149:                                              ; preds = %128
  %150 = landingpad { ptr, i32 }
          cleanup
  %151 = extractvalue { ptr, i32 } %150, 0
  store ptr %151, ptr %12, align 8
  %152 = extractvalue { ptr, i32 } %150, 1
  store i32 %152, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  br label %235

153:                                              ; preds = %130
  %154 = landingpad { ptr, i32 }
          cleanup
  %155 = extractvalue { ptr, i32 } %154, 0
  store ptr %155, ptr %12, align 8
  %156 = extractvalue { ptr, i32 } %154, 1
  store i32 %156, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #9
  br label %234

157:                                              ; preds = %200, %195, %193, %133, %132
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %12, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %13, align 4
  br label %233

161:                                              ; preds = %138, %134
  call void @llvm.lifetime.start.p0(i64 48, ptr %31) #9
  call void @llvm.lifetime.start.p0(i64 96, ptr %33) #9
  store ptr %33, ptr %34, align 8
  invoke void @_ZN6qtorch6retValC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(41) %33, ptr noundef nonnull align 8 dereferenceable(41) %23)
          to label %162 unwind label %206

162:                                              ; preds = %161
  %163 = getelementptr inbounds %"struct.qtorch::retVal", ptr %33, i64 1
  store ptr %163, ptr %34, align 8
  invoke void @_ZN6qtorch6retValC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(41) %163, ptr noundef nonnull align 8 dereferenceable(41) %27)
          to label %164 unwind label %206

164:                                              ; preds = %162
  %165 = getelementptr inbounds %"class.std::initializer_list.212", ptr %32, i32 0, i32 0
  store ptr %33, ptr %165, align 8, !tbaa !46
  %166 = getelementptr inbounds %"class.std::initializer_list.212", ptr %32, i32 0, i32 1
  store i64 2, ptr %166, align 8, !tbaa !48
  %167 = getelementptr inbounds { ptr, i64 }, ptr %32, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8
  %169 = getelementptr inbounds { ptr, i64 }, ptr %32, i32 0, i32 1
  %170 = load i64, ptr %169, align 8
  invoke void @"_ZSt3minIN6qtorch6retValEZNS0_16ContractionTools30CostBasedContractionBruteForceEiE3$_0ET_St16initializer_listIS4_ET0_"(ptr dead_on_unwind writable sret(%"struct.qtorch::retVal") align 8 %31, ptr %168, i64 %170)
          to label %171 unwind label %217

171:                                              ; preds = %164
  %172 = call noundef nonnull align 8 dereferenceable(41) ptr @_ZN6qtorch6retValaSEOS0_(ptr noundef nonnull align 8 dereferenceable(41) %22, ptr noundef nonnull align 8 dereferenceable(41) %31) #9
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %31) #9
  %173 = getelementptr inbounds [2 x %"struct.qtorch::retVal"], ptr %33, i32 0, i32 0
  %174 = getelementptr inbounds %"struct.qtorch::retVal", ptr %173, i64 2
  br label %175

175:                                              ; preds = %175, %171
  %176 = phi ptr [ %174, %171 ], [ %177, %175 ]
  %177 = getelementptr inbounds %"struct.qtorch::retVal", ptr %176, i64 -1
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %177) #9
  %178 = icmp eq ptr %177, %173
  br i1 %178, label %179, label %175

179:                                              ; preds = %175
  call void @llvm.lifetime.end.p0(i64 96, ptr %33) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %31) #9
  %180 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %181 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %182 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6qtorch7Network20GetUncontractedNodesEv(ptr noundef nonnull align 8 dereferenceable(380) %181) #9
  %183 = getelementptr inbounds %"struct.qtorch::retVal", ptr %22, i32 0, i32 0
  %184 = load i32, ptr %183, align 8, !tbaa !49
  %185 = sext i32 %184 to i64
  %186 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %182, i64 noundef %185) #9
  call void @_ZNSt10shared_ptrIN6qtorch4NodeEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 8 dereferenceable(16) %186) #9
  %187 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %188 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6qtorch7Network20GetUncontractedNodesEv(ptr noundef nonnull align 8 dereferenceable(380) %187) #9
  %189 = getelementptr inbounds %"struct.qtorch::retVal", ptr %22, i32 0, i32 1
  %190 = load i32, ptr %189, align 4, !tbaa !50
  %191 = sext i32 %190 to i64
  %192 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %188, i64 noundef %191) #9
  call void @_ZNSt10shared_ptrIN6qtorch4NodeEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 8 dereferenceable(16) %192) #9
  invoke void @_ZN6qtorch7Network13ContractNodesESt10shared_ptrINS_4NodeEES3_i(ptr dead_on_unwind writable sret(%"class.std::shared_ptr") align 8 %36, ptr noundef nonnull align 8 dereferenceable(380) %180, ptr noundef %37, ptr noundef %38, i32 noundef 15)
          to label %193 unwind label %229

193:                                              ; preds = %179
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %36) #9
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %38) #9
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %37) #9
  %194 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.83)
          to label %195 unwind label %157

195:                                              ; preds = %193
  %196 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %197 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6qtorch7Network20GetUncontractedNodesEv(ptr noundef nonnull align 8 dereferenceable(380) %196) #9
  %198 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %197) #9
  %199 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %194, i64 noundef %198)
          to label %200 unwind label %157

200:                                              ; preds = %195
  %201 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %199, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %202 unwind label %157

202:                                              ; preds = %200
  store i32 0, ptr %15, align 4
  br label %203

203:                                              ; preds = %202, %142
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %28) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #9
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %27) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %27) #9
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %23) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %23) #9
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %22) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %22) #9
  %204 = load i32, ptr %15, align 4
  switch i32 %204, label %254 [
    i32 0, label %205
    i32 11, label %118
  ]

205:                                              ; preds = %203
  br label %118, !llvm.loop !45

206:                                              ; preds = %162, %161
  %207 = landingpad { ptr, i32 }
          cleanup
  %208 = extractvalue { ptr, i32 } %207, 0
  store ptr %208, ptr %12, align 8
  %209 = extractvalue { ptr, i32 } %207, 1
  store i32 %209, ptr %13, align 4
  %210 = load ptr, ptr %34, align 8
  %211 = icmp eq ptr %33, %210
  br i1 %211, label %216, label %212

212:                                              ; preds = %212, %206
  %213 = phi ptr [ %210, %206 ], [ %214, %212 ]
  %214 = getelementptr inbounds %"struct.qtorch::retVal", ptr %213, i64 -1
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %214) #9
  %215 = icmp eq ptr %214, %33
  br i1 %215, label %216, label %212

216:                                              ; preds = %212, %206
  br label %228

217:                                              ; preds = %164
  %218 = landingpad { ptr, i32 }
          cleanup
  %219 = extractvalue { ptr, i32 } %218, 0
  store ptr %219, ptr %12, align 8
  %220 = extractvalue { ptr, i32 } %218, 1
  store i32 %220, ptr %13, align 4
  %221 = getelementptr inbounds [2 x %"struct.qtorch::retVal"], ptr %33, i32 0, i32 0
  %222 = getelementptr inbounds %"struct.qtorch::retVal", ptr %221, i64 2
  br label %223

223:                                              ; preds = %223, %217
  %224 = phi ptr [ %222, %217 ], [ %225, %223 ]
  %225 = getelementptr inbounds %"struct.qtorch::retVal", ptr %224, i64 -1
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %225) #9
  %226 = icmp eq ptr %225, %221
  br i1 %226, label %227, label %223

227:                                              ; preds = %223
  br label %228

228:                                              ; preds = %227, %216
  call void @llvm.lifetime.end.p0(i64 96, ptr %33) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %31) #9
  br label %233

229:                                              ; preds = %179
  %230 = landingpad { ptr, i32 }
          cleanup
  %231 = extractvalue { ptr, i32 } %230, 0
  store ptr %231, ptr %12, align 8
  %232 = extractvalue { ptr, i32 } %230, 1
  store i32 %232, ptr %13, align 4
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %38) #9
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %37) #9
  br label %233

233:                                              ; preds = %229, %228, %157
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %28) #9
  br label %234

234:                                              ; preds = %233, %153
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #9
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %27) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %27) #9
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #9
  br label %235

235:                                              ; preds = %234, %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #9
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %23) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %23) #9
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %22) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %22) #9
  br label %246

236:                                              ; preds = %126
  %237 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %238 = call noundef zeroext i1 @_ZN6qtorch7Network6IsDoneEv(ptr noundef nonnull align 8 dereferenceable(380) %237) #9
  br i1 %238, label %239, label %243

239:                                              ; preds = %236
  %240 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %8) #9
  %241 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6qtorch7Network13GetFinalValueEv(ptr noundef nonnull align 8 dereferenceable(380) %240) #9
  %242 = getelementptr inbounds %"class.qtorch::ContractionTools", ptr %39, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %242, ptr align 8 %241, i64 16, i1 false), !tbaa.struct !51
  br label %245

243:                                              ; preds = %236
  %244 = call ptr @__cxa_allocate_exception(i64 8) #9
  call void @llvm.memset.p0.i64(ptr align 16 %244, i8 0, i64 8, i1 false)
  call void @_ZN6qtorch18ContractionFailureC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %244) #9
  invoke void @__cxa_throw(ptr %244, ptr @_ZTIN6qtorch18ContractionFailureE, ptr @_ZNSt9exceptionD2Ev) #10
          to label %254 unwind label %145

245:                                              ; preds = %239
  call void @_ZNSt10shared_ptrIN6qtorch7NetworkEEC2EOS2_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %8) #9
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  br label %247

246:                                              ; preds = %235, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 40, ptr %19) #9
  br label %248

247:                                              ; preds = %245, %116
  call void @llvm.lifetime.end.p0(i64 32, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 40, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 5000, ptr %9) #9
  call void @_ZNSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #9
  ret void

248:                                              ; preds = %246, %97, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 5000, ptr %9) #9
  call void @_ZNSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %8) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #9
  br label %249

249:                                              ; preds = %248
  %250 = load ptr, ptr %12, align 8
  %251 = load i32, ptr %13, align 4
  %252 = insertvalue { ptr, i32 } poison, ptr %250, 0
  %253 = insertvalue { ptr, i32 } %252, i32 %251, 1
  resume { ptr, i32 } %253

254:                                              ; preds = %243, %203
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt11make_sharedIN6qtorch7NetworkEJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EESt10shared_ptrINSt9enable_ifIXntsr8is_arrayIT_EE5valueESB_E4typeEEDpOT0_(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.178") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6qtorch7Network13SetNumThreadsEi(ptr noundef nonnull align 8 dereferenceable(380), i32 noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK6qtorch7Network9HasFailedEv(ptr noundef nonnull align 8 dereferenceable(380)) #5 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6qtorch7Network6IsDoneEv(ptr noundef nonnull align 8 dereferenceable(380)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6qtorch7Network13GetFinalValueEv(ptr noundef nonnull align 8 dereferenceable(380)) #5 align 2

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #7

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

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

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) #8

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt3minIN6qtorch6retValEZNS0_16ContractionTools30CostBasedContractionBruteForceEiE3$_0ET_St16initializer_listIS4_ET0_"(ptr dead_on_unwind noalias writable sret(%"struct.qtorch::retVal") align 8, ptr, i64) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6qtorch6retValC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef nonnull align 8 dereferenceable(41)) unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(41) ptr @_ZN6qtorch6retValaSEOS0_(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef nonnull align 8 dereferenceable(41)) #6 align 2

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { "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 #9 = { nounwind }
attributes #10 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !26, i64 10120}
!12 = !{!"_ZTSN6qtorch16ContractionToolsE", !13, i64 0, !13, i64 32, !16, i64 64, !17, i64 80, !21, i64 104, !22, i64 5104, !25, i64 5120, !26, i64 10120, !10, i64 10124}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !7, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSSt7complexIdE", !7, i64 0}
!17 = !{!"_ZTSSt6vectorISt10shared_ptrIS_IS0_IN6qtorch4NodeEESaIS3_EEESaIS6_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrISt6vectorIS0_IN6qtorch4NodeEESaIS4_EEESaIS7_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrISt6vectorIS0_IN6qtorch4NodeEESaIS4_EEESaIS7_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrISt6vectorIS0_IN6qtorch4NodeEESaIS4_EEESaIS7_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTSSt13random_device", !7, i64 0}
!22 = !{!"_ZTSSt10shared_ptrIN6qtorch7NetworkEE", !23, i64 0}
!23 = !{!"_ZTSSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !24, i64 8}
!24 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!25 = !{!"_ZTSSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE", !7, i64 0, !15, i64 4992}
!26 = !{!"bool", !7, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!12, !10, i64 10124}
!30 = !{i64 0, i64 4992, !31, i64 4992, i64 8, !32}
!31 = !{!7, !7, i64 0}
!32 = !{!15, !15, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}
!36 = distinct !{!36, !34}
!37 = !{!38, !38, i64 0}
!38 = !{!"double", !7, i64 0}
!39 = !{!40, !26, i64 40}
!40 = !{!"_ZTSN6qtorch6retValE", !10, i64 0, !10, i64 4, !10, i64 8, !41, i64 16, !26, i64 40}
!41 = !{!"_ZTSSt6vectorIiSaIiEE", !42, i64 0}
!42 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !43, i64 0}
!43 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !44, i64 0}
!44 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!45 = distinct !{!45, !34}
!46 = !{!47, !6, i64 0}
!47 = !{!"_ZTSSt16initializer_listIN6qtorch6retValEE", !6, i64 0, !15, i64 8}
!48 = !{!47, !15, i64 8}
!49 = !{!40, !10, i64 0}
!50 = !{!40, !10, i64 4}
!51 = !{i64 0, i64 16, !31}


; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.qtorch::Timer" = type <{ %"class.std::chrono::time_point", i64, i8, [7 x i8] }>
%"class.std::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { ptr }
%"class.std::shared_ptr.178" = type { %"class.std::__shared_ptr.179" }
%"class.std::__shared_ptr.179" = type { ptr, %"class.std::__shared_count" }
%"class.std::mersenne_twister_engine" = type { [624 x i64], i64 }
%"class.std::vector.206" = type { %"struct.std::_Vector_base.207" }
%"struct.std::_Vector_base.207" = type { %"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<std::pair<int, int>>, std::allocator<std::vector<std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i32 }
%"class.std::mutex" = type { %"class.std::__mutex_base" }
%"class.std::__mutex_base" = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%class.anon.211 = type { ptr, ptr, ptr, ptr }
%"struct.qtorch::retVal" = type <{ i32, i32, i32, [4 x i8], %"class.std::vector.9", i8, [7 x i8] }>
%"class.std::vector.9" = type { %"struct.std::_Vector_base.10" }
%"struct.std::_Vector_base.10" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZN6qtorch8totTimerE = external dso_local global %"class.qtorch::Timer", align 8
@_ZN6qtorch7maxTimeE = external dso_local local_unnamed_addr global double, align 8
@_ZTIN6qtorch18ContractionFailureE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.83 = external hidden unnamed_addr constant [13 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #1

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

; Function Attrs: mustprogress 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) #3

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6qtorch7Network13ContractNodesESt10shared_ptrINS_4NodeEES3_i(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr") align 8, ptr noundef nonnull align 8 dereferenceable(380), ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6qtorch16ContractionTools30CostBasedContractionBruteForceEi(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.178") align 8 %0, ptr noundef nonnull align 8 dereferenceable(10128) %1, i32 noundef %2) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::shared_ptr.178", align 8
  %5 = alloca %"class.std::shared_ptr.178", align 8
  %6 = alloca %"class.std::mersenne_twister_engine", align 8
  %7 = alloca %"class.std::vector.206", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::pair", align 4
  %11 = alloca %"class.std::mutex", align 8
  %12 = alloca %class.anon.211, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.qtorch::retVal", align 8
  %15 = alloca %"struct.qtorch::retVal", align 8
  %16 = alloca %"class.std::thread", align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca %"struct.qtorch::retVal", align 8
  %20 = alloca %"class.std::thread", align 8
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca %"struct.qtorch::retVal", align 8
  %24 = alloca [2 x %"struct.qtorch::retVal"], align 8
  %25 = alloca %"class.std::shared_ptr", align 8
  %26 = alloca %"class.std::shared_ptr", align 8
  %27 = alloca %"class.std::shared_ptr", align 8
  %28 = getelementptr inbounds i8, ptr %1, i64 10120
  %29 = load i8, ptr %28, align 8, !tbaa !5, !range !25, !noundef !26
  %30 = trunc nuw i8 %29 to i1
  br i1 %30, label %38, label %31

31:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #8
  %32 = getelementptr inbounds i8, ptr %1, i64 32
  call void @_ZSt11make_sharedIN6qtorch7NetworkEJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EESt10shared_ptrINSt9enable_ifIXntsr8is_arrayIT_EE5valueESB_E4typeEEDpOT0_(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr.178") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull align 8 dereferenceable(32) %32)
  %33 = getelementptr inbounds i8, ptr %1, i64 5104
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN6qtorch7NetworkEEaSEOS2_(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(16) %4) #8
  call void @_ZNSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  %35 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %33) #8
  %36 = getelementptr inbounds i8, ptr %1, i64 10124
  %37 = load i32, ptr %36, align 4, !tbaa !27
  call void @_ZN6qtorch7Network13SetNumThreadsEi(ptr noundef nonnull align 8 dereferenceable(380) %35, i32 noundef %37) #8
  br label %38

38:                                               ; preds = %31, %3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #8
  %39 = getelementptr inbounds i8, ptr %1, i64 5104
  call void @_ZNSt10shared_ptrIN6qtorch7NetworkEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %39) #8
  call void @llvm.lifetime.start.p0(i64 5000, ptr nonnull %6) #8
  %40 = getelementptr inbounds i8, ptr %1, i64 5120
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(5000) %6, ptr noundef nonnull align 8 dereferenceable(5000) %40, i64 5000, i1 false), !tbaa.struct !28
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #8
  call void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #8
  invoke void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef 31)
          to label %.preheader unwind label %47

41:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %11) #8
  call void @_ZNSt5mutexC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %11) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #8
  store ptr %6, ptr %12, align 8, !tbaa !31
  %42 = getelementptr inbounds i8, ptr %12, i64 8
  store ptr %11, ptr %42, align 8, !tbaa !31
  %43 = getelementptr inbounds i8, ptr %12, i64 16
  store ptr %7, ptr %43, align 8, !tbaa !31
  %44 = getelementptr inbounds i8, ptr %12, i64 24
  store ptr %5, ptr %44, align 8, !tbaa !31
  %45 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %46 = call noundef zeroext i1 @_ZNK6qtorch7Network9HasFailedEv(ptr noundef nonnull align 8 dereferenceable(380) %45) #8
  br i1 %46, label %67, label %68

47:                                               ; preds = %38
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %147

.preheader:                                       ; preds = %38, %49
  %indvars.iv = phi i64 [ %indvars.iv.next, %49 ], [ 2, %38 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #8
  store i32 0, ptr %8, align 4, !tbaa !32
  br label %50

49:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 31
  br i1 %exitcond.not, label %41, label %.preheader, !llvm.loop !33

50:                                               ; preds = %.preheader, %51
  %storemerge38 = phi i32 [ 0, %.preheader ], [ %53, %51 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #8
  store i32 %storemerge38, ptr %9, align 4, !tbaa !32
  br label %55

51:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  %52 = load i32, ptr %8, align 4, !tbaa !32
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %8, align 4, !tbaa !32
  %54 = sext i32 %53 to i64
  %.not.not = icmp sgt i64 %indvars.iv, %54
  br i1 %.not.not, label %50, label %49, !llvm.loop !35

55:                                               ; preds = %50, %61
  %storemerge2837 = phi i32 [ %storemerge38, %50 ], [ %63, %61 ]
  %56 = load i32, ptr %8, align 4, !tbaa !32
  %57 = icmp eq i32 %56, %storemerge2837
  br i1 %57, label %61, label %58

58:                                               ; preds = %55
  %59 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #8
  call void @_ZNSt4pairIiiEC2IRiS2_TnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 4 dereferenceable(8) %10, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  invoke void @_ZNSt6vectorISt4pairIiiESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %59, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %60 unwind label %65

60:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  %.pre = load i32, ptr %9, align 4, !tbaa !32
  br label %61

61:                                               ; preds = %55, %60
  %62 = phi i32 [ %storemerge2837, %55 ], [ %.pre, %60 ]
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %9, align 4, !tbaa !32
  %64 = sext i32 %63 to i64
  %.not.not29 = icmp sgt i64 %indvars.iv, %64
  br i1 %.not.not29, label %55, label %51, !llvm.loop !36

65:                                               ; preds = %58
  %66 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #8
  br label %147

67:                                               ; preds = %41
  call void @_ZNSt10shared_ptrIN6qtorch7NetworkEEC2EDn(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr null) #8
  br label %146

68:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #8
  store i32 10, ptr %13, align 4, !tbaa !32
  %69 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %70 = call noundef zeroext i1 @_ZN6qtorch7Network6IsDoneEv(ptr noundef nonnull align 8 dereferenceable(380) %69) #8
  br i1 %70, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %68
  %71 = getelementptr inbounds i8, ptr %15, i64 40
  %72 = getelementptr inbounds i8, ptr %19, i64 40
  %73 = getelementptr inbounds i8, ptr %24, i64 48
  %74 = getelementptr inbounds i8, ptr %14, i64 4
  %75 = getelementptr inbounds i8, ptr %24, i64 48
  br label %76

76:                                               ; preds = %.lr.ph, %126
  %77 = invoke noundef double @_ZN6qtorch5Timer10getElapsedEv(ptr noundef nonnull align 8 dereferenceable(17) @_ZN6qtorch8totTimerE)
          to label %78 unwind label %.loopexit34

78:                                               ; preds = %76
  %79 = load double, ptr @_ZN6qtorch7maxTimeE, align 8, !tbaa !37
  %80 = fcmp olt double %77, %79
  br i1 %80, label %81, label %.critedge

81:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %14) #8
  call void @_ZN6qtorch6retValC2Ev(ptr noundef nonnull align 8 dereferenceable(41) %14) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %15) #8
  call void @_ZN6qtorch6retValC2Ev(ptr noundef nonnull align 8 dereferenceable(41) %15) #8
  store i8 0, ptr %71, align 8, !tbaa !39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #8
  store i32 3, ptr %17, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %18) #8
  store ptr %15, ptr %18, align 8, !tbaa !31
  invoke void @"_ZNSt6threadC2IRZN6qtorch16ContractionTools30CostBasedContractionBruteForceEiE3$_1JiPNS1_6retValERiEvEEOT_DpOT0_"(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %82 unwind label %94

82:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %19) #8
  call void @_ZN6qtorch6retValC2Ev(ptr noundef nonnull align 8 dereferenceable(41) %19) #8
  store i8 0, ptr %72, align 8, !tbaa !39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %20) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #8
  store i32 3, ptr %21, align 4, !tbaa !32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %22) #8
  store ptr %19, ptr %22, align 8, !tbaa !31
  invoke void @"_ZNSt6threadC2IRZN6qtorch16ContractionTools30CostBasedContractionBruteForceEiE3$_1JiPNS1_6retValERiEvEEOT_DpOT0_"(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(32) %12, ptr noundef nonnull align 4 dereferenceable(4) %21, ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 4 dereferenceable(4) %13)
          to label %83 unwind label %96

83:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #8
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %84 unwind label %98

84:                                               ; preds = %83
  invoke void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %20)
          to label %85 unwind label %98

85:                                               ; preds = %84
  %86 = load i8, ptr %71, align 8, !tbaa !39, !range !25, !noundef !26
  %87 = trunc nuw i8 %86 to i1
  br i1 %87, label %88, label %100

88:                                               ; preds = %85
  %89 = load i8, ptr %72, align 8, !tbaa !39, !range !25, !noundef !26
  %90 = trunc nuw i8 %89 to i1
  br i1 %90, label %91, label %100

91:                                               ; preds = %88
  %92 = load i32, ptr %13, align 4, !tbaa !32
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %13, align 4, !tbaa !32
  br label %126, !llvm.loop !45

.loopexit34:                                      ; preds = %76
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %145

.loopexit.split-lp:                               ; preds = %143
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %145

94:                                               ; preds = %81
  %95 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #8
  br label %136

96:                                               ; preds = %82
  %97 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #8
  br label %135

98:                                               ; preds = %124, %119, %117, %84, %83
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %134

100:                                              ; preds = %88, %85
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %23) #8
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %24) #8
  invoke void @_ZN6qtorch6retValC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(41) %24, ptr noundef nonnull align 8 dereferenceable(41) %15)
          to label %102 unwind label %.thread

.thread:                                          ; preds = %100
  %101 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit

102:                                              ; preds = %100
  invoke void @_ZN6qtorch6retValC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(41) %73, ptr noundef nonnull align 8 dereferenceable(41) %19)
          to label %103 unwind label %.loopexit.loopexit41

103:                                              ; preds = %102
  invoke void @"_ZSt3minIN6qtorch6retValEZNS0_16ContractionTools30CostBasedContractionBruteForceEiE3$_0ET_St16initializer_listIS4_ET0_"(ptr dead_on_unwind nonnull writable sret(%"struct.qtorch::retVal") align 8 %23, ptr nonnull %24, i64 2)
          to label %104 unwind label %.loopexit.loopexit

104:                                              ; preds = %103
  %105 = call noundef nonnull align 8 dereferenceable(41) ptr @_ZN6qtorch6retValaSEOS0_(ptr noundef nonnull align 8 dereferenceable(41) %14, ptr noundef nonnull align 8 dereferenceable(41) %23) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %23) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %75) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %24) #8
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %24) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %23) #8
  %106 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %107 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %108 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6qtorch7Network20GetUncontractedNodesEv(ptr noundef nonnull align 8 dereferenceable(380) %107) #8
  %109 = load i32, ptr %14, align 8, !tbaa !46
  %110 = sext i32 %109 to i64
  %111 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %108, i64 noundef %110) #8
  call void @_ZNSt10shared_ptrIN6qtorch4NodeEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(16) %111) #8
  %112 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %113 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6qtorch7Network20GetUncontractedNodesEv(ptr noundef nonnull align 8 dereferenceable(380) %112) #8
  %114 = load i32, ptr %74, align 4, !tbaa !47
  %115 = sext i32 %114 to i64
  %116 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %113, i64 noundef %115) #8
  call void @_ZNSt10shared_ptrIN6qtorch4NodeEEC2ERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(16) %116) #8
  invoke void @_ZN6qtorch7Network13ContractNodesESt10shared_ptrINS_4NodeEES3_i(ptr dead_on_unwind nonnull writable sret(%"class.std::shared_ptr") align 8 %25, ptr noundef nonnull align 8 dereferenceable(380) %106, ptr noundef nonnull %26, ptr noundef nonnull %27, i32 noundef 15)
          to label %117 unwind label %132

117:                                              ; preds = %104
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %25) #8
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %27) #8
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %26) #8
  %118 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.83)
          to label %119 unwind label %98

119:                                              ; preds = %117
  %120 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %121 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK6qtorch7Network20GetUncontractedNodesEv(ptr noundef nonnull align 8 dereferenceable(380) %120) #8
  %122 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %121) #8
  %123 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %118, i64 noundef %122)
          to label %124 unwind label %98

124:                                              ; preds = %119
  %125 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %123, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %126 unwind label %98

126:                                              ; preds = %124, %91
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %19) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %19) #8
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %15) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %15) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %14) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %14) #8
  %127 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %128 = call noundef zeroext i1 @_ZN6qtorch7Network6IsDoneEv(ptr noundef nonnull align 8 dereferenceable(380) %127) #8
  br i1 %128, label %.critedge, label %76

.loopexit.loopexit41:                             ; preds = %102
  %129 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %24) #8
  br label %.loopexit

.loopexit.loopexit:                               ; preds = %103
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = getelementptr inbounds i8, ptr %24, i64 48
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %131) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %24) #8
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit41, %.loopexit.loopexit, %.thread
  %.pn = phi { ptr, i32 } [ %101, %.thread ], [ %130, %.loopexit.loopexit ], [ %129, %.loopexit.loopexit41 ]
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %24) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %23) #8
  br label %134

132:                                              ; preds = %104
  %133 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %27) #8
  call void @_ZNSt12__shared_ptrIN6qtorch4NodeELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %26) #8
  br label %134

134:                                              ; preds = %132, %.loopexit, %98
  %.pn22 = phi { ptr, i32 } [ %99, %98 ], [ %133, %132 ], [ %.pn, %.loopexit ]
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %20) #8
  br label %135

135:                                              ; preds = %134, %96
  %.pn22.pn = phi { ptr, i32 } [ %.pn22, %134 ], [ %97, %96 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %20) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %19) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %19) #8
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #8
  br label %136

136:                                              ; preds = %135, %94
  %.pn22.pn.pn = phi { ptr, i32 } [ %.pn22.pn, %135 ], [ %95, %94 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %15) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %15) #8
  call void @_ZN6qtorch6retValD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %14) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %14) #8
  br label %145

.critedge:                                        ; preds = %78, %126, %68
  %137 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %138 = call noundef zeroext i1 @_ZN6qtorch7Network6IsDoneEv(ptr noundef nonnull align 8 dereferenceable(380) %137) #8
  br i1 %138, label %139, label %143

139:                                              ; preds = %.critedge
  %140 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %5) #8
  %141 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK6qtorch7Network13GetFinalValueEv(ptr noundef nonnull align 8 dereferenceable(380) %140) #8
  %142 = getelementptr inbounds i8, ptr %1, i64 64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %142, ptr noundef nonnull align 8 dereferenceable(16) %141, i64 16, i1 false), !tbaa.struct !48
  call void @_ZNSt10shared_ptrIN6qtorch7NetworkEEC2EOS2_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  br label %146

143:                                              ; preds = %.critedge
  %144 = call ptr @__cxa_allocate_exception(i64 8) #8
  store i64 0, ptr %144, align 16
  call void @_ZN6qtorch18ContractionFailureC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %144) #8
  invoke void @__cxa_throw(ptr nonnull %144, ptr nonnull @_ZTIN6qtorch18ContractionFailureE, ptr nonnull @_ZNSt9exceptionD2Ev) #9
          to label %148 unwind label %.loopexit.split-lp

145:                                              ; preds = %.loopexit34, %.loopexit.split-lp, %136
  %.pn26 = phi { ptr, i32 } [ %.pn22.pn.pn, %136 ], [ %lpad.loopexit, %.loopexit34 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %11) #8
  br label %147

146:                                              ; preds = %139, %67
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %11) #8
  call void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %6) #8
  call void @_ZNSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  ret void

147:                                              ; preds = %145, %65, %47
  %.pn30 = phi { ptr, i32 } [ %66, %65 ], [ %.pn26, %145 ], [ %48, %47 ]
  call void @_ZNSt6vectorIS_ISt4pairIiiESaIS1_EESaIS3_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 5000, ptr nonnull %6) #8
  call void @_ZNSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #8
  resume { ptr, i32 } %.pn30

148:                                              ; preds = %143
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt11make_sharedIN6qtorch7NetworkEJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EESt10shared_ptrINSt9enable_ifIXntsr8is_arrayIT_EE5valueESB_E4typeEEDpOT0_(ptr dead_on_unwind noalias writable sret(%"class.std::shared_ptr.178") align 8, ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6qtorch7Network13SetNumThreadsEi(ptr noundef nonnull align 8 dereferenceable(380), i32 noundef) local_unnamed_addr #4 align 2

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

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

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

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

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

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #6

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

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

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #7

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt3minIN6qtorch6retValEZNS0_16ContractionTools30CostBasedContractionBruteForceEiE3$_0ET_St16initializer_listIS4_ET0_"(ptr dead_on_unwind noalias writable sret(%"struct.qtorch::retVal") align 8, ptr, i64) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6qtorch6retValC2ERKS0_(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef nonnull align 8 dereferenceable(41)) unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(41) ptr @_ZN6qtorch6retValaSEOS0_(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef nonnull align 8 dereferenceable(41)) local_unnamed_addr #5 align 2

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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, !23, i64 10120}
!6 = !{!"_ZTSN6qtorch16ContractionToolsE", !7, i64 0, !7, i64 32, !13, i64 64, !14, i64 80, !18, i64 104, !19, i64 5104, !22, i64 5120, !23, i64 10120, !24, i64 10124}
!7 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !8, i64 0, !12, i64 8, !10, i64 16}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!"_ZTSSt7complexIdE", !10, i64 0}
!14 = !{!"_ZTSSt6vectorISt10shared_ptrIS_IS0_IN6qtorch4NodeEESaIS3_EEESaIS6_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrISt6vectorIS0_IN6qtorch4NodeEESaIS4_EEESaIS7_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrISt6vectorIS0_IN6qtorch4NodeEESaIS4_EEESaIS7_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrISt6vectorIS0_IN6qtorch4NodeEESaIS4_EEESaIS7_EE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!18 = !{!"_ZTSSt13random_device", !10, i64 0}
!19 = !{!"_ZTSSt10shared_ptrIN6qtorch7NetworkEE", !20, i64 0}
!20 = !{!"_ZTSSt12__shared_ptrIN6qtorch7NetworkELN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0, !21, i64 8}
!21 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !9, i64 0}
!22 = !{!"_ZTSSt23mersenne_twister_engineImLm32ELm624ELm397ELm31ELm2567483615ELm11ELm4294967295ELm7ELm2636928640ELm15ELm4022730752ELm18ELm1812433253EE", !10, i64 0, !12, i64 4992}
!23 = !{!"bool", !10, i64 0}
!24 = !{!"int", !10, i64 0}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!6, !24, i64 10124}
!28 = !{i64 0, i64 4992, !29, i64 4992, i64 8, !30}
!29 = !{!10, !10, i64 0}
!30 = !{!12, !12, i64 0}
!31 = !{!9, !9, i64 0}
!32 = !{!24, !24, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}
!36 = distinct !{!36, !34}
!37 = !{!38, !38, i64 0}
!38 = !{!"double", !10, i64 0}
!39 = !{!40, !23, i64 40}
!40 = !{!"_ZTSN6qtorch6retValE", !24, i64 0, !24, i64 4, !24, i64 8, !41, i64 16, !23, i64 40}
!41 = !{!"_ZTSSt6vectorIiSaIiEE", !42, i64 0}
!42 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !43, i64 0}
!43 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !44, i64 0}
!44 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !9, i64 0, !9, i64 8, !9, i64 16}
!45 = distinct !{!45, !34}
!46 = !{!40, !24, i64 0}
!47 = !{!40, !24, i64 4}
!48 = !{i64 0, i64 16, !29}


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