; LLVM IR from jingweizhanghuai/Morn :: test (test_array2)

; 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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__FUNCTION__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #5
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  invoke void @_mTimerBegin(ptr noundef @.str)
          to label %8 unwind label %13

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

9:                                                ; preds = %19, %8
  %10 = load i32, ptr %5, align 4, !tbaa !5
  %11 = icmp slt i32 %10, 10000000
  br i1 %11, label %17, label %12

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %26

13:                                               ; preds = %26, %0
  %14 = landingpad { ptr, i32 }
          cleanup
  %15 = extractvalue { ptr, i32 } %14, 0
  store ptr %15, ptr %3, align 8
  %16 = extractvalue { ptr, i32 } %14, 1
  store i32 %16, ptr %4, align 4
  br label %58

17:                                               ; preds = %9
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %18 unwind label %22

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %5, align 4, !tbaa !5
  br label %9, !llvm.loop !9

22:                                               ; preds = %17
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %3, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %58

26:                                               ; preds = %12
  %27 = invoke float @_mTimerEnd(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 12, ptr noundef @__FUNCTION__.main)
          to label %28 unwind label %13

28:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %29 = invoke ptr @ArrayCreate(i32 noundef 0, i32 noundef 4, ptr noundef null)
          to label %30 unwind label %36

30:                                               ; preds = %28
  store ptr %29, ptr %6, align 8, !tbaa !11
  invoke void @_mTimerBegin(ptr noundef @.str.2)
          to label %31 unwind label %36

31:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %44, %31
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = icmp slt i32 %33, 10000000
  br i1 %34, label %40, label %35

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

36:                                               ; preds = %53, %51, %30, %28
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %3, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %4, align 4
  br label %57

40:                                               ; preds = %32
  %41 = load ptr, ptr %6, align 8, !tbaa !11
  %42 = invoke ptr @m_ArrayPushBack(ptr noundef %41, ptr noundef %7)
          to label %43 unwind label %47

43:                                               ; preds = %40
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %7, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %7, align 4, !tbaa !5
  br label %32, !llvm.loop !13

47:                                               ; preds = %40
  %48 = landingpad { ptr, i32 }
          cleanup
  %49 = extractvalue { ptr, i32 } %48, 0
  store ptr %49, ptr %3, align 8
  %50 = extractvalue { ptr, i32 } %48, 1
  store i32 %50, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %57

51:                                               ; preds = %35
  %52 = invoke float @_mTimerEnd(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 18, ptr noundef @__FUNCTION__.main)
          to label %53 unwind label %36

53:                                               ; preds = %51
  %54 = load ptr, ptr %6, align 8, !tbaa !11
  invoke void @mArrayRelease(ptr noundef %54)
          to label %55 unwind label %36

55:                                               ; preds = %53
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #5
  %56 = load i32, ptr %1, align 4
  ret i32 %56

57:                                               ; preds = %47, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %58

58:                                               ; preds = %57, %22, %13
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #5
  br label %59

59:                                               ; preds = %58
  %60 = load ptr, ptr %3, align 8
  %61 = load i32, ptr %4, align 4
  %62 = insertvalue { ptr, i32 } poison, ptr %60, 0
  %63 = insertvalue { ptr, i32 } %62, i32 %61, 1
  resume { ptr, i32 } %63
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

declare void @_mTimerBegin(ptr noundef) #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #4 align 2

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

declare float @_mTimerEnd(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare ptr @ArrayCreate(i32 noundef, i32 noundef, ptr noundef) #3

declare ptr @m_ArrayPushBack(ptr noundef, ptr noundef) #3

declare void @mArrayRelease(ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse 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 = { 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 #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 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = distinct !{!13, !10}


; 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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__FUNCTION__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #5
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  invoke void @_mTimerBegin(ptr noundef nonnull @.str)
          to label %4 unwind label %7

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

5:                                                ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %6 = invoke float @_mTimerEnd(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 12, ptr noundef nonnull @__FUNCTION__.main)
          to label %16 unwind label %7

7:                                                ; preds = %5, %0
  %8 = landingpad { ptr, i32 }
          cleanup
  br label %34

9:                                                ; preds = %4, %10
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %10 unwind label %14

10:                                               ; preds = %9
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %2, align 4, !tbaa !5
  %13 = icmp slt i32 %11, 9999999
  br i1 %13, label %9, label %5, !llvm.loop !9

14:                                               ; preds = %9
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br label %34

16:                                               ; preds = %5
  %17 = invoke ptr @ArrayCreate(i32 noundef 0, i32 noundef 4, ptr noundef null)
          to label %18 unwind label %22

18:                                               ; preds = %16
  invoke void @_mTimerBegin(ptr noundef nonnull @.str.2)
          to label %19 unwind label %22

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %24

20:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %21 = invoke float @_mTimerEnd(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 18, ptr noundef nonnull @__FUNCTION__.main)
          to label %32 unwind label %22

22:                                               ; preds = %32, %20, %18, %16
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %34

24:                                               ; preds = %19, %26
  %25 = invoke ptr @m_ArrayPushBack(ptr noundef %17, ptr noundef nonnull %3)
          to label %26 unwind label %30

26:                                               ; preds = %24
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %3, align 4, !tbaa !5
  %29 = icmp slt i32 %27, 9999999
  br i1 %29, label %24, label %20, !llvm.loop !11

30:                                               ; preds = %24
  %31 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  br label %34

32:                                               ; preds = %20
  invoke void @mArrayRelease(ptr noundef %17)
          to label %33 unwind label %22

33:                                               ; preds = %32
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #5
  ret i32 0

34:                                               ; preds = %22, %30, %14, %7
  %.pn8 = phi { ptr, i32 } [ %15, %14 ], [ %8, %7 ], [ %31, %30 ], [ %23, %22 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn8
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

declare void @_mTimerBegin(ptr noundef) local_unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

declare float @_mTimerEnd(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare ptr @ArrayCreate(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare ptr @m_ArrayPushBack(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @mArrayRelease(ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass