; 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.HandleTensorRandPool = type { ptr }

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [19 x i8], align 1
@__FUNCTION__.mTensorRandPoolBackward = external hidden unnamed_addr constant [24 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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mTensorRandPoolBackward(ptr noundef %0) #3 {
  %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 i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  br label %25

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

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

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

37:                                               ; preds = %32
  %38 = load i32, ptr %3, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %38, i32 noundef -1, ptr noundef @.str.1, i32 noundef 478, ptr noundef @__FUNCTION__.mTensorRandPoolBackward, ptr noundef @.str.12)
  br label %39

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

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

48:                                               ; preds = %40
  store i32 1, ptr %5, align 4
  br label %251

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

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

92:                                               ; preds = %84
  %93 = load i32, ptr %15, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %93, i32 noundef -1, ptr noundef @.str.1, i32 noundef 492, ptr noundef @__FUNCTION__.mTensorRandPoolBackward, ptr noundef @.str.13)
  br label %94

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

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.TensorPoolPara, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = getelementptr inbounds %struct.MLayer, ptr %99, i32 0, i32 5
  %101 = load i32, ptr %100, align 8, !tbaa !25
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %140

103:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %132, %103
  %105 = load i32, ptr %16, align 4, !tbaa !9
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.MTensor, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 8, !tbaa !26
  %109 = icmp slt i32 %105, %108
  br i1 %109, label %111, label %110

110:                                              ; preds = %104
  store i32 6, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %135

111:                                              ; preds = %104
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.MTensor, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !27
  %115 = load i32, ptr %16, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds ptr, ptr %114, i64 %116
  %118 = load ptr, ptr %117, align 8, !tbaa !5
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.MTensor, ptr %119, i32 0, i32 2
  %121 = load i32, ptr %120, align 8, !tbaa !17
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.MTensor, ptr %122, i32 0, i32 3
  %124 = load i32, ptr %123, align 4, !tbaa !19
  %125 = mul nsw i32 %121, %124
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MTensor, ptr %126, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !20
  %129 = mul nsw i32 %125, %128
  %130 = sext i32 %129 to i64
  %131 = mul i64 %130, 4
  call void @llvm.memset.p0.i64(ptr align 4 %118, i8 0, i64 %131, i1 false)
  br label %132

132:                                              ; preds = %111
  %133 = load i32, ptr %16, align 4, !tbaa !9
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %16, align 4, !tbaa !9
  br label %104, !llvm.loop !28

135:                                              ; preds = %110
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.TensorPoolPara, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %137, align 8, !tbaa !15
  %139 = getelementptr inbounds %struct.MLayer, ptr %138, i32 0, i32 5
  store i32 1, ptr %139, align 8, !tbaa !25
  br label %140

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

141:                                              ; preds = %247, %140
  %142 = load i32, ptr %17, align 4, !tbaa !9
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.MTensor, ptr %143, i32 0, i32 0
  %145 = load i32, ptr %144, align 8, !tbaa !26
  %146 = icmp slt i32 %142, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %141
  store i32 9, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %250

148:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %149

149:                                              ; preds = %243, %148
  %150 = load i32, ptr %18, align 4, !tbaa !9
  %151 = load i32, ptr %12, align 4, !tbaa !9
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  store i32 12, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %246

154:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %155 = load ptr, ptr %14, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.HandleTensorRandPool, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !30
  %158 = load i32, ptr %17, align 4, !tbaa !9
  %159 = load i32, ptr %12, align 4, !tbaa !9
  %160 = mul nsw i32 %158, %159
  %161 = load i32, ptr %11, align 4, !tbaa !9
  %162 = mul nsw i32 %160, %161
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds i32, ptr %157, i64 %163
  %165 = load i32, ptr %18, align 4, !tbaa !9
  %166 = load i32, ptr %11, align 4, !tbaa !9
  %167 = mul nsw i32 %165, %166
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds i32, ptr %164, i64 %168
  store ptr %169, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.MTensor, ptr %170, i32 0, i32 4
  %172 = load ptr, ptr %171, align 8, !tbaa !27
  %173 = load i32, ptr %17, align 4, !tbaa !9
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds ptr, ptr %172, i64 %174
  %176 = load ptr, ptr %175, align 8, !tbaa !5
  %177 = load i32, ptr %18, align 4, !tbaa !9
  %178 = load i32, ptr %11, align 4, !tbaa !9
  %179 = mul nsw i32 %177, %178
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds float, ptr %176, i64 %180
  store ptr %181, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.MTensor, ptr %182, i32 0, i32 4
  %184 = load ptr, ptr %183, align 8, !tbaa !27
  %185 = load i32, ptr %17, align 4, !tbaa !9
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds ptr, ptr %184, i64 %186
  %188 = load ptr, ptr %187, align 8, !tbaa !5
  %189 = load i32, ptr %18, align 4, !tbaa !9
  %190 = load i32, ptr %10, align 4, !tbaa !9
  %191 = mul nsw i32 %189, %190
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds float, ptr %188, i64 %192
  store ptr %193, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  store i32 0, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.TensorPoolPara, ptr %194, i32 0, i32 7
  %196 = load i32, ptr %195, align 8, !tbaa !32
  store i32 %196, ptr %23, align 4, !tbaa !9
  br label %197

197:                                              ; preds = %236, %154
  %198 = load i32, ptr %23, align 4, !tbaa !9
  %199 = load i32, ptr %8, align 4, !tbaa !9
  %200 = icmp slt i32 %198, %199
  br i1 %200, label %202, label %201

201:                                              ; preds = %197
  store i32 15, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  br label %242

202:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #4
  %203 = load ptr, ptr %4, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.TensorPoolPara, ptr %203, i32 0, i32 6
  %205 = load i32, ptr %204, align 4, !tbaa !33
  store i32 %205, ptr %24, align 4, !tbaa !9
  br label %206

206:                                              ; preds = %229, %202
  %207 = load i32, ptr %24, align 4, !tbaa !9
  %208 = load i32, ptr %9, align 4, !tbaa !9
  %209 = icmp slt i32 %207, %208
  br i1 %209, label %211, label %210

210:                                              ; preds = %206
  store i32 18, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #4
  br label %235

211:                                              ; preds = %206
  %212 = load ptr, ptr %20, align 8, !tbaa !5
  %213 = load i32, ptr %22, align 4, !tbaa !9
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds float, ptr %212, i64 %214
  %216 = load float, ptr %215, align 4, !tbaa !34
  %217 = load ptr, ptr %21, align 8, !tbaa !5
  %218 = load ptr, ptr %19, align 8, !tbaa !5
  %219 = load i32, ptr %22, align 4, !tbaa !9
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds i32, ptr %218, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !9
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds float, ptr %217, i64 %223
  %225 = load float, ptr %224, align 4, !tbaa !34
  %226 = fadd float %225, %216
  store float %226, ptr %224, align 4, !tbaa !34
  %227 = load i32, ptr %22, align 4, !tbaa !9
  %228 = add nsw i32 %227, 1
  store i32 %228, ptr %22, align 4, !tbaa !9
  br label %229

229:                                              ; preds = %211
  %230 = load ptr, ptr %4, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.TensorPoolPara, ptr %230, i32 0, i32 4
  %232 = load i32, ptr %231, align 4, !tbaa !36
  %233 = load i32, ptr %24, align 4, !tbaa !9
  %234 = add nsw i32 %233, %232
  store i32 %234, ptr %24, align 4, !tbaa !9
  br label %206, !llvm.loop !37

235:                                              ; preds = %210
  br label %236

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

242:                                              ; preds = %201
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %243

243:                                              ; preds = %242
  %244 = load i32, ptr %18, align 4, !tbaa !9
  %245 = add nsw i32 %244, 1
  store i32 %245, ptr %18, align 4, !tbaa !9
  br label %149, !llvm.loop !40

246:                                              ; preds = %153
  br label %247

247:                                              ; preds = %246
  %248 = load i32, ptr %17, align 4, !tbaa !9
  %249 = add nsw i32 %248, 1
  store i32 %249, ptr %17, align 4, !tbaa !9
  br label %141, !llvm.loop !41

250:                                              ; preds = %147
  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 %251

251:                                              ; preds = %250, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %252 = load i32, ptr %5, align 4
  switch i32 %252, label %254 [
    i32 0, label %253
    i32 1, label %253
  ]

253:                                              ; preds = %251, %251
  ret void

254:                                              ; preds = %251
  unreachable
}

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 }

!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 = !{!12, !10, i64 64}
!26 = !{!18, !10, i64 0}
!27 = !{!18, !6, i64 16}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!31, !6, i64 0}
!31 = !{!"HandleTensorRandPool", !6, i64 0}
!32 = !{!14, !10, i64 32}
!33 = !{!14, !10, i64 28}
!34 = !{!35, !35, i64 0}
!35 = !{!"float", !7, i64 0}
!36 = !{!14, !10, i64 20}
!37 = distinct !{!37, !29}
!38 = !{!14, !10, i64 24}
!39 = distinct !{!39, !29}
!40 = distinct !{!40, !29}
!41 = distinct !{!41, !29}


; 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
@.str.13 = external hidden unnamed_addr constant [19 x i8], align 1
@__FUNCTION__.mTensorRandPoolBackward = external hidden unnamed_addr constant [24 x i8], align 1

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

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr 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) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @mTensorRandPoolBackward(ptr noundef %0) local_unnamed_addr #2 {
  %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 478, ptr noundef nonnull @__FUNCTION__.mTensorRandPoolBackward, 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 %18, 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 -993351271, ptr noundef nonnull @endTensorRandPool) #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 492, ptr noundef nonnull @__FUNCTION__.mTensorRandPoolBackward, ptr noundef nonnull @.str.13) #3
  br label %40

40:                                               ; preds = %39, %13
  %41 = load ptr, ptr %9, align 8, !tbaa !13
  %42 = getelementptr inbounds i8, ptr %41, i64 64
  %43 = load i32, ptr %42, align 8, !tbaa !23
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %.preheader71, label %65

.preheader71:                                     ; preds = %40
  %45 = load i32, ptr %16, align 8, !tbaa !24
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader71
  %47 = getelementptr inbounds i8, ptr %16, i64 16
  %48 = getelementptr inbounds i8, ptr %16, i64 4
  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, %.preheader71
  %49 = phi ptr [ %.pre, %._crit_edge.loopexit ], [ %41, %.preheader71 ]
  %50 = getelementptr inbounds i8, ptr %49, i64 64
  store i32 1, ptr %50, align 8, !tbaa !23
  br label %65

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

65:                                               ; preds = %._crit_edge, %40
  %66 = load i32, ptr %18, align 8, !tbaa !24
  %factor.op.mul89 = mul i32 %28, %30
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %.preheader.lr.ph, label %.loopexit

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

.preheader.lr.ph.split.us:                        ; preds = %.preheader.lr.ph
  %72 = getelementptr inbounds i8, ptr %9, i64 32
  %73 = getelementptr inbounds i8, ptr %16, i64 16
  %74 = getelementptr inbounds i8, ptr %18, i64 16
  %75 = load ptr, ptr %35, align 8, !tbaa !29
  %76 = load ptr, ptr %74, align 8, !tbaa !25
  %77 = load ptr, ptr %73, align 8, !tbaa !25
  %78 = load i32, ptr %72, align 8, !tbaa !31
  %79 = icmp slt i32 %78, %20
  br i1 %79, label %.preheader.lr.ph.split.us.split.us, label %.loopexit

.preheader.lr.ph.split.us.split.us:               ; preds = %.preheader.lr.ph.split.us
  %80 = load i32, ptr %69, align 4, !tbaa !32
  %81 = icmp slt i32 %80, %22
  %82 = load i32, ptr %71, align 8, !tbaa !33
  br i1 %81, 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
  %83 = load i32, ptr %70, align 4, !tbaa !34
  %84 = sext i32 %28 to i64
  %85 = sext i32 %23 to i64
  %wide.trip.count111 = zext nneg i32 %66 to i64
  %wide.trip.count = zext nneg i32 %30 to i64
  br label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %._crit_edge85.split.us.split.us.us.us.us, %.preheader.lr.ph.split.us.split.us.split.us
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %._crit_edge85.split.us.split.us.us.us.us ], [ 0, %.preheader.lr.ph.split.us.split.us.split.us ]
  %86 = trunc nuw nsw i64 %indvars.iv108 to i32
  %factor.op.mul.reass.us.us.us = mul i32 %factor.op.mul89, %86
  %87 = sext i32 %factor.op.mul.reass.us.us.us to i64
  %88 = getelementptr inbounds i32, ptr %75, i64 %87
  %89 = getelementptr inbounds ptr, ptr %76, i64 %indvars.iv108
  %90 = load ptr, ptr %89, align 8, !tbaa !26
  %91 = getelementptr inbounds ptr, ptr %77, i64 %indvars.iv108
  %92 = load ptr, ptr %91, align 8, !tbaa !26
  br label %.lr.ph81.us.us.us.us.us

.lr.ph81.us.us.us.us.us:                          ; preds = %._crit_edge82.split.us.us.us.us.us.us, %.preheader.us.us.us
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %._crit_edge82.split.us.us.us.us.us.us ], [ 0, %.preheader.us.us.us ]
  %93 = mul nsw i64 %indvars.iv105, %84
  %94 = getelementptr inbounds i32, ptr %88, i64 %93
  %95 = getelementptr inbounds float, ptr %90, i64 %93
  %96 = mul nsw i64 %indvars.iv105, %85
  %97 = getelementptr inbounds float, ptr %92, i64 %96
  br label %.lr.ph76.us.us.us.us.us.us

.lr.ph76.us.us.us.us.us.us:                       ; preds = %._crit_edge77.us.us.us.us.us.us, %.lr.ph81.us.us.us.us.us
  %.06579.us.us.us.us.us.us = phi i32 [ %78, %.lr.ph81.us.us.us.us.us ], [ %110, %._crit_edge77.us.us.us.us.us.us ]
  %.06678.us.us.us.us.us.us = phi i64 [ 0, %.lr.ph81.us.us.us.us.us ], [ %indvars.iv.next103, %._crit_edge77.us.us.us.us.us.us ]
  %sext = shl i64 %.06678.us.us.us.us.us.us, 32
  %98 = ashr exact i64 %sext, 32
  br label %99

99:                                               ; preds = %99, %.lr.ph76.us.us.us.us.us.us
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %99 ], [ %98, %.lr.ph76.us.us.us.us.us.us ]
  %.074.us.us.us.us.us.us = phi i32 [ %108, %99 ], [ %80, %.lr.ph76.us.us.us.us.us.us ]
  %100 = getelementptr inbounds float, ptr %95, i64 %indvars.iv102
  %101 = load float, ptr %100, align 4, !tbaa !35
  %102 = getelementptr inbounds i32, ptr %94, i64 %indvars.iv102
  %103 = load i32, ptr %102, align 4, !tbaa !37
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds float, ptr %97, i64 %104
  %106 = load float, ptr %105, align 4, !tbaa !35
  %107 = fadd float %101, %106
  store float %107, ptr %105, align 4, !tbaa !35
  %indvars.iv.next103 = add nsw i64 %indvars.iv102, 1
  %108 = add nsw i32 %83, %.074.us.us.us.us.us.us
  %109 = icmp slt i32 %108, %22
  br i1 %109, label %99, label %._crit_edge77.us.us.us.us.us.us, !llvm.loop !38

._crit_edge77.us.us.us.us.us.us:                  ; preds = %99
  %110 = add nsw i32 %82, %.06579.us.us.us.us.us.us
  %111 = icmp slt i32 %110, %20
  br i1 %111, label %.lr.ph76.us.us.us.us.us.us, label %._crit_edge82.split.us.us.us.us.us.us, !llvm.loop !39

._crit_edge82.split.us.us.us.us.us.us:            ; preds = %._crit_edge77.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_edge85.split.us.split.us.us.us.us, label %.lr.ph81.us.us.us.us.us, !llvm.loop !40

._crit_edge85.split.us.split.us.us.us.us:         ; preds = %._crit_edge82.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 !41

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

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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 }

!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 = !{!6, !9, i64 64}
!24 = !{!16, !9, i64 0}
!25 = !{!16, !10, i64 16}
!26 = !{!10, !10, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!30, !10, i64 0}
!30 = !{!"HandleTensorRandPool", !10, i64 0}
!31 = !{!12, !9, i64 32}
!32 = !{!12, !9, i64 28}
!33 = !{!12, !9, i64 24}
!34 = !{!12, !9, i64 20}
!35 = !{!36, !36, i64 0}
!36 = !{!"float", !7, i64 0}
!37 = !{!9, !9, i64 0}
!38 = distinct !{!38, !28}
!39 = distinct !{!39, !28}
!40 = distinct !{!40, !28}
!41 = distinct !{!41, !28}


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