; LLVM IR from DionysiosB/CodeForces :: CodeforcesEDU/BinarySearch2D-ChildrenHoliday.ll (Z5checkRKSt6vectorI9assistantSaIS0_EExx)

; 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.assistant = type { i64, i64, i64 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z5checkRKSt6vectorI9assistantSaIS0_EExx(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, i64 noundef %2) #0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 0, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %15

15:                                               ; preds = %100, %3
  %16 = load i64, ptr %9, align 8, !tbaa !11
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef i64 @_ZNKSt6vectorI9assistantSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #2
  %19 = icmp ult i64 %16, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %15
  store i32 2, ptr %10, align 4
  br label %103

21:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load i64, ptr %9, align 8, !tbaa !11
  %24 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %23) #2
  %25 = getelementptr inbounds %struct.assistant, ptr %24, i32 0, i32 0
  %26 = load i64, ptr %25, align 8, !tbaa !13
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load i64, ptr %9, align 8, !tbaa !11
  %29 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %27, i64 noundef %28) #2
  %30 = getelementptr inbounds %struct.assistant, ptr %29, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !15
  %32 = mul nsw i64 %26, %31
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load i64, ptr %9, align 8, !tbaa !11
  %35 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %34) #2
  %36 = getelementptr inbounds %struct.assistant, ptr %35, i32 0, i32 2
  %37 = load i64, ptr %36, align 8, !tbaa !16
  %38 = add nsw i64 %32, %37
  store i64 %38, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %39 = load i64, ptr %7, align 8, !tbaa !9
  %40 = load i64, ptr %11, align 8, !tbaa !9
  %41 = sdiv i64 %39, %40
  store i64 %41, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %42 = load i64, ptr %7, align 8, !tbaa !9
  %43 = load i64, ptr %11, align 8, !tbaa !9
  %44 = srem i64 %42, %43
  store i64 %44, ptr %13, align 8, !tbaa !9
  %45 = load i64, ptr %13, align 8, !tbaa !9
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load i64, ptr %9, align 8, !tbaa !11
  %48 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %46, i64 noundef %47) #2
  %49 = getelementptr inbounds %struct.assistant, ptr %48, i32 0, i32 0
  %50 = load i64, ptr %49, align 8, !tbaa !13
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = load i64, ptr %9, align 8, !tbaa !11
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %51, i64 noundef %52) #2
  %54 = getelementptr inbounds %struct.assistant, ptr %53, i32 0, i32 1
  %55 = load i64, ptr %54, align 8, !tbaa !15
  %56 = mul nsw i64 %50, %55
  %57 = icmp slt i64 %45, %56
  br i1 %57, label %58, label %60

58:                                               ; preds = %21
  %59 = load i64, ptr %13, align 8, !tbaa !9
  br label %72

60:                                               ; preds = %21
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = load i64, ptr %9, align 8, !tbaa !11
  %63 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %62) #2
  %64 = getelementptr inbounds %struct.assistant, ptr %63, i32 0, i32 0
  %65 = load i64, ptr %64, align 8, !tbaa !13
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = load i64, ptr %9, align 8, !tbaa !11
  %68 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %66, i64 noundef %67) #2
  %69 = getelementptr inbounds %struct.assistant, ptr %68, i32 0, i32 1
  %70 = load i64, ptr %69, align 8, !tbaa !15
  %71 = mul nsw i64 %65, %70
  br label %72

72:                                               ; preds = %60, %58
  %73 = phi i64 [ %59, %58 ], [ %71, %60 ]
  store i64 %73, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  %74 = load i64, ptr %12, align 8, !tbaa !9
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = load i64, ptr %9, align 8, !tbaa !11
  %77 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %75, i64 noundef %76) #2
  %78 = getelementptr inbounds %struct.assistant, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !15
  %80 = mul nsw i64 %74, %79
  %81 = load i64, ptr %13, align 8, !tbaa !9
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = load i64, ptr %9, align 8, !tbaa !11
  %84 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %82, i64 noundef %83) #2
  %85 = getelementptr inbounds %struct.assistant, ptr %84, i32 0, i32 0
  %86 = load i64, ptr %85, align 8, !tbaa !13
  %87 = sdiv i64 %81, %86
  %88 = add nsw i64 %80, %87
  store i64 %88, ptr %14, align 8, !tbaa !9
  %89 = load i64, ptr %14, align 8, !tbaa !9
  %90 = load i64, ptr %8, align 8, !tbaa !9
  %91 = add nsw i64 %90, %89
  store i64 %91, ptr %8, align 8, !tbaa !9
  %92 = load i64, ptr %8, align 8, !tbaa !9
  %93 = load i64, ptr %6, align 8, !tbaa !9
  %94 = icmp sge i64 %92, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %72
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %97

96:                                               ; preds = %72
  store i32 0, ptr %10, align 4
  br label %97

97:                                               ; preds = %96, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  %98 = load i32, ptr %10, align 4
  switch i32 %98, label %103 [
    i32 0, label %99
  ]

99:                                               ; preds = %97
  br label %100

100:                                              ; preds = %99
  %101 = load i64, ptr %9, align 8, !tbaa !11
  %102 = add nsw i64 %101, 1
  store i64 %102, ptr %9, align 8, !tbaa !11
  br label %15, !llvm.loop !17

103:                                              ; preds = %97, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  %104 = load i32, ptr %10, align 4
  switch i32 %104, label %106 [
    i32 2, label %105
  ]

105:                                              ; preds = %103
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %106

106:                                              ; preds = %105, %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %107 = load i1, ptr %4, align 1
  ret i1 %107
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), 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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS9assistant", !10, i64 0, !10, i64 8, !10, i64 16}
!15 = !{!14, !10, i64 8}
!16 = !{!14, !10, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"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 noundef zeroext i1 @_Z5checkRKSt6vectorI9assistantSaIS0_EExx(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = tail call noundef i64 @_ZNKSt6vectorI9assistantSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #1
  %.not4142.not = icmp eq i64 %4, 0
  br i1 %.not4142.not, label %.critedge, label %.lr.ph

5:                                                ; preds = %34
  %6 = add nuw nsw i64 %.03743, 1
  %7 = tail call noundef i64 @_ZNKSt6vectorI9assistantSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #1
  %.not41 = icmp ult i64 %6, %7
  br i1 %.not41, label %.lr.ph, label %.critedge, !llvm.loop !5

.lr.ph:                                           ; preds = %3, %5
  %.03644 = phi i64 [ %44, %5 ], [ 0, %3 ]
  %.03743 = phi i64 [ %6, %5 ], [ 0, %3 ]
  %8 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %9 = load i64, ptr %8, align 8, !tbaa !7
  %10 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  %12 = load i64, ptr %11, align 8, !tbaa !12
  %13 = mul nsw i64 %12, %9
  %14 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %16 = load i64, ptr %15, align 8, !tbaa !13
  %17 = add nsw i64 %16, %13
  %18 = sdiv i64 %2, %17
  %19 = srem i64 %2, %17
  %20 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %21 = load i64, ptr %20, align 8, !tbaa !7
  %22 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %23 = getelementptr inbounds i8, ptr %22, i64 8
  %24 = load i64, ptr %23, align 8, !tbaa !12
  %25 = mul nsw i64 %24, %21
  %26 = icmp slt i64 %19, %25
  br i1 %26, label %34, label %27

27:                                               ; preds = %.lr.ph
  %28 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %29 = load i64, ptr %28, align 8, !tbaa !7
  %30 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %31 = getelementptr inbounds i8, ptr %30, i64 8
  %32 = load i64, ptr %31, align 8, !tbaa !12
  %33 = mul nsw i64 %32, %29
  br label %34

34:                                               ; preds = %.lr.ph, %27
  %35 = phi i64 [ %33, %27 ], [ %19, %.lr.ph ]
  %36 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %37 = getelementptr inbounds i8, ptr %36, i64 8
  %38 = load i64, ptr %37, align 8, !tbaa !12
  %39 = mul nsw i64 %38, %18
  %40 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03743) #1
  %41 = load i64, ptr %40, align 8, !tbaa !7
  %42 = sdiv i64 %35, %41
  %43 = add i64 %39, %.03644
  %44 = add i64 %43, %42
  %.not.not = icmp sge i64 %44, %1
  br i1 %.not.not, label %.critedge, label %5

.critedge:                                        ; preds = %34, %5, %3
  %.not41.lcssa = phi i1 [ false, %3 ], [ %.not.not, %5 ], [ %.not.not, %34 ]
  ret i1 %.not41.lcssa
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI9assistantSaIS0_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(24) ptr @_ZNKSt6vectorI9assistantSaIS0_EEixEm(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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !9, i64 0}
!8 = !{!"_ZTS9assistant", !9, i64 0, !9, i64 8, !9, i64 16}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!8, !9, i64 8}
!13 = !{!8, !9, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass