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

; 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.qtorch::Network" = type <{ %"class.std::vector.14", %"class.std::vector.4", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", %"class.std::complex", %"class.std::mutex", i32, i32, i8, i8, [6 x i8], %"class.std::vector.14", %"class.std::vector.19", %"class.std::vector.14", %"class.std::unordered_map", %"class.std::unordered_map", i64, i32, [4 x i8] }>
%"class.std::vector.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<std::shared_ptr<qtorch::Wire>, std::allocator<std::shared_ptr<qtorch::Wire>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<qtorch::Wire>, std::allocator<std::shared_ptr<qtorch::Wire>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<qtorch::Wire>, std::allocator<std::shared_ptr<qtorch::Wire>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<qtorch::Wire>, std::allocator<std::shared_ptr<qtorch::Wire>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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::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.std::vector.19" = type { %"struct.std::_Vector_base.20" }
%"struct.std::_Vector_base.20" = type { %"struct.std::_Vector_base<std::vector<std::shared_ptr<qtorch::Node>>, std::allocator<std::vector<std::shared_ptr<qtorch::Node>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<std::shared_ptr<qtorch::Node>>, std::allocator<std::vector<std::shared_ptr<qtorch::Node>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<std::shared_ptr<qtorch::Node>>, std::allocator<std::vector<std::shared_ptr<qtorch::Node>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<std::shared_ptr<qtorch::Node>>, std::allocator<std::vector<std::shared_ptr<qtorch::Node>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.14" = type { %"struct.std::_Vector_base.15" }
%"struct.std::_Vector_base.15" = type { %"struct.std::_Vector_base<std::shared_ptr<qtorch::Node>, std::allocator<std::shared_ptr<qtorch::Node>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<qtorch::Node>, std::allocator<std::shared_ptr<qtorch::Node>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<qtorch::Node>, std::allocator<std::shared_ptr<qtorch::Node>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<qtorch::Node>, std::allocator<std::shared_ptr<qtorch::Node>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6qtorch7Network23MoveInitialStatesToBackEv(ptr noundef nonnull align 8 dereferenceable(380) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %7 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 11
  %8 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #3
  %9 = sub i64 %8, 1
  %10 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 6
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = sext i32 %11 to i64
  %13 = sub i64 %9, %12
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr %4, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %39, %1
  %16 = load i32, ptr %4, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 11
  %19 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %18) #3
  %20 = sub i64 %19, 1
  %21 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 6
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = mul nsw i32 2, %22
  %24 = sext i32 %23 to i64
  %25 = sub i64 %20, %24
  %26 = icmp uge i64 %17, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %42

28:                                               ; preds = %15
  %29 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 11
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %31) #3
  %33 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 11
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %35) #3
  call void @_ZSt4swapIN6qtorch4NodeEEvRSt10shared_ptrIT_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 8 dereferenceable(16) %36) #3
  %37 = load i32, ptr %3, align 4, !tbaa !9
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %3, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %28
  %40 = load i32, ptr %4, align 4, !tbaa !9
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr %4, align 4, !tbaa !9
  br label %15, !llvm.loop !38

42:                                               ; preds = %27
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %43 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 13
  %44 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %43) #3
  %45 = sub i64 %44, 1
  %46 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 6
  %47 = load i32, ptr %46, align 8, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = sub i64 %45, %48
  %50 = trunc i64 %49 to i32
  store i32 %50, ptr %5, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %75, %42
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 13
  %55 = call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %54) #3
  %56 = sub i64 %55, 1
  %57 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 6
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = mul nsw i32 2, %58
  %60 = sext i32 %59 to i64
  %61 = sub i64 %56, %60
  %62 = icmp uge i64 %53, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %78

64:                                               ; preds = %51
  %65 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 13
  %66 = load i32, ptr %3, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %65, i64 noundef %67) #3
  %69 = getelementptr inbounds %"class.qtorch::Network", ptr %6, i32 0, i32 13
  %70 = load i32, ptr %5, align 4, !tbaa !9
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef %71) #3
  call void @_ZSt4swapIN6qtorch4NodeEEvRSt10shared_ptrIT_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %68, ptr noundef nonnull align 8 dereferenceable(16) %72) #3
  %73 = load i32, ptr %3, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %3, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %64
  %76 = load i32, ptr %5, align 4, !tbaa !9
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr %5, align 4, !tbaa !9
  br label %51, !llvm.loop !40

78:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 168}
!12 = !{!"_ZTSN6qtorch7NetworkE", !13, i64 0, !17, i64 24, !21, i64 48, !21, i64 80, !24, i64 112, !25, i64 128, !10, i64 168, !10, i64 172, !27, i64 176, !27, i64 177, !13, i64 184, !28, i64 208, !13, i64 232, !32, i64 256, !32, i64 312, !37, i64 368, !10, i64 376}
!13 = !{!"_ZTSSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrIN6qtorch4NodeEESaIS3_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4NodeEESaIS3_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4NodeEESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"_ZTSSt6vectorISt10shared_ptrIN6qtorch4WireEESaIS3_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrIN6qtorch4WireEESaIS3_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4WireEESaIS3_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4WireEESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !23, i64 8, !7, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!23 = !{!"long", !7, i64 0}
!24 = !{!"_ZTSSt7complexIdE", !7, i64 0}
!25 = !{!"_ZTSSt5mutex", !26, i64 0}
!26 = !{!"_ZTSSt12__mutex_base", !7, i64 0}
!27 = !{!"bool", !7, i64 0}
!28 = !{!"_ZTSSt6vectorIS_ISt10shared_ptrIN6qtorch4NodeEESaIS3_EESaIS5_EE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseISt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS4_EESaIS6_EE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseISt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS4_EESaIS6_EE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseISt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS4_EESaIS6_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!32 = !{!"_ZTSSt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4hashIS5_ESt8equal_toIS5_ESaISt4pairIKS5_S5_EEE", !33, i64 0}
!33 = !{!"_ZTSSt10_HashtableINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESaIS8_ENSt8__detail10_Select1stESt8equal_toIS5_ESt4hashIS5_ENSA_18_Mod_range_hashingENSA_20_Default_ranged_hashENSA_20_Prime_rehash_policyENSA_17_Hashtable_traitsILb1ELb0ELb1EEEE", !6, i64 0, !23, i64 8, !34, i64 16, !23, i64 24, !35, i64 32, !6, i64 48}
!34 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!35 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !36, i64 0, !23, i64 8}
!36 = !{!"float", !7, i64 0}
!37 = !{!"long long", !7, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = distinct !{!40, !39}


; 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"

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN6qtorch7Network23MoveInitialStatesToBackEv(ptr noundef nonnull align 8 dereferenceable(380) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 184
  %3 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %4 = getelementptr inbounds i8, ptr %0, i64 168
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = xor i32 %5, -1
  %7 = trunc i64 %3 to i32
  %8 = add i32 %7, %6
  %9 = sext i32 %8 to i64
  %10 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %11 = load i32, ptr %4, align 8, !tbaa !5
  %12 = shl nsw i32 %11, 1
  %13 = xor i32 %12, -1
  %14 = sext i32 %13 to i64
  %15 = add i64 %10, %14
  %.not15 = icmp ugt i64 %15, %9
  br i1 %.not15, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %1
  %16 = getelementptr inbounds i8, ptr %0, i64 232
  %17 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #2
  %18 = load i32, ptr %4, align 8, !tbaa !5
  %19 = xor i32 %18, -1
  %20 = trunc i64 %17 to i32
  %21 = add i32 %20, %19
  %22 = sext i32 %21 to i64
  %23 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #2
  %24 = load i32, ptr %4, align 8, !tbaa !5
  %25 = shl nsw i32 %24, 1
  %26 = xor i32 %25, -1
  %27 = sext i32 %26 to i64
  %28 = add i64 %23, %27
  %.not1418 = icmp ugt i64 %28, %22
  br i1 %.not1418, label %._crit_edge23, label %.lr.ph22

.lr.ph:                                           ; preds = %1, %.lr.ph
  %indvars.iv24 = phi i64 [ %indvars.iv.next25, %.lr.ph ], [ 0, %1 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %9, %1 ]
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %indvars.iv24) #2
  %30 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %indvars.iv) #2
  tail call void @_ZSt4swapIN6qtorch4NodeEEvRSt10shared_ptrIT_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(16) %30) #2
  %indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %31 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #2
  %32 = load i32, ptr %4, align 8, !tbaa !5
  %33 = shl nsw i32 %32, 1
  %34 = xor i32 %33, -1
  %35 = sext i32 %34 to i64
  %36 = add i64 %31, %35
  %.not = icmp ugt i64 %36, %indvars.iv.next
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !36

._crit_edge23:                                    ; preds = %.lr.ph22, %._crit_edge
  ret void

.lr.ph22:                                         ; preds = %._crit_edge, %.lr.ph22
  %indvars.iv31 = phi i64 [ %indvars.iv.next32, %.lr.ph22 ], [ 0, %._crit_edge ]
  %indvars.iv29 = phi i64 [ %indvars.iv.next30, %.lr.ph22 ], [ %22, %._crit_edge ]
  %37 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %indvars.iv31) #2
  %38 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %indvars.iv29) #2
  tail call void @_ZSt4swapIN6qtorch4NodeEEvRSt10shared_ptrIT_ES5_(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 8 dereferenceable(16) %38) #2
  %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
  %indvars.iv.next30 = add nsw i64 %indvars.iv29, -1
  %39 = tail call noundef i64 @_ZNKSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #2
  %40 = load i32, ptr %4, align 8, !tbaa !5
  %41 = shl nsw i32 %40, 1
  %42 = xor i32 %41, -1
  %43 = sext i32 %42 to i64
  %44 = add i64 %39, %43
  %.not14 = icmp ugt i64 %44, %indvars.iv.next30
  br i1 %.not14, label %._crit_edge23, label %.lr.ph22, !llvm.loop !38
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIN6qtorch4NodeEEvRSt10shared_ptrIT_ES5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !24, i64 168}
!6 = !{!"_ZTSN6qtorch7NetworkE", !7, i64 0, !14, i64 24, !18, i64 48, !18, i64 80, !21, i64 112, !22, i64 128, !24, i64 168, !24, i64 172, !25, i64 176, !25, i64 177, !7, i64 184, !26, i64 208, !7, i64 232, !30, i64 256, !30, i64 312, !35, i64 368, !24, i64 376}
!7 = !{!"_ZTSSt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS3_EE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrIN6qtorch4NodeEESaIS3_EE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4NodeEESaIS3_EE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4NodeEESaIS3_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!"_ZTSSt6vectorISt10shared_ptrIN6qtorch4WireEESaIS3_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseISt10shared_ptrIN6qtorch4WireEESaIS3_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4WireEESaIS3_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseISt10shared_ptrIN6qtorch4WireEESaIS3_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !19, i64 0, !20, i64 8, !12, i64 16}
!19 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !11, i64 0}
!20 = !{!"long", !12, i64 0}
!21 = !{!"_ZTSSt7complexIdE", !12, i64 0}
!22 = !{!"_ZTSSt5mutex", !23, i64 0}
!23 = !{!"_ZTSSt12__mutex_base", !12, i64 0}
!24 = !{!"int", !12, i64 0}
!25 = !{!"bool", !12, i64 0}
!26 = !{!"_ZTSSt6vectorIS_ISt10shared_ptrIN6qtorch4NodeEESaIS3_EESaIS5_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseISt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS4_EESaIS6_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseISt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS4_EESaIS6_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseISt6vectorISt10shared_ptrIN6qtorch4NodeEESaIS4_EESaIS6_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!30 = !{!"_ZTSSt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_St4hashIS5_ESt8equal_toIS5_ESaISt4pairIKS5_S5_EEE", !31, i64 0}
!31 = !{!"_ZTSSt10_HashtableINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESaIS8_ENSt8__detail10_Select1stESt8equal_toIS5_ESt4hashIS5_ENSA_18_Mod_range_hashingENSA_20_Default_ranged_hashENSA_20_Prime_rehash_policyENSA_17_Hashtable_traitsILb1ELb0ELb1EEEE", !11, i64 0, !20, i64 8, !32, i64 16, !20, i64 24, !33, i64 32, !11, i64 48}
!32 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !11, i64 0}
!33 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !34, i64 0, !20, i64 8}
!34 = !{!"float", !12, i64 0}
!35 = !{!"long long", !12, i64 0}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = distinct !{!38, !37}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass