; LLVM IR from tangjz/acm-icpc :: 51nod (1670)

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

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

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %26

16:                                               ; preds = %11
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %20, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %16
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !9

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

27:                                               ; preds = %43, %26
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %46

32:                                               ; preds = %27
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sub nsw i32 %33, 1
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, %37
  store i32 %42, ptr %40, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %32
  %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 %27, !llvm.loop !11

46:                                               ; preds = %31
  store i32 1, ptr getelementptr inbounds ([100002 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %69, %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sdiv i32 1000000007, %53
  %55 = sext i32 %54 to i64
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = srem i32 1000000007, %56
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = mul nsw i64 %55, %61
  %63 = srem i64 %62, 1000000007
  %64 = sub nsw i64 1000000007, %63
  %65 = trunc i64 %64 to i32
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %67
  store i32 %65, ptr %68, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %52
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %5, align 4, !tbaa !5
  br label %47, !llvm.loop !12

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

73:                                               ; preds = %91, %72
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = sub nsw i32 %75, %76
  %78 = add nsw i32 %77, 1
  %79 = icmp sle i32 %74, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %94

81:                                               ; preds = %73
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %83
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sub nsw i32 %85, %86
  %88 = add nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %89
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %84, ptr noundef nonnull align 4 dereferenceable(4) %90) #4
  br label %91

91:                                               ; preds = %81
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %6, align 4, !tbaa !5
  br label %73, !llvm.loop !13

94:                                               ; preds = %80
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 2, ptr %7, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %108, %94
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = icmp sle i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %111

100:                                              ; preds = %95
  %101 = load i32, ptr @f, align 16, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = mul nsw i64 %102, %104
  %106 = srem i64 %105, 1000000007
  %107 = trunc i64 %106 to i32
  store i32 %107, ptr @f, align 16, !tbaa !5
  br label %108

108:                                              ; preds = %100
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %7, align 4, !tbaa !5
  br label %95, !llvm.loop !14

111:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %145, %111
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = load i32, ptr @n, align 4, !tbaa !5
  %115 = icmp slt i32 %113, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %148

117:                                              ; preds = %112
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sub nsw i32 %126, %127
  %129 = sext i32 %128 to i64
  %130 = mul nsw i64 %122, %129
  %131 = srem i64 %130, 1000000007
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = mul nsw i64 %131, %137
  %139 = srem i64 %138, 1000000007
  %140 = trunc i64 %139 to i32
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %143
  store i32 %140, ptr %144, align 4, !tbaa !5
  br label %145

145:                                              ; preds = %117
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %8, align 4, !tbaa !5
  br label %112, !llvm.loop !15

148:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %174, %148
  %150 = load i32, ptr %9, align 4, !tbaa !5
  %151 = load i32, ptr @n, align 4, !tbaa !5
  %152 = icmp sle i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %177

154:                                              ; preds = %149
  %155 = load i32, ptr @ans, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = load i32, ptr %9, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = load i32, ptr %9, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = load i32, ptr %9, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sub nsw i32 %162, %167
  %169 = sext i32 %168 to i64
  %170 = mul nsw i64 %158, %169
  %171 = add nsw i64 %156, %170
  %172 = srem i64 %171, 1000000007
  %173 = trunc i64 %172 to i32
  store i32 %173, ptr @ans, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %154
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %9, align 4, !tbaa !5
  br label %149, !llvm.loop !16

177:                                              ; preds = %153
  %178 = load i32, ptr @ans, align 4, !tbaa !5
  %179 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %178)
  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 nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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 = { inlinehint 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 #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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
@c = external dso_local local_unnamed_addr global [100002 x i32], align 16
@f = external dso_local global [100002 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  br label %._crit_edge48.thread

._crit_edge:                                      ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %5 = icmp sgt i32 %16, 1
  br i1 %5, label %.lr.ph47.preheader, label %._crit_edge48.thread

.lr.ph47.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %16 to i64
  %.pre = load i32, ptr @c, align 16, !tbaa !5
  %6 = add nsw i64 %wide.trip.count, -1
  %7 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %6, 3
  %8 = icmp ult i64 %7, 3
  br i1 %8, label %._crit_edge48.unr-lcssa, label %.lr.ph47.preheader.new

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

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03644 = phi i32 [ %15, %.lr.ph ], [ 0, %0 ]
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %11
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %12, align 4, !tbaa !5
  %15 = add nuw nsw i32 %.03644, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge48.thread:                             ; preds = %._crit_edge.thread, %._crit_edge
  %.ph = phi i32 [ %16, %._crit_edge ], [ %3, %._crit_edge.thread ]
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  br label %.preheader42

._crit_edge48.unr-lcssa:                          ; preds = %.lr.ph47, %.lr.ph47.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph47.preheader ], [ %35, %.lr.ph47 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph47.preheader ], [ %indvars.iv.next.3, %.lr.ph47 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge48, label %.lr.ph47.epil

.lr.ph47.epil:                                    ; preds = %._crit_edge48.unr-lcssa, %.lr.ph47.epil
  %18 = phi i32 [ %21, %.lr.ph47.epil ], [ %.unr, %._crit_edge48.unr-lcssa ]
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph47.epil ], [ %indvars.iv.unr, %._crit_edge48.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph47.epil ], [ 0, %._crit_edge48.unr-lcssa ]
  %19 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv.epil
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = add nsw i32 %20, %18
  store i32 %21, ptr %19, align 4, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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_edge48, label %.lr.ph47.epil, !llvm.loop !11

._crit_edge48:                                    ; preds = %.lr.ph47.epil, %._crit_edge48.unr-lcssa
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  %22 = add nuw i32 %16, 1
  %wide.trip.count78 = zext i32 %22 to i64
  br label %.lr.ph52

.lr.ph47:                                         ; preds = %.lr.ph47, %.lr.ph47.preheader.new
  %23 = phi i32 [ %.pre, %.lr.ph47.preheader.new ], [ %35, %.lr.ph47 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph47.preheader.new ], [ %indvars.iv.next.3, %.lr.ph47 ]
  %niter = phi i64 [ 0, %.lr.ph47.preheader.new ], [ %niter.next.3, %.lr.ph47 ]
  %24 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = add nsw i32 %25, %23
  store i32 %26, ptr %24, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv.next
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = add nsw i32 %28, %26
  store i32 %29, ptr %27, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %30 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv.next.1
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = add nsw i32 %31, %29
  store i32 %32, ptr %30, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %33 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv.next.2
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %34, %32
  store i32 %35, ptr %33, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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_edge48.unr-lcssa, label %.lr.ph47, !llvm.loop !13

.preheader42:                                     ; preds = %.lr.ph52, %._crit_edge48.thread
  %36 = phi i32 [ %.ph, %._crit_edge48.thread ], [ %16, %.lr.ph52 ]
  %.not3853 = icmp slt i32 %36, 1
  br i1 %.not3853, label %.preheader41.thread, label %.lr.ph55

.preheader41.thread:                              ; preds = %.preheader42
  store i32 1, ptr @f, align 16, !tbaa !5
  br label %.preheader

.lr.ph52:                                         ; preds = %._crit_edge48, %.lr.ph52
  %indvars.iv75 = phi i64 [ 2, %._crit_edge48 ], [ %indvars.iv.next76, %.lr.ph52 ]
  %37 = trunc nuw nsw i64 %indvars.iv75 to i32
  %38 = udiv i32 1000000007, %37
  %39 = zext nneg i32 %38 to i64
  %40 = urem i32 1000000007, %37
  %41 = zext nneg i32 %40 to i64
  %42 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = mul nsw i64 %44, %39
  %46 = srem i64 %45, 1000000007
  %47 = trunc nsw i64 %46 to i32
  %48 = sub nsw i32 1000000007, %47
  %49 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv75
  store i32 %48, ptr %49, align 4, !tbaa !5
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond79.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count78
  br i1 %exitcond79.not, label %.preheader42, label %.lr.ph52, !llvm.loop !14

._crit_edge56:                                    ; preds = %.lr.ph55
  store i32 1, ptr @f, align 16, !tbaa !5
  %.not3958 = icmp slt i32 %58, 2
  br i1 %.not3958, label %.preheader41, label %.lr.ph61.preheader

.lr.ph61.preheader:                               ; preds = %._crit_edge56
  %50 = add nuw i32 %58, 1
  %wide.trip.count86 = zext i32 %50 to i64
  %51 = add nsw i64 %wide.trip.count86, -2
  %52 = add nsw i64 %wide.trip.count86, -3
  %xtraiter114 = and i64 %51, 3
  %53 = icmp ult i64 %52, 3
  br i1 %53, label %..preheader41_crit_edge.unr-lcssa, label %.lr.ph61.preheader.new

.lr.ph61.preheader.new:                           ; preds = %.lr.ph61.preheader
  %unroll_iter119 = and i64 %51, -4
  br label %.lr.ph61

.lr.ph55:                                         ; preds = %.preheader42, %.lr.ph55
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %.lr.ph55 ], [ 1, %.preheader42 ]
  %54 = phi i32 [ %61, %.lr.ph55 ], [ %36, %.preheader42 ]
  %55 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv80
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %56
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %55, ptr noundef nonnull align 4 dereferenceable(4) %57) #4
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = trunc nuw i64 %indvars.iv.next81 to i32
  %60 = sub nsw i32 %58, %59
  %61 = add nsw i32 %60, 1
  %62 = sext i32 %60 to i64
  %.not38 = icmp sgt i64 %indvars.iv80, %62
  br i1 %.not38, label %._crit_edge56, label %.lr.ph55, !llvm.loop !15

..preheader41_crit_edge.unr-lcssa:                ; preds = %.lr.ph61, %.lr.ph61.preheader
  %.lcssa111.ph = phi i64 [ poison, %.lr.ph61.preheader ], [ %77, %.lr.ph61 ]
  %indvars.iv83.unr = phi i64 [ 2, %.lr.ph61.preheader ], [ %indvars.iv.next84.3, %.lr.ph61 ]
  %.unr116 = phi i64 [ 1, %.lr.ph61.preheader ], [ %77, %.lr.ph61 ]
  %lcmp.mod117.not = icmp eq i64 %xtraiter114, 0
  br i1 %lcmp.mod117.not, label %..preheader41_crit_edge, label %.lr.ph61.epil

.lr.ph61.epil:                                    ; preds = %..preheader41_crit_edge.unr-lcssa, %.lr.ph61.epil
  %indvars.iv83.epil = phi i64 [ %indvars.iv.next84.epil, %.lr.ph61.epil ], [ %indvars.iv83.unr, %..preheader41_crit_edge.unr-lcssa ]
  %63 = phi i64 [ %65, %.lr.ph61.epil ], [ %.unr116, %..preheader41_crit_edge.unr-lcssa ]
  %epil.iter115 = phi i64 [ %epil.iter115.next, %.lr.ph61.epil ], [ 0, %..preheader41_crit_edge.unr-lcssa ]
  %64 = mul nsw i64 %63, %indvars.iv83.epil
  %65 = srem i64 %64, 1000000007
  %indvars.iv.next84.epil = add nuw nsw i64 %indvars.iv83.epil, 1
  %epil.iter115.next = add i64 %epil.iter115, 1
  %epil.iter115.cmp.not = icmp eq i64 %epil.iter115.next, %xtraiter114
  br i1 %epil.iter115.cmp.not, label %..preheader41_crit_edge, label %.lr.ph61.epil, !llvm.loop !16

..preheader41_crit_edge:                          ; preds = %.lr.ph61.epil, %..preheader41_crit_edge.unr-lcssa
  %.lcssa111 = phi i64 [ %.lcssa111.ph, %..preheader41_crit_edge.unr-lcssa ], [ %65, %.lr.ph61.epil ]
  %66 = trunc nsw i64 %.lcssa111 to i32
  store i32 %66, ptr @f, align 16, !tbaa !5
  br label %.preheader41

.preheader41:                                     ; preds = %..preheader41_crit_edge, %._crit_edge56
  %67 = phi i64 [ %.lcssa111, %..preheader41_crit_edge ], [ 1, %._crit_edge56 ]
  %68 = icmp sgt i32 %58, 0
  br i1 %68, label %.lr.ph64.preheader, label %.preheader

.lr.ph64.preheader:                               ; preds = %.preheader41
  %wide.trip.count91 = zext nneg i32 %58 to i64
  br label %.lr.ph64

.lr.ph61:                                         ; preds = %.lr.ph61, %.lr.ph61.preheader.new
  %indvars.iv83 = phi i64 [ 2, %.lr.ph61.preheader.new ], [ %indvars.iv.next84.3, %.lr.ph61 ]
  %69 = phi i64 [ 1, %.lr.ph61.preheader.new ], [ %77, %.lr.ph61 ]
  %niter120 = phi i64 [ 0, %.lr.ph61.preheader.new ], [ %niter120.next.3, %.lr.ph61 ]
  %70 = mul nsw i64 %69, %indvars.iv83
  %71 = srem i64 %70, 1000000007
  %indvars.iv.next84 = or disjoint i64 %indvars.iv83, 1
  %72 = mul nsw i64 %71, %indvars.iv.next84
  %73 = srem i64 %72, 1000000007
  %indvars.iv.next84.1 = add nuw nsw i64 %indvars.iv83, 2
  %74 = mul nsw i64 %73, %indvars.iv.next84.1
  %75 = srem i64 %74, 1000000007
  %indvars.iv.next84.2 = add nuw nsw i64 %indvars.iv83, 3
  %76 = mul nsw i64 %75, %indvars.iv.next84.2
  %77 = srem i64 %76, 1000000007
  %indvars.iv.next84.3 = add nuw nsw i64 %indvars.iv83, 4
  %niter120.next.3 = add i64 %niter120, 4
  %niter120.ncmp.3 = icmp eq i64 %niter120.next.3, %unroll_iter119
  br i1 %niter120.ncmp.3, label %..preheader41_crit_edge.unr-lcssa, label %.lr.ph61, !llvm.loop !17

.preheader:                                       ; preds = %.lr.ph64, %.preheader41.thread, %.preheader41
  %.lcssa102104 = phi i32 [ %36, %.preheader41.thread ], [ %58, %.preheader41 ], [ %58, %.lr.ph64 ]
  %ans.promoted = load i32, ptr @ans, align 4, !tbaa !5
  %.not4065 = icmp slt i32 %.lcssa102104, 0
  br i1 %.not4065, label %103, label %.lr.ph67.preheader

.lr.ph67.preheader:                               ; preds = %.preheader
  %78 = add nuw i32 %.lcssa102104, 1
  %wide.trip.count96 = zext i32 %78 to i64
  %.pre98 = load i32, ptr @f, align 16, !tbaa !5
  %xtraiter121 = and i64 %wide.trip.count96, 1
  %79 = icmp eq i32 %.lcssa102104, 0
  br i1 %79, label %._crit_edge68.unr-lcssa, label %.lr.ph67.preheader.new

.lr.ph67.preheader.new:                           ; preds = %.lr.ph67.preheader
  %unroll_iter127 = and i64 %wide.trip.count96, 4294967294
  br label %.lr.ph67

.lr.ph64:                                         ; preds = %.lr.ph64.preheader, %.lr.ph64
  %80 = phi i64 [ %67, %.lr.ph64.preheader ], [ %92, %.lr.ph64 ]
  %indvars.iv88 = phi i64 [ 0, %.lr.ph64.preheader ], [ %indvars.iv.next89, %.lr.ph64 ]
  %81 = getelementptr inbounds [100002 x i32], ptr @c, i64 0, i64 %indvars.iv88
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = trunc nuw nsw i64 %indvars.iv88 to i32
  %84 = sub nsw i32 %82, %83
  %85 = sext i32 %84 to i64
  %86 = mul nsw i64 %80, %85
  %87 = srem i64 %86, 1000000007
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %88 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv.next89
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = mul nsw i64 %87, %90
  %92 = srem i64 %91, 1000000007
  %93 = trunc nsw i64 %92 to i32
  store i32 %93, ptr %88, align 4, !tbaa !5
  %exitcond92.not = icmp eq i64 %indvars.iv.next89, %wide.trip.count91
  br i1 %exitcond92.not, label %.preheader, label %.lr.ph64, !llvm.loop !18

._crit_edge68.unr-lcssa:                          ; preds = %.lr.ph67, %.lr.ph67.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph67.preheader ], [ %123, %.lr.ph67 ]
  %.unr123 = phi i32 [ %.pre98, %.lr.ph67.preheader ], [ %117, %.lr.ph67 ]
  %indvars.iv93.unr = phi i64 [ 0, %.lr.ph67.preheader ], [ %indvars.iv.next94.1, %.lr.ph67 ]
  %.unr124 = phi i32 [ %ans.promoted, %.lr.ph67.preheader ], [ %123, %.lr.ph67 ]
  %lcmp.mod125.not = icmp eq i64 %xtraiter121, 0
  br i1 %lcmp.mod125.not, label %._crit_edge68, label %.lr.ph67.epil

.lr.ph67.epil:                                    ; preds = %._crit_edge68.unr-lcssa
  %94 = sext i32 %.unr124 to i64
  %indvars.iv.next94.epil = add nuw nsw i64 %indvars.iv93.unr, 1
  %95 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv.next94.epil
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sub nsw i32 %.unr123, %96
  %98 = sext i32 %97 to i64
  %99 = mul nsw i64 %indvars.iv93.unr, %98
  %100 = add nsw i64 %99, %94
  %101 = srem i64 %100, 1000000007
  %102 = trunc nsw i64 %101 to i32
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %._crit_edge68.unr-lcssa, %.lr.ph67.epil
  %.lcssa = phi i32 [ %.lcssa.ph, %._crit_edge68.unr-lcssa ], [ %102, %.lr.ph67.epil ]
  store i32 %.lcssa, ptr @ans, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %._crit_edge68, %.preheader
  %104 = phi i32 [ %.lcssa, %._crit_edge68 ], [ %ans.promoted, %.preheader ]
  %105 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %104)
  ret i32 0

.lr.ph67:                                         ; preds = %.lr.ph67, %.lr.ph67.preheader.new
  %106 = phi i32 [ %.pre98, %.lr.ph67.preheader.new ], [ %117, %.lr.ph67 ]
  %indvars.iv93 = phi i64 [ 0, %.lr.ph67.preheader.new ], [ %indvars.iv.next94.1, %.lr.ph67 ]
  %107 = phi i32 [ %ans.promoted, %.lr.ph67.preheader.new ], [ %123, %.lr.ph67 ]
  %niter128 = phi i64 [ 0, %.lr.ph67.preheader.new ], [ %niter128.next.1, %.lr.ph67 ]
  %108 = sext i32 %107 to i64
  %indvars.iv.next94 = or disjoint i64 %indvars.iv93, 1
  %109 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv.next94
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sub nsw i32 %106, %110
  %112 = sext i32 %111 to i64
  %113 = mul nsw i64 %indvars.iv93, %112
  %114 = add nsw i64 %113, %108
  %115 = srem i64 %114, 1000000007
  %indvars.iv.next94.1 = add nuw nsw i64 %indvars.iv93, 2
  %116 = getelementptr inbounds [100002 x i32], ptr @f, i64 0, i64 %indvars.iv.next94.1
  %117 = load i32, ptr %116, align 8, !tbaa !5
  %118 = sub nsw i32 %110, %117
  %119 = sext i32 %118 to i64
  %120 = mul nsw i64 %indvars.iv.next94, %119
  %121 = add nsw i64 %120, %115
  %122 = srem i64 %121, 1000000007
  %123 = trunc nsw i64 %122 to i32
  %niter128.next.1 = add i64 %niter128, 2
  %niter128.ncmp.1 = icmp eq i64 %niter128.next.1, %unroll_iter127
  br i1 %niter128.ncmp.1, label %._crit_edge68.unr-lcssa, label %.lr.ph67, !llvm.loop !19
}

; 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 nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

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

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


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