; LLVM IR from huawei-noah/bolt :: compute/tensor/src/where.ll (Z23where_infer_output_sizeP6TensorS0_S0_S0_P8ArchInfo)

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

%struct.TensorDesc = type { i32, i32, i32, [20 x i32] }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z23where_infer_output_sizeP6TensorS0_S0_S0_P8ArchInfo(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %struct.TensorDesc, align 4
  %12 = alloca %struct.TensorDesc, align 4
  %13 = alloca %struct.TensorDesc, align 4
  %14 = alloca %struct.TensorDesc, 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
  %24 = alloca %struct.TensorDesc, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 92, ptr %11) #3
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4 %11, ptr noundef nonnull align 8 dereferenceable(32) %25)
  call void @llvm.lifetime.start.p0(i64 92, ptr %12) #3
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4 %12, ptr noundef nonnull align 8 dereferenceable(32) %26)
  call void @llvm.lifetime.start.p0(i64 92, ptr %13) #3
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4 %13, ptr noundef nonnull align 8 dereferenceable(32) %27)
  call void @llvm.lifetime.start.p0(i64 92, ptr %14) #3
  %28 = getelementptr inbounds %struct.TensorDesc, ptr %12, i32 0, i32 2
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 2
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = icmp ugt i32 %29, %31
  br i1 %32, label %33, label %34

33:                                               ; preds = %5
  br label %35

34:                                               ; preds = %5
  br label %35

35:                                               ; preds = %34, %33
  %36 = phi ptr [ %12, %33 ], [ %13, %34 ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %36, i64 92, i1 false), !tbaa.struct !14
  %37 = getelementptr inbounds %struct.TensorDesc, ptr %11, i32 0, i32 2
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 2
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = icmp ugt i32 %38, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %35
  br label %44

43:                                               ; preds = %35
  br label %44

44:                                               ; preds = %43, %42
  %45 = phi ptr [ %11, %42 ], [ %14, %43 ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %45, i64 92, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 0, ptr %15, align 4, !tbaa !17
  br label %46

46:                                               ; preds = %118, %44
  %47 = load i32, ptr %15, align 4, !tbaa !17
  %48 = getelementptr inbounds %struct.TensorDesc, ptr %11, i32 0, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = icmp ult i32 %47, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %53 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %54 = load i32, ptr %15, align 4, !tbaa !17
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds [20 x i32], ptr %53, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !17
  %58 = getelementptr inbounds %struct.TensorDesc, ptr %11, i32 0, i32 3
  %59 = load i32, ptr %15, align 4, !tbaa !17
  %60 = zext i32 %59 to i64
  %61 = getelementptr inbounds [20 x i32], ptr %58, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !17
  %63 = icmp ugt i32 %57, %62
  br i1 %63, label %64, label %70

64:                                               ; preds = %52
  %65 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %66 = load i32, ptr %15, align 4, !tbaa !17
  %67 = zext i32 %66 to i64
  %68 = getelementptr inbounds [20 x i32], ptr %65, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !17
  br label %76

70:                                               ; preds = %52
  %71 = getelementptr inbounds %struct.TensorDesc, ptr %11, i32 0, i32 3
  %72 = load i32, ptr %15, align 4, !tbaa !17
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds [20 x i32], ptr %71, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !17
  br label %76

76:                                               ; preds = %70, %64
  %77 = phi i32 [ %69, %64 ], [ %75, %70 ]
  store i32 %77, ptr %16, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %78 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %79 = load i32, ptr %15, align 4, !tbaa !17
  %80 = zext i32 %79 to i64
  %81 = getelementptr inbounds [20 x i32], ptr %78, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !17
  %83 = getelementptr inbounds %struct.TensorDesc, ptr %11, i32 0, i32 3
  %84 = load i32, ptr %15, align 4, !tbaa !17
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds [20 x i32], ptr %83, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !17
  %88 = icmp ult i32 %82, %87
  br i1 %88, label %89, label %95

89:                                               ; preds = %76
  %90 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %91 = load i32, ptr %15, align 4, !tbaa !17
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds [20 x i32], ptr %90, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !17
  br label %101

95:                                               ; preds = %76
  %96 = getelementptr inbounds %struct.TensorDesc, ptr %11, i32 0, i32 3
  %97 = load i32, ptr %15, align 4, !tbaa !17
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds [20 x i32], ptr %96, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !17
  br label %101

101:                                              ; preds = %95, %89
  %102 = phi i32 [ %94, %89 ], [ %100, %95 ]
  store i32 %102, ptr %17, align 4, !tbaa !17
  %103 = load i32, ptr %17, align 4, !tbaa !17
  %104 = icmp eq i32 %103, 1
  br i1 %104, label %105, label %111

105:                                              ; preds = %101
  %106 = load i32, ptr %16, align 4, !tbaa !17
  %107 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %108 = load i32, ptr %15, align 4, !tbaa !17
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds [20 x i32], ptr %107, i64 0, i64 %109
  store i32 %106, ptr %110, align 4, !tbaa !17
  br label %117

111:                                              ; preds = %101
  %112 = load i32, ptr %17, align 4, !tbaa !17
  %113 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %114 = load i32, ptr %15, align 4, !tbaa !17
  %115 = zext i32 %114 to i64
  %116 = getelementptr inbounds [20 x i32], ptr %113, i64 0, i64 %115
  store i32 %112, ptr %116, align 4, !tbaa !17
  br label %117

117:                                              ; preds = %111, %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %15, align 4, !tbaa !17
  %120 = add i32 %119, 1
  store i32 %120, ptr %15, align 4, !tbaa !17
  br label %46, !llvm.loop !19

121:                                              ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  store i32 0, ptr %18, align 4, !tbaa !17
  br label %122

122:                                              ; preds = %194, %121
  %123 = load i32, ptr %18, align 4, !tbaa !17
  %124 = getelementptr inbounds %struct.TensorDesc, ptr %12, i32 0, i32 2
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = icmp ult i32 %123, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  br label %197

128:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %129 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %130 = load i32, ptr %18, align 4, !tbaa !17
  %131 = zext i32 %130 to i64
  %132 = getelementptr inbounds [20 x i32], ptr %129, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !17
  %134 = getelementptr inbounds %struct.TensorDesc, ptr %12, i32 0, i32 3
  %135 = load i32, ptr %18, align 4, !tbaa !17
  %136 = zext i32 %135 to i64
  %137 = getelementptr inbounds [20 x i32], ptr %134, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !17
  %139 = icmp ugt i32 %133, %138
  br i1 %139, label %140, label %146

140:                                              ; preds = %128
  %141 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %142 = load i32, ptr %18, align 4, !tbaa !17
  %143 = zext i32 %142 to i64
  %144 = getelementptr inbounds [20 x i32], ptr %141, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !17
  br label %152

146:                                              ; preds = %128
  %147 = getelementptr inbounds %struct.TensorDesc, ptr %12, i32 0, i32 3
  %148 = load i32, ptr %18, align 4, !tbaa !17
  %149 = zext i32 %148 to i64
  %150 = getelementptr inbounds [20 x i32], ptr %147, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !17
  br label %152

152:                                              ; preds = %146, %140
  %153 = phi i32 [ %145, %140 ], [ %151, %146 ]
  store i32 %153, ptr %19, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %154 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %155 = load i32, ptr %18, align 4, !tbaa !17
  %156 = zext i32 %155 to i64
  %157 = getelementptr inbounds [20 x i32], ptr %154, i64 0, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !17
  %159 = getelementptr inbounds %struct.TensorDesc, ptr %12, i32 0, i32 3
  %160 = load i32, ptr %18, align 4, !tbaa !17
  %161 = zext i32 %160 to i64
  %162 = getelementptr inbounds [20 x i32], ptr %159, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !17
  %164 = icmp ult i32 %158, %163
  br i1 %164, label %165, label %171

165:                                              ; preds = %152
  %166 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %167 = load i32, ptr %18, align 4, !tbaa !17
  %168 = zext i32 %167 to i64
  %169 = getelementptr inbounds [20 x i32], ptr %166, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !17
  br label %177

171:                                              ; preds = %152
  %172 = getelementptr inbounds %struct.TensorDesc, ptr %12, i32 0, i32 3
  %173 = load i32, ptr %18, align 4, !tbaa !17
  %174 = zext i32 %173 to i64
  %175 = getelementptr inbounds [20 x i32], ptr %172, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !17
  br label %177

177:                                              ; preds = %171, %165
  %178 = phi i32 [ %170, %165 ], [ %176, %171 ]
  store i32 %178, ptr %20, align 4, !tbaa !17
  %179 = load i32, ptr %20, align 4, !tbaa !17
  %180 = icmp eq i32 %179, 1
  br i1 %180, label %181, label %187

181:                                              ; preds = %177
  %182 = load i32, ptr %19, align 4, !tbaa !17
  %183 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %184 = load i32, ptr %18, align 4, !tbaa !17
  %185 = zext i32 %184 to i64
  %186 = getelementptr inbounds [20 x i32], ptr %183, i64 0, i64 %185
  store i32 %182, ptr %186, align 4, !tbaa !17
  br label %193

187:                                              ; preds = %177
  %188 = load i32, ptr %20, align 4, !tbaa !17
  %189 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %190 = load i32, ptr %18, align 4, !tbaa !17
  %191 = zext i32 %190 to i64
  %192 = getelementptr inbounds [20 x i32], ptr %189, i64 0, i64 %191
  store i32 %188, ptr %192, align 4, !tbaa !17
  br label %193

193:                                              ; preds = %187, %181
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  br label %194

194:                                              ; preds = %193
  %195 = load i32, ptr %18, align 4, !tbaa !17
  %196 = add i32 %195, 1
  store i32 %196, ptr %18, align 4, !tbaa !17
  br label %122, !llvm.loop !21

197:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  store i32 0, ptr %21, align 4, !tbaa !17
  br label %198

198:                                              ; preds = %270, %197
  %199 = load i32, ptr %21, align 4, !tbaa !17
  %200 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 2
  %201 = load i32, ptr %200, align 4, !tbaa !9
  %202 = icmp ult i32 %199, %201
  br i1 %202, label %204, label %203

203:                                              ; preds = %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  br label %273

204:                                              ; preds = %198
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %205 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %206 = load i32, ptr %21, align 4, !tbaa !17
  %207 = zext i32 %206 to i64
  %208 = getelementptr inbounds [20 x i32], ptr %205, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !17
  %210 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %211 = load i32, ptr %21, align 4, !tbaa !17
  %212 = zext i32 %211 to i64
  %213 = getelementptr inbounds [20 x i32], ptr %210, i64 0, i64 %212
  %214 = load i32, ptr %213, align 4, !tbaa !17
  %215 = icmp ugt i32 %209, %214
  br i1 %215, label %216, label %222

216:                                              ; preds = %204
  %217 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %218 = load i32, ptr %21, align 4, !tbaa !17
  %219 = zext i32 %218 to i64
  %220 = getelementptr inbounds [20 x i32], ptr %217, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !17
  br label %228

222:                                              ; preds = %204
  %223 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %224 = load i32, ptr %21, align 4, !tbaa !17
  %225 = zext i32 %224 to i64
  %226 = getelementptr inbounds [20 x i32], ptr %223, i64 0, i64 %225
  %227 = load i32, ptr %226, align 4, !tbaa !17
  br label %228

228:                                              ; preds = %222, %216
  %229 = phi i32 [ %221, %216 ], [ %227, %222 ]
  store i32 %229, ptr %22, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %230 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %231 = load i32, ptr %21, align 4, !tbaa !17
  %232 = zext i32 %231 to i64
  %233 = getelementptr inbounds [20 x i32], ptr %230, i64 0, i64 %232
  %234 = load i32, ptr %233, align 4, !tbaa !17
  %235 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %236 = load i32, ptr %21, align 4, !tbaa !17
  %237 = zext i32 %236 to i64
  %238 = getelementptr inbounds [20 x i32], ptr %235, i64 0, i64 %237
  %239 = load i32, ptr %238, align 4, !tbaa !17
  %240 = icmp ult i32 %234, %239
  br i1 %240, label %241, label %247

241:                                              ; preds = %228
  %242 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %243 = load i32, ptr %21, align 4, !tbaa !17
  %244 = zext i32 %243 to i64
  %245 = getelementptr inbounds [20 x i32], ptr %242, i64 0, i64 %244
  %246 = load i32, ptr %245, align 4, !tbaa !17
  br label %253

247:                                              ; preds = %228
  %248 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %249 = load i32, ptr %21, align 4, !tbaa !17
  %250 = zext i32 %249 to i64
  %251 = getelementptr inbounds [20 x i32], ptr %248, i64 0, i64 %250
  %252 = load i32, ptr %251, align 4, !tbaa !17
  br label %253

253:                                              ; preds = %247, %241
  %254 = phi i32 [ %246, %241 ], [ %252, %247 ]
  store i32 %254, ptr %23, align 4, !tbaa !17
  %255 = load i32, ptr %23, align 4, !tbaa !17
  %256 = icmp eq i32 %255, 1
  br i1 %256, label %257, label %263

257:                                              ; preds = %253
  %258 = load i32, ptr %22, align 4, !tbaa !17
  %259 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %260 = load i32, ptr %21, align 4, !tbaa !17
  %261 = zext i32 %260 to i64
  %262 = getelementptr inbounds [20 x i32], ptr %259, i64 0, i64 %261
  store i32 %258, ptr %262, align 4, !tbaa !17
  br label %269

263:                                              ; preds = %253
  %264 = load i32, ptr %23, align 4, !tbaa !17
  %265 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %266 = load i32, ptr %21, align 4, !tbaa !17
  %267 = zext i32 %266 to i64
  %268 = getelementptr inbounds [20 x i32], ptr %265, i64 0, i64 %267
  store i32 %264, ptr %268, align 4, !tbaa !17
  br label %269

269:                                              ; preds = %263, %257
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  br label %270

270:                                              ; preds = %269
  %271 = load i32, ptr %21, align 4, !tbaa !17
  %272 = add i32 %271, 1
  store i32 %272, ptr %21, align 4, !tbaa !17
  br label %198, !llvm.loop !22

273:                                              ; preds = %203
  %274 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %14, i64 92, i1 false), !tbaa.struct !14
  call void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32) %274, ptr noundef byval(%struct.TensorDesc) align 8 %24)
  call void @llvm.lifetime.end.p0(i64 92, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 92, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 92, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 92, ptr %11) #3
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor8get_descEv(ptr dead_on_unwind noalias writable sret(%struct.TensorDesc) align 4, ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef byval(%struct.TensorDesc) align 8) #0 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !13, i64 8}
!10 = !{!"_ZTS10TensorDesc", !11, i64 0, !12, i64 4, !13, i64 8, !7, i64 12}
!11 = !{!"_ZTS8DataType", !7, i64 0}
!12 = !{!"_ZTS10DataFormat", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{i64 0, i64 4, !15, i64 4, i64 4, !16, i64 8, i64 4, !17, i64 12, i64 80, !18}
!15 = !{!11, !11, i64 0}
!16 = !{!12, !12, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}


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

%struct.TensorDesc = type { i32, i32, i32, [20 x i32] }

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z23where_infer_output_sizeP6TensorS0_S0_S0_P8ArchInfo(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr nocapture noundef readnone %4) local_unnamed_addr #0 {
  %6 = alloca %struct.TensorDesc, align 4
  %7 = alloca %struct.TensorDesc, align 4
  %8 = alloca %struct.TensorDesc, align 4
  %9 = alloca %struct.TensorDesc, align 8
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %6) #4
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind nonnull writable sret(%struct.TensorDesc) align 4 %6, ptr noundef nonnull align 8 dereferenceable(32) %0)
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %7) #4
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind nonnull writable sret(%struct.TensorDesc) align 4 %7, ptr noundef nonnull align 8 dereferenceable(32) %1)
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %8) #4
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind nonnull writable sret(%struct.TensorDesc) align 4 %8, ptr noundef nonnull align 8 dereferenceable(32) %2)
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %9) #4
  %10 = getelementptr inbounds i8, ptr %7, i64 8
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %8, i64 8
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp ugt i32 %11, %13
  %. = select i1 %14, ptr %7, ptr %8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(92) %9, ptr noundef nonnull align 4 dereferenceable(92) %., i64 92, i1 false), !tbaa.struct !12
  %15 = getelementptr inbounds i8, ptr %6, i64 8
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %9, i64 8
  %18 = load i32, ptr %17, align 8, !tbaa !5
  %19 = icmp ugt i32 %16, %18
  %20 = select i1 %19, ptr %6, ptr %9
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(92) %9, ptr noundef nonnull align 4 dereferenceable(92) %20, i64 92, i1 false), !tbaa.struct !12
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %.preheader70, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %21 = getelementptr inbounds i8, ptr %9, i64 12
  %22 = getelementptr inbounds i8, ptr %6, i64 12
  %wide.trip.count = zext i32 %16 to i64
  %min.iters.check = icmp ult i32 %16, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %wide.trip.count, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %23 = getelementptr inbounds [20 x i32], ptr %21, i64 0, i64 %index
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %wide.load = load <4 x i32>, ptr %23, align 4, !tbaa !15
  %wide.load89 = load <4 x i32>, ptr %24, align 4, !tbaa !15
  %25 = getelementptr inbounds [20 x i32], ptr %22, i64 0, i64 %index
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  %wide.load90 = load <4 x i32>, ptr %25, align 4, !tbaa !15
  %wide.load91 = load <4 x i32>, ptr %26, align 4, !tbaa !15
  %27 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load90)
  %28 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load89, <4 x i32> %wide.load91)
  %29 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load90)
  %30 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load89, <4 x i32> %wide.load91)
  %31 = icmp eq <4 x i32> %29, <i32 1, i32 1, i32 1, i32 1>
  %32 = icmp eq <4 x i32> %30, <i32 1, i32 1, i32 1, i32 1>
  %33 = select <4 x i1> %31, <4 x i32> %27, <4 x i32> %29
  %34 = select <4 x i1> %32, <4 x i32> %28, <4 x i32> %30
  store <4 x i32> %33, ptr %23, align 4, !tbaa !15
  store <4 x i32> %34, ptr %24, align 4, !tbaa !15
  %index.next = add nuw i64 %index, 8
  %35 = icmp eq i64 %index.next, %n.vec
  br i1 %35, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader70, label %scalar.ph.preheader

.preheader70:                                     ; preds = %scalar.ph, %middle.block, %5
  %.not76 = icmp eq i32 %11, 0
  br i1 %.not76, label %.preheader, label %.lr.ph73

.lr.ph73:                                         ; preds = %.preheader70
  %36 = getelementptr inbounds i8, ptr %9, i64 12
  %37 = getelementptr inbounds i8, ptr %7, i64 12
  %wide.trip.count82 = zext i32 %11 to i64
  %min.iters.check94 = icmp ult i32 %11, 8
  br i1 %min.iters.check94, label %scalar.ph93.preheader, label %vector.ph95

scalar.ph93.preheader:                            ; preds = %middle.block92, %.lr.ph73
  %indvars.iv79.ph = phi i64 [ 0, %.lr.ph73 ], [ %n.vec97, %middle.block92 ]
  br label %scalar.ph93

vector.ph95:                                      ; preds = %.lr.ph73
  %n.vec97 = and i64 %wide.trip.count82, 4294967288
  br label %vector.body99

vector.body99:                                    ; preds = %vector.body99, %vector.ph95
  %index100 = phi i64 [ 0, %vector.ph95 ], [ %index.next105, %vector.body99 ]
  %38 = getelementptr inbounds [20 x i32], ptr %36, i64 0, i64 %index100
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %wide.load101 = load <4 x i32>, ptr %38, align 4, !tbaa !15
  %wide.load102 = load <4 x i32>, ptr %39, align 4, !tbaa !15
  %40 = getelementptr inbounds [20 x i32], ptr %37, i64 0, i64 %index100
  %41 = getelementptr inbounds i8, ptr %40, i64 16
  %wide.load103 = load <4 x i32>, ptr %40, align 4, !tbaa !15
  %wide.load104 = load <4 x i32>, ptr %41, align 4, !tbaa !15
  %42 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load101, <4 x i32> %wide.load103)
  %43 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load102, <4 x i32> %wide.load104)
  %44 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load101, <4 x i32> %wide.load103)
  %45 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load102, <4 x i32> %wide.load104)
  %46 = icmp eq <4 x i32> %44, <i32 1, i32 1, i32 1, i32 1>
  %47 = icmp eq <4 x i32> %45, <i32 1, i32 1, i32 1, i32 1>
  %48 = select <4 x i1> %46, <4 x i32> %42, <4 x i32> %44
  %49 = select <4 x i1> %47, <4 x i32> %43, <4 x i32> %45
  store <4 x i32> %48, ptr %38, align 4, !tbaa !15
  store <4 x i32> %49, ptr %39, align 4, !tbaa !15
  %index.next105 = add nuw i64 %index100, 8
  %50 = icmp eq i64 %index.next105, %n.vec97
  br i1 %50, label %middle.block92, label %vector.body99, !llvm.loop !21

middle.block92:                                   ; preds = %vector.body99
  %cmp.n106 = icmp eq i64 %n.vec97, %wide.trip.count82
  br i1 %cmp.n106, label %.preheader, label %scalar.ph93.preheader

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %51 = getelementptr inbounds [20 x i32], ptr %21, i64 0, i64 %indvars.iv
  %52 = load i32, ptr %51, align 4, !tbaa !15
  %53 = getelementptr inbounds [20 x i32], ptr %22, i64 0, i64 %indvars.iv
  %54 = load i32, ptr %53, align 4, !tbaa !15
  %.67 = call i32 @llvm.umax.i32(i32 %52, i32 %54)
  %55 = call i32 @llvm.umin.i32(i32 %52, i32 %54)
  %56 = icmp eq i32 %55, 1
  %storemerge66 = select i1 %56, i32 %.67, i32 %55
  store i32 %storemerge66, ptr %51, align 4, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader70, label %scalar.ph, !llvm.loop !22

.preheader:                                       ; preds = %scalar.ph93, %middle.block92, %.preheader70
  %.not77 = icmp eq i32 %13, 0
  br i1 %.not77, label %._crit_edge, label %.lr.ph75

.lr.ph75:                                         ; preds = %.preheader
  %57 = getelementptr inbounds i8, ptr %9, i64 12
  %58 = getelementptr inbounds i8, ptr %8, i64 12
  %wide.trip.count87 = zext i32 %13 to i64
  %min.iters.check109 = icmp ult i32 %13, 8
  br i1 %min.iters.check109, label %scalar.ph108.preheader, label %vector.ph110

scalar.ph108.preheader:                           ; preds = %middle.block107, %.lr.ph75
  %indvars.iv84.ph = phi i64 [ 0, %.lr.ph75 ], [ %n.vec112, %middle.block107 ]
  br label %scalar.ph108

vector.ph110:                                     ; preds = %.lr.ph75
  %n.vec112 = and i64 %wide.trip.count87, 4294967288
  br label %vector.body114

vector.body114:                                   ; preds = %vector.body114, %vector.ph110
  %index115 = phi i64 [ 0, %vector.ph110 ], [ %index.next120, %vector.body114 ]
  %59 = getelementptr inbounds [20 x i32], ptr %57, i64 0, i64 %index115
  %60 = getelementptr inbounds i8, ptr %59, i64 16
  %wide.load116 = load <4 x i32>, ptr %59, align 4, !tbaa !15
  %wide.load117 = load <4 x i32>, ptr %60, align 4, !tbaa !15
  %61 = getelementptr inbounds [20 x i32], ptr %58, i64 0, i64 %index115
  %62 = getelementptr inbounds i8, ptr %61, i64 16
  %wide.load118 = load <4 x i32>, ptr %61, align 4, !tbaa !15
  %wide.load119 = load <4 x i32>, ptr %62, align 4, !tbaa !15
  %63 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load116, <4 x i32> %wide.load118)
  %64 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load117, <4 x i32> %wide.load119)
  %65 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load116, <4 x i32> %wide.load118)
  %66 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load117, <4 x i32> %wide.load119)
  %67 = icmp eq <4 x i32> %65, <i32 1, i32 1, i32 1, i32 1>
  %68 = icmp eq <4 x i32> %66, <i32 1, i32 1, i32 1, i32 1>
  %69 = select <4 x i1> %67, <4 x i32> %63, <4 x i32> %65
  %70 = select <4 x i1> %68, <4 x i32> %64, <4 x i32> %66
  store <4 x i32> %69, ptr %59, align 4, !tbaa !15
  store <4 x i32> %70, ptr %60, align 4, !tbaa !15
  %index.next120 = add nuw i64 %index115, 8
  %71 = icmp eq i64 %index.next120, %n.vec112
  br i1 %71, label %middle.block107, label %vector.body114, !llvm.loop !23

middle.block107:                                  ; preds = %vector.body114
  %cmp.n121 = icmp eq i64 %n.vec112, %wide.trip.count87
  br i1 %cmp.n121, label %._crit_edge, label %scalar.ph108.preheader

scalar.ph93:                                      ; preds = %scalar.ph93.preheader, %scalar.ph93
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %scalar.ph93 ], [ %indvars.iv79.ph, %scalar.ph93.preheader ]
  %72 = getelementptr inbounds [20 x i32], ptr %36, i64 0, i64 %indvars.iv79
  %73 = load i32, ptr %72, align 4, !tbaa !15
  %74 = getelementptr inbounds [20 x i32], ptr %37, i64 0, i64 %indvars.iv79
  %75 = load i32, ptr %74, align 4, !tbaa !15
  %.68 = call i32 @llvm.umax.i32(i32 %73, i32 %75)
  %76 = call i32 @llvm.umin.i32(i32 %73, i32 %75)
  %77 = icmp eq i32 %76, 1
  %storemerge65 = select i1 %77, i32 %.68, i32 %76
  store i32 %storemerge65, ptr %72, align 4, !tbaa !15
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %exitcond83.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count82
  br i1 %exitcond83.not, label %.preheader, label %scalar.ph93, !llvm.loop !24

._crit_edge:                                      ; preds = %scalar.ph108, %middle.block107, %.preheader
  call void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %9)
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %6) #4
  ret i32 0

scalar.ph108:                                     ; preds = %scalar.ph108.preheader, %scalar.ph108
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %scalar.ph108 ], [ %indvars.iv84.ph, %scalar.ph108.preheader ]
  %78 = getelementptr inbounds [20 x i32], ptr %57, i64 0, i64 %indvars.iv84
  %79 = load i32, ptr %78, align 4, !tbaa !15
  %80 = getelementptr inbounds [20 x i32], ptr %58, i64 0, i64 %indvars.iv84
  %81 = load i32, ptr %80, align 4, !tbaa !15
  %.69 = call i32 @llvm.umax.i32(i32 %79, i32 %81)
  %82 = call i32 @llvm.umin.i32(i32 %79, i32 %81)
  %83 = icmp eq i32 %82, 1
  %storemerge = select i1 %83, i32 %.69, i32 %82
  store i32 %storemerge, ptr %78, align 4, !tbaa !15
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
  br i1 %exitcond88.not, label %._crit_edge, label %scalar.ph108, !llvm.loop !25
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor8get_descEv(ptr dead_on_unwind noalias writable sret(%struct.TensorDesc) align 4, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef byval(%struct.TensorDesc) align 8) local_unnamed_addr #0 align 2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.umax.v4i32(<4 x i32>, <4 x i32>) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.umin.v4i32(<4 x i32>, <4 x 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !11, i64 8}
!6 = !{!"_ZTS10TensorDesc", !7, i64 0, !10, i64 4, !11, i64 8, !8, i64 12}
!7 = !{!"_ZTS8DataType", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS10DataFormat", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{i64 0, i64 4, !13, i64 4, i64 4, !14, i64 8, i64 4, !15, i64 12, i64 80, !16}
!13 = !{!7, !7, i64 0}
!14 = !{!10, !10, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !18, !19, !20}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !18, !19, !20}
!22 = distinct !{!22, !18, !20, !19}
!23 = distinct !{!23, !18, !19, !20}
!24 = distinct !{!24, !18, !20, !19}
!25 = distinct !{!25, !18, !20, !19}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass