; LLVM IR from jingweizhanghuai/Morn :: src/deep_learning (morn_tensor_pool)

; 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.MLayer = type { [32 x i8], i32, ptr, ptr, ptr, i32 }
%struct.TensorPoolPara = type { ptr, i32, i32, i32, i32, i32, i32, i32 }
%struct.MTensor = type { i32, i32, i32, i32, ptr, i32 }
%struct.MHandle = type { i32, i32, ptr, ptr }
%struct.HandleTensorMaxPool = type { ptr }
%struct.MMemoryBlock = type { i32, i32, ptr, ptr, ptr, i32 }

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.mTensorMaxPoolBackward = external hidden unnamed_addr constant [23 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [19 x i8], align 1

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

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @endTensorMaxPool(ptr noundef) #2

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @mTensorMaxPoolBackward(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %34, label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = ptrtoint ptr %31 to i64
  %33 = icmp eq i64 %32, -1
  br label %34

34:                                               ; preds = %30, %27
  %35 = phi i1 [ true, %27 ], [ %33, %30 ]
  %36 = zext i1 %35 to i32
  store i32 %36, ptr %3, align 4, !tbaa !9
  %37 = load i32, ptr %3, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %41

39:                                               ; preds = %34
  %40 = load i32, ptr %3, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %40, i32 noundef -1, ptr noundef @.str.1, i32 noundef 217, ptr noundef @__FUNCTION__.mTensorMaxPoolBackward, ptr noundef @.str.12)
  br label %41

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

42:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.MLayer, ptr %43, i32 0, i32 4
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  store ptr %45, ptr %4, align 8, !tbaa !5
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.TensorPoolPara, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !13
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %42
  store i32 1, ptr %5, align 4
  br label %258

51:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.TensorPoolPara, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !15
  %55 = getelementptr inbounds %struct.MLayer, ptr %54, i32 0, i32 3
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  store ptr %56, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.MLayer, ptr %57, i32 0, i32 3
  %59 = load ptr, ptr %58, align 8, !tbaa !16
  store ptr %59, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.MTensor, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 8, !tbaa !17
  store i32 %62, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.MTensor, ptr %63, i32 0, i32 3
  %65 = load i32, ptr %64, align 4, !tbaa !19
  store i32 %65, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %66 = load i32, ptr %8, align 4, !tbaa !9
  %67 = load i32, ptr %9, align 4, !tbaa !9
  %68 = mul nsw i32 %66, %67
  store i32 %68, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.MTensor, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 8, !tbaa !17
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.MTensor, ptr %72, i32 0, i32 3
  %74 = load i32, ptr %73, align 4, !tbaa !19
  %75 = mul nsw i32 %71, %74
  store i32 %75, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.MTensor, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !20
  store i32 %78, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.MLayer, ptr %79, i32 0, i32 2
  %81 = load ptr, ptr %80, align 8, !tbaa !21
  %82 = call ptr @GetHandle(ptr noundef %81, i32 noundef 8, i32 noundef -1726488948, ptr noundef @endTensorMaxPool)
  store ptr %82, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.MHandle, ptr %83, i32 0, i32 3
  %85 = load ptr, ptr %84, align 8, !tbaa !22
  store ptr %85, ptr %14, align 8, !tbaa !5
  br label %86

86:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %87 = load ptr, ptr %13, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.MHandle, ptr %87, i32 0, i32 1
  %89 = load volatile i32, ptr %88, align 4, !tbaa !24
  %90 = icmp eq i32 %89, 0
  %91 = zext i1 %90 to i32
  store i32 %91, ptr %15, align 4, !tbaa !9
  %92 = load i32, ptr %15, align 4, !tbaa !9
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %96

94:                                               ; preds = %86
  %95 = load i32, ptr %15, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %95, i32 noundef -1, ptr noundef @.str.1, i32 noundef 231, ptr noundef @__FUNCTION__.mTensorMaxPoolBackward, ptr noundef @.str.13)
  br label %96

96:                                               ; preds = %94, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %99 = load ptr, ptr %14, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.HandleTensorMaxPool, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !25
  store ptr %101, ptr %16, align 8, !tbaa !5
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.TensorPoolPara, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !15
  %105 = getelementptr inbounds %struct.MLayer, ptr %104, i32 0, i32 5
  %106 = load i32, ptr %105, align 8, !tbaa !27
  %107 = icmp eq i32 %106, 0
  br i1 %107, label %108, label %150

108:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %109

109:                                              ; preds = %142, %108
  %110 = load i32, ptr %17, align 4, !tbaa !9
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.MTensor, ptr %111, i32 0, i32 0
  %113 = load i32, ptr %112, align 8, !tbaa !28
  %114 = icmp slt i32 %110, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %109
  store i32 6, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %145

116:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = load i32, ptr %17, align 4, !tbaa !9
  %119 = call ptr @mTensorMemory(ptr noundef %117, i32 noundef %118)
  store ptr %119, ptr %18, align 8, !tbaa !5
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.MTensor, ptr %120, i32 0, i32 4
  %122 = load ptr, ptr %121, align 8, !tbaa !29
  %123 = load i32, ptr %17, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds ptr, ptr %122, i64 %124
  %126 = load ptr, ptr %125, align 8, !tbaa !5
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.MTensor, ptr %127, i32 0, i32 2
  %129 = load i32, ptr %128, align 8, !tbaa !17
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.MTensor, ptr %130, i32 0, i32 3
  %132 = load i32, ptr %131, align 4, !tbaa !19
  %133 = mul nsw i32 %129, %132
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.MTensor, ptr %134, i32 0, i32 1
  %136 = load i32, ptr %135, align 4, !tbaa !20
  %137 = mul nsw i32 %133, %136
  %138 = sext i32 %137 to i64
  %139 = mul i64 %138, 4
  call void @llvm.memset.p0.i64(ptr align 4 %126, i8 0, i64 %139, i1 false)
  %140 = load ptr, ptr %18, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.MMemoryBlock, ptr %140, i32 0, i32 5
  store i32 0, ptr %141, align 8, !tbaa !30
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  br label %142

142:                                              ; preds = %116
  %143 = load i32, ptr %17, align 4, !tbaa !9
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %17, align 4, !tbaa !9
  br label %109, !llvm.loop !32

145:                                              ; preds = %115
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.TensorPoolPara, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !15
  %149 = getelementptr inbounds %struct.MLayer, ptr %148, i32 0, i32 5
  store i32 1, ptr %149, align 8, !tbaa !27
  br label %150

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

151:                                              ; preds = %254, %150
  %152 = load i32, ptr %19, align 4, !tbaa !9
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.MTensor, ptr %153, i32 0, i32 0
  %155 = load i32, ptr %154, align 8, !tbaa !28
  %156 = icmp slt i32 %152, %155
  br i1 %156, label %158, label %157

157:                                              ; preds = %151
  store i32 9, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %257

158:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %159

159:                                              ; preds = %250, %158
  %160 = load i32, ptr %20, align 4, !tbaa !9
  %161 = load i32, ptr %12, align 4, !tbaa !9
  %162 = icmp slt i32 %160, %161
  br i1 %162, label %164, label %163

163:                                              ; preds = %159
  store i32 12, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %253

164:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %165 = load ptr, ptr %16, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.MTensor, ptr %165, i32 0, i32 4
  %167 = load ptr, ptr %166, align 8, !tbaa !29
  %168 = load i32, ptr %19, align 4, !tbaa !9
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds ptr, ptr %167, i64 %169
  %171 = load ptr, ptr %170, align 8, !tbaa !5
  %172 = load i32, ptr %20, align 4, !tbaa !9
  %173 = load i32, ptr %11, align 4, !tbaa !9
  %174 = mul nsw i32 %172, %173
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds i32, ptr %171, i64 %175
  store ptr %176, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.MTensor, ptr %177, i32 0, i32 4
  %179 = load ptr, ptr %178, align 8, !tbaa !29
  %180 = load i32, ptr %19, align 4, !tbaa !9
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds ptr, ptr %179, i64 %181
  %183 = load ptr, ptr %182, align 8, !tbaa !5
  %184 = load i32, ptr %20, align 4, !tbaa !9
  %185 = load i32, ptr %11, align 4, !tbaa !9
  %186 = mul nsw i32 %184, %185
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds float, ptr %183, i64 %187
  store ptr %188, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  %189 = load ptr, ptr %6, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.MTensor, ptr %189, i32 0, i32 4
  %191 = load ptr, ptr %190, align 8, !tbaa !29
  %192 = load i32, ptr %19, align 4, !tbaa !9
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds ptr, ptr %191, i64 %193
  %195 = load ptr, ptr %194, align 8, !tbaa !5
  %196 = load i32, ptr %20, align 4, !tbaa !9
  %197 = load i32, ptr %10, align 4, !tbaa !9
  %198 = mul nsw i32 %196, %197
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds float, ptr %195, i64 %199
  store ptr %200, ptr %23, align 8, !tbaa !5
  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
  %201 = load ptr, ptr %4, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.TensorPoolPara, ptr %201, i32 0, i32 7
  %203 = load i32, ptr %202, align 8, !tbaa !34
  store i32 %203, ptr %25, align 4, !tbaa !9
  br label %204

204:                                              ; preds = %243, %164
  %205 = load i32, ptr %25, align 4, !tbaa !9
  %206 = load i32, ptr %8, align 4, !tbaa !9
  %207 = icmp slt i32 %205, %206
  br i1 %207, label %209, label %208

208:                                              ; preds = %204
  store i32 15, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #4
  br label %249

209:                                              ; preds = %204
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #4
  %210 = load ptr, ptr %4, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.TensorPoolPara, ptr %210, i32 0, i32 6
  %212 = load i32, ptr %211, align 4, !tbaa !35
  store i32 %212, ptr %26, align 4, !tbaa !9
  br label %213

213:                                              ; preds = %236, %209
  %214 = load i32, ptr %26, align 4, !tbaa !9
  %215 = load i32, ptr %9, align 4, !tbaa !9
  %216 = icmp slt i32 %214, %215
  br i1 %216, label %218, label %217

217:                                              ; preds = %213
  store i32 18, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #4
  br label %242

218:                                              ; preds = %213
  %219 = load ptr, ptr %22, align 8, !tbaa !5
  %220 = load i32, ptr %24, align 4, !tbaa !9
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds float, ptr %219, i64 %221
  %223 = load float, ptr %222, align 4, !tbaa !36
  %224 = load ptr, ptr %23, align 8, !tbaa !5
  %225 = load ptr, ptr %21, align 8, !tbaa !5
  %226 = load i32, ptr %24, align 4, !tbaa !9
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds i32, ptr %225, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !9
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds float, ptr %224, i64 %230
  %232 = load float, ptr %231, align 4, !tbaa !36
  %233 = fadd float %232, %223
  store float %233, ptr %231, align 4, !tbaa !36
  %234 = load i32, ptr %24, align 4, !tbaa !9
  %235 = add nsw i32 %234, 1
  store i32 %235, ptr %24, align 4, !tbaa !9
  br label %236

236:                                              ; preds = %218
  %237 = load ptr, ptr %4, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.TensorPoolPara, ptr %237, i32 0, i32 4
  %239 = load i32, ptr %238, align 4, !tbaa !38
  %240 = load i32, ptr %26, align 4, !tbaa !9
  %241 = add nsw i32 %240, %239
  store i32 %241, ptr %26, align 4, !tbaa !9
  br label %213, !llvm.loop !39

242:                                              ; preds = %217
  br label %243

243:                                              ; preds = %242
  %244 = load ptr, ptr %4, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.TensorPoolPara, ptr %244, i32 0, i32 5
  %246 = load i32, ptr %245, align 8, !tbaa !40
  %247 = load i32, ptr %25, align 4, !tbaa !9
  %248 = add nsw i32 %247, %246
  store i32 %248, ptr %25, align 4, !tbaa !9
  br label %204, !llvm.loop !41

249:                                              ; preds = %208
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  br label %250

250:                                              ; preds = %249
  %251 = load i32, ptr %20, align 4, !tbaa !9
  %252 = add nsw i32 %251, 1
  store i32 %252, ptr %20, align 4, !tbaa !9
  br label %159, !llvm.loop !42

253:                                              ; preds = %163
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %19, align 4, !tbaa !9
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %19, align 4, !tbaa !9
  br label %151, !llvm.loop !43

257:                                              ; preds = %157
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  store i32 0, ptr %5, align 4
  br label %258

258:                                              ; preds = %257, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %259 = load i32, ptr %5, align 4
  switch i32 %259, label %261 [
    i32 0, label %260
    i32 1, label %260
  ]

260:                                              ; preds = %258, %258
  ret void

261:                                              ; preds = %258
  unreachable
}

declare ptr @mTensorMemory(ptr noundef, i32 noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 56}
!12 = !{!"MLayer", !7, i64 0, !10, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64}
!13 = !{!14, !10, i64 8}
!14 = !{!"TensorPoolPara", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!15 = !{!14, !6, i64 0}
!16 = !{!12, !6, i64 48}
!17 = !{!18, !10, i64 8}
!18 = !{!"MTensor", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24}
!19 = !{!18, !10, i64 12}
!20 = !{!18, !10, i64 4}
!21 = !{!12, !6, i64 40}
!22 = !{!23, !6, i64 16}
!23 = !{!"MHandle", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!24 = !{!23, !10, i64 4}
!25 = !{!26, !6, i64 0}
!26 = !{!"HandleTensorMaxPool", !6, i64 0}
!27 = !{!12, !10, i64 64}
!28 = !{!18, !10, i64 0}
!29 = !{!18, !6, i64 16}
!30 = !{!31, !10, i64 32}
!31 = !{!"MMemoryBlock", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = !{!14, !10, i64 32}
!35 = !{!14, !10, i64 28}
!36 = !{!37, !37, i64 0}
!37 = !{!"float", !7, i64 0}
!38 = !{!14, !10, i64 20}
!39 = distinct !{!39, !33}
!40 = !{!14, !10, i64 24}
!41 = distinct !{!41, !33}
!42 = distinct !{!42, !33}
!43 = distinct !{!43, !33}


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

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [14 x i8], align 1
@__FUNCTION__.mTensorMaxPoolBackward = external hidden unnamed_addr constant [23 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [19 x i8], align 1

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @endTensorMaxPool(ptr noundef) #1

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @mTensorMaxPoolBackward(ptr noundef %0) local_unnamed_addr #1 {
  %magicptr = ptrtoint ptr %0 to i64
  switch i64 %magicptr, label %7 [
    i64 -1, label %2
    i64 0, label %2
  ]

2:                                                ; preds = %1, %1
  %3 = icmp eq ptr %0, null
  %4 = icmp eq ptr %0, inttoptr (i64 -1 to ptr)
  %5 = or i1 %3, %4
  %6 = zext i1 %5 to i32
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %6, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 217, ptr noundef nonnull @__FUNCTION__.mTensorMaxPoolBackward, ptr noundef nonnull @.str.12) #3
  br label %7

7:                                                ; preds = %1, %2
  %8 = getelementptr inbounds i8, ptr %0, i64 56
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !11
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %.loopexit, label %13

13:                                               ; preds = %7
  %14 = load ptr, ptr %9, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %14, i64 48
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = load ptr, ptr %17, align 8, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %16, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %16, i64 12
  %22 = load i32, ptr %21, align 4, !tbaa !17
  %23 = mul nsw i32 %22, %20
  %24 = getelementptr inbounds i8, ptr %18, i64 8
  %25 = load i32, ptr %24, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %18, i64 12
  %27 = load i32, ptr %26, align 4, !tbaa !17
  %28 = mul nsw i32 %27, %25
  %29 = getelementptr inbounds i8, ptr %16, i64 4
  %30 = load i32, ptr %29, align 4, !tbaa !18
  %31 = getelementptr inbounds i8, ptr %0, i64 40
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  %33 = tail call ptr @GetHandle(ptr noundef %32, i32 noundef 8, i32 noundef -1726488948, ptr noundef nonnull @endTensorMaxPool) #3
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = getelementptr inbounds i8, ptr %33, i64 4
  %37 = load volatile i32, ptr %36, align 4, !tbaa !22
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %13
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 231, ptr noundef nonnull @__FUNCTION__.mTensorMaxPoolBackward, ptr noundef nonnull @.str.13) #3
  br label %40

40:                                               ; preds = %39, %13
  %41 = load ptr, ptr %35, align 8, !tbaa !23
  %42 = load ptr, ptr %9, align 8, !tbaa !13
  %43 = getelementptr inbounds i8, ptr %42, i64 64
  %44 = load i32, ptr %43, align 8, !tbaa !25
  %45 = icmp eq i32 %44, 0
  %.pre113 = load i32, ptr %16, align 8, !tbaa !26
  br i1 %45, label %.preheader72, label %68

.preheader72:                                     ; preds = %40
  %46 = icmp sgt i32 %.pre113, 0
  br i1 %46, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader72
  %47 = getelementptr inbounds i8, ptr %16, i64 16
  br label %51

._crit_edge.loopexit:                             ; preds = %51
  %.pre = load ptr, ptr %9, align 8, !tbaa !13
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader72
  %48 = phi i32 [ %65, %._crit_edge.loopexit ], [ %.pre113, %.preheader72 ]
  %49 = phi ptr [ %.pre, %._crit_edge.loopexit ], [ %42, %.preheader72 ]
  %50 = getelementptr inbounds i8, ptr %49, i64 64
  store i32 1, ptr %50, align 8, !tbaa !25
  br label %68

51:                                               ; preds = %.lr.ph, %51
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %51 ]
  %52 = trunc nuw nsw i64 %indvars.iv to i32
  %53 = tail call ptr @mTensorMemory(ptr noundef nonnull %16, i32 noundef %52) #3
  %54 = load ptr, ptr %47, align 8, !tbaa !27
  %55 = getelementptr inbounds ptr, ptr %54, i64 %indvars.iv
  %56 = load ptr, ptr %55, align 8, !tbaa !28
  %57 = load i32, ptr %19, align 8, !tbaa !15
  %58 = load i32, ptr %21, align 4, !tbaa !17
  %59 = mul nsw i32 %58, %57
  %60 = load i32, ptr %29, align 4, !tbaa !18
  %61 = mul nsw i32 %59, %60
  %62 = sext i32 %61 to i64
  %63 = shl nsw i64 %62, 2
  tail call void @llvm.memset.p0.i64(ptr align 4 %56, i8 0, i64 %63, i1 false)
  %64 = getelementptr inbounds i8, ptr %53, i64 32
  store i32 0, ptr %64, align 8, !tbaa !29
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %65 = load i32, ptr %16, align 8, !tbaa !26
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next, %66
  br i1 %67, label %51, label %._crit_edge.loopexit, !llvm.loop !31

68:                                               ; preds = %._crit_edge, %40
  %69 = phi i32 [ %48, %._crit_edge ], [ %.pre113, %40 ]
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.preheader.lr.ph, label %.loopexit

.preheader.lr.ph:                                 ; preds = %68
  %71 = icmp sgt i32 %30, 0
  %72 = getelementptr inbounds i8, ptr %9, i64 28
  %73 = getelementptr inbounds i8, ptr %9, i64 20
  %74 = getelementptr inbounds i8, ptr %9, i64 24
  br i1 %71, label %.preheader.lr.ph.split.us, label %.loopexit

.preheader.lr.ph.split.us:                        ; preds = %.preheader.lr.ph
  %75 = getelementptr inbounds i8, ptr %9, i64 32
  %76 = getelementptr inbounds i8, ptr %16, i64 16
  %77 = getelementptr inbounds i8, ptr %18, i64 16
  %78 = getelementptr inbounds i8, ptr %41, i64 16
  %79 = load ptr, ptr %78, align 8, !tbaa !27
  %80 = load ptr, ptr %77, align 8, !tbaa !27
  %81 = load ptr, ptr %76, align 8, !tbaa !27
  %82 = load i32, ptr %75, align 8, !tbaa !33
  %83 = icmp slt i32 %82, %20
  br i1 %83, label %.preheader.lr.ph.split.us.split.us, label %.loopexit

.preheader.lr.ph.split.us.split.us:               ; preds = %.preheader.lr.ph.split.us
  %84 = load i32, ptr %72, align 4, !tbaa !34
  %85 = icmp slt i32 %84, %22
  %86 = load i32, ptr %74, align 8, !tbaa !35
  br i1 %85, label %.preheader.lr.ph.split.us.split.us.split.us, label %.loopexit

.preheader.lr.ph.split.us.split.us.split.us:      ; preds = %.preheader.lr.ph.split.us.split.us
  %87 = load i32, ptr %73, align 4, !tbaa !36
  %88 = sext i32 %28 to i64
  %89 = sext i32 %23 to i64
  %wide.trip.count111 = zext nneg i32 %69 to i64
  %wide.trip.count = zext nneg i32 %30 to i64
  br label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %._crit_edge86.split.us.split.us.us.us.us, %.preheader.lr.ph.split.us.split.us.split.us
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %._crit_edge86.split.us.split.us.us.us.us ], [ 0, %.preheader.lr.ph.split.us.split.us.split.us ]
  %90 = getelementptr inbounds ptr, ptr %79, i64 %indvars.iv108
  %91 = load ptr, ptr %90, align 8, !tbaa !28
  %92 = getelementptr inbounds ptr, ptr %80, i64 %indvars.iv108
  %93 = load ptr, ptr %92, align 8, !tbaa !28
  %94 = getelementptr inbounds ptr, ptr %81, i64 %indvars.iv108
  %95 = load ptr, ptr %94, align 8, !tbaa !28
  br label %.lr.ph82.us.us.us.us.us

.lr.ph82.us.us.us.us.us:                          ; preds = %._crit_edge83.split.us.us.us.us.us.us, %.preheader.us.us.us
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %._crit_edge83.split.us.us.us.us.us.us ], [ 0, %.preheader.us.us.us ]
  %96 = mul nsw i64 %indvars.iv105, %88
  %97 = getelementptr inbounds i32, ptr %91, i64 %96
  %98 = getelementptr inbounds float, ptr %93, i64 %96
  %99 = mul nsw i64 %indvars.iv105, %89
  %100 = getelementptr inbounds float, ptr %95, i64 %99
  br label %.lr.ph77.us.us.us.us.us.us

.lr.ph77.us.us.us.us.us.us:                       ; preds = %._crit_edge78.us.us.us.us.us.us, %.lr.ph82.us.us.us.us.us
  %.06780.us.us.us.us.us.us = phi i32 [ %82, %.lr.ph82.us.us.us.us.us ], [ %113, %._crit_edge78.us.us.us.us.us.us ]
  %.06879.us.us.us.us.us.us = phi i64 [ 0, %.lr.ph82.us.us.us.us.us ], [ %indvars.iv.next103, %._crit_edge78.us.us.us.us.us.us ]
  %sext = shl i64 %.06879.us.us.us.us.us.us, 32
  %101 = ashr exact i64 %sext, 32
  br label %102

102:                                              ; preds = %102, %.lr.ph77.us.us.us.us.us.us
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %102 ], [ %101, %.lr.ph77.us.us.us.us.us.us ]
  %.075.us.us.us.us.us.us = phi i32 [ %111, %102 ], [ %84, %.lr.ph77.us.us.us.us.us.us ]
  %103 = getelementptr inbounds float, ptr %98, i64 %indvars.iv102
  %104 = load float, ptr %103, align 4, !tbaa !37
  %105 = getelementptr inbounds i32, ptr %97, i64 %indvars.iv102
  %106 = load i32, ptr %105, align 4, !tbaa !39
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds float, ptr %100, i64 %107
  %109 = load float, ptr %108, align 4, !tbaa !37
  %110 = fadd float %104, %109
  store float %110, ptr %108, align 4, !tbaa !37
  %indvars.iv.next103 = add nsw i64 %indvars.iv102, 1
  %111 = add nsw i32 %87, %.075.us.us.us.us.us.us
  %112 = icmp slt i32 %111, %22
  br i1 %112, label %102, label %._crit_edge78.us.us.us.us.us.us, !llvm.loop !40

._crit_edge78.us.us.us.us.us.us:                  ; preds = %102
  %113 = add nsw i32 %86, %.06780.us.us.us.us.us.us
  %114 = icmp slt i32 %113, %20
  br i1 %114, label %.lr.ph77.us.us.us.us.us.us, label %._crit_edge83.split.us.us.us.us.us.us, !llvm.loop !41

._crit_edge83.split.us.us.us.us.us.us:            ; preds = %._crit_edge78.us.us.us.us.us.us
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next106, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge86.split.us.split.us.us.us.us, label %.lr.ph82.us.us.us.us.us, !llvm.loop !42

._crit_edge86.split.us.split.us.us.us.us:         ; preds = %._crit_edge83.split.us.us.us.us.us.us
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count111
  br i1 %exitcond112.not, label %.loopexit, label %.preheader.us.us.us, !llvm.loop !43

.loopexit:                                        ; preds = %._crit_edge86.split.us.split.us.us.us.us, %.preheader.lr.ph.split.us.split.us, %.preheader.lr.ph.split.us, %.preheader.lr.ph, %68, %7
  ret void
}

declare ptr @mTensorMemory(ptr noundef, i32 noundef) local_unnamed_addr #0

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

attributes #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 56}
!6 = !{!"MLayer", !7, i64 0, !9, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !9, i64 64}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !9, i64 8}
!12 = !{!"TensorPoolPara", !10, i64 0, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !9, i64 24, !9, i64 28, !9, i64 32}
!13 = !{!12, !10, i64 0}
!14 = !{!6, !10, i64 48}
!15 = !{!16, !9, i64 8}
!16 = !{!"MTensor", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !10, i64 16, !9, i64 24}
!17 = !{!16, !9, i64 12}
!18 = !{!16, !9, i64 4}
!19 = !{!6, !10, i64 40}
!20 = !{!21, !10, i64 16}
!21 = !{!"MHandle", !9, i64 0, !9, i64 4, !10, i64 8, !10, i64 16}
!22 = !{!21, !9, i64 4}
!23 = !{!24, !10, i64 0}
!24 = !{!"HandleTensorMaxPool", !10, i64 0}
!25 = !{!6, !9, i64 64}
!26 = !{!16, !9, i64 0}
!27 = !{!16, !10, i64 16}
!28 = !{!10, !10, i64 0}
!29 = !{!30, !9, i64 32}
!30 = !{!"MMemoryBlock", !9, i64 0, !9, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !9, i64 32}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!12, !9, i64 32}
!34 = !{!12, !9, i64 28}
!35 = !{!12, !9, i64 24}
!36 = !{!12, !9, i64 20}
!37 = !{!38, !38, i64 0}
!38 = !{!"float", !7, i64 0}
!39 = !{!9, !9, i64 0}
!40 = distinct !{!40, !32}
!41 = distinct !{!41, !32}
!42 = distinct !{!42, !32}
!43 = distinct !{!43, !32}


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