; LLVM IR from DionysiosB/CodeForces :: 1760G-SlavicGsFavoriteProblem/Z3dfsllRKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EERS_1eb21634 (IlSaIlEERKl)

; 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.std::pair" = type { i64, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsllRKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EERS_IlSaIlEERKl(i64 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #0 {
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  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
  store ptr %4, ptr %10, align 8, !tbaa !9
  %15 = load i64, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %10, align 8, !tbaa !9
  %17 = load i64, ptr %16, align 8, !tbaa !5
  %18 = icmp eq i64 %15, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %5
  br label %69

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

21:                                               ; preds = %66, %20
  %22 = load i64, ptr %11, align 8, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !9
  %24 = load i64, ptr %6, align 8, !tbaa !5
  %25 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %23, i64 noundef %24) #3
  %26 = call noundef i64 @_ZNKSt6vectorISt4pairIllESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #3
  %27 = icmp ult i64 %22, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %21
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %69

29:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %30 = load ptr, ptr %8, align 8, !tbaa !9
  %31 = load i64, ptr %6, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %31) #3
  %33 = load i64, ptr %11, align 8, !tbaa !5
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %33) #3
  %35 = getelementptr inbounds %"struct.std::pair", ptr %34, i32 0, i32 0
  %36 = load i64, ptr %35, align 8, !tbaa !11
  store i64 %36, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %37 = load ptr, ptr %8, align 8, !tbaa !9
  %38 = load i64, ptr %6, align 8, !tbaa !5
  %39 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %37, i64 noundef %38) #3
  %40 = load i64, ptr %11, align 8, !tbaa !5
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %40) #3
  %42 = getelementptr inbounds %"struct.std::pair", ptr %41, i32 0, i32 1
  %43 = load i64, ptr %42, align 8, !tbaa !13
  store i64 %43, ptr %14, align 8, !tbaa !5
  %44 = load i64, ptr %13, align 8, !tbaa !5
  %45 = load i64, ptr %7, align 8, !tbaa !5
  %46 = icmp eq i64 %44, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %29
  store i32 4, ptr %12, align 4
  br label %63

48:                                               ; preds = %29
  %49 = load ptr, ptr %9, align 8, !tbaa !9
  %50 = load i64, ptr %6, align 8, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef %50) #3
  %52 = load i64, ptr %51, align 8, !tbaa !5
  %53 = load i64, ptr %14, align 8, !tbaa !5
  %54 = xor i64 %52, %53
  %55 = load ptr, ptr %9, align 8, !tbaa !9
  %56 = load i64, ptr %13, align 8, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %55, i64 noundef %56) #3
  store i64 %54, ptr %57, align 8, !tbaa !5
  %58 = load i64, ptr %13, align 8, !tbaa !5
  %59 = load i64, ptr %6, align 8, !tbaa !5
  %60 = load ptr, ptr %8, align 8, !tbaa !9
  %61 = load ptr, ptr %9, align 8, !tbaa !9
  %62 = load ptr, ptr %10, align 8, !tbaa !9
  call void @_Z3dfsllRKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EERS_IlSaIlEERKl(i64 noundef %58, i64 noundef %59, ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 8 dereferenceable(24) %61, ptr noundef nonnull align 8 dereferenceable(8) %62)
  store i32 0, ptr %12, align 4
  br label %63

63:                                               ; preds = %48, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %64 = load i32, ptr %12, align 4
  switch i32 %64, label %70 [
    i32 0, label %65
    i32 4, label %66
  ]

65:                                               ; preds = %63
  br label %66

66:                                               ; preds = %65, %63
  %67 = load i64, ptr %11, align 8, !tbaa !5
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr %11, align 8, !tbaa !5
  br label %21, !llvm.loop !14

69:                                               ; preds = %28, %19
  ret void

70:                                               ; preds = %63
  unreachable
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #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, !6, i64 0}
!12 = !{!"_ZTSSt4pairIllE", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"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 nounwind uwtable
define dso_local void @_Z3dfsllRKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EERS_IlSaIlEERKl(i64 noundef %0, i64 noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr nocapture noundef nonnull readonly align 8 dereferenceable(8) %4) local_unnamed_addr #0 {
  %6 = load i64, ptr %4, align 8, !tbaa !5
  %7 = icmp eq i64 %6, %1
  br i1 %7, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %5
  %8 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %0) #1
  %9 = tail call noundef i64 @_ZNKSt6vectorISt4pairIllESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #1
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %23
  %.025 = phi i64 [ %24, %23 ], [ 0, %.preheader ]
  %10 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %0) #1
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %10, i64 noundef %.025) #1
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %0) #1
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorISt4pairIllESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %13, i64 noundef %.025) #1
  %15 = icmp eq i64 %12, %1
  br i1 %15, label %23, label %16

16:                                               ; preds = %.lr.ph
  %17 = getelementptr inbounds i8, ptr %14, i64 8
  %18 = load i64, ptr %17, align 8, !tbaa !11
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %0) #1
  %20 = load i64, ptr %19, align 8, !tbaa !5
  %21 = xor i64 %20, %18
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %12) #1
  store i64 %21, ptr %22, align 8, !tbaa !5
  tail call void @_Z3dfsllRKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EERS_IlSaIlEERKl(i64 noundef %12, i64 noundef %0, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  br label %23

23:                                               ; preds = %.lr.ph, %16
  %24 = add nuw nsw i64 %.025, 1
  %25 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorIS_ISt4pairIllESaIS1_EESaIS3_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %0) #1
  %26 = tail call noundef i64 @_ZNKSt6vectorISt4pairIllESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #1
  %27 = icmp ult i64 %24, %26
  br i1 %27, label %.lr.ph, label %.loopexit, !llvm.loop !12

.loopexit:                                        ; preds = %23, %.preheader, %5
  ret void
}

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

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

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

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

attributes #0 = { 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 #1 = { 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, !6, i64 0}
!10 = !{!"_ZTSSt4pairIllE", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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