; LLVM IR from xirc/cp-algorithm :: atcoder/abc193/D/main.ll (Z5scoreRKSt6vectorIiSaIiEE)

; 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 nounwind uwtable
define dso_local noundef i32 @_Z5scoreRKSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(24) %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #2
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %33, %1
  %9 = load i32, ptr %4, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 10
  br i1 %10, label %12, label %11

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

12:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %13 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %13, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %26, %12
  %15 = load i32, ptr %7, align 4, !tbaa !9
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %18) #2
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = icmp slt i32 %15, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %14
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  br label %29

23:                                               ; preds = %14
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = mul nsw i32 %24, 10
  store i32 %25, ptr %6, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %23
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %7, align 4, !tbaa !9
  br label %14, !llvm.loop !11

29:                                               ; preds = %22
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = load i32, ptr %3, align 4, !tbaa !9
  %32 = add nsw i32 %31, %30
  store i32 %32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %33

33:                                               ; preds = %29
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %4, align 4, !tbaa !9
  br label %8, !llvm.loop !13

36:                                               ; preds = %11
  %37 = load i32, ptr %3, align 4, !tbaa !9
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #2
  ret i32 %37
}

; 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 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(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 = !{!"int", !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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z5scoreRKSt6vectorIiSaIiEE(ptr noundef nonnull align 8 dereferenceable(24) %0) local_unnamed_addr #0 {
.preheader:
  %1 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #1
  %2 = load i32, ptr %1, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %4 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 1) #1
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph.1, label %._crit_edge.1

.lr.ph.1:                                         ; preds = %._crit_edge, %.lr.ph.1
  %.014.1 = phi i32 [ %8, %.lr.ph.1 ], [ 0, %._crit_edge ]
  %.01013.1 = phi i32 [ %7, %.lr.ph.1 ], [ 1, %._crit_edge ]
  %7 = mul nuw nsw i32 %.01013.1, 10
  %8 = add nuw nsw i32 %.014.1, 1
  %9 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 1) #1
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %11 = icmp slt i32 %8, %10
  br i1 %11, label %.lr.ph.1, label %._crit_edge.1, !llvm.loop !9

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %.010.lcssa.1 = phi i32 [ 1, %._crit_edge ], [ %7, %.lr.ph.1 ]
  %12 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 2) #1
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph.2, label %._crit_edge.2

.lr.ph.2:                                         ; preds = %._crit_edge.1, %.lr.ph.2
  %.014.2 = phi i32 [ %16, %.lr.ph.2 ], [ 0, %._crit_edge.1 ]
  %.01013.2 = phi i32 [ %15, %.lr.ph.2 ], [ 2, %._crit_edge.1 ]
  %15 = mul nuw nsw i32 %.01013.2, 10
  %16 = add nuw nsw i32 %.014.2, 1
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 2) #1
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp slt i32 %16, %18
  br i1 %19, label %.lr.ph.2, label %._crit_edge.2, !llvm.loop !9

._crit_edge.2:                                    ; preds = %.lr.ph.2, %._crit_edge.1
  %.010.lcssa.2 = phi i32 [ 2, %._crit_edge.1 ], [ %15, %.lr.ph.2 ]
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 3) #1
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph.3, label %._crit_edge.3

.lr.ph.3:                                         ; preds = %._crit_edge.2, %.lr.ph.3
  %.014.3 = phi i32 [ %24, %.lr.ph.3 ], [ 0, %._crit_edge.2 ]
  %.01013.3 = phi i32 [ %23, %.lr.ph.3 ], [ 3, %._crit_edge.2 ]
  %23 = mul nuw nsw i32 %.01013.3, 10
  %24 = add nuw nsw i32 %.014.3, 1
  %25 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 3) #1
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp slt i32 %24, %26
  br i1 %27, label %.lr.ph.3, label %._crit_edge.3, !llvm.loop !9

._crit_edge.3:                                    ; preds = %.lr.ph.3, %._crit_edge.2
  %.010.lcssa.3 = phi i32 [ 3, %._crit_edge.2 ], [ %23, %.lr.ph.3 ]
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 4) #1
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph.4, label %._crit_edge.4

.lr.ph.4:                                         ; preds = %._crit_edge.3, %.lr.ph.4
  %.014.4 = phi i32 [ %32, %.lr.ph.4 ], [ 0, %._crit_edge.3 ]
  %.01013.4 = phi i32 [ %31, %.lr.ph.4 ], [ 4, %._crit_edge.3 ]
  %31 = mul nuw nsw i32 %.01013.4, 10
  %32 = add nuw nsw i32 %.014.4, 1
  %33 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 4) #1
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp slt i32 %32, %34
  br i1 %35, label %.lr.ph.4, label %._crit_edge.4, !llvm.loop !9

._crit_edge.4:                                    ; preds = %.lr.ph.4, %._crit_edge.3
  %.010.lcssa.4 = phi i32 [ 4, %._crit_edge.3 ], [ %31, %.lr.ph.4 ]
  %36 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 5) #1
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph.5, label %._crit_edge.5

.lr.ph.5:                                         ; preds = %._crit_edge.4, %.lr.ph.5
  %.014.5 = phi i32 [ %40, %.lr.ph.5 ], [ 0, %._crit_edge.4 ]
  %.01013.5 = phi i32 [ %39, %.lr.ph.5 ], [ 5, %._crit_edge.4 ]
  %39 = mul nuw nsw i32 %.01013.5, 10
  %40 = add nuw nsw i32 %.014.5, 1
  %41 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 5) #1
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp slt i32 %40, %42
  br i1 %43, label %.lr.ph.5, label %._crit_edge.5, !llvm.loop !9

._crit_edge.5:                                    ; preds = %.lr.ph.5, %._crit_edge.4
  %.010.lcssa.5 = phi i32 [ 5, %._crit_edge.4 ], [ %39, %.lr.ph.5 ]
  %44 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 6) #1
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph.6, label %._crit_edge.6

.lr.ph.6:                                         ; preds = %._crit_edge.5, %.lr.ph.6
  %.014.6 = phi i32 [ %48, %.lr.ph.6 ], [ 0, %._crit_edge.5 ]
  %.01013.6 = phi i32 [ %47, %.lr.ph.6 ], [ 6, %._crit_edge.5 ]
  %47 = mul nuw nsw i32 %.01013.6, 10
  %48 = add nuw nsw i32 %.014.6, 1
  %49 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 6) #1
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp slt i32 %48, %50
  br i1 %51, label %.lr.ph.6, label %._crit_edge.6, !llvm.loop !9

._crit_edge.6:                                    ; preds = %.lr.ph.6, %._crit_edge.5
  %.010.lcssa.6 = phi i32 [ 6, %._crit_edge.5 ], [ %47, %.lr.ph.6 ]
  %52 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 7) #1
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph.7, label %._crit_edge.7

.lr.ph.7:                                         ; preds = %._crit_edge.6, %.lr.ph.7
  %.014.7 = phi i32 [ %56, %.lr.ph.7 ], [ 0, %._crit_edge.6 ]
  %.01013.7 = phi i32 [ %55, %.lr.ph.7 ], [ 7, %._crit_edge.6 ]
  %55 = mul nuw nsw i32 %.01013.7, 10
  %56 = add nuw nsw i32 %.014.7, 1
  %57 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 7) #1
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp slt i32 %56, %58
  br i1 %59, label %.lr.ph.7, label %._crit_edge.7, !llvm.loop !9

._crit_edge.7:                                    ; preds = %.lr.ph.7, %._crit_edge.6
  %.010.lcssa.7 = phi i32 [ 7, %._crit_edge.6 ], [ %55, %.lr.ph.7 ]
  %60 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 8) #1
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp sgt i32 %61, 0
  br i1 %62, label %.lr.ph.8, label %._crit_edge.8

.lr.ph.8:                                         ; preds = %._crit_edge.7, %.lr.ph.8
  %.014.8 = phi i32 [ %64, %.lr.ph.8 ], [ 0, %._crit_edge.7 ]
  %.01013.8 = phi i32 [ %63, %.lr.ph.8 ], [ 8, %._crit_edge.7 ]
  %63 = mul nuw nsw i32 %.01013.8, 10
  %64 = add nuw nsw i32 %.014.8, 1
  %65 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 8) #1
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp slt i32 %64, %66
  br i1 %67, label %.lr.ph.8, label %._crit_edge.8, !llvm.loop !9

._crit_edge.8:                                    ; preds = %.lr.ph.8, %._crit_edge.7
  %.010.lcssa.8 = phi i32 [ 8, %._crit_edge.7 ], [ %63, %.lr.ph.8 ]
  %68 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 9) #1
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.lr.ph.9, label %._crit_edge.9

.lr.ph.9:                                         ; preds = %._crit_edge.8, %.lr.ph.9
  %.014.9 = phi i32 [ %72, %.lr.ph.9 ], [ 0, %._crit_edge.8 ]
  %.01013.9 = phi i32 [ %71, %.lr.ph.9 ], [ 9, %._crit_edge.8 ]
  %71 = mul nuw nsw i32 %.01013.9, 10
  %72 = add nuw nsw i32 %.014.9, 1
  %73 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 9) #1
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp slt i32 %72, %74
  br i1 %75, label %.lr.ph.9, label %._crit_edge.9, !llvm.loop !9

._crit_edge.9:                                    ; preds = %.lr.ph.9, %._crit_edge.8
  %.010.lcssa.9 = phi i32 [ 9, %._crit_edge.8 ], [ %71, %.lr.ph.9 ]
  %76 = add nuw nsw i32 %.010.lcssa.2, %.010.lcssa.1
  %77 = add nuw nsw i32 %.010.lcssa.3, %76
  %78 = add nuw nsw i32 %.010.lcssa.4, %77
  %79 = add nuw nsw i32 %.010.lcssa.5, %78
  %80 = add nuw nsw i32 %.010.lcssa.6, %79
  %81 = add nuw nsw i32 %.010.lcssa.7, %80
  %82 = add nuw nsw i32 %.010.lcssa.8, %81
  %83 = add nuw nsw i32 %.010.lcssa.9, %82
  ret i32 %83

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.014 = phi i32 [ %84, %.lr.ph ], [ 0, %.preheader ]
  %84 = add nuw nsw i32 %.014, 1
  %85 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef 0) #1
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp slt i32 %84, %86
  br i1 %87, label %.lr.ph, label %._crit_edge, !llvm.loop !9
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt6vectorIiSaIiEEixEm(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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass