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

; 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.HandleList = type { %struct.MList, i32, i32, i32, i32 }
%struct.MList = type { i32, ptr }
%struct.MHandle = type { i32, i32, ptr, ptr }
%struct.HandleTensorCreate = type { ptr, ptr, [8 x i64], i32, i32, i32, ptr, ptr, ptr, ptr }
%struct.MTensor = type { i32, i32, i32, i32, ptr, i32 }

@.str = external hidden unnamed_addr constant [87 x i8], align 1
@__FUNCTION__.TensorCreate = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @endTensorCreate(ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @TensorCreate(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5) #0 {
  %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 ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store i32 %0, ptr %8, align 4, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !5
  store i32 %3, ptr %11, align 4, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !9
  store i32 %5, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %23 = call ptr @ObjectAlloc(i32 noundef 32)
  store ptr %23, ptr %14, align 8, !tbaa !9
  %24 = load ptr, ptr %14, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct.HandleList, ptr %24, i64 -1
  %26 = getelementptr inbounds %struct.HandleList, ptr %25, i32 0, i32 4
  store i32 1802303064, ptr %26, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %27 = load ptr, ptr %14, align 8, !tbaa !9
  %28 = call ptr @GetHandle(ptr noundef %27, i32 noundef 128, i32 noundef 1802303064, ptr noundef @endTensorCreate)
  store ptr %28, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %29 = load ptr, ptr %15, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct.MHandle, ptr %29, i32 0, i32 3
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  store ptr %31, ptr %16, align 8, !tbaa !9
  %32 = load ptr, ptr %14, align 8, !tbaa !9
  %33 = load ptr, ptr %16, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct.HandleTensorCreate, ptr %33, i32 0, i32 0
  store ptr %32, ptr %34, align 8, !tbaa !16
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %37, %6
  %39 = load i32, ptr %8, align 4, !tbaa !5
  %40 = load ptr, ptr %14, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct.MTensor, ptr %40, i32 0, i32 0
  store i32 %39, ptr %41, align 8, !tbaa !18
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = icmp slt i32 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %38
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %44, %38
  %46 = load i32, ptr %9, align 4, !tbaa !5
  %47 = load ptr, ptr %14, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.MTensor, ptr %47, i32 0, i32 1
  store i32 %46, ptr %48, align 4, !tbaa !20
  %49 = load i32, ptr %10, align 4, !tbaa !5
  %50 = icmp slt i32 %49, 0
  br i1 %50, label %51, label %52

51:                                               ; preds = %45
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %51, %45
  %53 = load i32, ptr %10, align 4, !tbaa !5
  %54 = load ptr, ptr %14, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.MTensor, ptr %54, i32 0, i32 2
  store i32 %53, ptr %55, align 8, !tbaa !21
  %56 = load i32, ptr %11, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %52
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %58, %52
  %60 = load i32, ptr %11, align 4, !tbaa !5
  %61 = load ptr, ptr %14, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.MTensor, ptr %61, i32 0, i32 3
  store i32 %60, ptr %62, align 4, !tbaa !22
  %63 = load i32, ptr %13, align 4, !tbaa !5
  %64 = icmp slt i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %59
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %65, %59
  %67 = load ptr, ptr %14, align 8, !tbaa !9
  %68 = getelementptr inbounds %struct.MTensor, ptr %67, i32 0, i32 5
  store i32 0, ptr %68, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = load i32, ptr %10, align 4, !tbaa !5
  %71 = mul nsw i32 %69, %70
  %72 = load i32, ptr %11, align 4, !tbaa !5
  %73 = mul nsw i32 %71, %72
  store i32 %73, ptr %17, align 4, !tbaa !5
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %79, label %76

76:                                               ; preds = %66
  %77 = load i32, ptr %17, align 4, !tbaa !5
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %99

79:                                               ; preds = %76, %66
  br label %80

80:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %81 = load ptr, ptr %12, align 8, !tbaa !9
  %82 = icmp eq ptr %81, null
  br i1 %82, label %87, label %83

83:                                               ; preds = %80
  %84 = load ptr, ptr %12, align 8, !tbaa !9
  %85 = ptrtoint ptr %84 to i64
  %86 = icmp eq i64 %85, -1
  br label %87

87:                                               ; preds = %83, %80
  %88 = phi i1 [ true, %80 ], [ %86, %83 ]
  %89 = xor i1 %88, true
  %90 = zext i1 %89 to i32
  store i32 %90, ptr %18, align 4, !tbaa !5
  %91 = load i32, ptr %18, align 4, !tbaa !5
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %95

93:                                               ; preds = %87
  %94 = load i32, ptr %18, align 4, !tbaa !5
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %94, i32 noundef -1, ptr noundef @.str, i32 noundef 54, ptr noundef @__FUNCTION__.TensorCreate, ptr noundef @.str.2)
  br label %95

95:                                               ; preds = %93, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  %98 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %98, ptr %7, align 8
  store i32 1, ptr %19, align 4
  br label %213

99:                                               ; preds = %76
  %100 = load i32, ptr %17, align 4, !tbaa !5
  %101 = add nsw i32 %100, 8
  store i32 %101, ptr %17, align 4, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = load ptr, ptr %16, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.HandleTensorCreate, ptr %103, i32 0, i32 4
  store i32 %102, ptr %104, align 4, !tbaa !24
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = mul i64 %106, 8
  %108 = trunc i64 %107 to i32
  %109 = call ptr @m_Malloc(i32 noundef %108)
  %110 = load ptr, ptr %16, align 8, !tbaa !9
  %111 = getelementptr inbounds %struct.HandleTensorCreate, ptr %110, i32 0, i32 6
  store ptr %109, ptr %111, align 8, !tbaa !25
  %112 = load ptr, ptr %16, align 8, !tbaa !9
  %113 = getelementptr inbounds %struct.HandleTensorCreate, ptr %112, i32 0, i32 6
  %114 = load ptr, ptr %113, align 8, !tbaa !25
  %115 = load ptr, ptr %14, align 8, !tbaa !9
  %116 = getelementptr inbounds %struct.MTensor, ptr %115, i32 0, i32 4
  store ptr %114, ptr %116, align 8, !tbaa !26
  %117 = load ptr, ptr %12, align 8, !tbaa !9
  %118 = icmp eq ptr %117, null
  br i1 %118, label %134, label %119

119:                                              ; preds = %99
  %120 = load ptr, ptr %12, align 8, !tbaa !9
  %121 = ptrtoint ptr %120 to i64
  %122 = icmp eq i64 %121, -1
  br i1 %122, label %134, label %123

123:                                              ; preds = %119
  %124 = load ptr, ptr %16, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct.HandleTensorCreate, ptr %124, i32 0, i32 5
  store i32 0, ptr %125, align 8, !tbaa !27
  %126 = load ptr, ptr %16, align 8, !tbaa !9
  %127 = getelementptr inbounds %struct.HandleTensorCreate, ptr %126, i32 0, i32 6
  %128 = load ptr, ptr %127, align 8, !tbaa !25
  %129 = load ptr, ptr %12, align 8, !tbaa !9
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = mul i64 %131, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %128, ptr align 8 %129, i64 %132, i1 false)
  %133 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %133, ptr %7, align 8
  store i32 1, ptr %19, align 4
  br label %213

134:                                              ; preds = %119, %99
  %135 = load i32, ptr %17, align 4, !tbaa !5
  %136 = load ptr, ptr %16, align 8, !tbaa !9
  %137 = getelementptr inbounds %struct.HandleTensorCreate, ptr %136, i32 0, i32 5
  store i32 %135, ptr %137, align 8, !tbaa !27
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = load i32, ptr %17, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = mul i64 %140, 4
  %142 = trunc i64 %141 to i32
  %143 = load i32, ptr %13, align 4, !tbaa !5
  %144 = call ptr @mMemoryCreate(i32 noundef %138, i32 noundef %142, i32 noundef %143)
  %145 = load ptr, ptr %16, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct.HandleTensorCreate, ptr %145, i32 0, i32 7
  store ptr %144, ptr %146, align 8, !tbaa !28
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = mul i64 %148, 8
  %150 = call noalias ptr @malloc(i64 noundef %149) #7
  store ptr %150, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %151

151:                                              ; preds = %167, %134
  %152 = load i32, ptr %21, align 4, !tbaa !5
  %153 = load i32, ptr %8, align 4, !tbaa !5
  %154 = icmp slt i32 %152, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %151
  store i32 4, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %170

156:                                              ; preds = %151
  %157 = load ptr, ptr %16, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct.HandleTensorCreate, ptr %157, i32 0, i32 6
  %159 = load ptr, ptr %158, align 8, !tbaa !25
  %160 = load i32, ptr %21, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds ptr, ptr %159, i64 %161
  %163 = load ptr, ptr %20, align 8, !tbaa !9
  %164 = load i32, ptr %21, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds ptr, ptr %163, i64 %165
  store ptr %162, ptr %166, align 8, !tbaa !9
  br label %167

167:                                              ; preds = %156
  %168 = load i32, ptr %21, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %21, align 4, !tbaa !5
  br label %151, !llvm.loop !29

170:                                              ; preds = %155
  %171 = load ptr, ptr %16, align 8, !tbaa !9
  %172 = getelementptr inbounds %struct.HandleTensorCreate, ptr %171, i32 0, i32 7
  %173 = load ptr, ptr %172, align 8, !tbaa !28
  %174 = load i32, ptr %17, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = mul i64 %175, 4
  %177 = trunc i64 %176 to i32
  %178 = load ptr, ptr %20, align 8, !tbaa !9
  %179 = load i32, ptr %8, align 4, !tbaa !5
  call void @mMemoryIndex(ptr noundef %173, i32 noundef 1, i32 noundef %177, ptr noundef %178, i32 noundef %179)
  %180 = load ptr, ptr %20, align 8, !tbaa !9
  call void @free(ptr noundef %180) #6
  br label %181

181:                                              ; preds = %170
  %182 = load ptr, ptr %14, align 8, !tbaa !9
  %183 = load ptr, ptr %16, align 8, !tbaa !9
  %184 = getelementptr inbounds %struct.HandleTensorCreate, ptr %183, i32 0, i32 7
  %185 = load ptr, ptr %184, align 8, !tbaa !28
  call void @m_PropertyFunction(ptr noundef %182, ptr noundef @.str.3, ptr noundef @mornMemoryDevice, ptr noundef %185)
  br label %186

186:                                              ; preds = %181
  br label %187

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

188:                                              ; preds = %208, %187
  %189 = load i32, ptr %22, align 4, !tbaa !5
  %190 = load i32, ptr %8, align 4, !tbaa !5
  %191 = icmp slt i32 %189, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %188
  store i32 9, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %211

193:                                              ; preds = %188
  %194 = load ptr, ptr %14, align 8, !tbaa !9
  %195 = getelementptr inbounds %struct.MTensor, ptr %194, i32 0, i32 4
  %196 = load ptr, ptr %195, align 8, !tbaa !26
  %197 = load i32, ptr %22, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds ptr, ptr %196, i64 %198
  %200 = load ptr, ptr %199, align 8, !tbaa !9
  %201 = load i32, ptr %9, align 4, !tbaa !5
  %202 = load i32, ptr %10, align 4, !tbaa !5
  %203 = mul nsw i32 %201, %202
  %204 = load i32, ptr %11, align 4, !tbaa !5
  %205 = mul nsw i32 %203, %204
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds float, ptr %200, i64 %206
  store float 1.000000e+00, ptr %207, align 4, !tbaa !31
  br label %208

208:                                              ; preds = %193
  %209 = load i32, ptr %22, align 4, !tbaa !5
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %22, align 4, !tbaa !5
  br label %188, !llvm.loop !33

211:                                              ; preds = %192
  %212 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %212, ptr %7, align 8
  store i32 1, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %213

213:                                              ; preds = %211, %123, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %214 = load ptr, ptr %7, align 8
  ret ptr %214
}

declare ptr @ObjectAlloc(i32 noundef) #2

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

declare ptr @m_Malloc(i32 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

declare ptr @mMemoryCreate(i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

declare void @mMemoryIndex(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #5

declare void @m_PropertyFunction(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare void @mornMemoryDevice(ptr noundef, ptr noundef) #2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 allocsize(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 = { 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 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 28}
!12 = !{!"HandleList", !13, i64 0, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28}
!13 = !{!"MList", !6, i64 0, !10, i64 8}
!14 = !{!15, !10, i64 16}
!15 = !{!"MHandle", !6, i64 0, !6, i64 4, !10, i64 8, !10, i64 16}
!16 = !{!17, !10, i64 0}
!17 = !{!"HandleTensorCreate", !10, i64 0, !10, i64 8, !7, i64 16, !6, i64 80, !6, i64 84, !6, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120}
!18 = !{!19, !6, i64 0}
!19 = !{!"MTensor", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !10, i64 16, !6, i64 24}
!20 = !{!19, !6, i64 4}
!21 = !{!19, !6, i64 8}
!22 = !{!19, !6, i64 12}
!23 = !{!19, !6, i64 24}
!24 = !{!17, !6, i64 84}
!25 = !{!17, !10, i64 96}
!26 = !{!19, !10, i64 16}
!27 = !{!17, !6, i64 88}
!28 = !{!17, !10, i64 104}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!32, !32, i64 0}
!32 = !{!"float", !7, i64 0}
!33 = distinct !{!33, !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"

@.str = external hidden unnamed_addr constant [87 x i8], align 1
@__FUNCTION__.TensorCreate = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @endTensorCreate(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @TensorCreate(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = tail call ptr @ObjectAlloc(i32 noundef 32) #6
  %8 = getelementptr inbounds i8, ptr %7, i64 -4
  store i32 1802303064, ptr %8, align 4, !tbaa !5
  %9 = tail call ptr @GetHandle(ptr noundef %7, i32 noundef 128, i32 noundef 1802303064, ptr noundef nonnull @endTensorCreate) #6
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  store ptr %7, ptr %11, align 8, !tbaa !14
  %spec.store.select = tail call i32 @llvm.smax.i32(i32 %0, i32 0)
  store i32 %spec.store.select, ptr %7, align 8, !tbaa !16
  %spec.store.select7 = tail call i32 @llvm.smax.i32(i32 %1, i32 0)
  %12 = getelementptr inbounds i8, ptr %7, i64 4
  store i32 %spec.store.select7, ptr %12, align 4, !tbaa !18
  %spec.store.select1 = tail call i32 @llvm.smax.i32(i32 %2, i32 0)
  %13 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 %spec.store.select1, ptr %13, align 8, !tbaa !19
  %spec.store.select8 = tail call i32 @llvm.smax.i32(i32 %3, i32 0)
  %14 = getelementptr inbounds i8, ptr %7, i64 12
  store i32 %spec.store.select8, ptr %14, align 4, !tbaa !20
  %spec.store.select2 = tail call i32 @llvm.smax.i32(i32 %5, i32 0)
  %15 = getelementptr inbounds i8, ptr %7, i64 24
  store i32 0, ptr %15, align 8, !tbaa !21
  %16 = mul nuw nsw i32 %spec.store.select1, %spec.store.select7
  %17 = mul nuw nsw i32 %16, %spec.store.select8
  %18 = icmp slt i32 %0, 1
  %19 = icmp eq i32 %17, 0
  %or.cond = select i1 %18, i1 true, i1 %19
  br i1 %or.cond, label %20, label %25

20:                                               ; preds = %6
  %magicptr = ptrtoint ptr %4 to i64
  switch i64 %magicptr, label %21 [
    i64 -1, label %.loopexit
    i64 0, label %.loopexit
  ]

21:                                               ; preds = %20
  %22 = icmp ne ptr %4, null
  %23 = icmp ne ptr %4, inttoptr (i64 -1 to ptr)
  %.not86 = and i1 %22, %23
  %24 = zext i1 %.not86 to i32
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %24, i32 noundef -1, ptr noundef nonnull @.str, i32 noundef 54, ptr noundef nonnull @__FUNCTION__.TensorCreate, ptr noundef nonnull @.str.2) #6
  br label %.loopexit

25:                                               ; preds = %6
  %26 = getelementptr inbounds i8, ptr %11, i64 84
  store i32 %spec.store.select, ptr %26, align 4, !tbaa !22
  %27 = zext nneg i32 %spec.store.select to i64
  %28 = shl nuw nsw i64 %27, 3
  %29 = trunc i64 %28 to i32
  %30 = tail call ptr @m_Malloc(i32 noundef %29) #6
  %31 = getelementptr inbounds i8, ptr %11, i64 96
  store ptr %30, ptr %31, align 8, !tbaa !23
  %32 = getelementptr inbounds i8, ptr %7, i64 16
  store ptr %30, ptr %32, align 8, !tbaa !24
  %magicptr87 = ptrtoint ptr %4 to i64
  switch i64 %magicptr87, label %33 [
    i64 -1, label %.lr.ph.preheader
    i64 0, label %.lr.ph.preheader
  ]

33:                                               ; preds = %25
  %34 = getelementptr inbounds i8, ptr %11, i64 88
  store i32 0, ptr %34, align 8, !tbaa !25
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %30, ptr align 8 %4, i64 %28, i1 false)
  br label %.loopexit

.lr.ph.preheader:                                 ; preds = %25, %25
  %35 = add nuw nsw i32 %17, 8
  %36 = getelementptr inbounds i8, ptr %11, i64 88
  store i32 %35, ptr %36, align 8, !tbaa !25
  %37 = shl i32 %35, 2
  %38 = tail call ptr @mMemoryCreate(i32 noundef %spec.store.select, i32 noundef %37, i32 noundef %spec.store.select2) #6
  %39 = getelementptr inbounds i8, ptr %11, i64 104
  store ptr %38, ptr %39, align 8, !tbaa !26
  %40 = tail call noalias ptr @malloc(i64 noundef %28) #7
  %wide.trip.count = zext nneg i32 %0 to i64
  %.pre = load ptr, ptr %31, align 8, !tbaa !23
  %min.iters.check = icmp ult i32 %0, 4
  br i1 %min.iters.check, label %.lr.ph.preheader99, label %vector.ph

.lr.ph.preheader99:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i64> [ <i64 0, i64 1>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <2 x i64> %vec.ind, <i64 2, i64 2>
  %41 = getelementptr inbounds ptr, ptr %.pre, <2 x i64> %vec.ind
  %42 = getelementptr inbounds ptr, ptr %.pre, <2 x i64> %step.add
  %43 = getelementptr inbounds ptr, ptr %40, i64 %index
  %44 = getelementptr inbounds i8, ptr %43, i64 16
  store <2 x ptr> %41, ptr %43, align 8, !tbaa !27
  store <2 x ptr> %42, ptr %44, align 8, !tbaa !27
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
  %45 = icmp eq i64 %index.next, %n.vec
  br i1 %45, label %middle.block, label %vector.body, !llvm.loop !28

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

.lr.ph91:                                         ; preds = %.lr.ph, %middle.block
  tail call void @mMemoryIndex(ptr noundef %38, i32 noundef 1, i32 noundef %37, ptr noundef nonnull %40, i32 noundef %spec.store.select) #6
  tail call void @free(ptr noundef nonnull %40) #6
  %46 = load ptr, ptr %39, align 8, !tbaa !26
  tail call void @m_PropertyFunction(ptr noundef nonnull %7, ptr noundef nonnull @.str.3, ptr noundef nonnull @mornMemoryDevice, ptr noundef %46) #6
  %47 = load ptr, ptr %32, align 8, !tbaa !24
  %48 = zext nneg i32 %17 to i64
  %49 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %wide.trip.count, 3
  %50 = icmp ult i64 %49, 3
  br i1 %50, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph91.new

.lr.ph91.new:                                     ; preds = %.lr.ph91
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %53

.lr.ph:                                           ; preds = %.lr.ph.preheader99, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader99 ]
  %51 = getelementptr inbounds ptr, ptr %.pre, i64 %indvars.iv
  %52 = getelementptr inbounds ptr, ptr %40, i64 %indvars.iv
  store ptr %51, ptr %52, align 8, !tbaa !27
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.lr.ph91, label %.lr.ph, !llvm.loop !32

53:                                               ; preds = %53, %.lr.ph91.new
  %indvars.iv93 = phi i64 [ 0, %.lr.ph91.new ], [ %indvars.iv.next94.3, %53 ]
  %niter = phi i64 [ 0, %.lr.ph91.new ], [ %niter.next.3, %53 ]
  %54 = getelementptr inbounds ptr, ptr %47, i64 %indvars.iv93
  %55 = load ptr, ptr %54, align 8, !tbaa !27
  %56 = getelementptr inbounds float, ptr %55, i64 %48
  store float 1.000000e+00, ptr %56, align 4, !tbaa !33
  %indvars.iv.next94 = or disjoint i64 %indvars.iv93, 1
  %57 = getelementptr inbounds ptr, ptr %47, i64 %indvars.iv.next94
  %58 = load ptr, ptr %57, align 8, !tbaa !27
  %59 = getelementptr inbounds float, ptr %58, i64 %48
  store float 1.000000e+00, ptr %59, align 4, !tbaa !33
  %indvars.iv.next94.1 = or disjoint i64 %indvars.iv93, 2
  %60 = getelementptr inbounds ptr, ptr %47, i64 %indvars.iv.next94.1
  %61 = load ptr, ptr %60, align 8, !tbaa !27
  %62 = getelementptr inbounds float, ptr %61, i64 %48
  store float 1.000000e+00, ptr %62, align 4, !tbaa !33
  %indvars.iv.next94.2 = or disjoint i64 %indvars.iv93, 3
  %63 = getelementptr inbounds ptr, ptr %47, i64 %indvars.iv.next94.2
  %64 = load ptr, ptr %63, align 8, !tbaa !27
  %65 = getelementptr inbounds float, ptr %64, i64 %48
  store float 1.000000e+00, ptr %65, align 4, !tbaa !33
  %indvars.iv.next94.3 = add nuw nsw i64 %indvars.iv93, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.loopexit.loopexit.unr-lcssa, label %53, !llvm.loop !35

.loopexit.loopexit.unr-lcssa:                     ; preds = %53, %.lr.ph91
  %indvars.iv93.unr = phi i64 [ 0, %.lr.ph91 ], [ %indvars.iv.next94.3, %53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.epil.preheader

.epil.preheader:                                  ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader
  %indvars.iv93.epil = phi i64 [ %indvars.iv.next94.epil, %.epil.preheader ], [ %indvars.iv93.unr, %.loopexit.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  %66 = getelementptr inbounds ptr, ptr %47, i64 %indvars.iv93.epil
  %67 = load ptr, ptr %66, align 8, !tbaa !27
  %68 = getelementptr inbounds float, ptr %67, i64 %48
  store float 1.000000e+00, ptr %68, align 4, !tbaa !33
  %indvars.iv.next94.epil = add nuw nsw i64 %indvars.iv93.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.loopexit, label %.epil.preheader, !llvm.loop !36

.loopexit:                                        ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader, %21, %20, %20, %33
  ret ptr %7
}

declare ptr @ObjectAlloc(i32 noundef) local_unnamed_addr #1

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

declare ptr @m_Malloc(i32 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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

declare void @m_PropertyFunction(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @mornMemoryDevice(ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

attributes #0 = { 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 #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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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, !8, i64 28}
!6 = !{!"HandleList", !7, i64 0, !8, i64 16, !8, i64 20, !8, i64 24, !8, i64 28}
!7 = !{!"MList", !8, i64 0, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!13, !11, i64 16}
!13 = !{!"MHandle", !8, i64 0, !8, i64 4, !11, i64 8, !11, i64 16}
!14 = !{!15, !11, i64 0}
!15 = !{!"HandleTensorCreate", !11, i64 0, !11, i64 8, !9, i64 16, !8, i64 80, !8, i64 84, !8, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120}
!16 = !{!17, !8, i64 0}
!17 = !{!"MTensor", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !11, i64 16, !8, i64 24}
!18 = !{!17, !8, i64 4}
!19 = !{!17, !8, i64 8}
!20 = !{!17, !8, i64 12}
!21 = !{!17, !8, i64 24}
!22 = !{!15, !8, i64 84}
!23 = !{!15, !11, i64 96}
!24 = !{!17, !11, i64 16}
!25 = !{!15, !8, i64 88}
!26 = !{!15, !11, i64 104}
!27 = !{!11, !11, i64 0}
!28 = distinct !{!28, !29, !30, !31}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!"llvm.loop.isvectorized", i32 1}
!31 = !{!"llvm.loop.unroll.runtime.disable"}
!32 = distinct !{!32, !29, !31, !30}
!33 = !{!34, !34, i64 0}
!34 = !{!"float", !9, i64 0}
!35 = distinct !{!35, !29}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.unroll.disable"}


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