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

; 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 @_ZN10multiverso15AllreduceEngine13ReduceScatterEPciiPiS2_S1_PFvPKcS1_iE(ptr noundef nonnull align 8 dereferenceable(236) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #1 align 2 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i8, align 1
  %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
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store ptr %7, ptr %16, align 8, !tbaa !5
  %30 = load ptr, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #4
  %31 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !11
  %33 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 0
  %34 = load i32, ptr %33, align 8, !tbaa !11
  %35 = sub nsw i32 %34, 1
  %36 = and i32 %32, %35
  %37 = icmp eq i32 %36, 0
  %38 = zext i1 %37 to i64
  %39 = select i1 %37, i1 true, i1 false
  %40 = zext i1 %39 to i8
  store i8 %40, ptr %17, align 1, !tbaa !20
  %41 = load i8, ptr %17, align 1, !tbaa !20, !range !22, !noundef !23
  %42 = trunc i8 %41 to i1
  br i1 %42, label %82, label %43

43:                                               ; preds = %8
  %44 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %45 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !24
  %47 = icmp eq i32 %46, 2
  br i1 %47, label %48, label %59

48:                                               ; preds = %43
  %49 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !25
  %51 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %52 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %51, i32 0, i32 2
  %53 = load i32, ptr %52, align 8, !tbaa !26
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = load ptr, ptr %50, align 8, !tbaa !27
  %57 = getelementptr inbounds ptr, ptr %56, i64 10
  %58 = load ptr, ptr %57, align 8
  call void %58(ptr noundef nonnull align 8 dereferenceable(8) %50, i32 noundef %53, ptr noundef %54, i32 noundef %55)
  br label %81

59:                                               ; preds = %43
  %60 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %61 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 4, !tbaa !24
  %63 = icmp eq i32 %62, 1
  br i1 %63, label %64, label %80

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %65 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %65, ptr %18, align 4, !tbaa !9
  %66 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !25
  %68 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %69 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %68, i32 0, i32 2
  %70 = load i32, ptr %69, align 8, !tbaa !26
  %71 = load ptr, ptr %15, align 8, !tbaa !5
  %72 = load i32, ptr %18, align 4, !tbaa !9
  %73 = load ptr, ptr %67, align 8, !tbaa !27
  %74 = getelementptr inbounds ptr, ptr %73, i64 11
  %75 = load ptr, ptr %74, align 8
  call void %75(ptr noundef nonnull align 8 dereferenceable(8) %67, i32 noundef %70, ptr noundef %71, i32 noundef %72)
  %76 = load ptr, ptr %16, align 8, !tbaa !5
  %77 = load ptr, ptr %15, align 8, !tbaa !5
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = load i32, ptr %11, align 4, !tbaa !9
  call void %76(ptr noundef %77, ptr noundef %78, i32 noundef %79)
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %80

80:                                               ; preds = %64, %59
  br label %81

81:                                               ; preds = %80, %48
  br label %82

82:                                               ; preds = %81, %8
  %83 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %84 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %83, i32 0, i32 1
  %85 = load i32, ptr %84, align 4, !tbaa !24
  %86 = icmp ne i32 %85, 2
  br i1 %86, label %87, label %195

87:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %191, %87
  %89 = load i32, ptr %19, align 4, !tbaa !9
  %90 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %91 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %90, i32 0, i32 0
  %92 = load i32, ptr %91, align 8, !tbaa !29
  %93 = icmp slt i32 %89, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %88
  store i32 2, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %194

95:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %96 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %97 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %96, i32 0, i32 3
  %98 = load i32, ptr %19, 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) #4
  %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) #4
  %102 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %103 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %102, i32 0, i32 4
  %104 = load i32, ptr %19, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %105) #4
  %107 = load i32, ptr %106, align 4, !tbaa !9
  store i32 %107, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %108 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %109 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %108, i32 0, i32 6
  %110 = load i32, ptr %19, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %109, i64 noundef %111) #4
  %113 = load i32, ptr %112, align 4, !tbaa !9
  store i32 %113, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  store i32 0, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #4
  store i32 0, ptr %25, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %134, %95
  %115 = load i32, ptr %25, align 4, !tbaa !9
  %116 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %117 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %116, i32 0, i32 5
  %118 = load i32, ptr %19, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %117, i64 noundef %119) #4
  %121 = load i32, ptr %120, align 4, !tbaa !9
  %122 = icmp slt i32 %115, %121
  br i1 %122, label %124, label %123

123:                                              ; preds = %114
  store i32 5, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %137

124:                                              ; preds = %114
  %125 = load ptr, ptr %14, align 8, !tbaa !5
  %126 = load i32, ptr %22, align 4, !tbaa !9
  %127 = load i32, ptr %25, align 4, !tbaa !9
  %128 = add nsw i32 %126, %127
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr %125, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !9
  %132 = load i32, ptr %24, align 4, !tbaa !9
  %133 = add nsw i32 %132, %131
  store i32 %133, ptr %24, align 4, !tbaa !9
  br label %134

134:                                              ; preds = %124
  %135 = load i32, ptr %25, align 4, !tbaa !9
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %25, align 4, !tbaa !9
  br label %114, !llvm.loop !30

137:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  store i32 0, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #4
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %138

138:                                              ; preds = %158, %137
  %139 = load i32, ptr %27, align 4, !tbaa !9
  %140 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %141 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %140, i32 0, i32 7
  %142 = load i32, ptr %19, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %141, i64 noundef %143) #4
  %145 = load i32, ptr %144, align 4, !tbaa !9
  %146 = icmp slt i32 %139, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %138
  store i32 8, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #4
  br label %161

148:                                              ; preds = %138
  %149 = load ptr, ptr %14, align 8, !tbaa !5
  %150 = load i32, ptr %23, align 4, !tbaa !9
  %151 = load i32, ptr %27, align 4, !tbaa !9
  %152 = add nsw i32 %150, %151
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds i32, ptr %149, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !9
  %156 = load i32, ptr %26, align 4, !tbaa !9
  %157 = add nsw i32 %156, %155
  store i32 %157, ptr %26, align 4, !tbaa !9
  br label %158

158:                                              ; preds = %148
  %159 = load i32, ptr %27, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %27, align 4, !tbaa !9
  br label %138, !llvm.loop !32

161:                                              ; preds = %147
  %162 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 2
  %163 = load ptr, ptr %162, align 8, !tbaa !25
  %164 = load i32, ptr %21, align 4, !tbaa !9
  %165 = load ptr, ptr %10, align 8, !tbaa !5
  %166 = load ptr, ptr %13, align 8, !tbaa !5
  %167 = load i32, ptr %22, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds i32, ptr %166, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !9
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds i8, ptr %165, i64 %171
  %173 = load i32, ptr %24, align 4, !tbaa !9
  %174 = load i32, ptr %21, align 4, !tbaa !9
  %175 = load ptr, ptr %15, align 8, !tbaa !5
  %176 = load i32, ptr %26, align 4, !tbaa !9
  %177 = load ptr, ptr %163, align 8, !tbaa !27
  %178 = getelementptr inbounds ptr, ptr %177, i64 12
  %179 = load ptr, ptr %178, align 8
  call void %179(ptr noundef nonnull align 8 dereferenceable(8) %163, i32 noundef %164, ptr noundef %172, i32 noundef %173, i32 noundef %174, ptr noundef %175, i32 noundef %176)
  %180 = load ptr, ptr %16, align 8, !tbaa !5
  %181 = load ptr, ptr %15, align 8, !tbaa !5
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  %183 = load ptr, ptr %13, align 8, !tbaa !5
  %184 = load i32, ptr %23, align 4, !tbaa !9
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds i32, ptr %183, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !9
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds i8, ptr %182, i64 %188
  %190 = load i32, ptr %26, align 4, !tbaa !9
  call void %180(ptr noundef %181, ptr noundef %189, i32 noundef %190)
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %191

191:                                              ; preds = %161
  %192 = load i32, ptr %19, align 4, !tbaa !9
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %19, align 4, !tbaa !9
  br label %88, !llvm.loop !33

194:                                              ; preds = %94
  br label %195

195:                                              ; preds = %194, %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #4
  %196 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 1
  %197 = load i32, ptr %196, align 4, !tbaa !34
  store i32 %197, ptr %28, align 4, !tbaa !9
  %198 = load i8, ptr %17, align 1, !tbaa !20, !range !22, !noundef !23
  %199 = trunc i8 %198 to i1
  br i1 %199, label %254, label %200

200:                                              ; preds = %195
  %201 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %202 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %201, i32 0, i32 1
  %203 = load i32, ptr %202, align 4, !tbaa !24
  %204 = icmp eq i32 %203, 1
  br i1 %204, label %205, label %231

205:                                              ; preds = %200
  %206 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 2
  %207 = load ptr, ptr %206, align 8, !tbaa !25
  %208 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %209 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %208, i32 0, i32 2
  %210 = load i32, ptr %209, align 8, !tbaa !26
  %211 = load ptr, ptr %10, align 8, !tbaa !5
  %212 = load ptr, ptr %13, align 8, !tbaa !5
  %213 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %214 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %213, i32 0, i32 2
  %215 = load i32, ptr %214, align 8, !tbaa !26
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds i32, ptr %212, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !9
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds i8, ptr %211, i64 %219
  %221 = load ptr, ptr %14, align 8, !tbaa !5
  %222 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %223 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %222, i32 0, i32 2
  %224 = load i32, ptr %223, align 8, !tbaa !26
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds i32, ptr %221, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !9
  %228 = load ptr, ptr %207, align 8, !tbaa !27
  %229 = getelementptr inbounds ptr, ptr %228, i64 10
  %230 = load ptr, ptr %229, align 8
  call void %230(ptr noundef nonnull align 8 dereferenceable(8) %207, i32 noundef %210, ptr noundef %220, i32 noundef %227)
  br label %253

231:                                              ; preds = %200
  %232 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %233 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %232, i32 0, i32 1
  %234 = load i32, ptr %233, align 4, !tbaa !24
  %235 = icmp eq i32 %234, 2
  br i1 %235, label %236, label %252

236:                                              ; preds = %231
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #4
  %237 = load ptr, ptr %14, align 8, !tbaa !5
  %238 = load i32, ptr %28, align 4, !tbaa !9
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds i32, ptr %237, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !9
  store i32 %241, ptr %29, align 4, !tbaa !9
  %242 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 2
  %243 = load ptr, ptr %242, align 8, !tbaa !25
  %244 = getelementptr inbounds %"class.multiverso::AllreduceEngine", ptr %30, i32 0, i32 4
  %245 = getelementptr inbounds %"class.multiverso::RecursiveHalvingMap", ptr %244, i32 0, i32 2
  %246 = load i32, ptr %245, align 8, !tbaa !26
  %247 = load ptr, ptr %15, align 8, !tbaa !5
  %248 = load i32, ptr %29, align 4, !tbaa !9
  %249 = load ptr, ptr %243, align 8, !tbaa !27
  %250 = getelementptr inbounds ptr, ptr %249, i64 11
  %251 = load ptr, ptr %250, align 8
  call void %251(ptr noundef nonnull align 8 dereferenceable(8) %243, i32 noundef %246, ptr noundef %247, i32 noundef %248)
  store i32 1, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #4
  br label %270

252:                                              ; preds = %231
  br label %253

253:                                              ; preds = %252, %205
  br label %254

254:                                              ; preds = %253, %195
  %255 = load ptr, ptr %15, align 8, !tbaa !5
  %256 = load ptr, ptr %10, align 8, !tbaa !5
  %257 = load ptr, ptr %13, align 8, !tbaa !5
  %258 = load i32, ptr %28, align 4, !tbaa !9
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds i32, ptr %257, i64 %259
  %261 = load i32, ptr %260, align 4, !tbaa !9
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds i8, ptr %256, i64 %262
  %264 = load ptr, ptr %14, align 8, !tbaa !5
  %265 = load i32, ptr %28, align 4, !tbaa !9
  %266 = sext i32 %265 to i64
  %267 = getelementptr inbounds i32, ptr %264, i64 %266
  %268 = load i32, ptr %267, align 4, !tbaa !9
  %269 = sext i32 %268 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %255, ptr align 1 %263, i64 %269, i1 false)
  store i32 0, ptr %20, align 4
  br label %270

270:                                              ; preds = %254, %236
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #4
  %271 = load i32, ptr %20, align 4
  switch i32 %271, label %273 [
    i32 0, label %272
    i32 1, label %272
  ]

272:                                              ; preds = %270, %270
  ret void

273:                                              ; preds = %270
  unreachable
}

; 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

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 = { 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 0}
!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 = !{!21, !21, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!12, !19, i64 76}
!25 = !{!12, !6, i64 8}
!26 = !{!12, !10, i64 80}
!27 = !{!28, !28, i64 0}
!28 = !{!"vtable pointer", !8, i64 0}
!29 = !{!12, !10, i64 72}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}
!33 = distinct !{!33, !31}
!34 = !{!12, !10, i64 4}


; 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 @_ZN10multiverso15AllreduceEngine13ReduceScatterEPciiPiS2_S1_PFvPKcS1_iE(ptr noundef nonnull align 8 dereferenceable(236) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr noundef %6, ptr nocapture noundef readonly %7) local_unnamed_addr #0 align 2 {
  %9 = load i32, ptr %0, align 8, !tbaa !5
  %10 = tail call range(i32 0, 33) i32 @llvm.ctpop.i32(i32 %9)
  %11 = icmp ult i32 %10, 2
  br i1 %11, label %31, label %12

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %0, i64 76
  %14 = load i32, ptr %13, align 4, !tbaa !18
  switch i32 %14, label %31 [
    i32 2, label %15
    i32 1, label %23
  ]

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %0, i64 80
  %19 = load i32, ptr %18, align 8, !tbaa !20
  %20 = load ptr, ptr %17, align 8, !tbaa !21
  %21 = getelementptr inbounds i8, ptr %20, i64 80
  %22 = load ptr, ptr %21, align 8
  tail call void %22(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef %19, ptr noundef %1, i32 noundef %2)
  br label %31

23:                                               ; preds = %12
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !19
  %26 = getelementptr inbounds i8, ptr %0, i64 80
  %27 = load i32, ptr %26, align 8, !tbaa !20
  %28 = load ptr, ptr %25, align 8, !tbaa !21
  %29 = getelementptr inbounds i8, ptr %28, i64 88
  %30 = load ptr, ptr %29, align 8
  tail call void %30(ptr noundef nonnull align 8 dereferenceable(8) %25, i32 noundef %27, ptr noundef %6, i32 noundef %2)
  tail call void %7(ptr noundef %6, ptr noundef %1, i32 noundef %2)
  br label %31

31:                                               ; preds = %12, %15, %23, %8
  %32 = getelementptr inbounds i8, ptr %0, i64 72
  %33 = getelementptr inbounds i8, ptr %0, i64 76
  %34 = load i32, ptr %33, align 4, !tbaa !18
  %.not = icmp ne i32 %34, 2
  %35 = load i32, ptr %32, align 8
  %36 = icmp sgt i32 %35, 0
  %or.cond = select i1 %.not, i1 %36, i1 false
  br i1 %or.cond, label %.lr.ph71, label %.loopexit

.lr.ph71:                                         ; preds = %31
  %37 = getelementptr inbounds i8, ptr %0, i64 88
  %38 = getelementptr inbounds i8, ptr %0, i64 112
  %39 = getelementptr inbounds i8, ptr %0, i64 160
  %40 = getelementptr inbounds i8, ptr %0, i64 136
  %41 = getelementptr inbounds i8, ptr %0, i64 184
  %42 = getelementptr inbounds i8, ptr %0, i64 8
  br label %43

43:                                               ; preds = %.lr.ph71, %._crit_edge
  %indvars.iv78 = phi i64 [ 0, %.lr.ph71 ], [ %indvars.iv.next79, %._crit_edge ]
  %44 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %37, i64 noundef %indvars.iv78) #4
  %45 = load i32, ptr %44, align 4, !tbaa !23
  %46 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %indvars.iv78) #4
  %47 = load i32, ptr %46, align 4, !tbaa !23
  %48 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %indvars.iv78) #4
  %49 = load i32, ptr %48, align 4, !tbaa !23
  %50 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %indvars.iv78) #4
  %51 = load i32, ptr %50, align 4, !tbaa !23
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %43
  %53 = sext i32 %47 to i64
  %invariant.gep = getelementptr i32, ptr %5, i64 %53
  br label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %43
  %.060.lcssa = phi i32 [ 0, %43 ], [ %59, %.lr.ph ]
  %54 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %indvars.iv78) #4
  %55 = load i32, ptr %54, align 4, !tbaa !23
  %56 = icmp sgt i32 %55, 0
  %57 = sext i32 %49 to i64
  br i1 %56, label %.lr.ph68.preheader, label %._crit_edge

.lr.ph68.preheader:                               ; preds = %.preheader
  %invariant.gep82 = getelementptr i32, ptr %5, i64 %57
  br label %.lr.ph68

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.06064 = phi i32 [ 0, %.lr.ph.preheader ], [ %59, %.lr.ph ]
  %gep = getelementptr i32, ptr %invariant.gep, i64 %indvars.iv
  %58 = load i32, ptr %gep, align 4, !tbaa !23
  %59 = add nsw i32 %58, %.06064
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %60 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %indvars.iv78) #4
  %61 = load i32, ptr %60, align 4, !tbaa !23
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next, %62
  br i1 %63, label %.lr.ph, label %.preheader, !llvm.loop !24

._crit_edge:                                      ; preds = %.lr.ph68, %.preheader
  %.058.lcssa = phi i32 [ 0, %.preheader ], [ %81, %.lr.ph68 ]
  %64 = load ptr, ptr %42, align 8, !tbaa !19
  %65 = sext i32 %47 to i64
  %66 = getelementptr inbounds i32, ptr %4, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !23
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i8, ptr %1, i64 %68
  %70 = load ptr, ptr %64, align 8, !tbaa !21
  %71 = getelementptr inbounds i8, ptr %70, i64 96
  %72 = load ptr, ptr %71, align 8
  tail call void %72(ptr noundef nonnull align 8 dereferenceable(8) %64, i32 noundef %45, ptr noundef %69, i32 noundef %.060.lcssa, i32 noundef %45, ptr noundef %6, i32 noundef %.058.lcssa)
  %73 = getelementptr inbounds i32, ptr %4, i64 %57
  %74 = load i32, ptr %73, align 4, !tbaa !23
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i8, ptr %1, i64 %75
  tail call void %7(ptr noundef %6, ptr noundef %76, i32 noundef %.058.lcssa)
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %77 = load i32, ptr %32, align 8, !tbaa !26
  %78 = sext i32 %77 to i64
  %79 = icmp slt i64 %indvars.iv.next79, %78
  br i1 %79, label %43, label %.loopexit, !llvm.loop !27

.lr.ph68:                                         ; preds = %.lr.ph68.preheader, %.lr.ph68
  %indvars.iv75 = phi i64 [ 0, %.lr.ph68.preheader ], [ %indvars.iv.next76, %.lr.ph68 ]
  %.05866 = phi i32 [ 0, %.lr.ph68.preheader ], [ %81, %.lr.ph68 ]
  %gep83 = getelementptr i32, ptr %invariant.gep82, i64 %indvars.iv75
  %80 = load i32, ptr %gep83, align 4, !tbaa !23
  %81 = add nsw i32 %80, %.05866
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %82 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %indvars.iv78) #4
  %83 = load i32, ptr %82, align 4, !tbaa !23
  %84 = sext i32 %83 to i64
  %85 = icmp slt i64 %indvars.iv.next76, %84
  br i1 %85, label %.lr.ph68, label %._crit_edge, !llvm.loop !28

.loopexit:                                        ; preds = %._crit_edge, %31
  %86 = getelementptr inbounds i8, ptr %0, i64 4
  %87 = load i32, ptr %86, align 4, !tbaa !29
  br i1 %11, label %116, label %88

88:                                               ; preds = %.loopexit
  %89 = load i32, ptr %33, align 4, !tbaa !18
  switch i32 %89, label %116 [
    i32 1, label %90
    i32 2, label %105
  ]

90:                                               ; preds = %88
  %91 = getelementptr inbounds i8, ptr %0, i64 8
  %92 = load ptr, ptr %91, align 8, !tbaa !19
  %93 = getelementptr inbounds i8, ptr %0, i64 80
  %94 = load i32, ptr %93, align 8, !tbaa !20
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr %4, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !23
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i8, ptr %1, i64 %98
  %100 = getelementptr inbounds i32, ptr %5, i64 %95
  %101 = load i32, ptr %100, align 4, !tbaa !23
  %102 = load ptr, ptr %92, align 8, !tbaa !21
  %103 = getelementptr inbounds i8, ptr %102, i64 80
  %104 = load ptr, ptr %103, align 8
  tail call void %104(ptr noundef nonnull align 8 dereferenceable(8) %92, i32 noundef %94, ptr noundef %99, i32 noundef %101)
  br label %116

105:                                              ; preds = %88
  %106 = sext i32 %87 to i64
  %107 = getelementptr inbounds i32, ptr %5, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !23
  %109 = getelementptr inbounds i8, ptr %0, i64 8
  %110 = load ptr, ptr %109, align 8, !tbaa !19
  %111 = getelementptr inbounds i8, ptr %0, i64 80
  %112 = load i32, ptr %111, align 8, !tbaa !20
  %113 = load ptr, ptr %110, align 8, !tbaa !21
  %114 = getelementptr inbounds i8, ptr %113, i64 88
  %115 = load ptr, ptr %114, align 8
  tail call void %115(ptr noundef nonnull align 8 dereferenceable(8) %110, i32 noundef %112, ptr noundef %6, i32 noundef %108)
  br label %125

116:                                              ; preds = %88, %90, %.loopexit
  %117 = sext i32 %87 to i64
  %118 = getelementptr inbounds i32, ptr %4, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !23
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i8, ptr %1, i64 %120
  %122 = getelementptr inbounds i32, ptr %5, i64 %117
  %123 = load i32, ptr %122, align 4, !tbaa !23
  %124 = sext i32 %123 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %6, ptr align 1 %121, i64 %124, i1 false)
  br label %125

125:                                              ; preds = %116, %105
  ret void
}

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.ctpop.i32(i32) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 0}
!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 = !{!6, !17, i64 76}
!19 = !{!6, !10, i64 8}
!20 = !{!6, !7, i64 80}
!21 = !{!22, !22, i64 0}
!22 = !{!"vtable pointer", !9, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!6, !7, i64 72}
!27 = distinct !{!27, !25}
!28 = distinct !{!28, !25}
!29 = !{!6, !7, i64 4}


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