; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/248 Division 2/Problem B (B)

; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@v = external dso_local global [100100 x i32], align 16
@s1 = external dso_local global [100100 x i64], align 16
@s2 = external dso_local global [100100 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %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
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %20, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp sle i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %23

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %17
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %18)
  br label %20

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !9

23:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %44, %23
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp sle i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %47

29:                                               ; preds = %24
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sub nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !11
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = add nsw i64 %34, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %42
  store i64 %40, ptr %43, align 8, !tbaa !11
  br label %44

44:                                               ; preds = %29
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !13

47:                                               ; preds = %28
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr @v, i64 %49
  %51 = getelementptr inbounds i32, ptr %50, i64 1
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef getelementptr inbounds (i32, ptr @v, i64 1), ptr noundef %51)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %72, %47
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %75

57:                                               ; preds = %52
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = add nsw i64 %62, %67
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %70
  store i64 %68, ptr %71, align 8, !tbaa !11
  br label %72

72:                                               ; preds = %57
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %4, align 4, !tbaa !5
  br label %52, !llvm.loop !14

75:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  br label %77

77:                                               ; preds = %111, %75
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  store i32 %79, ptr %5, align 4, !tbaa !5
  %80 = icmp ne i32 %78, 0
  br i1 %80, label %81, label %112

81:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %6, ptr noundef %7, ptr noundef %8)
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = icmp eq i32 %83, 1
  br i1 %84, label %85, label %98

85:                                               ; preds = %81
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !11
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = sub nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !11
  %95 = sub nsw i64 %89, %94
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %95)
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %96, ptr noundef @.str.2)
  br label %111

98:                                               ; preds = %81
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = sub nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !11
  %108 = sub nsw i64 %102, %107
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %108)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @.str.2)
  br label %111

111:                                              ; preds = %98, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %77, !llvm.loop !15

112:                                              ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

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

attributes #0 = { mustprogress norecurse 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 = { "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 = { 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 #4 = { 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 #5 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


; 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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@v = external dso_local global [100100 x i32], align 16
@s1 = external dso_local local_unnamed_addr global [100100 x i64], align 16
@s2 = external dso_local local_unnamed_addr global [100100 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not19 = icmp slt i32 %6, 1
  br i1 %.not19, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %.not1621 = icmp slt i32 %11, 1
  br i1 %.not1621, label %._crit_edge, label %.lr.ph23.preheader

.lr.ph23.preheader:                               ; preds = %.preheader
  %.pre = load i64, ptr @s1, align 16, !tbaa !9
  %7 = zext nneg i32 %11 to i64
  %xtraiter = and i64 %7, 3
  %8 = icmp ult i32 %11, 4
  br i1 %8, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph23.preheader.new

.lr.ph23.preheader.new:                           ; preds = %.lr.ph23.preheader
  %unroll_iter = and i64 %7, 2147483644
  br label %.lr.ph23

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %9 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %.not.not = icmp slt i64 %indvars.iv, %12
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph23, %.lr.ph23.preheader
  %.unr = phi i64 [ %.pre, %.lr.ph23.preheader ], [ %44, %.lr.ph23 ]
  %indvars.iv35.unr = phi i64 [ 1, %.lr.ph23.preheader ], [ %indvars.iv.next36.3, %.lr.ph23 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph23.epil

.lr.ph23.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph23.epil
  %13 = phi i64 [ %17, %.lr.ph23.epil ], [ %.unr, %._crit_edge.loopexit.unr-lcssa ]
  %indvars.iv35.epil = phi i64 [ %indvars.iv.next36.epil, %.lr.ph23.epil ], [ %indvars.iv35.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph23.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %14 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv35.epil
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = add nsw i64 %13, %16
  %18 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %indvars.iv35.epil
  store i64 %17, ptr %18, align 8, !tbaa !9
  %indvars.iv.next36.epil = add nuw nsw i64 %indvars.iv35.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph23.epil, !llvm.loop !13

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph23.epil, %0, %.preheader
  %.lcssa46 = phi i32 [ %11, %.preheader ], [ %6, %0 ], [ %11, %.lr.ph23.epil ], [ %11, %._crit_edge.loopexit.unr-lcssa ]
  %19 = sext i32 %.lcssa46 to i64
  %20 = getelementptr inbounds i32, ptr @v, i64 %19
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @v, i64 4), ptr noundef nonnull %21)
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %.not1724 = icmp slt i32 %22, 1
  br i1 %.not1724, label %._crit_edge28, label %.lr.ph27.preheader

.lr.ph27.preheader:                               ; preds = %._crit_edge
  %.pre43 = load i64, ptr @s2, align 16, !tbaa !9
  %23 = zext nneg i32 %22 to i64
  %xtraiter52 = and i64 %23, 3
  %24 = icmp ult i32 %22, 4
  br i1 %24, label %._crit_edge28.loopexit.unr-lcssa, label %.lr.ph27.preheader.new

.lr.ph27.preheader.new:                           ; preds = %.lr.ph27.preheader
  %unroll_iter56 = and i64 %23, 2147483644
  br label %.lr.ph27

.lr.ph23:                                         ; preds = %.lr.ph23, %.lr.ph23.preheader.new
  %25 = phi i64 [ %.pre, %.lr.ph23.preheader.new ], [ %44, %.lr.ph23 ]
  %indvars.iv35 = phi i64 [ 1, %.lr.ph23.preheader.new ], [ %indvars.iv.next36.3, %.lr.ph23 ]
  %niter = phi i64 [ 0, %.lr.ph23.preheader.new ], [ %niter.next.3, %.lr.ph23 ]
  %26 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv35
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = add nsw i64 %25, %28
  %30 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %indvars.iv35
  store i64 %29, ptr %30, align 8, !tbaa !9
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %31 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv.next36
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = add nsw i64 %29, %33
  %35 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %indvars.iv.next36
  store i64 %34, ptr %35, align 8, !tbaa !9
  %indvars.iv.next36.1 = add nuw nsw i64 %indvars.iv35, 2
  %36 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv.next36.1
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = add nsw i64 %34, %38
  %40 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %indvars.iv.next36.1
  store i64 %39, ptr %40, align 8, !tbaa !9
  %indvars.iv.next36.2 = add nuw nsw i64 %indvars.iv35, 3
  %41 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv.next36.2
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = add nsw i64 %39, %43
  %45 = getelementptr inbounds [100100 x i64], ptr @s1, i64 0, i64 %indvars.iv.next36.2
  store i64 %44, ptr %45, align 8, !tbaa !9
  %indvars.iv.next36.3 = add nuw nsw i64 %indvars.iv35, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph23, !llvm.loop !15

._crit_edge28.loopexit.unr-lcssa:                 ; preds = %.lr.ph27, %.lr.ph27.preheader
  %.unr54 = phi i64 [ %.pre43, %.lr.ph27.preheader ], [ %74, %.lr.ph27 ]
  %indvars.iv38.unr = phi i64 [ 1, %.lr.ph27.preheader ], [ %indvars.iv.next39.3, %.lr.ph27 ]
  %lcmp.mod55.not = icmp eq i64 %xtraiter52, 0
  br i1 %lcmp.mod55.not, label %._crit_edge28, label %.lr.ph27.epil

.lr.ph27.epil:                                    ; preds = %._crit_edge28.loopexit.unr-lcssa, %.lr.ph27.epil
  %46 = phi i64 [ %50, %.lr.ph27.epil ], [ %.unr54, %._crit_edge28.loopexit.unr-lcssa ]
  %indvars.iv38.epil = phi i64 [ %indvars.iv.next39.epil, %.lr.ph27.epil ], [ %indvars.iv38.unr, %._crit_edge28.loopexit.unr-lcssa ]
  %epil.iter53 = phi i64 [ %epil.iter53.next, %.lr.ph27.epil ], [ 0, %._crit_edge28.loopexit.unr-lcssa ]
  %47 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv38.epil
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = add nsw i64 %46, %49
  %51 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %indvars.iv38.epil
  store i64 %50, ptr %51, align 8, !tbaa !9
  %indvars.iv.next39.epil = add nuw nsw i64 %indvars.iv38.epil, 1
  %epil.iter53.next = add i64 %epil.iter53, 1
  %epil.iter53.cmp.not = icmp eq i64 %epil.iter53.next, %xtraiter52
  br i1 %epil.iter53.cmp.not, label %._crit_edge28, label %.lr.ph27.epil, !llvm.loop !16

._crit_edge28:                                    ; preds = %._crit_edge28.loopexit.unr-lcssa, %.lr.ph27.epil, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr %1, align 4, !tbaa !5
  %.not1829 = icmp eq i32 %53, 0
  br i1 %.not1829, label %._crit_edge32, label %.lr.ph31

.lr.ph27:                                         ; preds = %.lr.ph27, %.lr.ph27.preheader.new
  %55 = phi i64 [ %.pre43, %.lr.ph27.preheader.new ], [ %74, %.lr.ph27 ]
  %indvars.iv38 = phi i64 [ 1, %.lr.ph27.preheader.new ], [ %indvars.iv.next39.3, %.lr.ph27 ]
  %niter57 = phi i64 [ 0, %.lr.ph27.preheader.new ], [ %niter57.next.3, %.lr.ph27 ]
  %56 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv38
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = add nsw i64 %55, %58
  %60 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %indvars.iv38
  store i64 %59, ptr %60, align 8, !tbaa !9
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %61 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv.next39
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = add nsw i64 %59, %63
  %65 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %indvars.iv.next39
  store i64 %64, ptr %65, align 8, !tbaa !9
  %indvars.iv.next39.1 = add nuw nsw i64 %indvars.iv38, 2
  %66 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv.next39.1
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = add nsw i64 %64, %68
  %70 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %indvars.iv.next39.1
  store i64 %69, ptr %70, align 8, !tbaa !9
  %indvars.iv.next39.2 = add nuw nsw i64 %indvars.iv38, 3
  %71 = getelementptr inbounds [100100 x i32], ptr @v, i64 0, i64 %indvars.iv.next39.2
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = add nsw i64 %69, %73
  %75 = getelementptr inbounds [100100 x i64], ptr @s2, i64 0, i64 %indvars.iv.next39.2
  store i64 %74, ptr %75, align 8, !tbaa !9
  %indvars.iv.next39.3 = add nuw nsw i64 %indvars.iv38, 4
  %niter57.next.3 = add i64 %niter57, 4
  %niter57.ncmp.3 = icmp eq i64 %niter57.next.3, %unroll_iter56
  br i1 %niter57.ncmp.3, label %._crit_edge28.loopexit.unr-lcssa, label %.lr.ph27, !llvm.loop !17

.lr.ph31:                                         ; preds = %._crit_edge28, %.lr.ph31
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %76 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = icmp eq i32 %77, 1
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = add nsw i32 %81, -1
  %83 = sext i32 %82 to i64
  %s1.s2 = select i1 %78, ptr @s1, ptr @s2
  %84 = getelementptr inbounds [100100 x i64], ptr %s1.s2, i64 0, i64 %80
  %85 = load i64, ptr %84, align 8, !tbaa !9
  %86 = getelementptr inbounds [100100 x i64], ptr %s1.s2, i64 0, i64 %83
  %87 = load i64, ptr %86, align 8, !tbaa !9
  %88 = sub nsw i64 %85, %87
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %88)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef nonnull @.str.2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %91 = load i32, ptr %1, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %1, align 4, !tbaa !5
  %.not18 = icmp eq i32 %91, 0
  br i1 %.not18, label %._crit_edge32, label %.lr.ph31, !llvm.loop !18

._crit_edge32:                                    ; preds = %.lr.ph31, %._crit_edge28
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress norecurse 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 = { nofree nounwind "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 = { 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 #4 = { 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 #5 = { 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 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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