; 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.TensorRegister = type { [32 x i8], ptr, ptr, ptr }
%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 }

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@morn_tensor_register = external global [256 x %struct.TensorRegister], align 16
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@__FUNCTION__.TensorMaxPoolSet = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@morn_network_flag = external global i32, align 4

; 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 willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

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

declare void @mTensorRelease(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @TensorMaxPoolSet(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.MLayer, ptr %17, i32 0, i32 5
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = icmp ne i32 %19, -1
  br i1 %20, label %21, label %22

21:                                               ; preds = %1
  br label %297

22:                                               ; preds = %1
  br label %23

23:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.MLayer, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !12
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [256 x %struct.TensorRegister], ptr @morn_tensor_register, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.TensorRegister, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds [32 x i8], ptr %29, i64 0, i64 0
  %31 = call i32 @strcmp(ptr noundef @.str.8, ptr noundef %30) #5
  store i32 %31, ptr %3, align 4, !tbaa !13
  %32 = load i32, ptr %3, align 4, !tbaa !13
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %36

34:                                               ; preds = %23
  %35 = load i32, ptr %3, align 4, !tbaa !13
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %35, i32 noundef -1, ptr noundef @.str.1, i32 noundef 54, ptr noundef @__FUNCTION__.TensorMaxPoolSet, ptr noundef @.str.9)
  br label %36

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

37:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.MLayer, ptr %38, i32 0, i32 4
  %40 = load ptr, ptr %39, align 8, !tbaa !14
  store ptr %40, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.TensorPoolPara, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  %44 = getelementptr inbounds %struct.MLayer, ptr %43, i32 0, i32 2
  %45 = load ptr, ptr %44, align 8, !tbaa !17
  store ptr %45, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.TensorPoolPara, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  %49 = getelementptr inbounds %struct.MLayer, ptr %48, i32 0, i32 3
  %50 = load ptr, ptr %49, align 8, !tbaa !18
  store ptr %50, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.MLayer, ptr %51, i32 0, i32 2
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  store ptr %53, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.MTensor, ptr %54, i32 0, i32 2
  %56 = load i32, ptr %55, align 8, !tbaa !19
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.TensorPoolPara, ptr %57, i32 0, i32 5
  %59 = load i32, ptr %58, align 8, !tbaa !21
  %60 = sdiv i32 %56, %59
  store i32 %60, ptr %8, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.MTensor, ptr %61, i32 0, i32 3
  %63 = load i32, ptr %62, align 4, !tbaa !22
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.TensorPoolPara, ptr %64, i32 0, i32 4
  %66 = load i32, ptr %65, align 4, !tbaa !23
  %67 = sdiv i32 %63, %66
  store i32 %67, ptr %9, align 4, !tbaa !13
  br label %68

68:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %69 = load i32, ptr %8, align 4, !tbaa !13
  %70 = icmp slt i32 %69, 1
  br i1 %70, label %74, label %71

71:                                               ; preds = %68
  %72 = load i32, ptr %9, align 4, !tbaa !13
  %73 = icmp slt i32 %72, 1
  br label %74

74:                                               ; preds = %71, %68
  %75 = phi i1 [ true, %68 ], [ %73, %71 ]
  %76 = zext i1 %75 to i32
  store i32 %76, ptr %10, align 4, !tbaa !13
  %77 = load i32, ptr %10, align 4, !tbaa !13
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %81

79:                                               ; preds = %74
  %80 = load i32, ptr %10, align 4, !tbaa !13
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %80, i32 noundef -1, ptr noundef @.str.1, i32 noundef 62, ptr noundef @__FUNCTION__.TensorMaxPoolSet, ptr noundef @.str.10)
  br label %81

81:                                               ; preds = %79, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.MTensor, ptr %84, i32 0, i32 3
  %86 = load i32, ptr %85, align 4, !tbaa !22
  %87 = load i32, ptr %9, align 4, !tbaa !13
  %88 = sub nsw i32 %87, 1
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.TensorPoolPara, ptr %89, i32 0, i32 4
  %91 = load i32, ptr %90, align 4, !tbaa !23
  %92 = mul nsw i32 %88, %91
  %93 = sub nsw i32 %86, %92
  %94 = sdiv i32 %93, 2
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.TensorPoolPara, ptr %95, i32 0, i32 6
  store i32 %94, ptr %96, align 4, !tbaa !24
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.MTensor, ptr %97, i32 0, i32 2
  %99 = load i32, ptr %98, align 8, !tbaa !19
  %100 = load i32, ptr %8, align 4, !tbaa !13
  %101 = sub nsw i32 %100, 1
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.TensorPoolPara, ptr %102, i32 0, i32 5
  %104 = load i32, ptr %103, align 8, !tbaa !21
  %105 = mul nsw i32 %101, %104
  %106 = sub nsw i32 %99, %105
  %107 = sdiv i32 %106, 2
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.TensorPoolPara, ptr %108, i32 0, i32 7
  store i32 %107, ptr %109, align 8, !tbaa !25
  br label %110

110:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 5, ptr %11, align 4, !tbaa !13
  %111 = load i32, ptr %11, align 4, !tbaa !13
  %112 = icmp eq i32 %111, 0
  br i1 %112, label %113, label %118

113:                                              ; preds = %110
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.MTensor, ptr %115, i32 0, i32 4
  %117 = load ptr, ptr %116, align 8, !tbaa !26
  call void @TensorRedefine(ptr noundef %114, i32 noundef -1, i32 noundef -1, i32 noundef -1, i32 noundef -1, ptr noundef %117, i32 noundef -1)
  br label %175

118:                                              ; preds = %110
  %119 = load i32, ptr %11, align 4, !tbaa !13
  %120 = icmp eq i32 %119, 4
  br i1 %120, label %121, label %135

121:                                              ; preds = %118
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.MTensor, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !27
  %126 = add nsw i32 %125, 0
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.MTensor, ptr %127, i32 0, i32 1
  %129 = load i32, ptr %128, align 4, !tbaa !28
  %130 = load i32, ptr %8, align 4, !tbaa !13
  %131 = load i32, ptr %9, align 4, !tbaa !13
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.MTensor, ptr %132, i32 0, i32 4
  %134 = load ptr, ptr %133, align 8, !tbaa !26
  call void @TensorRedefine(ptr noundef %122, i32 noundef %126, i32 noundef %129, i32 noundef %130, i32 noundef %131, ptr noundef %134, i32 noundef -1)
  br label %174

135:                                              ; preds = %118
  %136 = load i32, ptr %11, align 4, !tbaa !13
  %137 = icmp eq i32 %136, 5
  br i1 %137, label %138, label %149

138:                                              ; preds = %135
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.MTensor, ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 8, !tbaa !27
  %143 = add nsw i32 %142, 0
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.MTensor, ptr %144, i32 0, i32 1
  %146 = load i32, ptr %145, align 4, !tbaa !28
  %147 = load i32, ptr %8, align 4, !tbaa !13
  %148 = load i32, ptr %9, align 4, !tbaa !13
  call void @TensorRedefine(ptr noundef %139, i32 noundef %143, i32 noundef %146, i32 noundef %147, i32 noundef %148, ptr noundef null, i32 noundef -1)
  br label %173

149:                                              ; preds = %135
  %150 = load i32, ptr %11, align 4, !tbaa !13
  %151 = icmp eq i32 %150, 6
  br i1 %151, label %152, label %163

152:                                              ; preds = %149
  %153 = load ptr, ptr %7, align 8, !tbaa !5
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.MTensor, ptr %154, i32 0, i32 0
  %156 = load i32, ptr %155, align 8, !tbaa !27
  %157 = add nsw i32 %156, 0
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.MTensor, ptr %158, i32 0, i32 1
  %160 = load i32, ptr %159, align 4, !tbaa !28
  %161 = load i32, ptr %8, align 4, !tbaa !13
  %162 = load i32, ptr %9, align 4, !tbaa !13
  call void @TensorRedefine(ptr noundef %153, i32 noundef %157, i32 noundef %160, i32 noundef %161, i32 noundef %162, ptr noundef null, i32 noundef -1)
  br label %172

163:                                              ; preds = %149
  br label %164

164:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 1, ptr %12, align 4, !tbaa !13
  %165 = load i32, ptr %12, align 4, !tbaa !13
  %166 = icmp ne i32 %165, 0
  br i1 %166, label %167, label %169

167:                                              ; preds = %164
  %168 = load i32, ptr %12, align 4, !tbaa !13
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %168, i32 noundef -1, ptr noundef @.str.1, i32 noundef 67, ptr noundef @__FUNCTION__.TensorMaxPoolSet, ptr noundef @.str.11)
  br label %169

169:                                              ; preds = %167, %164
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %170

170:                                              ; preds = %169
  br label %171

171:                                              ; preds = %170
  br label %172

172:                                              ; preds = %171, %152
  br label %173

173:                                              ; preds = %172, %138
  br label %174

174:                                              ; preds = %173, %121
  br label %175

175:                                              ; preds = %174, %113
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  %178 = load i32, ptr @morn_network_flag, align 4, !tbaa !13
  %179 = icmp eq i32 %178, 1
  br i1 %179, label %180, label %261

180:                                              ; preds = %177
  br label %181

181:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 5, ptr %13, align 4, !tbaa !13
  %182 = load i32, ptr %13, align 4, !tbaa !13
  %183 = icmp eq i32 %182, 0
  br i1 %183, label %184, label %189

184:                                              ; preds = %181
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.MTensor, ptr %186, i32 0, i32 4
  %188 = load ptr, ptr %187, align 8, !tbaa !26
  call void @TensorRedefine(ptr noundef %185, i32 noundef -1, i32 noundef -1, i32 noundef -1, i32 noundef -1, ptr noundef %188, i32 noundef -1)
  br label %258

189:                                              ; preds = %181
  %190 = load i32, ptr %13, align 4, !tbaa !13
  %191 = icmp eq i32 %190, 4
  br i1 %191, label %192, label %210

192:                                              ; preds = %189
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = load ptr, ptr %5, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.MTensor, ptr %194, i32 0, i32 0
  %196 = load i32, ptr %195, align 8, !tbaa !27
  %197 = add nsw i32 %196, 0
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.MTensor, ptr %198, i32 0, i32 1
  %200 = load i32, ptr %199, align 4, !tbaa !28
  %201 = load ptr, ptr %5, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.MTensor, ptr %201, i32 0, i32 2
  %203 = load i32, ptr %202, align 8, !tbaa !19
  %204 = load ptr, ptr %5, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.MTensor, ptr %204, i32 0, i32 3
  %206 = load i32, ptr %205, align 4, !tbaa !22
  %207 = load ptr, ptr %6, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.MTensor, ptr %207, i32 0, i32 4
  %209 = load ptr, ptr %208, align 8, !tbaa !26
  call void @TensorRedefine(ptr noundef %193, i32 noundef %197, i32 noundef %200, i32 noundef %203, i32 noundef %206, ptr noundef %209, i32 noundef -1)
  br label %257

210:                                              ; preds = %189
  %211 = load i32, ptr %13, align 4, !tbaa !13
  %212 = icmp eq i32 %211, 5
  br i1 %212, label %213, label %228

213:                                              ; preds = %210
  %214 = load ptr, ptr %6, align 8, !tbaa !5
  %215 = load ptr, ptr %5, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.MTensor, ptr %215, i32 0, i32 0
  %217 = load i32, ptr %216, align 8, !tbaa !27
  %218 = add nsw i32 %217, 0
  %219 = load ptr, ptr %5, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.MTensor, ptr %219, i32 0, i32 1
  %221 = load i32, ptr %220, align 4, !tbaa !28
  %222 = load ptr, ptr %5, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.MTensor, ptr %222, i32 0, i32 2
  %224 = load i32, ptr %223, align 8, !tbaa !19
  %225 = load ptr, ptr %5, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.MTensor, ptr %225, i32 0, i32 3
  %227 = load i32, ptr %226, align 4, !tbaa !22
  call void @TensorRedefine(ptr noundef %214, i32 noundef %218, i32 noundef %221, i32 noundef %224, i32 noundef %227, ptr noundef null, i32 noundef -1)
  br label %256

228:                                              ; preds = %210
  %229 = load i32, ptr %13, align 4, !tbaa !13
  %230 = icmp eq i32 %229, 6
  br i1 %230, label %231, label %246

231:                                              ; preds = %228
  %232 = load ptr, ptr %6, align 8, !tbaa !5
  %233 = load ptr, ptr %5, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.MTensor, ptr %233, i32 0, i32 0
  %235 = load i32, ptr %234, align 8, !tbaa !27
  %236 = add nsw i32 %235, 0
  %237 = load ptr, ptr %5, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.MTensor, ptr %237, i32 0, i32 1
  %239 = load i32, ptr %238, align 4, !tbaa !28
  %240 = load ptr, ptr %5, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.MTensor, ptr %240, i32 0, i32 2
  %242 = load i32, ptr %241, align 8, !tbaa !19
  %243 = load ptr, ptr %5, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.MTensor, ptr %243, i32 0, i32 3
  %245 = load i32, ptr %244, align 4, !tbaa !22
  call void @TensorRedefine(ptr noundef %232, i32 noundef %236, i32 noundef %239, i32 noundef %242, i32 noundef %245, ptr noundef null, i32 noundef -1)
  br label %255

246:                                              ; preds = %228
  br label %247

247:                                              ; preds = %246
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 1, ptr %14, align 4, !tbaa !13
  %248 = load i32, ptr %14, align 4, !tbaa !13
  %249 = icmp ne i32 %248, 0
  br i1 %249, label %250, label %252

250:                                              ; preds = %247
  %251 = load i32, ptr %14, align 4, !tbaa !13
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %251, i32 noundef -1, ptr noundef @.str.1, i32 noundef 69, ptr noundef @__FUNCTION__.TensorMaxPoolSet, ptr noundef @.str.11)
  br label %252

252:                                              ; preds = %250, %247
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253
  br label %255

255:                                              ; preds = %254, %231
  br label %256

256:                                              ; preds = %255, %213
  br label %257

257:                                              ; preds = %256, %192
  br label %258

258:                                              ; preds = %257, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %259

259:                                              ; preds = %258
  br label %260

260:                                              ; preds = %259
  br label %261

261:                                              ; preds = %260, %177
  %262 = load i32, ptr @morn_network_flag, align 4, !tbaa !13
  %263 = icmp eq i32 %262, 1
  br i1 %263, label %264, label %296

264:                                              ; preds = %261
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %265 = load ptr, ptr %7, align 8, !tbaa !5
  %266 = call ptr @GetHandle(ptr noundef %265, i32 noundef 8, i32 noundef -1726488948, ptr noundef @endTensorMaxPool)
  store ptr %266, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %267 = load ptr, ptr %15, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.MHandle, ptr %267, i32 0, i32 3
  %269 = load ptr, ptr %268, align 8, !tbaa !29
  store ptr %269, ptr %16, align 8, !tbaa !5
  %270 = load ptr, ptr %16, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.HandleTensorMaxPool, ptr %270, i32 0, i32 0
  %272 = load ptr, ptr %271, align 8, !tbaa !31
  %273 = icmp ne ptr %272, null
  br i1 %273, label %274, label %278

274:                                              ; preds = %264
  %275 = load ptr, ptr %16, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.HandleTensorMaxPool, ptr %275, i32 0, i32 0
  %277 = load ptr, ptr %276, align 8, !tbaa !31
  call void @mTensorRelease(ptr noundef %277)
  br label %278

278:                                              ; preds = %274, %264
  %279 = load ptr, ptr %5, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.MTensor, ptr %279, i32 0, i32 0
  %281 = load i32, ptr %280, align 8, !tbaa !27
  %282 = add nsw i32 %281, 0
  %283 = load ptr, ptr %5, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.MTensor, ptr %283, i32 0, i32 1
  %285 = load i32, ptr %284, align 4, !tbaa !28
  %286 = load i32, ptr %8, align 4, !tbaa !13
  %287 = load i32, ptr %9, align 4, !tbaa !13
  %288 = load ptr, ptr %7, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct.MTensor, ptr %288, i32 0, i32 5
  %290 = load i32, ptr %289, align 8, !tbaa !33
  %291 = call ptr @TensorCreate(i32 noundef %282, i32 noundef %285, i32 noundef %286, i32 noundef %287, ptr noundef null, i32 noundef %290)
  %292 = load ptr, ptr %16, align 8, !tbaa !5
  %293 = getelementptr inbounds %struct.HandleTensorMaxPool, ptr %292, i32 0, i32 0
  store ptr %291, ptr %293, align 8, !tbaa !31
  %294 = load ptr, ptr %15, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.MHandle, ptr %294, i32 0, i32 1
  store volatile i32 1, ptr %295, align 4, !tbaa !34
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %296

296:                                              ; preds = %278, %261
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %297

297:                                              ; preds = %296, %21
  ret void
}

declare void @TensorRedefine(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #1

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

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

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 willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind 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 }
attributes #5 = { nounwind willreturn memory(read) }

!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, !11, i64 64}
!10 = !{!"MLayer", !7, i64 0, !11, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 32}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 56}
!15 = !{!16, !6, i64 0}
!16 = !{!"TensorPoolPara", !6, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!17 = !{!10, !6, i64 40}
!18 = !{!10, !6, i64 48}
!19 = !{!20, !11, i64 8}
!20 = !{!"MTensor", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !6, i64 16, !11, i64 24}
!21 = !{!16, !11, i64 24}
!22 = !{!20, !11, i64 12}
!23 = !{!16, !11, i64 20}
!24 = !{!16, !11, i64 28}
!25 = !{!16, !11, i64 32}
!26 = !{!20, !6, i64 16}
!27 = !{!20, !11, i64 0}
!28 = !{!20, !11, i64 4}
!29 = !{!30, !6, i64 16}
!30 = !{!"MHandle", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16}
!31 = !{!32, !6, i64 0}
!32 = !{!"HandleTensorMaxPool", !6, i64 0}
!33 = !{!20, !11, i64 24}
!34 = !{!30, !11, 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"

%struct.TensorRegister = type { [32 x i8], ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@morn_tensor_register = external global [256 x %struct.TensorRegister], align 16
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@__FUNCTION__.TensorMaxPoolSet = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [15 x i8], align 1
@morn_network_flag = external local_unnamed_addr global i32, align 4

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1

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

declare void @mTensorRelease(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @TensorMaxPoolSet(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 64
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i32 %3, -1
  br i1 %.not, label %4, label %.thread

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 32
  %6 = load i32, ptr %5, align 8, !tbaa !11
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds [256 x %struct.TensorRegister], ptr @morn_tensor_register, i64 0, i64 %7
  %9 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef nonnull dereferenceable(1) %8) #3
  %.not83 = icmp eq i32 %9, 0
  br i1 %.not83, label %11, label %10

10:                                               ; preds = %4
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %9, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 54, ptr noundef nonnull @__FUNCTION__.TensorMaxPoolSet, ptr noundef nonnull @.str.9) #4
  br label %11

11:                                               ; preds = %10, %4
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %14, i64 40
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %14, i64 48
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %16, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %13, i64 24
  %24 = load i32, ptr %23, align 8, !tbaa !19
  %25 = sdiv i32 %22, %24
  %26 = getelementptr inbounds i8, ptr %16, i64 12
  %27 = load i32, ptr %26, align 4, !tbaa !20
  %28 = getelementptr inbounds i8, ptr %13, i64 20
  %29 = load i32, ptr %28, align 4, !tbaa !21
  %30 = sdiv i32 %27, %29
  %31 = icmp slt i32 %25, 1
  %32 = icmp slt i32 %30, 1
  %33 = select i1 %31, i1 true, i1 %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %11
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 62, ptr noundef nonnull @__FUNCTION__.TensorMaxPoolSet, ptr noundef nonnull @.str.10) #4
  %.pre = load i32, ptr %26, align 4, !tbaa !20
  %.pre85 = load i32, ptr %28, align 4, !tbaa !21
  %.pre86 = load i32, ptr %21, align 8, !tbaa !17
  %.pre87 = load i32, ptr %23, align 8, !tbaa !19
  br label %35

35:                                               ; preds = %34, %11
  %36 = phi i32 [ %.pre87, %34 ], [ %24, %11 ]
  %37 = phi i32 [ %.pre86, %34 ], [ %22, %11 ]
  %38 = phi i32 [ %.pre85, %34 ], [ %29, %11 ]
  %39 = phi i32 [ %.pre, %34 ], [ %27, %11 ]
  %40 = add nsw i32 %30, -1
  %41 = mul nsw i32 %38, %40
  %42 = sub nsw i32 %39, %41
  %43 = sdiv i32 %42, 2
  %44 = getelementptr inbounds i8, ptr %13, i64 28
  store i32 %43, ptr %44, align 4, !tbaa !22
  %45 = add nsw i32 %25, -1
  %46 = mul nsw i32 %36, %45
  %47 = sub nsw i32 %37, %46
  %48 = sdiv i32 %47, 2
  %49 = getelementptr inbounds i8, ptr %13, i64 32
  store i32 %48, ptr %49, align 8, !tbaa !23
  %50 = load i32, ptr %16, align 8, !tbaa !24
  %51 = getelementptr inbounds i8, ptr %16, i64 4
  %52 = load i32, ptr %51, align 4, !tbaa !25
  tail call void @TensorRedefine(ptr noundef %20, i32 noundef %50, i32 noundef %52, i32 noundef %25, i32 noundef %30, ptr noundef null, i32 noundef -1) #4
  %53 = load i32, ptr @morn_network_flag, align 4, !tbaa !26
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %.thread

55:                                               ; preds = %35
  %56 = load i32, ptr %16, align 8, !tbaa !24
  %57 = load i32, ptr %51, align 4, !tbaa !25
  %58 = load i32, ptr %21, align 8, !tbaa !17
  %59 = load i32, ptr %26, align 4, !tbaa !20
  tail call void @TensorRedefine(ptr noundef %18, i32 noundef %56, i32 noundef %57, i32 noundef %58, i32 noundef %59, ptr noundef null, i32 noundef -1) #4
  %.pr = load i32, ptr @morn_network_flag, align 4, !tbaa !26
  %60 = icmp eq i32 %.pr, 1
  br i1 %60, label %61, label %.thread

61:                                               ; preds = %55
  %62 = tail call ptr @GetHandle(ptr noundef %20, i32 noundef 8, i32 noundef -1726488948, ptr noundef nonnull @endTensorMaxPool) #4
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %64 = load ptr, ptr %63, align 8, !tbaa !27
  %65 = load ptr, ptr %64, align 8, !tbaa !29
  %.not84 = icmp eq ptr %65, null
  br i1 %.not84, label %67, label %66

66:                                               ; preds = %61
  tail call void @mTensorRelease(ptr noundef nonnull %65) #4
  br label %67

67:                                               ; preds = %66, %61
  %68 = load i32, ptr %16, align 8, !tbaa !24
  %69 = load i32, ptr %51, align 4, !tbaa !25
  %70 = getelementptr inbounds i8, ptr %20, i64 24
  %71 = load i32, ptr %70, align 8, !tbaa !31
  %72 = tail call ptr @TensorCreate(i32 noundef %68, i32 noundef %69, i32 noundef %25, i32 noundef %30, ptr noundef null, i32 noundef %71) #4
  store ptr %72, ptr %64, align 8, !tbaa !29
  %73 = getelementptr inbounds i8, ptr %62, i64 4
  store volatile i32 1, ptr %73, align 4, !tbaa !32
  br label %.thread

.thread:                                          ; preds = %35, %55, %67, %1
  ret void
}

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

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

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

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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { nounwind willreturn memory(read) }
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, !9, i64 64}
!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 = !{!6, !9, i64 32}
!12 = !{!6, !10, i64 56}
!13 = !{!14, !10, i64 0}
!14 = !{!"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}
!15 = !{!6, !10, i64 40}
!16 = !{!6, !10, i64 48}
!17 = !{!18, !9, i64 8}
!18 = !{!"MTensor", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !10, i64 16, !9, i64 24}
!19 = !{!14, !9, i64 24}
!20 = !{!18, !9, i64 12}
!21 = !{!14, !9, i64 20}
!22 = !{!14, !9, i64 28}
!23 = !{!14, !9, i64 32}
!24 = !{!18, !9, i64 0}
!25 = !{!18, !9, i64 4}
!26 = !{!9, !9, i64 0}
!27 = !{!28, !10, i64 16}
!28 = !{!"MHandle", !9, i64 0, !9, i64 4, !10, i64 8, !10, i64 16}
!29 = !{!30, !10, i64 0}
!30 = !{!"HandleTensorMaxPool", !10, i64 0}
!31 = !{!18, !9, i64 24}
!32 = !{!28, !9, i64 4}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass