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

; 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.TensorDirConvPara = type { ptr, i32, i32, i32, i32, i32, i32, float, float, float }
%struct.MHandle = type { i32, i32, ptr, ptr }
%struct.MTensor = type { i32, i32, i32, i32, ptr, i32 }
%struct.HandleTensorDirConv = type { ptr, ptr, ptr }
%struct.MMemoryBlock = type { i32, i32, ptr, ptr, ptr, i32 }

@.str.1 = external hidden unnamed_addr constant [93 x i8], align 1
@morn_tensor_register = external global [256 x %struct.TensorRegister], align 16
@morn_network_parafile = external global ptr, align 8
@.str.27 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [19 x i8], align 1
@__FUNCTION__.mTensorDirConvBackward = external hidden unnamed_addr constant [23 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [19 x i8], align 1
@morn_network_time = external global i32, align 4
@morn_network_save = external global i32, align 4
@morn_network_error = external global float, align 4
@morn_network_error_thresh = external global float, align 4
@morn_network_time_max = 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 @DirConvTensorToMatData(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

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

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

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) #4

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #5

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

declare void @mSgemm(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @mTensorDirConvBackward(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca [64 x i8], align 16
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  br label %20

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

23:                                               ; preds = %20
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = ptrtoint ptr %24 to i64
  %26 = icmp eq i64 %25, -1
  br label %27

27:                                               ; preds = %23, %20
  %28 = phi i1 [ true, %20 ], [ %26, %23 ]
  %29 = zext i1 %28 to i32
  store i32 %29, ptr %3, align 4, !tbaa !9
  %30 = load i32, ptr %3, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  %33 = load i32, ptr %3, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %33, i32 noundef -1, ptr noundef @.str.1, i32 noundef 576, ptr noundef @__FUNCTION__.mTensorDirConvBackward, ptr noundef @.str.29)
  br label %34

34:                                               ; preds = %32, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.MLayer, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !11
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [256 x %struct.TensorRegister], ptr @morn_tensor_register, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.TensorRegister, ptr %41, i32 0, i32 0
  %43 = getelementptr inbounds [32 x i8], ptr %42, i64 0, i64 0
  %44 = call i32 @strcmp(ptr noundef @.str.30, ptr noundef %43) #8
  store i32 %44, ptr %4, align 4, !tbaa !9
  %45 = load i32, ptr %4, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %49

47:                                               ; preds = %36
  %48 = load i32, ptr %4, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %48, i32 noundef -1, ptr noundef @.str.1, i32 noundef 577, ptr noundef @__FUNCTION__.mTensorDirConvBackward, ptr noundef @.str.31)
  br label %49

49:                                               ; preds = %47, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %50

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.MLayer, ptr %51, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !13
  store ptr %53, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.TensorDirConvPara, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !14
  %57 = getelementptr inbounds %struct.MLayer, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !17
  store ptr %58, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.TensorDirConvPara, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !14
  %62 = getelementptr inbounds %struct.MLayer, ptr %61, i32 0, i32 3
  %63 = load ptr, ptr %62, align 8, !tbaa !18
  store ptr %63, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %64 = load ptr, ptr %2, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.MLayer, ptr %64, i32 0, i32 3
  %66 = load ptr, ptr %65, align 8, !tbaa !18
  store ptr %66, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.MLayer, ptr %67, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !17
  %70 = call ptr @GetHandle(ptr noundef %69, i32 noundef 24, i32 noundef -1641646925, ptr noundef @endTensorDirConv)
  store ptr %70, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.MHandle, ptr %71, i32 0, i32 3
  %73 = load ptr, ptr %72, align 8, !tbaa !19
  store ptr %73, ptr %10, align 8, !tbaa !5
  br label %74

74:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.MHandle, ptr %75, i32 0, i32 1
  %77 = load volatile i32, ptr %76, align 4, !tbaa !21
  %78 = icmp eq i32 %77, 0
  %79 = zext i1 %78 to i32
  store i32 %79, ptr %11, align 4, !tbaa !9
  %80 = load i32, ptr %11, align 4, !tbaa !9
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %84

82:                                               ; preds = %74
  %83 = load i32, ptr %11, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %83, i32 noundef -1, ptr noundef @.str.1, i32 noundef 585, ptr noundef @__FUNCTION__.mTensorDirConvBackward, ptr noundef @.str.32)
  br label %84

84:                                               ; preds = %82, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.MTensor, ptr %87, i32 0, i32 2
  %89 = load i32, ptr %88, align 8, !tbaa !22
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.MTensor, ptr %90, i32 0, i32 3
  %92 = load i32, ptr %91, align 4, !tbaa !24
  %93 = mul nsw i32 %89, %92
  store i32 %93, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.TensorDirConvPara, ptr %94, i32 0, i32 2
  %96 = load i32, ptr %95, align 4, !tbaa !25
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.TensorDirConvPara, ptr %97, i32 0, i32 2
  %99 = load i32, ptr %98, align 4, !tbaa !25
  %100 = add nsw i32 %96, %99
  %101 = add nsw i32 %100, 1
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.MTensor, ptr %102, i32 0, i32 1
  %104 = load i32, ptr %103, align 4, !tbaa !26
  %105 = mul nsw i32 %101, %104
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %13, align 4, !tbaa !9
  br label %107

107:                                              ; preds = %86
  %108 = load i32, ptr @morn_network_time, align 4, !tbaa !9
  %109 = load i32, ptr @morn_network_save, align 4, !tbaa !9
  %110 = srem i32 %108, %109
  %111 = icmp eq i32 %110, 0
  br i1 %111, label %112, label %115

112:                                              ; preds = %107
  %113 = load i32, ptr @morn_network_time, align 4, !tbaa !9
  %114 = icmp sgt i32 %113, 0
  br i1 %114, label %124, label %115

115:                                              ; preds = %112, %107
  %116 = load float, ptr @morn_network_error, align 4, !tbaa !27
  %117 = load float, ptr @morn_network_error_thresh, align 4, !tbaa !27
  %118 = fcmp ole float %116, %117
  br i1 %118, label %124, label %119

119:                                              ; preds = %115
  %120 = load float, ptr @morn_network_error, align 4, !tbaa !27
  %121 = load i32, ptr @morn_network_time_max, align 4, !tbaa !9
  %122 = sitofp i32 %121 to float
  %123 = fcmp oeq float %120, %122
  br i1 %123, label %124, label %148

124:                                              ; preds = %119, %115, %112
  call void @llvm.lifetime.start.p0(i64 64, ptr %14) #7
  %125 = getelementptr inbounds [64 x i8], ptr %14, i64 0, i64 0
  %126 = load ptr, ptr %2, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MLayer, ptr %126, i32 0, i32 0
  %128 = getelementptr inbounds [32 x i8], ptr %127, i64 0, i64 0
  %129 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %125, ptr noundef @.str.27, ptr noundef %128, ptr noundef @.str.28) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %130 = load ptr, ptr %10, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %130, i32 0, i32 1
  %132 = load ptr, ptr %131, align 8, !tbaa !28
  %133 = getelementptr inbounds %struct.MMemoryBlock, ptr %132, i32 0, i32 2
  %134 = load ptr, ptr %133, align 8, !tbaa !30
  store ptr %134, ptr %15, align 8, !tbaa !5
  %135 = load ptr, ptr @morn_network_parafile, align 8, !tbaa !5
  %136 = getelementptr inbounds [64 x i8], ptr %14, i64 0, i64 0
  %137 = getelementptr inbounds i8, ptr %136, i64 0
  %138 = call i32 @m_Hash(ptr noundef %137, i32 noundef -1)
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.TensorDirConvPara, ptr %139, i32 0, i32 1
  %141 = load i32, ptr %140, align 8, !tbaa !32
  %142 = load i32, ptr %13, align 4, !tbaa !9
  %143 = mul nsw i32 %141, %142
  %144 = sext i32 %143 to i64
  %145 = mul i64 %144, 4
  %146 = trunc i64 %145 to i32
  %147 = call i32 @mMORNWrite(ptr noundef %135, i32 noundef %138, ptr noundef %15, i32 noundef 1, i32 noundef %146)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr %14) #7
  br label %148

148:                                              ; preds = %124, %119
  br label %149

149:                                              ; preds = %148
  br label %150

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

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

157:                                              ; preds = %151
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %210

158:                                              ; preds = %151
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  %160 = load i32, ptr %16, align 4, !tbaa !9
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !34
  %164 = getelementptr inbounds %struct.MMemoryBlock, ptr %163, i32 0, i32 2
  %165 = load ptr, ptr %164, align 8, !tbaa !30
  %166 = load ptr, ptr %5, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.TensorDirConvPara, ptr %166, i32 0, i32 2
  %168 = load i32, ptr %167, align 4, !tbaa !25
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.TensorDirConvPara, ptr %169, i32 0, i32 3
  %171 = load i32, ptr %170, align 8, !tbaa !35
  %172 = load ptr, ptr %5, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.TensorDirConvPara, ptr %172, i32 0, i32 5
  %174 = load i32, ptr %173, align 8, !tbaa !36
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.TensorDirConvPara, ptr %175, i32 0, i32 4
  %177 = load i32, ptr %176, align 4, !tbaa !37
  call void @DirConvTensorToMatData(ptr noundef %159, i32 noundef %160, ptr noundef %165, i32 noundef %168, i32 noundef %171, i32 noundef %174, i32 noundef %177)
  %178 = load ptr, ptr %5, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.TensorDirConvPara, ptr %178, i32 0, i32 1
  %180 = load i32, ptr %179, align 8, !tbaa !32
  %181 = load i32, ptr %13, align 4, !tbaa !9
  %182 = load i32, ptr %12, align 4, !tbaa !9
  %183 = load i32, ptr %12, align 4, !tbaa !9
  %184 = sitofp i32 %183 to float
  %185 = fdiv float 1.000000e+00, %184
  %186 = load ptr, ptr %8, align 8, !tbaa !5
  %187 = load i32, ptr %16, align 4, !tbaa !9
  %188 = call ptr @mTensorMemory(ptr noundef %186, i32 noundef %187)
  %189 = load i32, ptr %12, align 4, !tbaa !9
  %190 = load ptr, ptr %10, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %190, i32 0, i32 0
  %192 = load ptr, ptr %191, align 8, !tbaa !34
  %193 = load i32, ptr %13, align 4, !tbaa !9
  %194 = load i32, ptr %16, align 4, !tbaa !9
  %195 = icmp eq i32 %194, 0
  br i1 %195, label %196, label %200

196:                                              ; preds = %158
  %197 = load ptr, ptr %5, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.TensorDirConvPara, ptr %197, i32 0, i32 9
  %199 = load float, ptr %198, align 8, !tbaa !38
  br label %201

200:                                              ; preds = %158
  br label %201

201:                                              ; preds = %200, %196
  %202 = phi float [ %199, %196 ], [ 1.000000e+00, %200 ]
  %203 = load ptr, ptr %10, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %203, i32 0, i32 2
  %205 = load ptr, ptr %204, align 8, !tbaa !39
  %206 = load i32, ptr %13, align 4, !tbaa !9
  call void @mSgemm(i32 noundef 0, i32 noundef 0, i32 noundef %180, i32 noundef %181, i32 noundef %182, float noundef %185, ptr noundef %188, i32 noundef %189, ptr noundef %192, i32 noundef %193, float noundef %202, ptr noundef %205, i32 noundef %206)
  br label %207

207:                                              ; preds = %201
  %208 = load i32, ptr %16, align 4, !tbaa !9
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %16, align 4, !tbaa !9
  br label %151, !llvm.loop !40

210:                                              ; preds = %157
  %211 = load ptr, ptr %5, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.TensorDirConvPara, ptr %211, i32 0, i32 1
  %213 = load i32, ptr %212, align 8, !tbaa !32
  %214 = load i32, ptr %13, align 4, !tbaa !9
  %215 = mul nsw i32 %213, %214
  %216 = load ptr, ptr %5, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.TensorDirConvPara, ptr %216, i32 0, i32 7
  %218 = load float, ptr %217, align 8, !tbaa !42
  %219 = load ptr, ptr %6, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.MTensor, ptr %219, i32 0, i32 0
  %221 = load i32, ptr %220, align 8, !tbaa !33
  %222 = sitofp i32 %221 to float
  %223 = fdiv float %218, %222
  %224 = fsub float 0.000000e+00, %223
  %225 = load ptr, ptr %10, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %225, i32 0, i32 2
  %227 = load ptr, ptr %226, align 8, !tbaa !39
  %228 = load ptr, ptr %5, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.TensorDirConvPara, ptr %228, i32 0, i32 8
  %230 = load float, ptr %229, align 4, !tbaa !43
  %231 = load ptr, ptr %5, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.TensorDirConvPara, ptr %231, i32 0, i32 7
  %233 = load float, ptr %232, align 8, !tbaa !42
  %234 = fneg float %230
  %235 = call float @llvm.fmuladd.f32(float %234, float %233, float 1.000000e+00)
  %236 = load ptr, ptr %10, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %236, i32 0, i32 1
  %238 = load ptr, ptr %237, align 8, !tbaa !28
  call void @mSaxpby(i32 noundef %215, float noundef %224, ptr noundef %227, float noundef %235, ptr noundef %238)
  %239 = load ptr, ptr %5, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.TensorDirConvPara, ptr %239, i32 0, i32 6
  %241 = load i32, ptr %240, align 4, !tbaa !44
  %242 = icmp eq i32 %241, 0
  br i1 %242, label %243, label %244

243:                                              ; preds = %210
  store i32 1, ptr %17, align 4
  br label %337

244:                                              ; preds = %210
  %245 = load ptr, ptr %5, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.TensorDirConvPara, ptr %245, i32 0, i32 0
  %247 = load ptr, ptr %246, align 8, !tbaa !14
  %248 = getelementptr inbounds %struct.MLayer, ptr %247, i32 0, i32 5
  %249 = load i32, ptr %248, align 8, !tbaa !45
  %250 = icmp eq i32 %249, 0
  br i1 %250, label %251, label %288

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

252:                                              ; preds = %280, %251
  %253 = load i32, ptr %18, align 4, !tbaa !9
  %254 = load ptr, ptr %7, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.MTensor, ptr %254, i32 0, i32 0
  %256 = load i32, ptr %255, align 8, !tbaa !33
  %257 = icmp slt i32 %253, %256
  br i1 %257, label %259, label %258

258:                                              ; preds = %252
  store i32 13, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %283

259:                                              ; preds = %252
  %260 = load ptr, ptr %7, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct.MTensor, ptr %260, i32 0, i32 4
  %262 = load ptr, ptr %261, align 8, !tbaa !46
  %263 = load i32, ptr %18, align 4, !tbaa !9
  %264 = sext i32 %263 to i64
  %265 = getelementptr inbounds ptr, ptr %262, i64 %264
  %266 = load ptr, ptr %265, align 8, !tbaa !5
  %267 = load ptr, ptr %6, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.MTensor, ptr %267, i32 0, i32 2
  %269 = load i32, ptr %268, align 8, !tbaa !22
  %270 = load ptr, ptr %6, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct.MTensor, ptr %270, i32 0, i32 3
  %272 = load i32, ptr %271, align 4, !tbaa !24
  %273 = mul nsw i32 %269, %272
  %274 = load ptr, ptr %6, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.MTensor, ptr %274, i32 0, i32 1
  %276 = load i32, ptr %275, align 4, !tbaa !26
  %277 = mul nsw i32 %273, %276
  %278 = sext i32 %277 to i64
  %279 = mul i64 %278, 4
  call void @llvm.memset.p0.i64(ptr align 4 %266, i8 0, i64 %279, i1 false)
  br label %280

280:                                              ; preds = %259
  %281 = load i32, ptr %18, align 4, !tbaa !9
  %282 = add nsw i32 %281, 1
  store i32 %282, ptr %18, align 4, !tbaa !9
  br label %252, !llvm.loop !47

283:                                              ; preds = %258
  %284 = load ptr, ptr %5, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct.TensorDirConvPara, ptr %284, i32 0, i32 0
  %286 = load ptr, ptr %285, align 8, !tbaa !14
  %287 = getelementptr inbounds %struct.MLayer, ptr %286, i32 0, i32 5
  store i32 1, ptr %287, align 8, !tbaa !45
  br label %288

288:                                              ; preds = %283, %244
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %289

289:                                              ; preds = %333, %288
  %290 = load i32, ptr %19, align 4, !tbaa !9
  %291 = load ptr, ptr %6, align 8, !tbaa !5
  %292 = getelementptr inbounds %struct.MTensor, ptr %291, i32 0, i32 0
  %293 = load i32, ptr %292, align 8, !tbaa !33
  %294 = icmp slt i32 %290, %293
  br i1 %294, label %296, label %295

295:                                              ; preds = %289
  store i32 16, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %336

296:                                              ; preds = %289
  %297 = load i32, ptr %12, align 4, !tbaa !9
  %298 = load i32, ptr %13, align 4, !tbaa !9
  %299 = load ptr, ptr %5, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.TensorDirConvPara, ptr %299, i32 0, i32 1
  %301 = load i32, ptr %300, align 8, !tbaa !32
  %302 = load ptr, ptr %8, align 8, !tbaa !5
  %303 = load i32, ptr %19, align 4, !tbaa !9
  %304 = call ptr @mTensorMemory(ptr noundef %302, i32 noundef %303)
  %305 = load i32, ptr %12, align 4, !tbaa !9
  %306 = load ptr, ptr %10, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %306, i32 0, i32 1
  %308 = load ptr, ptr %307, align 8, !tbaa !28
  %309 = load i32, ptr %13, align 4, !tbaa !9
  %310 = load ptr, ptr %10, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %310, i32 0, i32 0
  %312 = load ptr, ptr %311, align 8, !tbaa !34
  %313 = load i32, ptr %13, align 4, !tbaa !9
  call void @mSgemm(i32 noundef 1, i32 noundef 0, i32 noundef %297, i32 noundef %298, i32 noundef %301, float noundef 1.000000e+00, ptr noundef %304, i32 noundef %305, ptr noundef %308, i32 noundef %309, float noundef 0.000000e+00, ptr noundef %312, i32 noundef %313)
  %314 = load ptr, ptr %10, align 8, !tbaa !5
  %315 = getelementptr inbounds %struct.HandleTensorDirConv, ptr %314, i32 0, i32 0
  %316 = load ptr, ptr %315, align 8, !tbaa !34
  %317 = getelementptr inbounds %struct.MMemoryBlock, ptr %316, i32 0, i32 2
  %318 = load ptr, ptr %317, align 8, !tbaa !30
  %319 = load ptr, ptr %7, align 8, !tbaa !5
  %320 = load i32, ptr %19, align 4, !tbaa !9
  %321 = load ptr, ptr %5, align 8, !tbaa !5
  %322 = getelementptr inbounds %struct.TensorDirConvPara, ptr %321, i32 0, i32 2
  %323 = load i32, ptr %322, align 4, !tbaa !25
  %324 = load ptr, ptr %5, align 8, !tbaa !5
  %325 = getelementptr inbounds %struct.TensorDirConvPara, ptr %324, i32 0, i32 3
  %326 = load i32, ptr %325, align 8, !tbaa !35
  %327 = load ptr, ptr %5, align 8, !tbaa !5
  %328 = getelementptr inbounds %struct.TensorDirConvPara, ptr %327, i32 0, i32 5
  %329 = load i32, ptr %328, align 8, !tbaa !36
  %330 = load ptr, ptr %5, align 8, !tbaa !5
  %331 = getelementptr inbounds %struct.TensorDirConvPara, ptr %330, i32 0, i32 4
  %332 = load i32, ptr %331, align 4, !tbaa !37
  call void @DirConvMatDataToTensor(ptr noundef %318, ptr noundef %319, i32 noundef %320, i32 noundef %323, i32 noundef %326, i32 noundef %329, i32 noundef %332)
  br label %333

333:                                              ; preds = %296
  %334 = load i32, ptr %19, align 4, !tbaa !9
  %335 = add nsw i32 %334, 1
  store i32 %335, ptr %19, align 4, !tbaa !9
  br label %289, !llvm.loop !48

336:                                              ; preds = %295
  store i32 0, ptr %17, align 4
  br label %337

337:                                              ; preds = %336, %243
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  %338 = load i32, ptr %17, align 4
  switch i32 %338, label %340 [
    i32 0, label %339
    i32 1, label %339
  ]

339:                                              ; preds = %337, %337
  ret void

340:                                              ; preds = %337
  unreachable
}

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

declare void @mSaxpby(i32 noundef, float noundef, ptr noundef, float noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #6

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind "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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 32}
!12 = !{!"MLayer", !7, i64 0, !10, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64}
!13 = !{!12, !6, i64 56}
!14 = !{!15, !6, i64 0}
!15 = !{!"TensorDirConvPara", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !16, i64 32, !16, i64 36, !16, i64 40}
!16 = !{!"float", !7, i64 0}
!17 = !{!12, !6, i64 40}
!18 = !{!12, !6, i64 48}
!19 = !{!20, !6, i64 16}
!20 = !{!"MHandle", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!21 = !{!20, !10, i64 4}
!22 = !{!23, !10, i64 8}
!23 = !{!"MTensor", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24}
!24 = !{!23, !10, i64 12}
!25 = !{!15, !10, i64 12}
!26 = !{!23, !10, i64 4}
!27 = !{!16, !16, i64 0}
!28 = !{!29, !6, i64 8}
!29 = !{!"HandleTensorDirConv", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!31, !6, i64 8}
!31 = !{!"MMemoryBlock", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32}
!32 = !{!15, !10, i64 8}
!33 = !{!23, !10, i64 0}
!34 = !{!29, !6, i64 0}
!35 = !{!15, !10, i64 16}
!36 = !{!15, !10, i64 24}
!37 = !{!15, !10, i64 20}
!38 = !{!15, !16, i64 40}
!39 = !{!29, !6, i64 16}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}
!42 = !{!15, !16, i64 32}
!43 = !{!15, !16, i64 36}
!44 = !{!15, !10, i64 28}
!45 = !{!12, !10, i64 64}
!46 = !{!23, !6, i64 16}
!47 = distinct !{!47, !41}
!48 = distinct !{!48, !41}


; 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 [93 x i8], align 1
@morn_tensor_register = external global [256 x %struct.TensorRegister], align 16
@morn_network_parafile = external local_unnamed_addr global ptr, align 8
@.str.27 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [19 x i8], align 1
@__FUNCTION__.mTensorDirConvBackward = external hidden unnamed_addr constant [23 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [19 x i8], align 1
@morn_network_time = external local_unnamed_addr global i32, align 4
@morn_network_save = external local_unnamed_addr global i32, align 4
@morn_network_error = external local_unnamed_addr global float, align 4
@morn_network_error_thresh = external local_unnamed_addr global float, align 4
@morn_network_time_max = external local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress 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, ...) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @DirConvTensorToMatData(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @DirConvMatDataToTensor(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #5

declare i32 @m_Hash(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @mSgemm(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, float noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @mTensorDirConvBackward(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca [64 x i8], align 16
  %3 = alloca ptr, align 8
  %magicptr = ptrtoint ptr %0 to i64
  switch i64 %magicptr, label %9 [
    i64 -1, label %4
    i64 0, label %4
  ]

4:                                                ; preds = %1, %1
  %5 = icmp eq ptr %0, null
  %6 = icmp eq ptr %0, inttoptr (i64 -1 to ptr)
  %7 = or i1 %5, %6
  %8 = zext i1 %7 to i32
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %8, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 576, ptr noundef nonnull @__FUNCTION__.mTensorDirConvBackward, ptr noundef nonnull @.str.29) #7
  br label %9

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

15:                                               ; preds = %9
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %14, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 577, ptr noundef nonnull @__FUNCTION__.mTensorDirConvBackward, ptr noundef nonnull @.str.31) #7
  br label %16

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

34:                                               ; preds = %16
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 585, ptr noundef nonnull @__FUNCTION__.mTensorDirConvBackward, ptr noundef nonnull @.str.32) #7
  br label %35

35:                                               ; preds = %34, %16
  %36 = getelementptr inbounds i8, ptr %25, i64 8
  %37 = load i32, ptr %36, align 8, !tbaa !20
  %38 = getelementptr inbounds i8, ptr %25, i64 12
  %39 = load i32, ptr %38, align 4, !tbaa !22
  %40 = mul nsw i32 %39, %37
  %41 = getelementptr inbounds i8, ptr %18, i64 12
  %42 = load i32, ptr %41, align 4, !tbaa !23
  %43 = shl nsw i32 %42, 1
  %44 = or disjoint i32 %43, 1
  %45 = getelementptr inbounds i8, ptr %21, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !24
  %47 = mul nsw i32 %44, %46
  %48 = add nsw i32 %47, 1
  %49 = load i32, ptr @morn_network_time, align 4
  %50 = load i32, ptr @morn_network_save, align 4, !tbaa !25
  %51 = srem i32 %49, %50
  %52 = icmp eq i32 %51, 0
  %53 = icmp sgt i32 %49, 0
  %or.cond = and i1 %53, %52
  br i1 %or.cond, label %62, label %54

54:                                               ; preds = %35
  %55 = load float, ptr @morn_network_error, align 4, !tbaa !26
  %56 = load float, ptr @morn_network_error_thresh, align 4, !tbaa !26
  %57 = fcmp ugt float %55, %56
  br i1 %57, label %58, label %62

58:                                               ; preds = %54
  %59 = load i32, ptr @morn_network_time_max, align 4, !tbaa !25
  %60 = sitofp i32 %59 to float
  %61 = fcmp oeq float %55, %60
  br i1 %61, label %62, label %75

62:                                               ; preds = %35, %58, %54
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %2) #7
  %63 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.27, ptr noundef nonnull %0, ptr noundef nonnull @.str.28) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %64 = getelementptr inbounds i8, ptr %30, i64 8
  %65 = load ptr, ptr %64, align 8, !tbaa !27
  %66 = getelementptr inbounds i8, ptr %65, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !29
  store ptr %67, ptr %3, align 8, !tbaa !31
  %68 = load ptr, ptr @morn_network_parafile, align 8, !tbaa !31
  %69 = call i32 @m_Hash(ptr noundef nonnull %2, i32 noundef -1) #7
  %70 = getelementptr inbounds i8, ptr %18, i64 8
  %71 = load i32, ptr %70, align 8, !tbaa !32
  %72 = shl i32 %48, 2
  %73 = mul i32 %72, %71
  %74 = call i32 @mMORNWrite(ptr noundef %68, i32 noundef %69, ptr noundef nonnull %3, i32 noundef 1, i32 noundef %73) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %2) #7
  br label %75

75:                                               ; preds = %62, %58
  %76 = load i32, ptr %25, align 8, !tbaa !33
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %78, label %._crit_edge

78:                                               ; preds = %75
  %79 = getelementptr inbounds i8, ptr %18, i64 16
  %80 = getelementptr inbounds i8, ptr %18, i64 24
  %81 = getelementptr inbounds i8, ptr %18, i64 20
  %82 = getelementptr inbounds i8, ptr %18, i64 8
  %83 = sitofp i32 %40 to float
  %84 = fdiv float 1.000000e+00, %83
  %85 = getelementptr inbounds i8, ptr %30, i64 16
  %86 = load ptr, ptr %30, align 8, !tbaa !34
  %87 = getelementptr inbounds i8, ptr %86, i64 8
  %88 = load ptr, ptr %87, align 8, !tbaa !29
  %89 = load i32, ptr %41, align 4, !tbaa !23
  %90 = load i32, ptr %79, align 8, !tbaa !35
  %91 = load i32, ptr %80, align 8, !tbaa !36
  %92 = load i32, ptr %81, align 4, !tbaa !37
  call void @DirConvTensorToMatData(ptr noundef nonnull %21, i32 noundef 0, ptr noundef %88, i32 noundef %89, i32 noundef %90, i32 noundef %91, i32 noundef %92)
  %93 = load i32, ptr %82, align 8, !tbaa !32
  %94 = call ptr @mTensorMemory(ptr noundef nonnull %25, i32 noundef 0) #7
  %95 = load ptr, ptr %30, align 8, !tbaa !34
  %96 = getelementptr inbounds i8, ptr %18, i64 40
  %97 = load float, ptr %96, align 8, !tbaa !38
  %98 = load ptr, ptr %85, align 8, !tbaa !39
  call void @mSgemm(i32 noundef 0, i32 noundef 0, i32 noundef %93, i32 noundef %48, i32 noundef %40, float noundef %84, ptr noundef %94, i32 noundef %40, ptr noundef %95, i32 noundef %48, float noundef %97, ptr noundef %98, i32 noundef %48) #7
  %99 = load i32, ptr %25, align 8, !tbaa !33
  %100 = icmp sgt i32 %99, 1
  br i1 %100, label %.peel.next, label %._crit_edge

._crit_edge:                                      ; preds = %.peel.next, %78, %75
  %101 = getelementptr inbounds i8, ptr %18, i64 8
  %102 = load i32, ptr %101, align 8, !tbaa !32
  %103 = mul nsw i32 %102, %48
  %104 = getelementptr inbounds i8, ptr %18, i64 32
  %105 = load float, ptr %104, align 8, !tbaa !40
  %106 = load i32, ptr %21, align 8, !tbaa !33
  %107 = sitofp i32 %106 to float
  %108 = fdiv float %105, %107
  %109 = fsub float 0.000000e+00, %108
  %110 = getelementptr inbounds i8, ptr %30, i64 16
  %111 = load ptr, ptr %110, align 8, !tbaa !39
  %112 = getelementptr inbounds i8, ptr %18, i64 36
  %113 = load float, ptr %112, align 4, !tbaa !41
  %114 = fneg float %113
  %115 = call float @llvm.fmuladd.f32(float %114, float %105, float 1.000000e+00)
  %116 = getelementptr inbounds i8, ptr %30, i64 8
  %117 = load ptr, ptr %116, align 8, !tbaa !27
  call void @mSaxpby(i32 noundef %103, float noundef %109, ptr noundef %111, float noundef %115, ptr noundef %117) #7
  %118 = getelementptr inbounds i8, ptr %18, i64 28
  %119 = load i32, ptr %118, align 4, !tbaa !42
  %120 = icmp eq i32 %119, 0
  br i1 %120, label %.loopexit, label %135

.peel.next:                                       ; preds = %78, %.peel.next
  %.08891 = phi i32 [ %132, %.peel.next ], [ 1, %78 ]
  %121 = load ptr, ptr %30, align 8, !tbaa !34
  %122 = getelementptr inbounds i8, ptr %121, i64 8
  %123 = load ptr, ptr %122, align 8, !tbaa !29
  %124 = load i32, ptr %41, align 4, !tbaa !23
  %125 = load i32, ptr %79, align 8, !tbaa !35
  %126 = load i32, ptr %80, align 8, !tbaa !36
  %127 = load i32, ptr %81, align 4, !tbaa !37
  call void @DirConvTensorToMatData(ptr noundef %21, i32 noundef %.08891, ptr noundef %123, i32 noundef %124, i32 noundef %125, i32 noundef %126, i32 noundef %127)
  %128 = load i32, ptr %82, align 8, !tbaa !32
  %129 = call ptr @mTensorMemory(ptr noundef nonnull %25, i32 noundef %.08891) #7
  %130 = load ptr, ptr %30, align 8, !tbaa !34
  %131 = load ptr, ptr %85, align 8, !tbaa !39
  call void @mSgemm(i32 noundef 0, i32 noundef 0, i32 noundef %128, i32 noundef %48, i32 noundef %40, float noundef %84, ptr noundef %129, i32 noundef %40, ptr noundef %130, i32 noundef %48, float noundef 1.000000e+00, ptr noundef %131, i32 noundef %48) #7
  %132 = add nuw nsw i32 %.08891, 1
  %133 = load i32, ptr %25, align 8, !tbaa !33
  %134 = icmp slt i32 %132, %133
  br i1 %134, label %.peel.next, label %._crit_edge, !llvm.loop !43

135:                                              ; preds = %._crit_edge
  %136 = load ptr, ptr %18, align 8, !tbaa !12
  %137 = getelementptr inbounds i8, ptr %136, i64 64
  %138 = load i32, ptr %137, align 8, !tbaa !46
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %.preheader, label %161

.preheader:                                       ; preds = %135
  %140 = load i32, ptr %23, align 8, !tbaa !33
  %141 = icmp sgt i32 %140, 0
  br i1 %141, label %.lr.ph93, label %._crit_edge94

.lr.ph93:                                         ; preds = %.preheader
  %142 = getelementptr inbounds i8, ptr %23, i64 16
  %143 = getelementptr inbounds i8, ptr %21, i64 8
  %144 = getelementptr inbounds i8, ptr %21, i64 12
  br label %147

._crit_edge94.loopexit:                           ; preds = %147
  %.pre = load ptr, ptr %18, align 8, !tbaa !12
  br label %._crit_edge94

._crit_edge94:                                    ; preds = %._crit_edge94.loopexit, %.preheader
  %145 = phi ptr [ %.pre, %._crit_edge94.loopexit ], [ %136, %.preheader ]
  %146 = getelementptr inbounds i8, ptr %145, i64 64
  store i32 1, ptr %146, align 8, !tbaa !46
  br label %161

147:                                              ; preds = %.lr.ph93, %147
  %indvars.iv = phi i64 [ 0, %.lr.ph93 ], [ %indvars.iv.next, %147 ]
  %148 = load ptr, ptr %142, align 8, !tbaa !47
  %149 = getelementptr inbounds ptr, ptr %148, i64 %indvars.iv
  %150 = load ptr, ptr %149, align 8, !tbaa !31
  %151 = load i32, ptr %143, align 8, !tbaa !20
  %152 = load i32, ptr %144, align 4, !tbaa !22
  %153 = mul nsw i32 %152, %151
  %154 = load i32, ptr %45, align 4, !tbaa !24
  %155 = mul nsw i32 %153, %154
  %156 = sext i32 %155 to i64
  %157 = shl nsw i64 %156, 2
  call void @llvm.memset.p0.i64(ptr align 4 %150, i8 0, i64 %157, i1 false)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %158 = load i32, ptr %23, align 8, !tbaa !33
  %159 = sext i32 %158 to i64
  %160 = icmp slt i64 %indvars.iv.next, %159
  br i1 %160, label %147, label %._crit_edge94.loopexit, !llvm.loop !48

161:                                              ; preds = %._crit_edge94, %135
  %162 = load i32, ptr %21, align 8, !tbaa !33
  %163 = icmp sgt i32 %162, 0
  br i1 %163, label %.lr.ph97, label %.loopexit

.lr.ph97:                                         ; preds = %161
  %164 = getelementptr inbounds i8, ptr %18, i64 16
  %165 = getelementptr inbounds i8, ptr %18, i64 24
  %166 = getelementptr inbounds i8, ptr %18, i64 20
  br label %167

167:                                              ; preds = %.lr.ph97, %167
  %.095 = phi i32 [ 0, %.lr.ph97 ], [ %179, %167 ]
  %168 = load i32, ptr %101, align 8, !tbaa !32
  %169 = call ptr @mTensorMemory(ptr noundef nonnull %25, i32 noundef %.095) #7
  %170 = load ptr, ptr %116, align 8, !tbaa !27
  %171 = load ptr, ptr %30, align 8, !tbaa !34
  call void @mSgemm(i32 noundef 1, i32 noundef 0, i32 noundef %40, i32 noundef %48, i32 noundef %168, float noundef 1.000000e+00, ptr noundef %169, i32 noundef %40, ptr noundef %170, i32 noundef %48, float noundef 0.000000e+00, ptr noundef %171, i32 noundef %48) #7
  %172 = load ptr, ptr %30, align 8, !tbaa !34
  %173 = getelementptr inbounds i8, ptr %172, i64 8
  %174 = load ptr, ptr %173, align 8, !tbaa !29
  %175 = load i32, ptr %41, align 4, !tbaa !23
  %176 = load i32, ptr %164, align 8, !tbaa !35
  %177 = load i32, ptr %165, align 8, !tbaa !36
  %178 = load i32, ptr %166, align 4, !tbaa !37
  call void @DirConvMatDataToTensor(ptr noundef %174, ptr noundef %23, i32 noundef %.095, i32 noundef %175, i32 noundef %176, i32 noundef %177, i32 noundef %178)
  %179 = add nuw nsw i32 %.095, 1
  %180 = load i32, ptr %21, align 8, !tbaa !33
  %181 = icmp slt i32 %179, %180
  br i1 %181, label %167, label %.loopexit, !llvm.loop !49

.loopexit:                                        ; preds = %167, %161, %._crit_edge
  ret void
}

declare i32 @mMORNWrite(ptr noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @mSaxpby(i32 noundef, float noundef, ptr noundef, float noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #6

attributes #0 = { mustprogress 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 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nofree nounwind "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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { 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, !9, i64 32}
!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, !10, i64 56}
!12 = !{!13, !10, i64 0}
!13 = !{!"TensorDirConvPara", !10, i64 0, !9, i64 8, !9, i64 12, !9, i64 16, !9, i64 20, !9, i64 24, !9, i64 28, !14, i64 32, !14, i64 36, !14, i64 40}
!14 = !{!"float", !7, i64 0}
!15 = !{!6, !10, i64 40}
!16 = !{!6, !10, i64 48}
!17 = !{!18, !10, i64 16}
!18 = !{!"MHandle", !9, i64 0, !9, i64 4, !10, i64 8, !10, i64 16}
!19 = !{!18, !9, i64 4}
!20 = !{!21, !9, i64 8}
!21 = !{!"MTensor", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !10, i64 16, !9, i64 24}
!22 = !{!21, !9, i64 12}
!23 = !{!13, !9, i64 12}
!24 = !{!21, !9, i64 4}
!25 = !{!9, !9, i64 0}
!26 = !{!14, !14, i64 0}
!27 = !{!28, !10, i64 8}
!28 = !{!"HandleTensorDirConv", !10, i64 0, !10, i64 8, !10, i64 16}
!29 = !{!30, !10, i64 8}
!30 = !{!"MMemoryBlock", !9, i64 0, !9, i64 4, !10, i64 8, !10, i64 16, !10, i64 24, !9, i64 32}
!31 = !{!10, !10, i64 0}
!32 = !{!13, !9, i64 8}
!33 = !{!21, !9, i64 0}
!34 = !{!28, !10, i64 0}
!35 = !{!13, !9, i64 16}
!36 = !{!13, !9, i64 24}
!37 = !{!13, !9, i64 20}
!38 = !{!13, !14, i64 40}
!39 = !{!28, !10, i64 16}
!40 = !{!13, !14, i64 32}
!41 = !{!13, !14, i64 36}
!42 = !{!13, !9, i64 28}
!43 = distinct !{!43, !44, !45}
!44 = !{!"llvm.loop.mustprogress"}
!45 = !{!"llvm.loop.peeled.count", i32 1}
!46 = !{!6, !9, i64 64}
!47 = !{!21, !10, i64 16}
!48 = distinct !{!48, !44}
!49 = distinct !{!49, !44}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass