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

; 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.TensorSplitPara = type { ptr, i32, i32, i32 }
%struct.MTensor = type { i32, i32, i32, i32, ptr, i32 }

@.str.1 = external hidden unnamed_addr constant [95 x i8], align 1
@morn_tensor_register = external global [256 x %struct.TensorRegister], align 16
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [6 x i8], align 1
@__FUNCTION__.mTensorSplitBackward = external hidden unnamed_addr constant [21 x i8], align 1

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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind uwtable
define dso_local void @mTensorSplitBackward(ptr noundef %0) #4 {
  %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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %20, label %16

16:                                               ; preds = %13
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = ptrtoint ptr %17 to i64
  %19 = icmp eq i64 %18, -1
  br label %20

20:                                               ; preds = %16, %13
  %21 = phi i1 [ true, %13 ], [ %19, %16 ]
  %22 = zext i1 %21 to i32
  store i32 %22, ptr %3, align 4, !tbaa !9
  %23 = load i32, ptr %3, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %20
  %26 = load i32, ptr %3, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %26, i32 noundef -1, ptr noundef @.str.1, i32 noundef 210, ptr noundef @__FUNCTION__.mTensorSplitBackward, ptr noundef @.str.9)
  br label %27

27:                                               ; preds = %25, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %28

28:                                               ; preds = %27
  br label %29

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

40:                                               ; preds = %29
  %41 = load i32, ptr %4, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %41, i32 noundef -1, ptr noundef @.str.1, i32 noundef 211, ptr noundef @__FUNCTION__.mTensorSplitBackward, ptr noundef @.str.11)
  br label %42

42:                                               ; preds = %40, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %43

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.MLayer, ptr %44, i32 0, i32 4
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  store ptr %46, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.TensorSplitPara, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = getelementptr inbounds %struct.MLayer, ptr %49, i32 0, i32 3
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  store ptr %51, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.MLayer, ptr %52, i32 0, i32 3
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  store ptr %54, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.MTensor, ptr %55, i32 0, i32 2
  %57 = load i32, ptr %56, align 8, !tbaa !17
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.MTensor, ptr %58, i32 0, i32 3
  %60 = load i32, ptr %59, align 4, !tbaa !19
  %61 = mul nsw i32 %57, %60
  store i32 %61, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.TensorSplitPara, ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 4, !tbaa !20
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = mul nsw i32 %64, %65
  store i32 %66, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %228, %43
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.MTensor, ptr %69, i32 0, i32 0
  %71 = load i32, ptr %70, align 8, !tbaa !21
  %72 = icmp slt i32 %68, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %67
  store i32 6, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %231

74:                                               ; preds = %67
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.TensorSplitPara, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !22
  %78 = icmp eq i32 %77, 1
  br i1 %78, label %79, label %227

79:                                               ; preds = %74
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.MTensor, ptr %80, i32 0, i32 4
  %82 = load ptr, ptr %81, align 8, !tbaa !23
  %83 = load i32, ptr %10, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds ptr, ptr %82, i64 %84
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.MTensor, ptr %87, i32 0, i32 4
  %89 = load ptr, ptr %88, align 8, !tbaa !23
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds ptr, ptr %89, i64 %91
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  %94 = icmp ne ptr %86, %93
  br i1 %94, label %95, label %227

95:                                               ; preds = %79
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.TensorSplitPara, ptr %96, i32 0, i32 0
  %98 = load ptr, ptr %97, align 8, !tbaa !14
  %99 = getelementptr inbounds %struct.MLayer, ptr %98, i32 0, i32 5
  %100 = load i32, ptr %99, align 8, !tbaa !24
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %102, label %186

102:                                              ; preds = %95
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.TensorSplitPara, ptr %103, i32 0, i32 2
  %105 = load i32, ptr %104, align 4, !tbaa !20
  %106 = icmp sgt i32 %105, 0
  br i1 %106, label %107, label %122

107:                                              ; preds = %102
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.MTensor, ptr %108, i32 0, i32 4
  %110 = load ptr, ptr %109, align 8, !tbaa !23
  %111 = load i32, ptr %10, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds ptr, ptr %110, i64 %112
  %114 = load ptr, ptr %113, align 8, !tbaa !5
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.TensorSplitPara, ptr %115, i32 0, i32 2
  %117 = load i32, ptr %116, align 4, !tbaa !20
  %118 = load i32, ptr %8, align 4, !tbaa !9
  %119 = mul nsw i32 %117, %118
  %120 = sext i32 %119 to i64
  %121 = mul i64 %120, 4
  call void @llvm.memset.p0.i64(ptr align 4 %114, i8 0, i64 %121, i1 false)
  br label %122

122:                                              ; preds = %107, %102
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.MTensor, ptr %123, i32 0, i32 4
  %125 = load ptr, ptr %124, align 8, !tbaa !23
  %126 = load i32, ptr %10, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds ptr, ptr %125, i64 %127
  %129 = load ptr, ptr %128, align 8, !tbaa !5
  %130 = load i32, ptr %9, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds float, ptr %129, i64 %131
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.MTensor, ptr %133, i32 0, i32 4
  %135 = load ptr, ptr %134, align 8, !tbaa !23
  %136 = load i32, ptr %10, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds ptr, ptr %135, i64 %137
  %139 = load ptr, ptr %138, align 8, !tbaa !5
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.MTensor, ptr %140, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !25
  %143 = load i32, ptr %8, align 4, !tbaa !9
  %144 = mul nsw i32 %142, %143
  %145 = sext i32 %144 to i64
  %146 = mul i64 %145, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %132, ptr align 4 %139, i64 %146, i1 false)
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.TensorSplitPara, ptr %147, i32 0, i32 3
  %149 = load i32, ptr %148, align 8, !tbaa !26
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.MTensor, ptr %150, i32 0, i32 1
  %152 = load i32, ptr %151, align 4, !tbaa !25
  %153 = sub nsw i32 %152, 1
  %154 = icmp slt i32 %149, %153
  br i1 %154, label %155, label %185

155:                                              ; preds = %122
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.MTensor, ptr %156, i32 0, i32 4
  %158 = load ptr, ptr %157, align 8, !tbaa !23
  %159 = load i32, ptr %10, align 4, !tbaa !9
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds ptr, ptr %158, i64 %160
  %162 = load ptr, ptr %161, align 8, !tbaa !5
  %163 = load i32, ptr %9, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds float, ptr %162, i64 %164
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.MTensor, ptr %166, i32 0, i32 1
  %168 = load i32, ptr %167, align 4, !tbaa !25
  %169 = load i32, ptr %8, align 4, !tbaa !9
  %170 = mul nsw i32 %168, %169
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds float, ptr %165, i64 %171
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.MTensor, ptr %173, i32 0, i32 1
  %175 = load i32, ptr %174, align 4, !tbaa !25
  %176 = sub nsw i32 %175, 1
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.TensorSplitPara, ptr %177, i32 0, i32 3
  %179 = load i32, ptr %178, align 8, !tbaa !26
  %180 = sub nsw i32 %176, %179
  %181 = load i32, ptr %8, align 4, !tbaa !9
  %182 = mul nsw i32 %180, %181
  %183 = sext i32 %182 to i64
  %184 = mul i64 %183, 4
  call void @llvm.memset.p0.i64(ptr align 4 %172, i8 0, i64 %184, i1 false)
  br label %185

185:                                              ; preds = %155, %122
  br label %226

186:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %187

187:                                              ; preds = %222, %186
  %188 = load i32, ptr %12, align 4, !tbaa !9
  %189 = load ptr, ptr %7, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.MTensor, ptr %189, i32 0, i32 1
  %191 = load i32, ptr %190, align 4, !tbaa !25
  %192 = load i32, ptr %8, align 4, !tbaa !9
  %193 = mul nsw i32 %191, %192
  %194 = icmp slt i32 %188, %193
  br i1 %194, label %196, label %195

195:                                              ; preds = %187
  store i32 9, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %225

196:                                              ; preds = %187
  %197 = load ptr, ptr %7, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.MTensor, ptr %197, i32 0, i32 4
  %199 = load ptr, ptr %198, align 8, !tbaa !23
  %200 = load i32, ptr %10, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds ptr, ptr %199, i64 %201
  %203 = load ptr, ptr %202, align 8, !tbaa !5
  %204 = load i32, ptr %12, align 4, !tbaa !9
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds float, ptr %203, i64 %205
  %207 = load float, ptr %206, align 4, !tbaa !27
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.MTensor, ptr %208, i32 0, i32 4
  %210 = load ptr, ptr %209, align 8, !tbaa !23
  %211 = load i32, ptr %10, align 4, !tbaa !9
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds ptr, ptr %210, i64 %212
  %214 = load ptr, ptr %213, align 8, !tbaa !5
  %215 = load i32, ptr %9, align 4, !tbaa !9
  %216 = load i32, ptr %12, align 4, !tbaa !9
  %217 = add nsw i32 %215, %216
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds float, ptr %214, i64 %218
  %220 = load float, ptr %219, align 4, !tbaa !27
  %221 = fadd float %220, %207
  store float %221, ptr %219, align 4, !tbaa !27
  br label %222

222:                                              ; preds = %196
  %223 = load i32, ptr %12, align 4, !tbaa !9
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %12, align 4, !tbaa !9
  br label %187, !llvm.loop !29

225:                                              ; preds = %195
  br label %226

226:                                              ; preds = %225, %185
  br label %227

227:                                              ; preds = %226, %79, %74
  br label %228

228:                                              ; preds = %227
  %229 = load i32, ptr %10, align 4, !tbaa !9
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %10, align 4, !tbaa !9
  br label %67, !llvm.loop !31

231:                                              ; preds = %73
  %232 = load ptr, ptr %5, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.TensorSplitPara, ptr %232, i32 0, i32 1
  %234 = load i32, ptr %233, align 8, !tbaa !22
  %235 = icmp eq i32 %234, 1
  br i1 %235, label %236, label %241

236:                                              ; preds = %231
  %237 = load ptr, ptr %5, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.TensorSplitPara, ptr %237, i32 0, i32 0
  %239 = load ptr, ptr %238, align 8, !tbaa !14
  %240 = getelementptr inbounds %struct.MLayer, ptr %239, i32 0, i32 5
  store i32 1, ptr %240, align 8, !tbaa !24
  br label %241

241:                                              ; preds = %236, %231
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void
}

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

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"TensorSplitPara", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16}
!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 = !{!15, !10, i64 12}
!21 = !{!18, !10, i64 0}
!22 = !{!15, !10, i64 8}
!23 = !{!18, !6, i64 16}
!24 = !{!12, !10, i64 64}
!25 = !{!18, !10, i64 4}
!26 = !{!15, !10, i64 16}
!27 = !{!28, !28, i64 0}
!28 = !{!"float", !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}


; 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 [95 x i8], align 1
@morn_tensor_register = external global [256 x %struct.TensorRegister], align 16
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [6 x i8], align 1
@__FUNCTION__.mTensorSplitBackward = external hidden unnamed_addr constant [21 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mTensorSplitBackward(ptr noundef %0) local_unnamed_addr #3 {
  %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 210, ptr noundef nonnull @__FUNCTION__.mTensorSplitBackward, ptr noundef nonnull @.str.9) #5
  br label %7

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

13:                                               ; preds = %7
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %12, i32 noundef -1, ptr noundef nonnull @.str.1, i32 noundef 211, ptr noundef nonnull @__FUNCTION__.mTensorSplitBackward, ptr noundef nonnull @.str.11) #5
  br label %14

14:                                               ; preds = %13, %7
  %15 = getelementptr inbounds i8, ptr %0, i64 56
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = getelementptr inbounds i8, ptr %18, i64 8
  %20 = load i32, ptr %19, align 8, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %18, i64 12
  %22 = load i32, ptr %21, align 4, !tbaa !15
  %23 = mul i32 %22, %20
  %24 = getelementptr inbounds i8, ptr %16, i64 12
  %25 = load i32, ptr %18, align 8, !tbaa !16
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph66, label %._crit_edge

.lr.ph66:                                         ; preds = %14
  %27 = load i32, ptr %24, align 4, !tbaa !17
  %28 = mul i32 %27, %23
  %29 = load ptr, ptr %16, align 8, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %29, i64 48
  %31 = load ptr, ptr %30, align 8, !tbaa !12
  %32 = getelementptr inbounds i8, ptr %16, i64 8
  %33 = getelementptr inbounds i8, ptr %31, i64 16
  %34 = getelementptr inbounds i8, ptr %18, i64 16
  %35 = getelementptr inbounds i8, ptr %18, i64 4
  %36 = sext i32 %28 to i64
  %37 = getelementptr inbounds i8, ptr %16, i64 16
  %38 = getelementptr inbounds i8, ptr %31, i64 4
  %39 = load i32, ptr %32, align 8, !tbaa !20
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %.lr.ph66.split.preheader, label %._crit_edge

.lr.ph66.split.preheader:                         ; preds = %.lr.ph66
  %41 = shl nsw i64 %36, 2
  br label %.lr.ph66.split

._crit_edge:                                      ; preds = %.loopexit, %.lr.ph66, %14
  %42 = getelementptr inbounds i8, ptr %16, i64 8
  %43 = load i32, ptr %42, align 8, !tbaa !20
  %44 = icmp eq i32 %43, 1
  br i1 %44, label %127, label %130

.lr.ph66.splitthread-pre-split:                   ; preds = %.loopexit
  %.pr = load i32, ptr %32, align 8, !tbaa !20
  br label %.lr.ph66.split

.lr.ph66.split:                                   ; preds = %.lr.ph66.split.preheader, %.lr.ph66.splitthread-pre-split
  %45 = phi i32 [ %.pr, %.lr.ph66.splitthread-pre-split ], [ 1, %.lr.ph66.split.preheader ]
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %.lr.ph66.splitthread-pre-split ], [ 0, %.lr.ph66.split.preheader ]
  %46 = icmp eq i32 %45, 1
  br i1 %46, label %47, label %.loopexit

47:                                               ; preds = %.lr.ph66.split
  %48 = load ptr, ptr %33, align 8, !tbaa !21
  %49 = getelementptr inbounds ptr, ptr %48, i64 %indvars.iv69
  %50 = load ptr, ptr %49, align 8, !tbaa !22
  %51 = load ptr, ptr %34, align 8, !tbaa !21
  %52 = getelementptr inbounds ptr, ptr %51, i64 %indvars.iv69
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %.not63 = icmp eq ptr %50, %53
  br i1 %.not63, label %.loopexit, label %54

54:                                               ; preds = %47
  %55 = load ptr, ptr %16, align 8, !tbaa !19
  %56 = getelementptr inbounds i8, ptr %55, i64 64
  %57 = load i32, ptr %56, align 8, !tbaa !23
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %76, label %.preheader

.preheader:                                       ; preds = %54
  %59 = load i32, ptr %35, align 4, !tbaa !24
  %60 = mul nsw i32 %59, %23
  %61 = icmp sgt i32 %60, 0
  br i1 %61, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %60 to i64
  %invariant.gep = getelementptr float, ptr %50, i64 %36
  %min.iters.check = icmp ult i32 %60, 8
  br i1 %min.iters.check, label %.lr.ph.preheader81, label %vector.memcheck

.lr.ph.preheader81:                               ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader81, %.lr.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %.lr.ph.prol ], [ %indvars.iv.ph, %.lr.ph.preheader81 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader81 ]
  %62 = getelementptr inbounds float, ptr %53, i64 %indvars.iv.prol
  %63 = load float, ptr %62, align 4, !tbaa !25
  %gep.prol = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.prol
  %64 = load float, ptr %gep.prol, align 4, !tbaa !25
  %65 = fadd float %63, %64
  store float %65, ptr %gep.prol, align 4, !tbaa !25
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !27

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader81
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph.preheader81 ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %66 = sub nsw i64 %indvars.iv.ph, %wide.trip.count
  %67 = icmp ugt i64 %66, -4
  br i1 %67, label %.loopexit, label %.lr.ph

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %scevgep = getelementptr i8, ptr %50, i64 %41
  %68 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep76 = getelementptr i8, ptr %scevgep, i64 %68
  %scevgep77 = getelementptr i8, ptr %53, i64 %68
  %bound0 = icmp ult ptr %invariant.gep, %scevgep77
  %bound1 = icmp ult ptr %53, %scevgep76
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph.preheader81, label %vector.ph

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

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %69 = getelementptr inbounds float, ptr %53, i64 %index
  %70 = getelementptr inbounds i8, ptr %69, i64 16
  %wide.load = load <4 x float>, ptr %69, align 4, !tbaa !25, !alias.scope !29
  %wide.load78 = load <4 x float>, ptr %70, align 4, !tbaa !25, !alias.scope !29
  %71 = getelementptr float, ptr %invariant.gep, i64 %index
  %72 = getelementptr i8, ptr %71, i64 16
  %wide.load79 = load <4 x float>, ptr %71, align 4, !tbaa !25, !alias.scope !32, !noalias !29
  %wide.load80 = load <4 x float>, ptr %72, align 4, !tbaa !25, !alias.scope !32, !noalias !29
  %73 = fadd <4 x float> %wide.load, %wide.load79
  %74 = fadd <4 x float> %wide.load78, %wide.load80
  store <4 x float> %73, ptr %71, align 4, !tbaa !25, !alias.scope !32, !noalias !29
  store <4 x float> %74, ptr %72, align 4, !tbaa !25, !alias.scope !32, !noalias !29
  %index.next = add nuw i64 %index, 8
  %75 = icmp eq i64 %index.next, %n.vec
  br i1 %75, label %middle.block, label %vector.body, !llvm.loop !34

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

76:                                               ; preds = %54
  %77 = load i32, ptr %24, align 4, !tbaa !17
  %78 = icmp sgt i32 %77, 0
  br i1 %78, label %79, label %83

79:                                               ; preds = %76
  %80 = mul nsw i32 %77, %23
  %81 = sext i32 %80 to i64
  %82 = shl nsw i64 %81, 2
  tail call void @llvm.memset.p0.i64(ptr align 4 %50, i8 0, i64 %82, i1 false)
  %.pre = load ptr, ptr %33, align 8, !tbaa !21
  %.phi.trans.insert = getelementptr inbounds ptr, ptr %.pre, i64 %indvars.iv69
  %.pre72 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !22
  %.pre73 = load ptr, ptr %34, align 8, !tbaa !21
  %.phi.trans.insert74 = getelementptr inbounds ptr, ptr %.pre73, i64 %indvars.iv69
  %.pre75 = load ptr, ptr %.phi.trans.insert74, align 8, !tbaa !22
  br label %83

83:                                               ; preds = %79, %76
  %84 = phi ptr [ %.pre75, %79 ], [ %53, %76 ]
  %85 = phi ptr [ %.pre72, %79 ], [ %50, %76 ]
  %86 = getelementptr inbounds float, ptr %85, i64 %36
  %87 = load i32, ptr %35, align 4, !tbaa !24
  %88 = mul nsw i32 %87, %23
  %89 = sext i32 %88 to i64
  %90 = shl nsw i64 %89, 2
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 4 %86, ptr align 4 %84, i64 %90, i1 false)
  %91 = load i32, ptr %37, align 8, !tbaa !38
  %92 = load i32, ptr %38, align 4, !tbaa !24
  %93 = add nsw i32 %92, -1
  %94 = icmp slt i32 %91, %93
  br i1 %94, label %95, label %.loopexit

95:                                               ; preds = %83
  %96 = load ptr, ptr %33, align 8, !tbaa !21
  %97 = getelementptr inbounds ptr, ptr %96, i64 %indvars.iv69
  %98 = load ptr, ptr %97, align 8, !tbaa !22
  %99 = getelementptr inbounds float, ptr %98, i64 %36
  %100 = load i32, ptr %35, align 4, !tbaa !24
  %101 = mul nsw i32 %100, %23
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds float, ptr %99, i64 %102
  %104 = sub nsw i32 %93, %91
  %105 = mul nsw i32 %104, %23
  %106 = sext i32 %105 to i64
  %107 = shl nsw i64 %106, 2
  tail call void @llvm.memset.p0.i64(ptr align 4 %103, i8 0, i64 %107, i1 false)
  br label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %108 = getelementptr inbounds float, ptr %53, i64 %indvars.iv
  %109 = load float, ptr %108, align 4, !tbaa !25
  %gep = getelementptr float, ptr %invariant.gep, i64 %indvars.iv
  %110 = load float, ptr %gep, align 4, !tbaa !25
  %111 = fadd float %109, %110
  store float %111, ptr %gep, align 4, !tbaa !25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %112 = getelementptr inbounds float, ptr %53, i64 %indvars.iv.next
  %113 = load float, ptr %112, align 4, !tbaa !25
  %gep.1 = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.next
  %114 = load float, ptr %gep.1, align 4, !tbaa !25
  %115 = fadd float %113, %114
  store float %115, ptr %gep.1, align 4, !tbaa !25
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %116 = getelementptr inbounds float, ptr %53, i64 %indvars.iv.next.1
  %117 = load float, ptr %116, align 4, !tbaa !25
  %gep.2 = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.next.1
  %118 = load float, ptr %gep.2, align 4, !tbaa !25
  %119 = fadd float %117, %118
  store float %119, ptr %gep.2, align 4, !tbaa !25
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %120 = getelementptr inbounds float, ptr %53, i64 %indvars.iv.next.2
  %121 = load float, ptr %120, align 4, !tbaa !25
  %gep.3 = getelementptr float, ptr %invariant.gep, i64 %indvars.iv.next.2
  %122 = load float, ptr %gep.3, align 4, !tbaa !25
  %123 = fadd float %121, %122
  store float %123, ptr %gep.3, align 4, !tbaa !25
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %.loopexit, label %.lr.ph, !llvm.loop !39

.loopexit:                                        ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %.preheader, %.lr.ph66.split, %47, %83, %95
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %124 = load i32, ptr %18, align 8, !tbaa !16
  %125 = sext i32 %124 to i64
  %126 = icmp slt i64 %indvars.iv.next70, %125
  br i1 %126, label %.lr.ph66.splitthread-pre-split, label %._crit_edge, !llvm.loop !40

127:                                              ; preds = %._crit_edge
  %128 = load ptr, ptr %16, align 8, !tbaa !19
  %129 = getelementptr inbounds i8, ptr %128, i64 64
  store i32 1, ptr %129, align 8, !tbaa !23
  br label %130

130:                                              ; preds = %127, %._crit_edge
  ret void
}

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #6 = { 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 = !{!6, !10, i64 48}
!13 = !{!14, !9, i64 8}
!14 = !{!"MTensor", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !10, i64 16, !9, i64 24}
!15 = !{!14, !9, i64 12}
!16 = !{!14, !9, i64 0}
!17 = !{!18, !9, i64 12}
!18 = !{!"TensorSplitPara", !10, i64 0, !9, i64 8, !9, i64 12, !9, i64 16}
!19 = !{!18, !10, i64 0}
!20 = !{!18, !9, i64 8}
!21 = !{!14, !10, i64 16}
!22 = !{!10, !10, i64 0}
!23 = !{!6, !9, i64 64}
!24 = !{!14, !9, i64 4}
!25 = !{!26, !26, i64 0}
!26 = !{!"float", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.unroll.disable"}
!29 = !{!30}
!30 = distinct !{!30, !31}
!31 = distinct !{!31, !"LVerDomain"}
!32 = !{!33}
!33 = distinct !{!33, !31}
!34 = distinct !{!34, !35, !36, !37}
!35 = !{!"llvm.loop.mustprogress"}
!36 = !{!"llvm.loop.isvectorized", i32 1}
!37 = !{!"llvm.loop.unroll.runtime.disable"}
!38 = !{!18, !9, i64 16}
!39 = distinct !{!39, !35, !36}
!40 = distinct !{!40, !35, !41}
!41 = !{!"llvm.loop.unswitch.partial.disable"}


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