; LLVM IR from tangjz/acm-icpc :: codeforces/complete (1043D)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [11 x [100001 x i32]], align 16
@pos = external dso_local global [11 x [100001 x i32]], align 16
@f = external dso_local global [100001 x i64], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 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 i8, align 1
  %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, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

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

14:                                               ; preds = %10
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  br label %50

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

16:                                               ; preds = %43, %15
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sle i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %46

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [11 x [100001 x i32]], ptr @a, i64 0, i64 %23
  %25 = getelementptr inbounds [100001 x i32], ptr %24, i64 0, i64 0
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr %25, i64 %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %28)
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [11 x [100001 x i32]], ptr @pos, i64 0, i64 %32
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [11 x [100001 x i32]], ptr @a, i64 0, i64 %35
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100001 x i32], ptr %36, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100001 x i32], ptr %33, i64 0, i64 %41
  store i32 %30, ptr %42, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %21
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %4, align 4, !tbaa !5
  br label %16, !llvm.loop !9

46:                                               ; preds = %20
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !11

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

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

55:                                               ; preds = %51
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %132

56:                                               ; preds = %51
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %58
  store i64 1, ptr %59, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #3
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = icmp sgt i32 %60, 1
  %62 = zext i1 %61 to i8
  store i8 %62, ptr %6, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds ([11 x [100001 x i32]], ptr @a, i64 0, i64 1), i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  store i32 %67, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %105, %56
  %69 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %70 = trunc i8 %69 to i1
  br i1 %70, label %71, label %75

71:                                               ; preds = %68
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = icmp sle i32 %72, %73
  br label %75

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

77:                                               ; preds = %75
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %108

78:                                               ; preds = %75
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [11 x [100001 x i32]], ptr @a, i64 0, i64 %81
  %83 = load i32, ptr %8, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [11 x [100001 x i32]], ptr @pos, i64 0, i64 %84
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds ([11 x [100001 x i32]], ptr @a, i64 0, i64 1), i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100001 x i32], ptr %85, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100001 x i32], ptr %82, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp eq i32 %79, %96
  %98 = zext i1 %97 to i32
  %99 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %100 = trunc i8 %99 to i1
  %101 = zext i1 %100 to i32
  %102 = and i32 %101, %98
  %103 = icmp ne i32 %102, 0
  %104 = zext i1 %103 to i8
  store i8 %104, ptr %6, align 1, !tbaa !14
  br label %105

105:                                              ; preds = %78
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %8, align 4, !tbaa !5
  br label %68, !llvm.loop !18

108:                                              ; preds = %77
  %109 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %110 = trunc i8 %109 to i1
  br i1 %110, label %111, label %122

111:                                              ; preds = %108
  %112 = load i32, ptr %5, align 4, !tbaa !5
  %113 = sub nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !12
  %117 = load i32, ptr %5, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !12
  %121 = add nsw i64 %120, %116
  store i64 %121, ptr %119, align 8, !tbaa !12
  br label %122

122:                                              ; preds = %111, %108
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !12
  %127 = load i64, ptr @ans, align 8, !tbaa !12
  %128 = add nsw i64 %127, %126
  store i64 %128, ptr @ans, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  br label %129

129:                                              ; preds = %122
  %130 = load i32, ptr %5, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %5, align 4, !tbaa !5
  br label %51, !llvm.loop !19

132:                                              ; preds = %55
  %133 = load i64, ptr @ans, align 8, !tbaa !12
  %134 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %133)
  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

declare i32 @printf(ptr noundef, ...) #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 = { "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 = { 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}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [11 x [100001 x i32]], align 16
@pos = external dso_local local_unnamed_addr global [11 x [100001 x i32]], align 16
@f = external dso_local local_unnamed_addr global [100001 x i64], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @m, align 4
  %.not36 = icmp slt i32 %2, 1
  %.pre71 = load i32, ptr @n, align 4, !tbaa !5
  br i1 %.not36, label %.preheader, label %.preheader33.lr.ph

.preheader33.lr.ph:                               ; preds = %0
  %3 = icmp slt i32 %.pre71, 1
  br i1 %3, label %.preheader._crit_edge, label %.preheader33

.preheader33:                                     ; preds = %.preheader33.lr.ph, %._crit_edge
  %4 = phi i32 [ %29, %._crit_edge ], [ %2, %.preheader33.lr.ph ]
  %5 = phi i32 [ %30, %._crit_edge ], [ %.pre71, %.preheader33.lr.ph ]
  %indvars.iv56 = phi i64 [ %indvars.iv.next57, %._crit_edge ], [ 1, %.preheader33.lr.ph ]
  %.not3234 = icmp slt i32 %5, 1
  br i1 %.not3234, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader33
  %6 = getelementptr inbounds [11 x [100001 x i32]], ptr @a, i64 0, i64 %indvars.iv56
  br label %32

.preheader:                                       ; preds = %._crit_edge, %0
  %7 = phi i32 [ %.pre71, %0 ], [ %30, %._crit_edge ]
  %.lcssa = phi i32 [ %2, %0 ], [ %29, %._crit_edge ]
  %.lcssa.fr = freeze i32 %.lcssa
  %.not3143 = icmp slt i32 %7, 1
  br i1 %.not3143, label %.preheader._crit_edge, label %.lr.ph45

.preheader._crit_edge:                            ; preds = %.preheader33.lr.ph, %.preheader
  %.pre72 = load i64, ptr @ans, align 8, !tbaa !9
  br label %42

.lr.ph45:                                         ; preds = %.preheader
  %ans.promoted = load i64, ptr @ans, align 8, !tbaa !9
  %8 = icmp sgt i32 %.lcssa.fr, 0
  br i1 %8, label %.lr.ph45.split.preheader, label %9

9:                                                ; preds = %.lr.ph45
  %10 = add nuw i32 %7, 1
  %wide.trip.count = zext i32 %10 to i64
  store i64 1, ptr getelementptr inbounds (i8, ptr @f, i64 8), align 8, !tbaa !9
  %11 = add nsw i64 %ans.promoted, 1
  %exitcond.peel.not = icmp eq i32 %10, 2
  br i1 %exitcond.peel.not, label %._crit_edge46, label %.lr.ph45.split.us.peel.next.preheader

.lr.ph45.split.us.peel.next.preheader:            ; preds = %9
  %12 = add nsw i64 %wide.trip.count, -2
  %min.iters.check = icmp ult i64 %12, 4
  br i1 %min.iters.check, label %.lr.ph45.split.us.peel.next.preheader97, label %vector.ph

.lr.ph45.split.us.peel.next.preheader97:          ; preds = %middle.block, %.lr.ph45.split.us.peel.next.preheader
  %.ph = phi i64 [ 1, %.lr.ph45.split.us.peel.next.preheader ], [ %ind.end, %middle.block ]
  %indvars.iv59.ph = phi i64 [ 2, %.lr.ph45.split.us.peel.next.preheader ], [ %ind.end91, %middle.block ]
  %.ph98 = phi i64 [ %11, %.lr.ph45.split.us.peel.next.preheader ], [ %21, %middle.block ]
  br label %.lr.ph45.split.us.peel.next

vector.ph:                                        ; preds = %.lr.ph45.split.us.peel.next.preheader
  %n.vec = and i64 %12, -4
  %ind.end = or disjoint i64 %n.vec, 1
  %ind.end91 = or disjoint i64 %n.vec, 2
  %13 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %11, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <2 x i64> [ <i64 1, i64 2>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %13, %vector.ph ], [ %18, %vector.body ]
  %vec.phi94 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %19, %vector.body ]
  %offset.idx = or disjoint i64 %index, 2
  %14 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %offset.idx
  %15 = add nuw nsw <2 x i64> %vec.ind, <i64 1, i64 1>
  %16 = add <2 x i64> %vec.ind, <i64 3, i64 3>
  %17 = getelementptr inbounds i8, ptr %14, i64 16
  store <2 x i64> %15, ptr %14, align 16, !tbaa !9
  store <2 x i64> %16, ptr %17, align 16, !tbaa !9
  %18 = add <2 x i64> %vec.phi, %15
  %19 = add <2 x i64> %vec.phi94, %16
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i64> %vec.ind, <i64 4, i64 4>
  %20 = icmp eq i64 %index.next, %n.vec
  br i1 %20, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %19, %18
  %21 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %12, %n.vec
  br i1 %cmp.n, label %._crit_edge46, label %.lr.ph45.split.us.peel.next.preheader97

.lr.ph45.split.preheader:                         ; preds = %.lr.ph45
  %22 = zext nneg i32 %.lcssa.fr to i64
  %23 = add nuw i32 %7, 1
  %wide.trip.count69 = zext i32 %23 to i64
  br label %.lr.ph45.split

.lr.ph45.split.us.peel.next:                      ; preds = %.lr.ph45.split.us.peel.next.preheader97, %.lr.ph45.split.us.peel.next
  %24 = phi i64 [ %27, %.lr.ph45.split.us.peel.next ], [ %.ph, %.lr.ph45.split.us.peel.next.preheader97 ]
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph45.split.us.peel.next ], [ %indvars.iv59.ph, %.lr.ph45.split.us.peel.next.preheader97 ]
  %25 = phi i64 [ %28, %.lr.ph45.split.us.peel.next ], [ %.ph98, %.lr.ph45.split.us.peel.next.preheader97 ]
  %26 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %indvars.iv59
  %27 = add nuw nsw i64 %24, 1
  store i64 %27, ptr %26, align 8, !tbaa !9
  %28 = add nsw i64 %25, %27
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge46, label %.lr.ph45.split.us.peel.next, !llvm.loop !16

._crit_edge.loopexit:                             ; preds = %32
  %.pre = load i32, ptr @m, align 4
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader33
  %29 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %4, %.preheader33 ]
  %30 = phi i32 [ %40, %._crit_edge.loopexit ], [ %5, %.preheader33 ]
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %31 = sext i32 %29 to i64
  %.not.not = icmp slt i64 %indvars.iv56, %31
  br i1 %.not.not, label %.preheader33, label %.preheader, !llvm.loop !17

32:                                               ; preds = %.lr.ph, %32
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %32 ]
  %33 = getelementptr inbounds i32, ptr %6, i64 %indvars.iv
  %34 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %33)
  %35 = getelementptr inbounds [11 x [100001 x i32]], ptr @a, i64 0, i64 %indvars.iv56, i64 %indvars.iv
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [11 x [100001 x i32]], ptr @pos, i64 0, i64 %indvars.iv56, i64 %37
  %39 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %39, ptr %38, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %.not32.not = icmp slt i64 %indvars.iv, %41
  br i1 %.not32.not, label %32, label %._crit_edge.loopexit, !llvm.loop !19

._crit_edge46:                                    ; preds = %.lr.ph45.split.us.peel.next, %._crit_edge41.thread, %middle.block, %9
  %.us-phi48 = phi i64 [ %11, %9 ], [ %21, %middle.block ], [ %69, %._crit_edge41.thread ], [ %28, %.lr.ph45.split.us.peel.next ]
  store i64 %.us-phi48, ptr @ans, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %.preheader._crit_edge, %._crit_edge46
  %43 = phi i64 [ %.pre72, %.preheader._crit_edge ], [ %.us-phi48, %._crit_edge46 ]
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %43)
  ret i32 0

.lr.ph45.split:                                   ; preds = %.lr.ph45.split.preheader, %._crit_edge41.thread
  %indvars.iv66 = phi i64 [ 1, %.lr.ph45.split.preheader ], [ %indvars.iv.next67, %._crit_edge41.thread ]
  %45 = phi i64 [ %ans.promoted, %.lr.ph45.split.preheader ], [ %69, %._crit_edge41.thread ]
  %46 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %indvars.iv66
  store i64 1, ptr %46, align 8, !tbaa !9
  %47 = icmp ugt i64 %indvars.iv66, 1
  %48 = add nsw i64 %indvars.iv66, -1
  %49 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds (i8, ptr @a, i64 400004), i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  br i1 %47, label %.lr.ph40, label %._crit_edge41.thread

.lr.ph40:                                         ; preds = %.lr.ph45.split
  %51 = getelementptr inbounds [100001 x i32], ptr getelementptr inbounds (i8, ptr @a, i64 400004), i64 0, i64 %indvars.iv66
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  br label %54

._crit_edge41:                                    ; preds = %54
  br i1 %61, label %64, label %._crit_edge41.thread

54:                                               ; preds = %.lr.ph40, %54
  %indvars.iv63 = phi i64 [ 1, %.lr.ph40 ], [ %indvars.iv.next64, %54 ]
  %55 = getelementptr inbounds [11 x [100001 x i32]], ptr @pos, i64 0, i64 %indvars.iv63, i64 %53
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [11 x [100001 x i32]], ptr @a, i64 0, i64 %indvars.iv63, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = icmp eq i32 %50, %60
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %62 = icmp ult i64 %indvars.iv63, %22
  %63 = and i1 %61, %62
  br i1 %63, label %54, label %._crit_edge41, !llvm.loop !20

64:                                               ; preds = %._crit_edge41
  %65 = getelementptr inbounds [100001 x i64], ptr @f, i64 0, i64 %48
  %66 = load i64, ptr %65, align 8, !tbaa !9
  %67 = add nsw i64 %66, 1
  store i64 %67, ptr %46, align 8, !tbaa !9
  br label %._crit_edge41.thread

._crit_edge41.thread:                             ; preds = %.lr.ph45.split, %64, %._crit_edge41
  %68 = phi i64 [ %67, %64 ], [ 1, %._crit_edge41 ], [ 1, %.lr.ph45.split ]
  %69 = add nsw i64 %45, %68
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %exitcond70.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count69
  br i1 %exitcond70.not, label %._crit_edge46, label %.lr.ph45.split, !llvm.loop !21
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #2

attributes #0 = { mustprogress nofree norecurse 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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !13, !14, !15}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.peeled.count", i32 1}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12, !13, !15, !14}
!17 = distinct !{!17, !12, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass