; LLVM IR from DionysiosB/CodeForces :: 0001-0099/14D-TwoPaths.ll (Z3dfsllRKSt6vectorIS_IbSaIbEESaIS1_EElRlS6_)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsllRKSt6vectorIS_IbSaIbEESaIS1_EElRlS6_(i64 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %3, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #0 {
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  store i64 %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !9
  store i64 %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !9
  %14 = load i64, ptr %10, align 8, !tbaa !5
  %15 = load ptr, ptr %11, align 8, !tbaa !9
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = icmp sgt i64 %14, %16
  br i1 %17, label %18, label %23

18:                                               ; preds = %6
  %19 = load i64, ptr %10, align 8, !tbaa !5
  %20 = load ptr, ptr %11, align 8, !tbaa !9
  store i64 %19, ptr %20, align 8, !tbaa !5
  %21 = load i64, ptr %7, align 8, !tbaa !5
  %22 = load ptr, ptr %12, align 8, !tbaa !9
  store i64 %21, ptr %22, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %18, %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %24

24:                                               ; preds = %52, %23
  %25 = load i64, ptr %13, align 8, !tbaa !5
  %26 = load ptr, ptr %9, align 8, !tbaa !9
  %27 = load i64, ptr %7, align 8, !tbaa !5
  %28 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIS_IbSaIbEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %26, i64 noundef %27) #3
  %29 = call noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %28) #3
  %30 = icmp ult i64 %25, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %55

32:                                               ; preds = %24
  %33 = load ptr, ptr %9, align 8, !tbaa !9
  %34 = load i64, ptr %7, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIS_IbSaIbEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %34) #3
  %36 = load i64, ptr %13, align 8, !tbaa !5
  %37 = call noundef zeroext i1 @_ZNKSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %35, i64 noundef %36)
  br i1 %37, label %39, label %38

38:                                               ; preds = %32
  br label %52

39:                                               ; preds = %32
  %40 = load i64, ptr %13, align 8, !tbaa !5
  %41 = load i64, ptr %8, align 8, !tbaa !5
  %42 = icmp eq i64 %40, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %39
  br label %52

44:                                               ; preds = %39
  %45 = load i64, ptr %13, align 8, !tbaa !5
  %46 = load i64, ptr %7, align 8, !tbaa !5
  %47 = load ptr, ptr %9, align 8, !tbaa !9
  %48 = load i64, ptr %10, align 8, !tbaa !5
  %49 = add nsw i64 %48, 1
  %50 = load ptr, ptr %11, align 8, !tbaa !9
  %51 = load ptr, ptr %12, align 8, !tbaa !9
  call void @_Z3dfsllRKSt6vectorIS_IbSaIbEESaIS1_EElRlS6_(i64 noundef %45, i64 noundef %46, ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef %49, ptr noundef nonnull align 8 dereferenceable(8) %50, ptr noundef nonnull align 8 dereferenceable(8) %51)
  br label %52

52:                                               ; preds = %44, %43, %38
  %53 = load i64, ptr %13, align 8, !tbaa !5
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr %13, align 8, !tbaa !5
  br label %24, !llvm.loop !11

55:                                               ; preds = %31
  ret void
}

; 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 noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIS_IbSaIbEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #0 align 2

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

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


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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsllRKSt6vectorIS_IbSaIbEESaIS1_EElRlS6_(i64 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %3, ptr nocapture noundef nonnull align 8 dereferenceable(8) %4, ptr nocapture noundef nonnull writeonly align 8 dereferenceable(8) %5) local_unnamed_addr #0 {
  %7 = load i64, ptr %4, align 8, !tbaa !5
  %8 = icmp slt i64 %7, %3
  br i1 %8, label %9, label %10

9:                                                ; preds = %6
  store i64 %3, ptr %4, align 8, !tbaa !5
  store i64 %0, ptr %5, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %9, %6
  %11 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIS_IbSaIbEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %0) #2
  %12 = tail call noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %11) #2
  %.not = icmp eq i64 %12, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %10
  %13 = add nsw i64 %3, 1
  br label %14

._crit_edge:                                      ; preds = %19, %10
  ret void

14:                                               ; preds = %.lr.ph, %19
  %.022 = phi i64 [ 0, %.lr.ph ], [ %20, %19 ]
  %15 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIS_IbSaIbEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %0) #2
  %16 = tail call noundef zeroext i1 @_ZNKSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %15, i64 noundef %.022)
  %17 = icmp ne i64 %.022, %1
  %or.cond.not = select i1 %16, i1 %17, i1 false
  br i1 %or.cond.not, label %18, label %19

18:                                               ; preds = %14
  tail call void @_Z3dfsllRKSt6vectorIS_IbSaIbEESaIS1_EElRlS6_(i64 noundef %.022, i64 noundef %0, ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %13, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  br label %19

19:                                               ; preds = %14, %18
  %20 = add nuw nsw i64 %.022, 1
  %21 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIS_IbSaIbEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %0) #2
  %22 = tail call noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %21) #2
  %23 = icmp ult i64 %20, %22
  br i1 %23, label %14, label %._crit_edge, !llvm.loop !9
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNKSt6vectorIS_IbSaIbEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { 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 #2 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass