; LLVM IR from huawei-noah/bolt :: compute/tensor/src (check)

; 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.TensorDesc = type { i32, i32, i32, [20 x i32] }
%struct.CheckParamSpec = type { i32 }
%struct.ArchInfo = type { i32, ptr }

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@stdout = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [18 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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor8get_descEv(ptr dead_on_unwind noalias writable sret(%struct.TensorDesc) align 4, ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z23check_infer_output_sizeP6TensorS0_14CheckParamSpecS0_P8ArchInfo(ptr noundef %0, ptr noundef %1, i32 %2, ptr noundef %3, ptr noundef %4) #1 {
  %6 = alloca %struct.CheckParamSpec, align 4
  %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 %struct.TensorDesc, align 4
  %14 = alloca %struct.TensorDesc, align 4
  %15 = alloca %struct.TensorDesc, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %struct.TensorDesc, align 8
  %22 = getelementptr inbounds %struct.CheckParamSpec, ptr %6, i32 0, i32 0
  store i32 %2, ptr %22, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %41

25:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !9
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %40

28:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %29 = call i64 (i64, ...) @syscall(i64 noundef 186) #7
  %30 = trunc i64 %29 to i32
  store i32 %30, ptr %12, align 4, !tbaa !11
  %31 = load i32, ptr %12, align 4, !tbaa !11
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %31)
  %33 = load ptr, ptr @stdout, align 8, !tbaa !5
  %34 = call i32 @fflush(ptr noundef %33)
  %35 = load i32, ptr %11, align 4, !tbaa !9
  %36 = call ptr @ee2str(i32 noundef %35)
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %36)
  %38 = load ptr, ptr @stdout, align 8, !tbaa !5
  %39 = call i32 @fflush(ptr noundef %38)
  call void @exit(i32 noundef 1) #8
  unreachable

40:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %41

41:                                               ; preds = %40, %5
  call void @llvm.lifetime.start.p0(i64 92, ptr %13) #7
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4 %13, ptr noundef nonnull align 8 dereferenceable(32) %42)
  call void @llvm.lifetime.start.p0(i64 92, ptr %14) #7
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind writable sret(%struct.TensorDesc) align 4 %14, ptr noundef nonnull align 8 dereferenceable(32) %43)
  call void @llvm.lifetime.start.p0(i64 92, ptr %15) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %13, i64 92, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %44

44:                                               ; preds = %127, %41
  %45 = load i32, ptr %16, align 4, !tbaa !11
  %46 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 2
  %47 = load i32, ptr %46, align 4, !tbaa !19
  %48 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !19
  %50 = icmp ult i32 %47, %49
  br i1 %50, label %51, label %54

51:                                               ; preds = %44
  %52 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !19
  br label %57

54:                                               ; preds = %44
  %55 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 2
  %56 = load i32, ptr %55, align 4, !tbaa !19
  br label %57

57:                                               ; preds = %54, %51
  %58 = phi i32 [ %53, %51 ], [ %56, %54 ]
  %59 = icmp ult i32 %45, %58
  br i1 %59, label %61, label %60

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

61:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %62 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %63 = load i32, ptr %16, align 4, !tbaa !11
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds [20 x i32], ptr %62, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !11
  %67 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %68 = load i32, ptr %16, align 4, !tbaa !11
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds [20 x i32], ptr %67, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !11
  %72 = icmp ugt i32 %66, %71
  br i1 %72, label %73, label %79

73:                                               ; preds = %61
  %74 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %75 = load i32, ptr %16, align 4, !tbaa !11
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds [20 x i32], ptr %74, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !11
  br label %85

79:                                               ; preds = %61
  %80 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %81 = load i32, ptr %16, align 4, !tbaa !11
  %82 = zext i32 %81 to i64
  %83 = getelementptr inbounds [20 x i32], ptr %80, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !11
  br label %85

85:                                               ; preds = %79, %73
  %86 = phi i32 [ %78, %73 ], [ %84, %79 ]
  store i32 %86, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %87 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %88 = load i32, ptr %16, align 4, !tbaa !11
  %89 = zext i32 %88 to i64
  %90 = getelementptr inbounds [20 x i32], ptr %87, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !11
  %92 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %93 = load i32, ptr %16, align 4, !tbaa !11
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds [20 x i32], ptr %92, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !11
  %97 = icmp ult i32 %91, %96
  br i1 %97, label %98, label %104

98:                                               ; preds = %85
  %99 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %100 = load i32, ptr %16, align 4, !tbaa !11
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds [20 x i32], ptr %99, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !11
  br label %110

104:                                              ; preds = %85
  %105 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %106 = load i32, ptr %16, align 4, !tbaa !11
  %107 = zext i32 %106 to i64
  %108 = getelementptr inbounds [20 x i32], ptr %105, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !11
  br label %110

110:                                              ; preds = %104, %98
  %111 = phi i32 [ %103, %98 ], [ %109, %104 ]
  store i32 %111, ptr %18, align 4, !tbaa !11
  %112 = load i32, ptr %18, align 4, !tbaa !11
  %113 = icmp eq i32 %112, 1
  br i1 %113, label %114, label %120

114:                                              ; preds = %110
  %115 = load i32, ptr %17, align 4, !tbaa !11
  %116 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %117 = load i32, ptr %16, align 4, !tbaa !11
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds [20 x i32], ptr %116, i64 0, i64 %118
  store i32 %115, ptr %119, align 4, !tbaa !11
  br label %126

120:                                              ; preds = %110
  %121 = load i32, ptr %18, align 4, !tbaa !11
  %122 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %123 = load i32, ptr %16, align 4, !tbaa !11
  %124 = zext i32 %123 to i64
  %125 = getelementptr inbounds [20 x i32], ptr %122, i64 0, i64 %124
  store i32 %121, ptr %125, align 4, !tbaa !11
  br label %126

126:                                              ; preds = %120, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %16, align 4, !tbaa !11
  %129 = add i32 %128, 1
  store i32 %129, ptr %16, align 4, !tbaa !11
  br label %44, !llvm.loop !21

130:                                              ; preds = %60
  %131 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 2
  %132 = load i32, ptr %131, align 4, !tbaa !19
  %133 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 2
  %134 = load i32, ptr %133, align 4, !tbaa !19
  %135 = icmp ult i32 %132, %134
  br i1 %135, label %136, label %162

136:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %137 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 2
  %138 = load i32, ptr %137, align 4, !tbaa !19
  store i32 %138, ptr %19, align 4, !tbaa !11
  br label %139

139:                                              ; preds = %155, %136
  %140 = load i32, ptr %19, align 4, !tbaa !11
  %141 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 2
  %142 = load i32, ptr %141, align 4, !tbaa !19
  %143 = icmp ult i32 %140, %142
  br i1 %143, label %145, label %144

144:                                              ; preds = %139
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %158

145:                                              ; preds = %139
  %146 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 3
  %147 = load i32, ptr %19, align 4, !tbaa !11
  %148 = zext i32 %147 to i64
  %149 = getelementptr inbounds [20 x i32], ptr %146, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !11
  %151 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 3
  %152 = load i32, ptr %19, align 4, !tbaa !11
  %153 = zext i32 %152 to i64
  %154 = getelementptr inbounds [20 x i32], ptr %151, i64 0, i64 %153
  store i32 %150, ptr %154, align 4, !tbaa !11
  br label %155

155:                                              ; preds = %145
  %156 = load i32, ptr %19, align 4, !tbaa !11
  %157 = add i32 %156, 1
  store i32 %157, ptr %19, align 4, !tbaa !11
  br label %139, !llvm.loop !23

158:                                              ; preds = %144
  %159 = getelementptr inbounds %struct.TensorDesc, ptr %14, i32 0, i32 2
  %160 = load i32, ptr %159, align 4, !tbaa !19
  %161 = getelementptr inbounds %struct.TensorDesc, ptr %13, i32 0, i32 2
  store i32 %160, ptr %161, align 4, !tbaa !19
  br label %162

162:                                              ; preds = %158, %130
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %13, i64 92, i1 false), !tbaa.struct !13
  %163 = getelementptr inbounds %struct.TensorDesc, ptr %15, i32 0, i32 0
  store i32 0, ptr %163, align 4, !tbaa !24
  %164 = load ptr, ptr %10, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.ArchInfo, ptr %164, i32 0, i32 0
  %166 = load i32, ptr %165, align 8, !tbaa !25
  %167 = icmp eq i32 %166, 2
  br i1 %167, label %173, label %168

168:                                              ; preds = %162
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.ArchInfo, ptr %169, i32 0, i32 0
  %171 = load i32, ptr %170, align 8, !tbaa !25
  %172 = icmp eq i32 %171, 7
  br i1 %172, label %173, label %175

173:                                              ; preds = %168, %162
  %174 = getelementptr inbounds %struct.TensorDesc, ptr %15, i32 0, i32 0
  store i32 3, ptr %174, align 4, !tbaa !24
  br label %175

175:                                              ; preds = %173, %168
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !9
  %176 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %15, i64 92, i1 false), !tbaa.struct !13
  call void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32) %176, ptr noundef byval(%struct.TensorDesc) align 8 %21)
  %177 = load i32, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 92, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 92, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 92, ptr %13) #7
  ret i32 %177
}

; Function Attrs: nounwind
declare i64 @syscall(i64 noundef, ...) #2

declare i32 @printf(ptr noundef, ...) #3

declare i32 @fflush(ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @ee2str(i32 noundef) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

; 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) #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef byval(%struct.TensorDesc) align 8) #1 align 2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTS2EE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 4, !14, i64 4, i64 4, !16, i64 8, i64 4, !11, i64 12, i64 80, !18}
!14 = !{!15, !15, i64 0}
!15 = !{!"_ZTS8DataType", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_ZTS10DataFormat", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !12, i64 8}
!20 = !{!"_ZTS10TensorDesc", !15, i64 0, !17, i64 4, !12, i64 8, !7, i64 12}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!20, !15, i64 0}
!25 = !{!26, !27, i64 0}
!26 = !{!"_ZTS8ArchInfo", !27, i64 0, !6, i64 8}
!27 = !{!"_ZTS4Arch", !7, i64 0}


; 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.TensorDesc = type { i32, i32, i32, [20 x i32] }

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [18 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor8get_descEv(ptr dead_on_unwind noalias writable sret(%struct.TensorDesc) align 4, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; 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 uwtable
define dso_local noundef i32 @_Z23check_infer_output_sizeP6TensorS0_14CheckParamSpecS0_P8ArchInfo(ptr noundef %0, ptr noundef %1, i32 %2, ptr noundef %3, ptr nocapture noundef readonly %4) local_unnamed_addr #1 {
  %6 = alloca %struct.TensorDesc, align 4
  %7 = alloca %struct.TensorDesc, align 4
  %8 = alloca %struct.TensorDesc, align 8
  %9 = icmp eq ptr %3, null
  br i1 %9, label %10, label %20

10:                                               ; preds = %5
  %11 = tail call i64 (i64, ...) @syscall(i64 noundef 186) #8
  %12 = trunc i64 %11 to i32
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %12)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = tail call i32 @fflush(ptr noundef %14)
  %16 = tail call ptr @ee2str(i32 noundef 1)
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %16)
  %18 = load ptr, ptr @stdout, align 8, !tbaa !5
  %19 = tail call i32 @fflush(ptr noundef %18)
  tail call void @exit(i32 noundef 1) #9
  unreachable

20:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %6) #8
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind nonnull writable sret(%struct.TensorDesc) align 4 %6, ptr noundef nonnull align 8 dereferenceable(32) %0)
  call void @llvm.lifetime.start.p0(i64 92, ptr nonnull %7) #8
  call void @_ZN6Tensor8get_descEv(ptr dead_on_unwind nonnull writable sret(%struct.TensorDesc) align 4 %7, ptr noundef nonnull align 8 dereferenceable(32) %1)
  %21 = getelementptr inbounds i8, ptr %6, i64 8
  %22 = load i32, ptr %21, align 4
  %23 = getelementptr inbounds i8, ptr %7, i64 8
  %24 = load i32, ptr %23, align 4
  %25 = call i32 @llvm.umin.i32(i32 %22, i32 %24)
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %20
  %26 = getelementptr inbounds i8, ptr %6, i64 12
  %27 = getelementptr inbounds i8, ptr %7, i64 12
  %wide.trip.count = zext i32 %25 to i64
  %min.iters.check = icmp ult i32 %25, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

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

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

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %28 = getelementptr inbounds [20 x i32], ptr %26, i64 0, i64 %index
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %wide.load = load <4 x i32>, ptr %28, align 4, !tbaa !9
  %wide.load52 = load <4 x i32>, ptr %29, align 4, !tbaa !9
  %30 = getelementptr inbounds [20 x i32], ptr %27, i64 0, i64 %index
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  %wide.load53 = load <4 x i32>, ptr %30, align 4, !tbaa !9
  %wide.load54 = load <4 x i32>, ptr %31, align 4, !tbaa !9
  %32 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load53)
  %33 = call <4 x i32> @llvm.umax.v4i32(<4 x i32> %wide.load52, <4 x i32> %wide.load54)
  %34 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load, <4 x i32> %wide.load53)
  %35 = call <4 x i32> @llvm.umin.v4i32(<4 x i32> %wide.load52, <4 x i32> %wide.load54)
  %36 = icmp eq <4 x i32> %34, <i32 1, i32 1, i32 1, i32 1>
  %37 = icmp eq <4 x i32> %35, <i32 1, i32 1, i32 1, i32 1>
  %38 = select <4 x i1> %36, <4 x i32> %32, <4 x i32> %34
  %39 = select <4 x i1> %37, <4 x i32> %33, <4 x i32> %35
  store <4 x i32> %38, ptr %28, align 4, !tbaa !9
  store <4 x i32> %39, ptr %29, align 4, !tbaa !9
  %index.next = add nuw i64 %index, 8
  %40 = icmp eq i64 %index.next, %n.vec
  br i1 %40, label %middle.block, label %vector.body, !llvm.loop !11

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

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %20
  %41 = icmp ult i32 %22, %24
  br i1 %41, label %.preheader, label %56

.preheader:                                       ; preds = %._crit_edge
  %42 = zext i32 %22 to i64
  %43 = shl nuw nsw i64 %42, 2
  %44 = add nuw nsw i64 %43, 12
  %scevgep = getelementptr i8, ptr %6, i64 %44
  %scevgep48 = getelementptr i8, ptr %7, i64 %44
  %45 = xor i32 %22, -1
  %46 = add i32 %24, %45
  %47 = zext i32 %46 to i64
  %48 = shl nuw nsw i64 %47, 2
  %49 = add nuw nsw i64 %48, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, ptr noundef nonnull align 4 dereferenceable(1) %scevgep48, i64 %49, i1 false), !tbaa !9
  store i32 %24, ptr %21, align 4, !tbaa !15
  br label %56

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %50 = getelementptr inbounds [20 x i32], ptr %26, i64 0, i64 %indvars.iv
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = getelementptr inbounds [20 x i32], ptr %27, i64 0, i64 %indvars.iv
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %. = call i32 @llvm.umax.i32(i32 %51, i32 %53)
  %54 = call i32 @llvm.umin.i32(i32 %51, i32 %53)
  %55 = icmp eq i32 %54, 1
  %storemerge = select i1 %55, i32 %., i32 %54
  store i32 %storemerge, ptr %50, align 4, !tbaa !9
  %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 %._crit_edge, label %scalar.ph, !llvm.loop !19

56:                                               ; preds = %.preheader, %._crit_edge
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 4
  %57 = load i32, ptr %4, align 8, !tbaa !20
  %switch.selectcmp.case1 = icmp eq i32 %57, 2
  %switch.selectcmp.case2 = icmp eq i32 %57, 7
  %switch.selectcmp = or i1 %switch.selectcmp.case1, %switch.selectcmp.case2
  %58 = select i1 %switch.selectcmp, i32 3, i32 0
  store i32 %58, ptr %8, align 8, !tbaa !23
  %.sroa.7.0..sroa_idx23 = getelementptr inbounds i8, ptr %8, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(88) %.sroa.7.0..sroa_idx23, ptr noundef nonnull align 4 dereferenceable(88) %.sroa.7.0..sroa_idx, i64 88, i1 false)
  call void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull byval(%struct.TensorDesc) align 8 %8)
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 92, ptr nonnull %6) #8
  ret i32 0
}

; Function Attrs: nounwind
declare i64 @syscall(i64 noundef, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local ptr @ee2str(i32 noundef) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #5

; 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) #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6Tensor6resizeE10TensorDesc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef byval(%struct.TensorDesc) align 8) local_unnamed_addr #1 align 2

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.umax.v4i32(<4 x i32>, <4 x i32>) #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.umin.v4i32(<4 x i32>, <4 x i32>) #7

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { 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 #3 = { 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 #4 = { inlinehint mustprogress 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 = { noreturn 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 nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = !{!16, !10, i64 8}
!16 = !{!"_ZTS10TensorDesc", !17, i64 0, !18, i64 4, !10, i64 8, !7, i64 12}
!17 = !{!"_ZTS8DataType", !7, i64 0}
!18 = !{!"_ZTS10DataFormat", !7, i64 0}
!19 = distinct !{!19, !12, !14, !13}
!20 = !{!21, !22, i64 0}
!21 = !{!"_ZTS8ArchInfo", !22, i64 0, !6, i64 8}
!22 = !{!"_ZTS4Arch", !7, i64 0}
!23 = !{!17, !17, i64 0}


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