; LLVM IR from DionysiosB/CodeForces :: 0300-0399/339C-XeniaAndWeights.ll (Z3dfsllRKSt6vectorIbSaIbEERS_IlSaIlEE)

; 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 noundef zeroext i1 @_Z3dfsllRKSt6vectorIbSaIbEERS_IlSaIlEE(i64 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(40) %2, ptr noundef nonnull align 8 dereferenceable(24) %3) #0 {
  %5 = alloca i1, align 1
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i8, align 1
  store i64 %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  %16 = load i64, ptr %6, align 8, !tbaa !5
  %17 = icmp sle i64 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %4
  store i1 true, ptr %5, align 1
  br label %92

19:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %20 = load i64, ptr %7, align 8, !tbaa !5
  %21 = icmp slt i64 %20, 0
  %22 = zext i1 %21 to i64
  %23 = select i1 %21, i32 -1, i32 1
  %24 = sext i32 %23 to i64
  store i64 %24, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 1, ptr %11, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %85, %19
  %26 = load i64, ptr %11, align 8, !tbaa !5
  %27 = load ptr, ptr %8, align 8, !tbaa !9
  %28 = call noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %27) #3
  %29 = icmp ule i64 %26, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %25
  store i32 2, ptr %12, align 4
  br label %88

31:                                               ; preds = %25
  %32 = load ptr, ptr %8, align 8, !tbaa !9
  %33 = load i64, ptr %11, align 8, !tbaa !5
  %34 = call noundef zeroext i1 @_ZNKSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %32, i64 noundef %33)
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  br label %85

36:                                               ; preds = %31
  %37 = load ptr, ptr %9, align 8, !tbaa !9
  %38 = call noundef i64 @_ZNKSt6vectorIlSaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %37) #3
  %39 = icmp ugt i64 %38, 0
  br i1 %39, label %40, label %47

40:                                               ; preds = %36
  %41 = load ptr, ptr %9, align 8, !tbaa !9
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #3
  %43 = load i64, ptr %42, align 8, !tbaa !5
  %44 = load i64, ptr %11, align 8, !tbaa !5
  %45 = icmp eq i64 %43, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %40
  br label %85

47:                                               ; preds = %40, %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %48 = load i64, ptr %7, align 8, !tbaa !5
  %49 = load i64, ptr %10, align 8, !tbaa !5
  %50 = load i64, ptr %11, align 8, !tbaa !5
  %51 = mul nsw i64 %49, %50
  %52 = sub nsw i64 %48, %51
  store i64 %52, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %53 = load i64, ptr %13, align 8, !tbaa !5
  %54 = icmp slt i64 %53, 0
  %55 = zext i1 %54 to i64
  %56 = select i1 %54, i32 -1, i32 1
  %57 = sext i32 %56 to i64
  store i64 %57, ptr %14, align 8, !tbaa !5
  %58 = load i64, ptr %13, align 8, !tbaa !5
  %59 = icmp eq i64 %58, 0
  br i1 %59, label %65, label %60

60:                                               ; preds = %47
  %61 = load i64, ptr %10, align 8, !tbaa !5
  %62 = load i64, ptr %14, align 8, !tbaa !5
  %63 = mul nsw i64 %61, %62
  %64 = icmp sge i64 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %60, %47
  store i32 4, ptr %12, align 4
  br label %82

66:                                               ; preds = %60
  %67 = load ptr, ptr %9, align 8, !tbaa !9
  call void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) %67, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #3
  %68 = load i64, ptr %6, align 8, !tbaa !5
  %69 = sub nsw i64 %68, 1
  %70 = load i64, ptr %13, align 8, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !9
  %72 = load ptr, ptr %9, align 8, !tbaa !9
  %73 = call noundef zeroext i1 @_Z3dfsllRKSt6vectorIbSaIbEERS_IlSaIlEE(i64 noundef %69, i64 noundef %70, ptr noundef nonnull align 8 dereferenceable(40) %71, ptr noundef nonnull align 8 dereferenceable(24) %72)
  %74 = zext i1 %73 to i8
  store i8 %74, ptr %15, align 1, !tbaa !11
  %75 = load i8, ptr %15, align 1, !tbaa !11, !range !13, !noundef !14
  %76 = trunc i8 %75 to i1
  br i1 %76, label %77, label %78

77:                                               ; preds = %66
  store i1 true, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %81

78:                                               ; preds = %66
  %79 = load ptr, ptr %9, align 8, !tbaa !9
  call void @_ZNSt6vectorIlSaIlEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %79) #3
  br label %80

80:                                               ; preds = %78
  store i32 0, ptr %12, align 4
  br label %81

81:                                               ; preds = %80, %77
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #3
  br label %82

82:                                               ; preds = %81, %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %83 = load i32, ptr %12, align 4
  switch i32 %83, label %88 [
    i32 0, label %84
    i32 4, label %85
  ]

84:                                               ; preds = %82
  br label %85

85:                                               ; preds = %84, %82, %46, %35
  %86 = load i64, ptr %11, align 8, !tbaa !5
  %87 = add nsw i64 %86, 1
  store i64 %87, ptr %11, align 8, !tbaa !5
  br label %25, !llvm.loop !15

88:                                               ; preds = %82, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %89 = load i32, ptr %12, align 4
  switch i32 %89, label %91 [
    i32 2, label %90
  ]

90:                                               ; preds = %88
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %91

91:                                               ; preds = %90, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %92

92:                                               ; preds = %91, %18
  %93 = load i1, ptr %5, align 1
  ret i1 %93
}

; 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 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIlSaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIlSaIlEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"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 noundef zeroext i1 @_Z3dfsllRKSt6vectorIbSaIbEERS_IlSaIlEE(i64 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(40) %2, ptr noundef nonnull align 8 dereferenceable(24) %3) local_unnamed_addr #0 {
  %5 = alloca i64, align 8
  %6 = icmp slt i64 %0, 1
  br i1 %6, label %53, label %7

7:                                                ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  store i64 1, ptr %5, align 8, !tbaa !5
  %8 = tail call noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %2) #3
  %.not.not32 = icmp eq i64 %8, 0
  br i1 %.not.not32, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %7
  %.inv29 = icmp slt i64 %1, 0
  %9 = add nsw i64 %0, -1
  br i1 %.inv29, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.thread.us
  %10 = load i64, ptr %5, align 8, !tbaa !5
  %11 = call noundef zeroext i1 @_ZNKSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %2, i64 noundef %10)
  br i1 %11, label %12, label %.thread.us

12:                                               ; preds = %.lr.ph.split.us
  %13 = call noundef i64 @_ZNKSt6vectorIlSaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %.not26.us = icmp eq i64 %13, 0
  br i1 %.not26.us, label %._crit_edge35, label %14

._crit_edge35:                                    ; preds = %12
  %.pre36 = load i64, ptr %5, align 8, !tbaa !5
  br label %19

14:                                               ; preds = %12
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %16 = load i64, ptr %15, align 8, !tbaa !5
  %17 = load i64, ptr %5, align 8, !tbaa !5
  %18 = icmp eq i64 %16, %17
  br i1 %18, label %.thread.us, label %19

19:                                               ; preds = %._crit_edge35, %14
  %20 = phi i64 [ %.pre36, %._crit_edge35 ], [ %17, %14 ]
  %21 = sub nsw i64 0, %20
  %22 = add nsw i64 %20, %1
  %23 = icmp eq i64 %21, %1
  %24 = xor i64 %22, %1
  %25 = icmp sgt i64 %24, -1
  %or.cond.us = select i1 %23, i1 true, i1 %25
  br i1 %or.cond.us, label %.thread.us, label %26

26:                                               ; preds = %19
  call void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %27 = call noundef zeroext i1 @_Z3dfsllRKSt6vectorIbSaIbEERS_IlSaIlEE(i64 noundef %9, i64 noundef %22, ptr noundef nonnull align 8 dereferenceable(40) %2, ptr noundef nonnull align 8 dereferenceable(24) %3)
  br i1 %27, label %.split.us, label %28

28:                                               ; preds = %26
  call void @_ZNSt6vectorIlSaIlEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  br label %.thread.us

.thread.us:                                       ; preds = %19, %28, %14, %.lr.ph.split.us
  %29 = load i64, ptr %5, align 8, !tbaa !5
  %30 = add nsw i64 %29, 1
  store i64 %30, ptr %5, align 8, !tbaa !5
  %31 = call noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %2) #3
  %.not.not.us = icmp ugt i64 %30, %31
  br i1 %.not.not.us, label %.critedge, label %.lr.ph.split.us, !llvm.loop !9

.lr.ph.split:                                     ; preds = %.lr.ph, %.thread
  %32 = load i64, ptr %5, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZNKSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %2, i64 noundef %32)
  br i1 %33, label %34, label %.thread

34:                                               ; preds = %.lr.ph.split
  %35 = call noundef i64 @_ZNKSt6vectorIlSaIlEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %.not26 = icmp eq i64 %35, 0
  br i1 %.not26, label %._crit_edge, label %36

._crit_edge:                                      ; preds = %34
  %.pre = load i64, ptr %5, align 8, !tbaa !5
  br label %41

36:                                               ; preds = %34
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  %38 = load i64, ptr %37, align 8, !tbaa !5
  %39 = load i64, ptr %5, align 8, !tbaa !5
  %40 = icmp eq i64 %38, %39
  br i1 %40, label %.thread, label %41

41:                                               ; preds = %._crit_edge, %36
  %42 = phi i64 [ %.pre, %._crit_edge ], [ %39, %36 ]
  %43 = sub nsw i64 %1, %42
  %44 = icmp eq i64 %42, %1
  %45 = xor i64 %43, %1
  %46 = icmp sgt i64 %45, -1
  %or.cond = select i1 %44, i1 true, i1 %46
  br i1 %or.cond, label %.thread, label %47

47:                                               ; preds = %41
  call void @_ZNSt6vectorIlSaIlEE9push_backERKl(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %48 = call noundef zeroext i1 @_Z3dfsllRKSt6vectorIbSaIbEERS_IlSaIlEE(i64 noundef %9, i64 noundef %43, ptr noundef nonnull align 8 dereferenceable(40) %2, ptr noundef nonnull align 8 dereferenceable(24) %3)
  br i1 %48, label %.split.us, label %49

49:                                               ; preds = %47
  call void @_ZNSt6vectorIlSaIlEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  br label %.thread

.thread:                                          ; preds = %49, %41, %36, %.lr.ph.split
  %50 = load i64, ptr %5, align 8, !tbaa !5
  %51 = add nsw i64 %50, 1
  store i64 %51, ptr %5, align 8, !tbaa !5
  %52 = call noundef i64 @_ZNKSt6vectorIbSaIbEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %2) #3
  %.not.not = icmp ugt i64 %51, %52
  br i1 %.not.not, label %.critedge, label %.lr.ph.split, !llvm.loop !9

.split.us:                                        ; preds = %47, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br label %53

.critedge:                                        ; preds = %.thread, %.thread.us, %7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br label %53

53:                                               ; preds = %.split.us, %.critedge, %4
  %.6 = phi i1 [ true, %4 ], [ false, %.critedge ], [ true, %.split.us ]
  ret i1 %.6
}

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

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

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

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

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

; Function Attrs: mustprogress 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 = { 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 = { 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: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass