; LLVM IR from Shah-Shishir/Codeforces-Solutions :: 433B. Kuriyama Mirai's Stones (main)

; 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"

@a = external dso_local global [100005 x i64], align 16
@b = external dso_local global [100005 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = 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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  br label %8

8:                                                ; preds = %112, %0
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  %10 = icmp ne i32 %9, -1
  br i1 %10, label %11, label %113

11:                                               ; preds = %8
  store i64 0, ptr @b, align 16, !tbaa !5
  store i64 0, ptr @a, align 16, !tbaa !5
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %28, %11
  %13 = load i32, ptr %3, align 4, !tbaa !9
  %14 = load i32, ptr %2, align 4, !tbaa !9
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %16, label %31

16:                                               ; preds = %12
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %19)
  %21 = load i32, ptr %3, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %22
  %24 = load i64, ptr %23, align 8, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %26
  store i64 %24, ptr %27, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %16
  %29 = load i32, ptr %3, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %3, align 4, !tbaa !9
  br label %12, !llvm.loop !11

31:                                               ; preds = %12
  store i32 2, ptr %3, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %47, %31
  %33 = load i32, ptr %3, align 4, !tbaa !9
  %34 = load i32, ptr %2, align 4, !tbaa !9
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %36, label %50

36:                                               ; preds = %32
  %37 = load i32, ptr %3, align 4, !tbaa !9
  %38 = sub nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %39
  %41 = load i64, ptr %40, align 8, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = add nsw i64 %45, %41
  store i64 %46, ptr %44, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %36
  %48 = load i32, ptr %3, align 4, !tbaa !9
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !9
  br label %32, !llvm.loop !13

50:                                               ; preds = %32
  %51 = load i32, ptr %2, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i64, ptr @b, i64 %52
  %54 = getelementptr inbounds i64, ptr %53, i64 1
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @b, ptr noundef %54)
  store i32 2, ptr %3, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %70, %50
  %56 = load i32, ptr %3, align 4, !tbaa !9
  %57 = load i32, ptr %2, align 4, !tbaa !9
  %58 = icmp sle i32 %56, %57
  br i1 %58, label %59, label %73

59:                                               ; preds = %55
  %60 = load i32, ptr %3, align 4, !tbaa !9
  %61 = sub nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %62
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !5
  %69 = add nsw i64 %68, %64
  store i64 %69, ptr %67, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %59
  %71 = load i32, ptr %3, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %3, align 4, !tbaa !9
  br label %55, !llvm.loop !14

73:                                               ; preds = %55
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %109, %73
  %76 = load i32, ptr %3, align 4, !tbaa !9
  %77 = load i32, ptr %4, align 4, !tbaa !9
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %79, label %112

79:                                               ; preds = %75
  %80 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %5, ptr noundef %6, ptr noundef %7)
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = icmp eq i32 %81, 1
  br i1 %82, label %83, label %95

83:                                               ; preds = %79
  %84 = load i32, ptr %7, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !5
  %88 = load i32, ptr %6, align 4, !tbaa !9
  %89 = sub nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = sub nsw i64 %87, %92
  %94 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %93)
  br label %107

95:                                               ; preds = %79
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !5
  %100 = load i32, ptr %6, align 4, !tbaa !9
  %101 = sub nsw i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !5
  %105 = sub nsw i64 %99, %104
  %106 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %105)
  br label %107

107:                                              ; preds = %95, %83
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %109

109:                                              ; preds = %107
  %110 = load i32, ptr %3, align 4, !tbaa !9
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %3, align 4, !tbaa !9
  br label %75, !llvm.loop !15

112:                                              ; preds = %75
  br label %8, !llvm.loop !16

113:                                              ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  ret i32 0
}

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

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

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

declare i32 @printf(ptr noundef, ...) #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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 = { 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 = !{!"long long", !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}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !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"

@a = external dso_local global [100005 x i64], align 16
@b = external dso_local global [100005 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = 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 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %.not34 = icmp eq i32 %6, -1
  br i1 %.not34, label %._crit_edge37, label %.lr.ph36

.loopexit:                                        ; preds = %.lr.ph33, %._crit_edge29
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %.not = icmp eq i32 %7, -1
  br i1 %.not, label %._crit_edge37, label %.lr.ph36, !llvm.loop !5

.lr.ph36:                                         ; preds = %0, %.loopexit
  store i64 0, ptr @b, align 16, !tbaa !7
  store i64 0, ptr @a, align 16, !tbaa !7
  %8 = load i32, ptr %1, align 4, !tbaa !11
  %.not1620 = icmp slt i32 %8, 1
  br i1 %.not1620, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %.not1722 = icmp slt i32 %17, 2
  br i1 %.not1722, label %._crit_edge, label %.lr.ph24.preheader

.lr.ph24.preheader:                               ; preds = %.preheader
  %9 = add nuw i32 %17, 1
  %wide.trip.count = zext i32 %9 to i64
  %.pre = load i64, ptr getelementptr inbounds (i8, ptr @a, i64 8), align 8, !tbaa !7
  %10 = add nsw i64 %wide.trip.count, -2
  %11 = add nsw i64 %wide.trip.count, -3
  %xtraiter = and i64 %10, 3
  %12 = icmp ult i64 %11, 3
  br i1 %12, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph24.preheader.new

.lr.ph24.preheader.new:                           ; preds = %.lr.ph24.preheader
  %unroll_iter = and i64 %10, -4
  br label %.lr.ph24

.lr.ph:                                           ; preds = %.lr.ph36, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph36 ]
  %13 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %13)
  %15 = load i64, ptr %13, align 8, !tbaa !7
  %16 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %indvars.iv
  store i64 %15, ptr %16, align 8, !tbaa !7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr %1, align 4, !tbaa !11
  %18 = sext i32 %17 to i64
  %.not16.not = icmp slt i64 %indvars.iv, %18
  br i1 %.not16.not, label %.lr.ph, label %.preheader, !llvm.loop !13

.lr.ph24:                                         ; preds = %.lr.ph24, %.lr.ph24.preheader.new
  %19 = phi i64 [ %.pre, %.lr.ph24.preheader.new ], [ %31, %.lr.ph24 ]
  %indvars.iv40 = phi i64 [ 2, %.lr.ph24.preheader.new ], [ %indvars.iv.next41.3, %.lr.ph24 ]
  %niter = phi i64 [ 0, %.lr.ph24.preheader.new ], [ %niter.next.3, %.lr.ph24 ]
  %20 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv40
  %21 = load i64, ptr %20, align 16, !tbaa !7
  %22 = add nsw i64 %21, %19
  store i64 %22, ptr %20, align 16, !tbaa !7
  %indvars.iv.next41 = or disjoint i64 %indvars.iv40, 1
  %23 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv.next41
  %24 = load i64, ptr %23, align 8, !tbaa !7
  %25 = add nsw i64 %24, %22
  store i64 %25, ptr %23, align 8, !tbaa !7
  %indvars.iv.next41.1 = add nuw nsw i64 %indvars.iv40, 2
  %26 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv.next41.1
  %27 = load i64, ptr %26, align 16, !tbaa !7
  %28 = add nsw i64 %27, %25
  store i64 %28, ptr %26, align 16, !tbaa !7
  %indvars.iv.next41.2 = add nuw nsw i64 %indvars.iv40, 3
  %29 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv.next41.2
  %30 = load i64, ptr %29, align 8, !tbaa !7
  %31 = add nsw i64 %30, %28
  store i64 %31, ptr %29, align 8, !tbaa !7
  %indvars.iv.next41.3 = add nuw nsw i64 %indvars.iv40, 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.ph24, !llvm.loop !14

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph24, %.lr.ph24.preheader
  %.unr = phi i64 [ %.pre, %.lr.ph24.preheader ], [ %31, %.lr.ph24 ]
  %indvars.iv40.unr = phi i64 [ 2, %.lr.ph24.preheader ], [ %indvars.iv.next41.3, %.lr.ph24 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph24.epil

.lr.ph24.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph24.epil
  %32 = phi i64 [ %35, %.lr.ph24.epil ], [ %.unr, %._crit_edge.loopexit.unr-lcssa ]
  %indvars.iv40.epil = phi i64 [ %indvars.iv.next41.epil, %.lr.ph24.epil ], [ %indvars.iv40.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph24.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %33 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv40.epil
  %34 = load i64, ptr %33, align 8, !tbaa !7
  %35 = add nsw i64 %34, %32
  store i64 %35, ptr %33, align 8, !tbaa !7
  %indvars.iv.next41.epil = add nuw nsw i64 %indvars.iv40.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.ph24.epil, !llvm.loop !15

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph24.epil, %.lr.ph36, %.preheader
  %.lcssa51 = phi i32 [ %17, %.preheader ], [ %8, %.lr.ph36 ], [ %17, %.lr.ph24.epil ], [ %17, %._crit_edge.loopexit.unr-lcssa ]
  %36 = sext i32 %.lcssa51 to i64
  %gep = getelementptr i64, ptr getelementptr inbounds (i8, ptr @b, i64 8), i64 %36
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @b, ptr noundef nonnull %gep)
  %37 = load i32, ptr %1, align 4, !tbaa !11
  %.not1825 = icmp slt i32 %37, 2
  br i1 %.not1825, label %._crit_edge29, label %.lr.ph28.preheader

.lr.ph28.preheader:                               ; preds = %._crit_edge
  %38 = add nuw i32 %37, 1
  %wide.trip.count46 = zext i32 %38 to i64
  %.pre48 = load i64, ptr getelementptr inbounds (i8, ptr @b, i64 8), align 8, !tbaa !7
  %39 = add nsw i64 %wide.trip.count46, -2
  %40 = add nsw i64 %wide.trip.count46, -3
  %xtraiter55 = and i64 %39, 3
  %41 = icmp ult i64 %40, 3
  br i1 %41, label %._crit_edge29.loopexit.unr-lcssa, label %.lr.ph28.preheader.new

.lr.ph28.preheader.new:                           ; preds = %.lr.ph28.preheader
  %unroll_iter59 = and i64 %39, -4
  br label %.lr.ph28

.lr.ph28:                                         ; preds = %.lr.ph28, %.lr.ph28.preheader.new
  %42 = phi i64 [ %.pre48, %.lr.ph28.preheader.new ], [ %54, %.lr.ph28 ]
  %indvars.iv43 = phi i64 [ 2, %.lr.ph28.preheader.new ], [ %indvars.iv.next44.3, %.lr.ph28 ]
  %niter60 = phi i64 [ 0, %.lr.ph28.preheader.new ], [ %niter60.next.3, %.lr.ph28 ]
  %43 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %indvars.iv43
  %44 = load i64, ptr %43, align 16, !tbaa !7
  %45 = add nsw i64 %44, %42
  store i64 %45, ptr %43, align 16, !tbaa !7
  %indvars.iv.next44 = or disjoint i64 %indvars.iv43, 1
  %46 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %indvars.iv.next44
  %47 = load i64, ptr %46, align 8, !tbaa !7
  %48 = add nsw i64 %47, %45
  store i64 %48, ptr %46, align 8, !tbaa !7
  %indvars.iv.next44.1 = add nuw nsw i64 %indvars.iv43, 2
  %49 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %indvars.iv.next44.1
  %50 = load i64, ptr %49, align 16, !tbaa !7
  %51 = add nsw i64 %50, %48
  store i64 %51, ptr %49, align 16, !tbaa !7
  %indvars.iv.next44.2 = add nuw nsw i64 %indvars.iv43, 3
  %52 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %indvars.iv.next44.2
  %53 = load i64, ptr %52, align 8, !tbaa !7
  %54 = add nsw i64 %53, %51
  store i64 %54, ptr %52, align 8, !tbaa !7
  %indvars.iv.next44.3 = add nuw nsw i64 %indvars.iv43, 4
  %niter60.next.3 = add i64 %niter60, 4
  %niter60.ncmp.3 = icmp eq i64 %niter60.next.3, %unroll_iter59
  br i1 %niter60.ncmp.3, label %._crit_edge29.loopexit.unr-lcssa, label %.lr.ph28, !llvm.loop !17

._crit_edge29.loopexit.unr-lcssa:                 ; preds = %.lr.ph28, %.lr.ph28.preheader
  %.unr57 = phi i64 [ %.pre48, %.lr.ph28.preheader ], [ %54, %.lr.ph28 ]
  %indvars.iv43.unr = phi i64 [ 2, %.lr.ph28.preheader ], [ %indvars.iv.next44.3, %.lr.ph28 ]
  %lcmp.mod58.not = icmp eq i64 %xtraiter55, 0
  br i1 %lcmp.mod58.not, label %._crit_edge29, label %.lr.ph28.epil

.lr.ph28.epil:                                    ; preds = %._crit_edge29.loopexit.unr-lcssa, %.lr.ph28.epil
  %55 = phi i64 [ %58, %.lr.ph28.epil ], [ %.unr57, %._crit_edge29.loopexit.unr-lcssa ]
  %indvars.iv43.epil = phi i64 [ %indvars.iv.next44.epil, %.lr.ph28.epil ], [ %indvars.iv43.unr, %._crit_edge29.loopexit.unr-lcssa ]
  %epil.iter56 = phi i64 [ %epil.iter56.next, %.lr.ph28.epil ], [ 0, %._crit_edge29.loopexit.unr-lcssa ]
  %56 = getelementptr inbounds [100005 x i64], ptr @b, i64 0, i64 %indvars.iv43.epil
  %57 = load i64, ptr %56, align 8, !tbaa !7
  %58 = add nsw i64 %57, %55
  store i64 %58, ptr %56, align 8, !tbaa !7
  %indvars.iv.next44.epil = add nuw nsw i64 %indvars.iv43.epil, 1
  %epil.iter56.next = add i64 %epil.iter56, 1
  %epil.iter56.cmp.not = icmp eq i64 %epil.iter56.next, %xtraiter55
  br i1 %epil.iter56.cmp.not, label %._crit_edge29, label %.lr.ph28.epil, !llvm.loop !18

._crit_edge29:                                    ; preds = %._crit_edge29.loopexit.unr-lcssa, %.lr.ph28.epil, %._crit_edge
  %59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %60 = load i32, ptr %2, align 4, !tbaa !11
  %.not1930 = icmp slt i32 %60, 1
  br i1 %.not1930, label %.loopexit, label %.lr.ph33

.lr.ph33:                                         ; preds = %._crit_edge29, %.lr.ph33
  %.331 = phi i32 [ %76, %.lr.ph33 ], [ 1, %._crit_edge29 ]
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %62 = load i32, ptr %3, align 4, !tbaa !11
  %63 = icmp eq i32 %62, 1
  %64 = load i32, ptr %5, align 4, !tbaa !11
  %65 = sext i32 %64 to i64
  %66 = load i32, ptr %4, align 4, !tbaa !11
  %67 = add nsw i32 %66, -1
  %68 = sext i32 %67 to i64
  %a.b = select i1 %63, ptr @a, ptr @b
  %69 = getelementptr inbounds [100005 x i64], ptr %a.b, i64 0, i64 %65
  %70 = load i64, ptr %69, align 8, !tbaa !7
  %71 = getelementptr inbounds [100005 x i64], ptr %a.b, i64 0, i64 %68
  %72 = load i64, ptr %71, align 8, !tbaa !7
  %73 = sub nsw i64 %70, %72
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %73)
  %75 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %76 = add nuw nsw i32 %.331, 1
  %77 = load i32, ptr %2, align 4, !tbaa !11
  %.not19.not = icmp slt i32 %.331, %77
  br i1 %.not19.not, label %.lr.ph33, label %.loopexit, !llvm.loop !19

._crit_edge37:                                    ; preds = %.loopexit, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret i32 0
}

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

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

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"long long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !6}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !6}


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