; LLVM IR from microsoft/Multiverso :: src/net/allreduce_engine.ll (ZN10multiverso15AllreduceEngine9AllgatherEPciPiS2_S1_)

; 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.multiverso::AllreduceEngine" = type <{ i32, i32, ptr, %"class.multiverso::BruckMap", %"class.multiverso::RecursiveHalvingMap", ptr, ptr, ptr, i32, [4 x i8] }>
%"class.multiverso::BruckMap" = type { i32, %"class.std::vector", %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.multiverso::RecursiveHalvingMap" = type { i32, i32, i32, %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector" }

; 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 uwtable
define dso_local void @_ZN10multiverso15AllreduceEngine9AllgatherEPciPiS2_S1_(ptr noundef nonnull align 8 dereferenceable(236) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #1 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %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 i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %24 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !9
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = load ptr, ptr %11, align 8, !tbaa !5
  %28 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !11
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr %27, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %25, ptr align 1 %26, i64 %33, i1 false)
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 1
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %34, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = load i32, ptr %13, align 4, !tbaa !9
  %41 = add nsw i32 %40, %39
  store i32 %41, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 1, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %147, %6
  %43 = load i32, ptr %15, align 4, !tbaa !9
  %44 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 3
  %45 = getelementptr inbounds %"class.multiverso::BruckMap", ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !20
  %47 = icmp slt i32 %43, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %42
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %150

49:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %50 = load i32, ptr %15, align 4, !tbaa !9
  %51 = shl i32 1, %50
  %52 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !21
  %54 = load i32, ptr %14, align 4, !tbaa !9
  %55 = sub nsw i32 %53, %54
  %56 = icmp slt i32 %51, %55
  br i1 %56, label %57, label %60

57:                                               ; preds = %49
  %58 = load i32, ptr %15, align 4, !tbaa !9
  %59 = shl i32 1, %58
  br label %65

60:                                               ; preds = %49
  %61 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 0
  %62 = load i32, ptr %61, align 8, !tbaa !21
  %63 = load i32, ptr %14, align 4, !tbaa !9
  %64 = sub nsw i32 %62, %63
  br label %65

65:                                               ; preds = %60, %57
  %66 = phi i32 [ %59, %57 ], [ %64, %60 ]
  store i32 %66, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %67 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 3
  %68 = getelementptr inbounds %"class.multiverso::BruckMap", ptr %67, i32 0, i32 2
  %69 = load i32, ptr %15, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %68, i64 noundef %70) #5
  %72 = load i32, ptr %71, align 4, !tbaa !9
  store i32 %72, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %92, %65
  %74 = load i32, ptr %20, align 4, !tbaa !9
  %75 = load i32, ptr %17, align 4, !tbaa !9
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %95

78:                                               ; preds = %73
  %79 = load ptr, ptr %11, align 8, !tbaa !5
  %80 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !11
  %82 = load i32, ptr %20, align 4, !tbaa !9
  %83 = add nsw i32 %81, %82
  %84 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 0
  %85 = load i32, ptr %84, align 8, !tbaa !21
  %86 = srem i32 %83, %85
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %79, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = load i32, ptr %19, align 4, !tbaa !9
  %91 = add nsw i32 %90, %89
  store i32 %91, ptr %19, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %78
  %93 = load i32, ptr %20, align 4, !tbaa !9
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %20, align 4, !tbaa !9
  br label %73, !llvm.loop !22

95:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %96 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 3
  %97 = getelementptr inbounds %"class.multiverso::BruckMap", ptr %96, i32 0, i32 1
  %98 = load i32, ptr %15, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %97, i64 noundef %99) #5
  %101 = load i32, ptr %100, align 4, !tbaa !9
  store i32 %101, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  store i32 0, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %123, %95
  %103 = load i32, ptr %23, align 4, !tbaa !9
  %104 = load i32, ptr %17, align 4, !tbaa !9
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 8, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %126

107:                                              ; preds = %102
  %108 = load ptr, ptr %11, align 8, !tbaa !5
  %109 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 1
  %110 = load i32, ptr %109, align 4, !tbaa !11
  %111 = load i32, ptr %14, align 4, !tbaa !9
  %112 = add nsw i32 %110, %111
  %113 = load i32, ptr %23, align 4, !tbaa !9
  %114 = add nsw i32 %112, %113
  %115 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !21
  %117 = srem i32 %114, %116
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr %108, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !9
  %121 = load i32, ptr %22, align 4, !tbaa !9
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr %22, align 4, !tbaa !9
  br label %123

123:                                              ; preds = %107
  %124 = load i32, ptr %23, align 4, !tbaa !9
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %23, align 4, !tbaa !9
  br label %102, !llvm.loop !24

126:                                              ; preds = %106
  %127 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 2
  %128 = load ptr, ptr %127, align 8, !tbaa !25
  %129 = load i32, ptr %18, align 4, !tbaa !9
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = load i32, ptr %19, align 4, !tbaa !9
  %132 = load i32, ptr %21, align 4, !tbaa !9
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = load i32, ptr %13, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds i8, ptr %133, i64 %135
  %137 = load i32, ptr %22, align 4, !tbaa !9
  %138 = load ptr, ptr %128, align 8, !tbaa !26
  %139 = getelementptr inbounds ptr, ptr %138, i64 12
  %140 = load ptr, ptr %139, align 8
  call void %140(ptr noundef nonnull align 8 dereferenceable(8) %128, i32 noundef %129, ptr noundef %130, i32 noundef %131, i32 noundef %132, ptr noundef %136, i32 noundef %137)
  %141 = load i32, ptr %22, align 4, !tbaa !9
  %142 = load i32, ptr %13, align 4, !tbaa !9
  %143 = add nsw i32 %142, %141
  store i32 %143, ptr %13, align 4, !tbaa !9
  %144 = load i32, ptr %17, align 4, !tbaa !9
  %145 = load i32, ptr %14, align 4, !tbaa !9
  %146 = add nsw i32 %145, %144
  store i32 %146, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %147

147:                                              ; preds = %126
  %148 = load i32, ptr %15, align 4, !tbaa !9
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %15, align 4, !tbaa !9
  br label %42, !llvm.loop !28

150:                                              ; preds = %48
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = load ptr, ptr %12, align 8, !tbaa !5
  %153 = load i32, ptr %9, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds i8, ptr %152, i64 %154
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef %151, ptr noundef %155)
  %156 = load ptr, ptr %12, align 8, !tbaa !5
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  %159 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 1
  %160 = load i32, ptr %159, align 4, !tbaa !11
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds i32, ptr %158, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds i8, ptr %157, i64 %164
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef %156, ptr noundef %165)
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  %167 = load ptr, ptr %10, align 8, !tbaa !5
  %168 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %24, i32 0, i32 1
  %169 = load i32, ptr %168, align 4, !tbaa !11
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds i32, ptr %167, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds i8, ptr %166, i64 %173
  %175 = load ptr, ptr %12, align 8, !tbaa !5
  %176 = load i32, ptr %9, align 4, !tbaa !9
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds i8, ptr %175, i64 %177
  call void @_ZSt7reverseIPcEvT_S1_(ptr noundef %174, ptr noundef %178)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  ret void
}

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 4}
!12 = !{!"_ZTSN10multiverso15AllreduceEngineE", !10, i64 0, !10, i64 4, !6, i64 8, !13, i64 16, !18, i64 72, !6, i64 208, !6, i64 216, !6, i64 224, !10, i64 232}
!13 = !{!"_ZTSN10multiverso8BruckMapE", !10, i64 0, !14, i64 8, !14, i64 32}
!14 = !{!"_ZTSSt6vectorIiSaIiEE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"_ZTSN10multiverso19RecursiveHalvingMapE", !10, i64 0, !19, i64 4, !10, i64 8, !14, i64 16, !14, i64 40, !14, i64 64, !14, i64 88, !14, i64 112}
!19 = !{!"_ZTSN10multiverso24RecursiveHalvingNodeTypeE", !7, i64 0}
!20 = !{!12, !10, i64 16}
!21 = !{!12, !10, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = distinct !{!24, !23}
!25 = !{!12, !6, i64 8}
!26 = !{!27, !27, i64 0}
!27 = !{!"vtable pointer", !8, i64 0}
!28 = distinct !{!28, !23}


; 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 uwtable
define dso_local void @_ZN10multiverso15AllreduceEngine9AllgatherEPciPiS2_S1_(ptr noundef nonnull align 8 dereferenceable(236) %0, ptr nocapture noundef readonly %1, i32 noundef %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr noundef %5) local_unnamed_addr #0 align 2 {
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds i32, ptr %4, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !18
  %12 = sext i32 %11 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %5, ptr align 1 %1, i64 %12, i1 false)
  %13 = getelementptr inbounds i8, ptr %0, i64 16
  %14 = load i32, ptr %13, align 8, !tbaa !19
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph68, label %._crit_edge69

.lr.ph68:                                         ; preds = %6
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr %4, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  %21 = getelementptr inbounds i8, ptr %0, i64 24
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  br label %37

._crit_edge69:                                    ; preds = %._crit_edge62, %6
  %23 = sext i32 %2 to i64
  %24 = getelementptr inbounds i8, ptr %5, i64 %23
  tail call void @_ZSt7reverseIPcEvT_S1_(ptr noundef %5, ptr noundef %24)
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr %3, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !18
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i8, ptr %5, i64 %29
  tail call void @_ZSt7reverseIPcEvT_S1_(ptr noundef %5, ptr noundef %30)
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr %3, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !18
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %5, i64 %35
  tail call void @_ZSt7reverseIPcEvT_S1_(ptr noundef %36, ptr noundef %24)
  ret void

37:                                               ; preds = %.lr.ph68, %._crit_edge62
  %indvars.iv = phi i64 [ 0, %.lr.ph68 ], [ %indvars.iv.next, %._crit_edge62 ]
  %.04866 = phi i32 [ %19, %.lr.ph68 ], [ %91, %._crit_edge62 ]
  %.05165 = phi i32 [ 1, %.lr.ph68 ], [ %92, %._crit_edge62 ]
  %38 = trunc nuw nsw i64 %indvars.iv to i32
  %39 = shl nuw i32 1, %38
  %40 = load i32, ptr %0, align 8, !tbaa !20
  %41 = sub i32 %40, %.05165
  %. = tail call i32 @llvm.smin.i32(i32 %39, i32 %41)
  %42 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %20, i64 noundef %indvars.iv) #5
  %43 = load i32, ptr %42, align 4, !tbaa !18
  %44 = icmp sgt i32 %., 0
  br i1 %44, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %37
  %45 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %indvars.iv) #5
  %46 = load i32, ptr %45, align 4, !tbaa !18
  br label %._crit_edge62

.lr.ph:                                           ; preds = %37
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = load i32, ptr %0, align 8, !tbaa !20
  %49 = add nsw i32 %., -1
  %xtraiter = and i32 %., 1
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %._crit_edge.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i32 %., 2147483646
  br label %62

._crit_edge.unr-lcssa:                            ; preds = %62, %.lr.ph
  %.lcssa.ph = phi i32 [ poison, %.lr.ph ], [ %75, %62 ]
  %.04957.unr = phi i32 [ 0, %.lr.ph ], [ %76, %62 ]
  %.05056.unr = phi i32 [ 0, %.lr.ph ], [ %75, %62 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.epilog-lcssa

._crit_edge.epilog-lcssa:                         ; preds = %._crit_edge.unr-lcssa
  %51 = add nsw i32 %47, %.04957.unr
  %52 = srem i32 %51, %48
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds i32, ptr %4, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = add nsw i32 %55, %.05056.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.unr-lcssa, %._crit_edge.epilog-lcssa
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge.unr-lcssa ], [ %56, %._crit_edge.epilog-lcssa ]
  %57 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %21, i64 noundef %indvars.iv) #5
  %58 = load i32, ptr %57, align 4, !tbaa !18
  br i1 %44, label %.lr.ph61, label %._crit_edge62

.lr.ph61:                                         ; preds = %._crit_edge
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = load i32, ptr %0, align 8, !tbaa !20
  %xtraiter80 = and i32 %., 1
  %61 = icmp eq i32 %49, 0
  br i1 %61, label %._crit_edge62.loopexit.unr-lcssa, label %.lr.ph61.new

.lr.ph61.new:                                     ; preds = %.lr.ph61
  %unroll_iter83 = and i32 %., 2147483646
  br label %96

62:                                               ; preds = %62, %.lr.ph.new
  %.04957 = phi i32 [ 0, %.lr.ph.new ], [ %76, %62 ]
  %.05056 = phi i32 [ 0, %.lr.ph.new ], [ %75, %62 ]
  %niter = phi i32 [ 0, %.lr.ph.new ], [ %niter.next.1, %62 ]
  %63 = add nsw i32 %47, %.04957
  %64 = srem i32 %63, %48
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr %4, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !18
  %68 = add nsw i32 %67, %.05056
  %69 = or disjoint i32 %.04957, 1
  %70 = add nsw i32 %47, %69
  %71 = srem i32 %70, %48
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i32, ptr %4, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !18
  %75 = add nsw i32 %74, %68
  %76 = add nuw nsw i32 %.04957, 2
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %62, !llvm.loop !21

._crit_edge62.loopexit.unr-lcssa:                 ; preds = %96, %.lr.ph61
  %.lcssa77.ph = phi i32 [ poison, %.lr.ph61 ], [ %111, %96 ]
  %.059.unr = phi i32 [ 0, %.lr.ph61 ], [ %112, %96 ]
  %.04758.unr = phi i32 [ 0, %.lr.ph61 ], [ %111, %96 ]
  %lcmp.mod81.not = icmp eq i32 %xtraiter80, 0
  br i1 %lcmp.mod81.not, label %._crit_edge62, label %._crit_edge62.loopexit.epilog-lcssa

._crit_edge62.loopexit.epilog-lcssa:              ; preds = %._crit_edge62.loopexit.unr-lcssa
  %77 = add i32 %.059.unr, %.05165
  %78 = add i32 %77, %59
  %79 = srem i32 %78, %60
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr %4, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !18
  %83 = add nsw i32 %82, %.04758.unr
  br label %._crit_edge62

._crit_edge62:                                    ; preds = %._crit_edge62.loopexit.epilog-lcssa, %._crit_edge62.loopexit.unr-lcssa, %._crit_edge.thread, %._crit_edge
  %84 = phi i32 [ %58, %._crit_edge ], [ %46, %._crit_edge.thread ], [ %58, %._crit_edge62.loopexit.unr-lcssa ], [ %58, %._crit_edge62.loopexit.epilog-lcssa ]
  %.050.lcssa74 = phi i32 [ %.lcssa, %._crit_edge ], [ 0, %._crit_edge.thread ], [ %.lcssa, %._crit_edge62.loopexit.unr-lcssa ], [ %.lcssa, %._crit_edge62.loopexit.epilog-lcssa ]
  %.047.lcssa = phi i32 [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ], [ %.lcssa77.ph, %._crit_edge62.loopexit.unr-lcssa ], [ %83, %._crit_edge62.loopexit.epilog-lcssa ]
  %85 = load ptr, ptr %22, align 8, !tbaa !23
  %86 = sext i32 %.04866 to i64
  %87 = getelementptr inbounds i8, ptr %5, i64 %86
  %88 = load ptr, ptr %85, align 8, !tbaa !24
  %89 = getelementptr inbounds i8, ptr %88, i64 96
  %90 = load ptr, ptr %89, align 8
  tail call void %90(ptr noundef nonnull align 8 dereferenceable(8) %85, i32 noundef %43, ptr noundef %5, i32 noundef %.050.lcssa74, i32 noundef %84, ptr noundef %87, i32 noundef %.047.lcssa)
  %91 = add nsw i32 %.047.lcssa, %.04866
  %92 = add nsw i32 %., %.05165
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %93 = load i32, ptr %13, align 8, !tbaa !19
  %94 = sext i32 %93 to i64
  %95 = icmp slt i64 %indvars.iv.next, %94
  br i1 %95, label %37, label %._crit_edge69, !llvm.loop !26

96:                                               ; preds = %96, %.lr.ph61.new
  %.059 = phi i32 [ 0, %.lr.ph61.new ], [ %112, %96 ]
  %.04758 = phi i32 [ 0, %.lr.ph61.new ], [ %111, %96 ]
  %niter84 = phi i32 [ 0, %.lr.ph61.new ], [ %niter84.next.1, %96 ]
  %97 = add i32 %.059, %.05165
  %98 = add i32 %97, %59
  %99 = srem i32 %98, %60
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds i32, ptr %4, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !18
  %103 = add nsw i32 %102, %.04758
  %104 = or disjoint i32 %.059, 1
  %105 = add i32 %104, %.05165
  %106 = add i32 %105, %59
  %107 = srem i32 %106, %60
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %4, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !18
  %111 = add nsw i32 %110, %103
  %112 = add nuw nsw i32 %.059, 2
  %niter84.next.1 = add i32 %niter84, 2
  %niter84.ncmp.1 = icmp eq i32 %niter84.next.1, %unroll_iter83
  br i1 %niter84.ncmp.1, label %._crit_edge62.loopexit.unr-lcssa, label %96, !llvm.loop !27
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPcEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 4}
!6 = !{!"_ZTSN10multiverso15AllreduceEngineE", !7, i64 0, !7, i64 4, !10, i64 8, !11, i64 16, !16, i64 72, !10, i64 208, !10, i64 216, !10, i64 224, !7, i64 232}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTSN10multiverso8BruckMapE", !7, i64 0, !12, i64 8, !12, i64 32}
!12 = !{!"_ZTSSt6vectorIiSaIiEE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!16 = !{!"_ZTSN10multiverso19RecursiveHalvingMapE", !7, i64 0, !17, i64 4, !7, i64 8, !12, i64 16, !12, i64 40, !12, i64 64, !12, i64 88, !12, i64 112}
!17 = !{!"_ZTSN10multiverso24RecursiveHalvingNodeTypeE", !8, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!6, !7, i64 16}
!20 = !{!6, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!6, !10, i64 8}
!24 = !{!25, !25, i64 0}
!25 = !{!"vtable pointer", !9, i64 0}
!26 = distinct !{!26, !22}
!27 = distinct !{!27, !22}


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