; LLVM IR from bqi343/cp-notebook :: Contests/USACO Training/Ch 5/5.3 milk4.ll (Z3dfsiSt6vectorIiSaIiEESt6bitsetILm20001EE)

; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [313 x i64] }
%"class.std::bitset<20001>::reference" = type { ptr, i64 }

@Q = external dso_local global i32, align 4
@P = external dso_local global i32, align 4
@best = external dso_local global i32, align 4
@pail = external dso_local global %"class.std::vector", align 8
@best1 = external dso_local global %"class.std::vector", align 8

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsiSt6vectorIiSaIiEESt6bitsetILm20001EE(i32 noundef %0, ptr noundef %1, ptr noundef byval(%"class.std::bitset") align 8 %2) #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::bitset<20001>::reference", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::bitset", align 8
  %9 = alloca %"class.std::bitset<20001>::reference", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::vector", align 8
  %12 = alloca %"class.std::bitset", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %"class.std::vector", align 8
  %16 = alloca %"class.std::bitset", align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %17 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %18 = load i32, ptr @best, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = icmp uge i64 %17, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %3
  br label %90

22:                                               ; preds = %3
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  call void @_ZNSt6bitsetILm20001EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<20001>::reference") align 8 %6, ptr noundef nonnull align 8 dereferenceable(2504) %2, i64 noundef 0)
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20001EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %6, i1 noundef zeroext true) #4
  call void @_ZNSt6bitsetILm20001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  br label %50

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %46, %27
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pail, i64 noundef %30) #4
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = mul nsw i32 %32, %33
  %35 = load i32, ptr @Q, align 4, !tbaa !5
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %37, label %49

37:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 2504, ptr %8) #4
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pail, i64 noundef %39) #4
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = mul nsw i32 %41, %42
  %44 = sext i32 %43 to i64
  call void @_ZNKSt6bitsetILm20001EElsEm(ptr dead_on_unwind writable sret(%"class.std::bitset") align 8 %8, ptr noundef nonnull align 8 dereferenceable(2504) %2, i64 noundef %44) #4
  %45 = call noundef nonnull align 8 dereferenceable(2504) ptr @_ZNSt6bitsetILm20001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(2504) %2, ptr noundef nonnull align 8 dereferenceable(2504) %8) #4
  call void @llvm.lifetime.end.p0(i64 2504, ptr %8) #4
  br label %46

46:                                               ; preds = %37
  %47 = load i32, ptr %7, align 4, !tbaa !5
  %48 = shl i32 %47, 1
  store i32 %48, ptr %7, align 4, !tbaa !5
  br label %28, !llvm.loop !11

49:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %50

50:                                               ; preds = %49, %25
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  %51 = load i32, ptr @Q, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  call void @_ZNSt6bitsetILm20001EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<20001>::reference") align 8 %9, ptr noundef nonnull align 8 dereferenceable(2504) %2, i64 noundef %52)
  %53 = call noundef zeroext i1 @_ZNKSt6bitsetILm20001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  %54 = zext i1 %53 to i32
  %55 = icmp eq i32 %54, 1
  call void @_ZNSt6bitsetILm20001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  br i1 %55, label %56, label %60

56:                                               ; preds = %50
  %57 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %58 = trunc i64 %57 to i32
  store i32 %58, ptr @best, align 4, !tbaa !5
  %59 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIiSaIiEEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @best1, ptr noundef nonnull align 8 dereferenceable(24) %1)
  br label %90

60:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %10, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %77, %60
  %64 = load i32, ptr %10, align 4, !tbaa !5
  %65 = load i32, ptr @P, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  %67 = icmp slt i32 %64, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %89

69:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #4
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %1)
  call void @llvm.lifetime.start.p0(i64 2504, ptr %12) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %2, i64 2504, i1 false)
  %70 = load i32, ptr %10, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pail, i64 noundef %71) #4
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 4 dereferenceable(4) %72)
          to label %73 unwind label %80

73:                                               ; preds = %69
  %74 = load i32, ptr %10, align 4, !tbaa !5
  invoke void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %75 unwind label %80

75:                                               ; preds = %73
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %12, i64 2504, i1 false)
  invoke void @_Z3dfsiSt6vectorIiSaIiEESt6bitsetILm20001EE(i32 noundef %74, ptr noundef %15, ptr noundef byval(%"class.std::bitset") align 8 %16)
          to label %76 unwind label %84

76:                                               ; preds = %75
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  call void @llvm.lifetime.end.p0(i64 2504, ptr %12) #4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #4
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %10, align 4, !tbaa !5
  br label %63, !llvm.loop !13

80:                                               ; preds = %73, %69
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %13, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %14, align 4
  br label %88

84:                                               ; preds = %75
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %13, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %14, align 4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #4
  br label %88

88:                                               ; preds = %84, %80
  call void @llvm.lifetime.end.p0(i64 2504, ptr %12) #4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %91

89:                                               ; preds = %68
  br label %90

90:                                               ; preds = %89, %56, %21
  ret void

91:                                               ; preds = %88
  %92 = load ptr, ptr %13, align 8
  %93 = load i32, ptr %14, align 4
  %94 = insertvalue { ptr, i32 } poison, ptr %92, 0
  %95 = insertvalue { ptr, i32 } %94, i32 %93, 1
  resume { ptr, i32 } %95
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm20001EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<20001>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(2504), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20001EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm20001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt6bitsetILm20001EElsEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(2504), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(2504) ptr @_ZNSt6bitsetILm20001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(2504), ptr noundef nonnull align 8 dereferenceable(2504)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm20001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

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

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

; 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) #3

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

declare i32 @__gxx_personality_v0(...)

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 = { 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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!"int", !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"}
!13 = distinct !{!13, !12}


; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [313 x i64] }
%"class.std::bitset<20001>::reference" = type { ptr, i64 }

@Q = external dso_local local_unnamed_addr global i32, align 4
@P = external dso_local local_unnamed_addr global i32, align 4
@best = external dso_local local_unnamed_addr global i32, align 4
@pail = external dso_local global %"class.std::vector", align 8
@best1 = external dso_local global %"class.std::vector", align 8

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3dfsiSt6vectorIiSaIiEESt6bitsetILm20001EE(i32 noundef %0, ptr noundef nonnull %1, ptr noundef byval(%"class.std::bitset") align 8 %2) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::bitset<20001>::reference", align 8
  %5 = alloca %"class.std::bitset", align 8
  %6 = alloca %"class.std::bitset<20001>::reference", align 8
  %7 = alloca %"class.std::vector", align 8
  %.sroa.0 = alloca [313 x i64], align 8
  %8 = alloca %"class.std::vector", align 8
  %9 = tail call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %10 = load i32, ptr @best, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %.not = icmp ult i64 %9, %11
  br i1 %.not, label %12, label %.loopexit

12:                                               ; preds = %3
  %13 = icmp eq i32 %0, 0
  br i1 %13, label %18, label %.preheader18

.preheader18:                                     ; preds = %12
  %14 = sext i32 %0 to i64
  %15 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pail, i64 noundef %14) #4
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = load i32, ptr @Q, align 4, !tbaa !5
  %.not1620 = icmp sgt i32 %16, %17
  br i1 %.not1620, label %.loopexit19, label %.lr.ph

18:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @_ZNSt6bitsetILm20001EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20001>::reference") align 8 %4, ptr noundef nonnull align 8 dereferenceable(2504) %2, i64 noundef 0)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm20001EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %4, i1 noundef zeroext true) #4
  call void @_ZNSt6bitsetILm20001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  %.pre = load i32, ptr @Q, align 4, !tbaa !5
  br label %.loopexit19

.lr.ph:                                           ; preds = %.preheader18, %.lr.ph
  %.01421 = phi i32 [ %25, %.lr.ph ], [ 1, %.preheader18 ]
  call void @llvm.lifetime.start.p0(i64 2504, ptr nonnull %5) #4
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pail, i64 noundef %14) #4
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = mul nsw i32 %21, %.01421
  %23 = sext i32 %22 to i64
  call void @_ZNKSt6bitsetILm20001EElsEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset") align 8 %5, ptr noundef nonnull align 8 dereferenceable(2504) %2, i64 noundef %23) #4
  %24 = call noundef nonnull align 8 dereferenceable(2504) ptr @_ZNSt6bitsetILm20001EEoRERKS0_(ptr noundef nonnull align 8 dereferenceable(2504) %2, ptr noundef nonnull align 8 dereferenceable(2504) %5) #4
  call void @llvm.lifetime.end.p0(i64 2504, ptr nonnull %5) #4
  %25 = shl i32 %.01421, 1
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pail, i64 noundef %14) #4
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = mul nsw i32 %27, %25
  %29 = load i32, ptr @Q, align 4, !tbaa !5
  %.not16 = icmp sgt i32 %28, %29
  br i1 %.not16, label %.loopexit19, label %.lr.ph, !llvm.loop !9

.loopexit19:                                      ; preds = %.lr.ph, %.preheader18, %18
  %30 = phi i32 [ %17, %.preheader18 ], [ %.pre, %18 ], [ %29, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  %31 = sext i32 %30 to i64
  call void @_ZNSt6bitsetILm20001EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<20001>::reference") align 8 %6, ptr noundef nonnull align 8 dereferenceable(2504) %2, i64 noundef %31)
  %32 = call noundef zeroext i1 @_ZNKSt6bitsetILm20001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  call void @_ZNSt6bitsetILm20001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  br i1 %32, label %36, label %.preheader

.preheader:                                       ; preds = %.loopexit19
  %33 = load i32, ptr @P, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, %0
  br i1 %34, label %.lr.ph24.preheader, label %.loopexit

.lr.ph24.preheader:                               ; preds = %.preheader
  %35 = sext i32 %0 to i64
  br label %.lr.ph24

36:                                               ; preds = %.loopexit19
  %37 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #4
  %38 = trunc i64 %37 to i32
  store i32 %38, ptr @best, align 4, !tbaa !5
  %39 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIiSaIiEEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @best1, ptr noundef nonnull align 8 dereferenceable(24) %1)
  br label %.loopexit

.lr.ph24:                                         ; preds = %.lr.ph24.preheader, %44
  %indvars.iv = phi i64 [ %35, %.lr.ph24.preheader ], [ %indvars.iv.next, %44 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #4
  call void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %1)
  call void @llvm.lifetime.start.p0(i64 2504, ptr nonnull %.sroa.0)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(2504) %.sroa.0, ptr noundef nonnull align 8 dereferenceable(2504) %2, i64 2504, i1 false)
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @pail, i64 noundef %indvars.iv.next) #4
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 4 dereferenceable(4) %40)
          to label %41 unwind label %48

41:                                               ; preds = %.lr.ph24
  invoke void @_ZNSt6vectorIiSaIiEEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %42 unwind label %48

42:                                               ; preds = %41
  %43 = trunc nsw i64 %indvars.iv.next to i32
  invoke void @_Z3dfsiSt6vectorIiSaIiEESt6bitsetILm20001EE(i32 noundef %43, ptr noundef nonnull %8, ptr noundef nonnull byval(%"class.std::bitset") align 8 %.sroa.0)
          to label %44 unwind label %50

44:                                               ; preds = %42
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  call void @llvm.lifetime.end.p0(i64 2504, ptr nonnull %.sroa.0)
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #4
  %45 = load i32, ptr @P, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next, %46
  br i1 %47, label %.lr.ph24, label %.loopexit, !llvm.loop !11

48:                                               ; preds = %41, %.lr.ph24
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %52

50:                                               ; preds = %42
  %51 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #4
  br label %52

52:                                               ; preds = %50, %48
  %.pn = phi { ptr, i32 } [ %51, %50 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 2504, ptr nonnull %.sroa.0)
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #4
  resume { ptr, i32 } %.pn

.loopexit:                                        ; preds = %44, %.preheader, %3, %36
  ret void
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm20001EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<20001>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(2504), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm20001EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNKSt6bitsetILm20001EElsEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset") align 8, ptr noundef nonnull align 8 dereferenceable(2504), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm20001EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress 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) #3

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

declare i32 @__gxx_personality_v0(...)

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 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass