; LLVM IR from facebook/redex :: libredex (BalancedPartitioning)

; 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.__gnu_cxx::__normal_iterator" = type { ptr }
%class.anon.36 = type { i8 }
%class.Document = type { i32, i64, %"class.std::vector.4", %"class.std::vector.4" }
%"class.std::vector.4" = type { %"struct.std::_Vector_base.5" }
%"struct.std::_Vector_base.5" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.4 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j = external hidden unnamed_addr constant [135 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [39 x i8], align 1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEENSt15iterator_traitsIT_E15difference_typeESA_SA_(ptr, ptr) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPP8DocumentSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4 align 2

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j(ptr noundef nonnull align 8 dereferenceable(131088) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %3) #6 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %16 = alloca %class.anon.36, align 1
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  %22 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %23, i64 8, i1 false), !tbaa.struct !11
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %24, i64 8, i1 false), !tbaa.struct !11
  %25 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %10, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8
  %27 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %11, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8
  %29 = call noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEENSt15iterator_traitsIT_E15difference_typeESA_SA_(ptr %26, ptr %28)
  %30 = trunc i64 %29 to i32
  store i32 %30, ptr %9, align 4, !tbaa !9
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = icmp ugt i32 %31, 0
  br i1 %32, label %33, label %34

33:                                               ; preds = %4
  br label %37

34:                                               ; preds = %4
  %35 = load i32, ptr %9, align 4, !tbaa !9
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.6, ptr noundef @.str.4, i32 noundef 303, ptr noundef @__PRETTY_FUNCTION__._ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j, i32 noundef 2, ptr noundef @.str.7, i32 noundef %35) #8
  unreachable

36:                                               ; No predecessors!
  br label %37

37:                                               ; preds = %36, %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = add i32 %38, 1
  %40 = udiv i32 %39, 2
  store i32 %40, ptr %12, align 4, !tbaa !9
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = icmp ugt i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %37
  br label %47

44:                                               ; preds = %37
  %45 = load i32, ptr %12, align 4, !tbaa !9
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.8, ptr noundef @.str.4, i32 noundef 307, ptr noundef @__PRETTY_FUNCTION__._ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j, i32 noundef 2, ptr noundef @.str.9, i32 noundef %45) #8
  unreachable

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46, %43
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %48, i64 8, i1 false), !tbaa.struct !11
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i32, ptr %12, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %49, i64 noundef %51) #7
  %53 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  store ptr %52, ptr %53, align 8
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %54, i64 8, i1 false), !tbaa.struct !11
  %55 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %13, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8
  %57 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %14, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8
  %59 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %15, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8
  call void @"_ZSt11nth_elementIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEZNK20BalancedPartitioning5splitERKS8_SB_jE3$_0EvT_SD_SD_T0_"(ptr %56, ptr %58, ptr %60)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %61, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %90, %47
  %63 = load i32, ptr %18, align 4, !tbaa !9
  %64 = icmp ult i32 %63, 2
  br i1 %64, label %66, label %65

65:                                               ; preds = %62
  store i32 2, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %93

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

67:                                               ; preds = %86, %66
  %68 = load i32, ptr %20, align 4, !tbaa !9
  %69 = load i32, ptr %12, align 4, !tbaa !9
  %70 = icmp ult i32 %68, %69
  br i1 %70, label %71, label %74

71:                                               ; preds = %67
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP8DocumentSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %72) #7
  br label %74

74:                                               ; preds = %71, %67
  %75 = phi i1 [ false, %67 ], [ %73, %71 ]
  br i1 %75, label %77, label %76

76:                                               ; preds = %74
  store i32 5, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %89

77:                                               ; preds = %74
  %78 = load i32, ptr %8, align 4, !tbaa !9
  %79 = load i32, ptr %18, align 4, !tbaa !9
  %80 = add i32 %78, %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %81 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %17, i32 noundef 0) #7
  %82 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %21, i32 0, i32 0
  store ptr %81, ptr %82, align 8
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  %85 = getelementptr inbounds %class.Document, ptr %84, i32 0, i32 0
  store i32 %80, ptr %85, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %86

86:                                               ; preds = %77
  %87 = load i32, ptr %20, align 4, !tbaa !9
  %88 = add i32 %87, 1
  store i32 %88, ptr %20, align 4, !tbaa !9
  br label %67, !llvm.loop !19

89:                                               ; preds = %76
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %18, align 4, !tbaa !9
  %92 = add i32 %91, 1
  store i32 %92, ptr %18, align 4, !tbaa !9
  br label %62, !llvm.loop !21

93:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt11nth_elementIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEZNK20BalancedPartitioning5splitERKS8_SB_jE3$_0EvT_SD_SD_T0_"(ptr, ptr, ptr) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #4 = { 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 #5 = { noreturn "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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 8, !5}
!12 = !{!13, !10, i64 0}
!13 = !{!"_ZTS8Document", !10, i64 0, !14, i64 8, !15, i64 16, !15, i64 40}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSSt6vectorIjSaIjEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}


; 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.__gnu_cxx::__normal_iterator" = type { ptr }

@.str.4 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j = external hidden unnamed_addr constant [135 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [39 x i8], align 1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEENSt15iterator_traitsIT_E15difference_typeESA_SA_(ptr, ptr) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPP8DocumentSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j(ptr nocapture noundef nonnull readnone align 8 dereferenceable(131088) %0, ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %3) local_unnamed_addr #5 align 2 {
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %.sroa.012.0.copyload = load ptr, ptr %1, align 8, !tbaa !5
  %.sroa.011.0.copyload = load ptr, ptr %2, align 8, !tbaa !5
  %7 = tail call noundef i64 @_ZSt8distanceIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEENSt15iterator_traitsIT_E15difference_typeESA_SA_(ptr %.sroa.012.0.copyload, ptr %.sroa.011.0.copyload)
  %8 = trunc i64 %7 to i32
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %10

9:                                                ; preds = %4
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.4, i32 noundef 303, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j, i32 noundef 2, ptr noundef nonnull @.str.7, i32 noundef 0) #7
  unreachable

10:                                               ; preds = %4
  %11 = add i32 %8, 1
  %.not28 = icmp ult i32 %11, 2
  br i1 %.not28, label %12, label %.preheader.us.preheader

12:                                               ; preds = %10
  tail call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.4, i32 noundef 307, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK20BalancedPartitioning5splitERKN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEESA_j, i32 noundef 2, ptr noundef nonnull @.str.9, i32 noundef 0) #7
  unreachable

.preheader.us.preheader:                          ; preds = %10
  %13 = lshr i32 %11, 1
  %.sroa.06.0.copyload = load ptr, ptr %1, align 8, !tbaa !5
  %14 = zext nneg i32 %13 to i64
  %15 = tail call ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEplEl(ptr noundef nonnull align 8 dereferenceable(8) %1, i64 noundef %14) #8
  %.sroa.0.0.copyload = load ptr, ptr %2, align 8, !tbaa !5
  tail call void @"_ZSt11nth_elementIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEZNK20BalancedPartitioning5splitERKS8_SB_jE3$_0EvT_SD_SD_T0_"(ptr %.sroa.06.0.copyload, ptr %15, ptr %.sroa.0.0.copyload)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %16 = load i64, ptr %1, align 8, !tbaa !5
  store i64 %16, ptr %5, align 8, !tbaa !5
  %umax = tail call i32 @llvm.umax.i32(i32 %13, i32 1)
  br label %17

17:                                               ; preds = %.preheader.us.preheader, %27
  %.029.us = phi i32 [ 0, %.preheader.us.preheader ], [ %31, %27 ]
  %18 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP8DocumentSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  br i1 %18, label %27, label %.critedge.us

.critedge.us:                                     ; preds = %17, %27
  %19 = add i32 %3, 1
  br label %20

20:                                               ; preds = %22, %.critedge.us
  %.029.us.1 = phi i32 [ 0, %.critedge.us ], [ %26, %22 ]
  %21 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPP8DocumentSt6vectorIS2_SaIS2_EEEEbRKNS_17__normal_iteratorIT_T0_EESC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %2) #8
  br i1 %21, label %22, label %.split33.us

22:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %23 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #8
  store ptr %23, ptr %6, align 8
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  store i32 %19, ptr %25, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %26 = add nuw nsw i32 %.029.us.1, 1
  %exitcond.1.not = icmp eq i32 %26, %umax
  br i1 %exitcond.1.not, label %.split33.us, label %20, !llvm.loop !17

27:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %28 = call ptr @_ZN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #8
  store ptr %28, ptr %6, align 8
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS2_SaIS2_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #8
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  store i32 %3, ptr %30, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %31 = add nuw nsw i32 %.029.us, 1
  %exitcond.not = icmp eq i32 %31, %umax
  br i1 %exitcond.not, label %.critedge.us, label %17, !llvm.loop !17

.split33.us:                                      ; preds = %20, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt11nth_elementIN9__gnu_cxx17__normal_iteratorIPP8DocumentSt6vectorIS3_SaIS3_EEEEZNK20BalancedPartitioning5splitERKS8_SB_jE3$_0EvT_SD_SD_T0_"(ptr, ptr, ptr) local_unnamed_addr #1

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 #2 = { inlinehint 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 = { 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 #4 = { noreturn "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 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { noreturn }
attributes #8 = { 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, !11, i64 0}
!10 = !{!"_ZTS8Document", !11, i64 0, !12, i64 8, !13, i64 16, !13, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!"_ZTSSt6vectorIjSaIjEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass