; LLVM IR from tangjz/acm-icpc :: lydsy/3343.ll (Z6updateiii)

; 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
@val = external dso_local global [1000010 x i32], align 16
@cha = external dso_local global [1000010 x i32], align 16
@add = external dso_local global [1010 x i32], align 16
@Size = external dso_local global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6updateiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) #0 {
  %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
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = call noundef i32 @_Z2Noi(i32 noundef %21)
  store i32 %22, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = call noundef i32 @_Z2Noi(i32 noundef %23)
  store i32 %24, ptr %10, align 4, !tbaa !5
  %25 = load i32, ptr %9, align 4, !tbaa !5
  %26 = load i32, ptr %10, align 4, !tbaa !5
  %27 = icmp eq i32 %25, %26
  br i1 %27, label %28, label %81

28:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %29 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %29, ptr %11, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %42, %28
  %31 = load i32, ptr %11, align 4, !tbaa !5
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = icmp sle i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %45

35:                                               ; preds = %30
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = load i32, ptr %11, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, %36
  store i32 %41, ptr %39, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %35
  %43 = load i32, ptr %11, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %11, align 4, !tbaa !5
  br label %30, !llvm.loop !9

45:                                               ; preds = %34
  %46 = load i32, ptr %9, align 4, !tbaa !5
  %47 = sub nsw i32 %46, 1
  %48 = load i32, ptr @Size, align 4, !tbaa !5
  %49 = mul nsw i32 %47, %48
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %51 = load i32, ptr %9, align 4, !tbaa !5
  %52 = load i32, ptr @Size, align 4, !tbaa !5
  %53 = mul nsw i32 %51, %52
  store i32 %53, ptr %12, align 4, !tbaa !5
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %55 = load i32, ptr %54, align 4, !tbaa !5
  store i32 %55, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %56 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %56, ptr %13, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %70, %45
  %58 = load i32, ptr %13, align 4, !tbaa !5
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = icmp sle i32 %58, %59
  br i1 %60, label %62, label %61

61:                                               ; preds = %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %73

62:                                               ; preds = %57
  %63 = load i32, ptr %13, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %13, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000010 x i32], ptr @cha, i64 0, i64 %68
  store i32 %66, ptr %69, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %62
  %71 = load i32, ptr %13, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %13, align 4, !tbaa !5
  br label %57, !llvm.loop !11

73:                                               ; preds = %61
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr @cha, i64 %75
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr @cha, i64 %78
  %80 = getelementptr inbounds i32, ptr %79, i64 1
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %76, ptr noundef %80)
  br label %184

81:                                               ; preds = %3
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = sub nsw i32 %82, 1
  %84 = load i32, ptr @Size, align 4, !tbaa !5
  %85 = mul nsw i32 %83, %84
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %7, align 4, !tbaa !5
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = load i32, ptr @Size, align 4, !tbaa !5
  %89 = mul nsw i32 %87, %88
  store i32 %89, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %90 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %90, ptr %14, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %103, %81
  %92 = load i32, ptr %14, align 4, !tbaa !5
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = icmp sle i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %106

96:                                               ; preds = %91
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = load i32, ptr %14, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = add nsw i32 %101, %97
  store i32 %102, ptr %100, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %96
  %104 = load i32, ptr %14, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %14, align 4, !tbaa !5
  br label %91, !llvm.loop !12

106:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %107 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %107, ptr %15, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %121, %106
  %109 = load i32, ptr %15, align 4, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = icmp sle i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %124

113:                                              ; preds = %108
  %114 = load i32, ptr %15, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %15, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1000010 x i32], ptr @cha, i64 0, i64 %119
  store i32 %117, ptr %120, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %113
  %122 = load i32, ptr %15, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %15, align 4, !tbaa !5
  br label %108, !llvm.loop !13

124:                                              ; preds = %112
  %125 = load i32, ptr %7, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds i32, ptr @cha, i64 %126
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr @cha, i64 %129
  %131 = getelementptr inbounds i32, ptr %130, i64 1
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %127, ptr noundef %131)
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = sub nsw i32 %132, 1
  %134 = load i32, ptr @Size, align 4, !tbaa !5
  %135 = mul nsw i32 %133, %134
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = load i32, ptr @Size, align 4, !tbaa !5
  %139 = mul nsw i32 %137, %138
  store i32 %139, ptr %16, align 4, !tbaa !5
  %140 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %141 = load i32, ptr %140, align 4, !tbaa !5
  store i32 %141, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %142 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %142, ptr %17, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %155, %124
  %144 = load i32, ptr %17, align 4, !tbaa !5
  %145 = load i32, ptr %5, align 4, !tbaa !5
  %146 = icmp sle i32 %144, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %158

148:                                              ; preds = %143
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = load i32, ptr %17, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = add nsw i32 %153, %149
  store i32 %154, ptr %152, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %148
  %156 = load i32, ptr %17, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %17, align 4, !tbaa !5
  br label %143, !llvm.loop !14

158:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %159 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %159, ptr %18, align 4, !tbaa !5
  br label %160

160:                                              ; preds = %173, %158
  %161 = load i32, ptr %18, align 4, !tbaa !5
  %162 = load i32, ptr %8, align 4, !tbaa !5
  %163 = icmp sle i32 %161, %162
  br i1 %163, label %165, label %164

164:                                              ; preds = %160
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %176

165:                                              ; preds = %160
  %166 = load i32, ptr %18, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = load i32, ptr %18, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1000010 x i32], ptr @cha, i64 0, i64 %171
  store i32 %169, ptr %172, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %165
  %174 = load i32, ptr %18, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %18, align 4, !tbaa !5
  br label %160, !llvm.loop !15

176:                                              ; preds = %164
  %177 = load i32, ptr %7, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds i32, ptr @cha, i64 %178
  %180 = load i32, ptr %8, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds i32, ptr @cha, i64 %181
  %183 = getelementptr inbounds i32, ptr %182, i64 1
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %179, ptr noundef %183)
  br label %184

184:                                              ; preds = %176, %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %185 = load i32, ptr %9, align 4, !tbaa !5
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %187 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %187, ptr %20, align 4, !tbaa !5
  br label %188

188:                                              ; preds = %200, %184
  %189 = load i32, ptr %19, align 4, !tbaa !5
  %190 = load i32, ptr %20, align 4, !tbaa !5
  %191 = icmp slt i32 %189, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %203

193:                                              ; preds = %188
  %194 = load i32, ptr %6, align 4, !tbaa !5
  %195 = load i32, ptr %19, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [1010 x i32], ptr @add, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = add nsw i32 %198, %194
  store i32 %199, ptr %197, align 4, !tbaa !5
  br label %200

200:                                              ; preds = %193
  %201 = load i32, ptr %19, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %19, align 4, !tbaa !5
  br label %188, !llvm.loop !16

203:                                              ; preds = %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z2Noi(i32 noundef) #2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = !{!"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
@val = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@cha = external dso_local global [1000010 x i32], align 16
@add = external dso_local local_unnamed_addr global [1010 x i32], align 16
@Size = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6updateiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = tail call noundef i32 @_Z2Noi(i32 noundef %0)
  %7 = tail call noundef i32 @_Z2Noi(i32 noundef %1)
  %8 = icmp eq i32 %6, %7
  br i1 %8, label %.preheader, label %28

.preheader:                                       ; preds = %3
  %.not7390 = icmp sgt i32 %0, %1
  br i1 %.not7390, label %._crit_edge93, label %.lr.ph92.preheader

.lr.ph92.preheader:                               ; preds = %.preheader
  %9 = sext i32 %0 to i64
  %10 = add i32 %1, 1
  %11 = sub i32 %1, %0
  %12 = zext i32 %11 to i64
  %13 = add nuw nsw i64 %12, 1
  %min.iters.check169 = icmp ult i32 %11, 7
  br i1 %min.iters.check169, label %.lr.ph92.preheader202, label %vector.ph170

.lr.ph92.preheader202:                            ; preds = %middle.block167, %.lr.ph92.preheader
  %indvars.iv119.ph = phi i64 [ %9, %.lr.ph92.preheader ], [ %ind.end173, %middle.block167 ]
  br label %.lr.ph92

vector.ph170:                                     ; preds = %.lr.ph92.preheader
  %n.vec172 = and i64 %13, 8589934584
  %ind.end173 = add nsw i64 %n.vec172, %9
  %broadcast.splatinsert180 = insertelement <4 x i32> poison, i32 %2, i64 0
  %broadcast.splat181 = shufflevector <4 x i32> %broadcast.splatinsert180, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body175

vector.body175:                                   ; preds = %vector.body175, %vector.ph170
  %index176 = phi i64 [ 0, %vector.ph170 ], [ %index.next182, %vector.body175 ]
  %offset.idx177 = add i64 %index176, %9
  %14 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %offset.idx177
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %wide.load178 = load <4 x i32>, ptr %14, align 4, !tbaa !5
  %wide.load179 = load <4 x i32>, ptr %15, align 4, !tbaa !5
  %16 = add nsw <4 x i32> %wide.load178, %broadcast.splat181
  %17 = add nsw <4 x i32> %wide.load179, %broadcast.splat181
  store <4 x i32> %16, ptr %14, align 4, !tbaa !5
  store <4 x i32> %17, ptr %15, align 4, !tbaa !5
  %index.next182 = add nuw i64 %index176, 8
  %18 = icmp eq i64 %index.next182, %n.vec172
  br i1 %18, label %middle.block167, label %vector.body175, !llvm.loop !9

middle.block167:                                  ; preds = %vector.body175
  %cmp.n183 = icmp eq i64 %13, %n.vec172
  br i1 %cmp.n183, label %._crit_edge93, label %.lr.ph92.preheader202

._crit_edge93:                                    ; preds = %.lr.ph92, %middle.block167, %.preheader
  %19 = add i32 %6, -1
  %20 = load i32, ptr @Size, align 4, !tbaa !5
  %21 = mul i32 %20, %19
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %22 = mul nsw i32 %20, %6
  store i32 %22, ptr %4, align 4, !tbaa !5
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %24 = load i32, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %.not7494.not = icmp slt i32 %21, %24
  br i1 %.not7494.not, label %._crit_edge98.sink.split, label %._crit_edge98

.lr.ph92:                                         ; preds = %.lr.ph92.preheader202, %.lr.ph92
  %indvars.iv119 = phi i64 [ %indvars.iv.next120, %.lr.ph92 ], [ %indvars.iv119.ph, %.lr.ph92.preheader202 ]
  %25 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %indvars.iv119
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = add nsw i32 %26, %2
  store i32 %27, ptr %25, align 4, !tbaa !5
  %indvars.iv.next120 = add nsw i64 %indvars.iv119, 1
  %lftr.wideiv122 = trunc i64 %indvars.iv.next120 to i32
  %exitcond123.not = icmp eq i32 %10, %lftr.wideiv122
  br i1 %exitcond123.not, label %._crit_edge93, label %.lr.ph92, !llvm.loop !13

28:                                               ; preds = %3
  %29 = add i32 %6, -1
  %30 = load i32, ptr @Size, align 4, !tbaa !5
  %31 = mul i32 %30, %29
  %32 = mul nsw i32 %30, %6
  %.not77 = icmp slt i32 %32, %0
  br i1 %.not77, label %.preheader76, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %28
  %33 = sext i32 %0 to i64
  %34 = add i32 %32, 1
  %35 = sub i32 %32, %0
  %36 = zext i32 %35 to i64
  %37 = add nuw nsw i64 %36, 1
  %min.iters.check = icmp ult i32 %35, 7
  br i1 %min.iters.check, label %.lr.ph.preheader204, label %vector.ph

.lr.ph.preheader204:                              ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ %33, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %37, 8589934584
  %ind.end = add nsw i64 %n.vec, %33
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %2, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %33
  %38 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %offset.idx
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %wide.load = load <4 x i32>, ptr %38, align 4, !tbaa !5
  %wide.load149 = load <4 x i32>, ptr %39, align 4, !tbaa !5
  %40 = add nsw <4 x i32> %wide.load, %broadcast.splat
  %41 = add nsw <4 x i32> %wide.load149, %broadcast.splat
  store <4 x i32> %40, ptr %38, align 4, !tbaa !5
  store <4 x i32> %41, ptr %39, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %42 = icmp eq i64 %index.next, %n.vec
  br i1 %42, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %37, %n.vec
  br i1 %cmp.n, label %.preheader76, label %.lr.ph.preheader204

.preheader76:                                     ; preds = %.lr.ph, %middle.block, %28
  %.not7079.not = icmp slt i32 %31, %32
  br i1 %.not7079.not, label %.lr.ph81.preheader, label %._crit_edge

.lr.ph81.preheader:                               ; preds = %.preheader76
  %43 = sext i32 %31 to i64
  %44 = shl nsw i64 %43, 2
  %45 = add nsw i64 %44, 4
  %scevgep = getelementptr i8, ptr @cha, i64 %45
  %scevgep105 = getelementptr i8, ptr @val, i64 %45
  %46 = add i32 %30, -1
  %47 = zext i32 %46 to i64
  %48 = shl nuw nsw i64 %47, 2
  %49 = add nuw nsw i64 %48, 4
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep, ptr noundef nonnull align 4 dereferenceable(1) %scevgep105, i64 %49, i1 false), !tbaa !5
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph.preheader204, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader204 ]
  %50 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %indvars.iv
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %2
  store i32 %52, ptr %50, align 4, !tbaa !5
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i32 %34, %lftr.wideiv
  br i1 %exitcond.not, label %.preheader76, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph81.preheader, %.preheader76
  %53 = sext i32 %31 to i64
  %54 = getelementptr i32, ptr @cha, i64 %53
  %55 = getelementptr i8, ptr %54, i64 4
  %56 = sext i32 %32 to i64
  %57 = getelementptr inbounds i32, ptr @cha, i64 %56
  %58 = getelementptr inbounds i8, ptr %57, i64 4
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull %55, ptr noundef nonnull %58)
  %59 = add i32 %7, -1
  %60 = load i32, ptr @Size, align 4, !tbaa !5
  %61 = mul i32 %60, %59
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %62 = mul nsw i32 %60, %7
  store i32 %62, ptr %5, align 4, !tbaa !5
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %.not7182.not = icmp slt i32 %61, %1
  br i1 %.not7182.not, label %.lr.ph85.preheader, label %.preheader75

.lr.ph85.preheader:                               ; preds = %._crit_edge
  %65 = sext i32 %61 to i64
  %66 = add nsw i64 %65, 1
  %67 = add i32 %1, 1
  %68 = xor i32 %61, -1
  %69 = add i32 %68, %1
  %70 = zext i32 %69 to i64
  %71 = add nuw nsw i64 %70, 1
  %min.iters.check152 = icmp ult i32 %69, 7
  br i1 %min.iters.check152, label %.lr.ph85.preheader203, label %vector.ph153

.lr.ph85.preheader203:                            ; preds = %middle.block150, %.lr.ph85.preheader
  %indvars.iv109.ph = phi i64 [ %66, %.lr.ph85.preheader ], [ %ind.end156, %middle.block150 ]
  br label %.lr.ph85

vector.ph153:                                     ; preds = %.lr.ph85.preheader
  %n.vec155 = and i64 %71, 8589934584
  %ind.end156 = add nsw i64 %66, %n.vec155
  %broadcast.splatinsert163 = insertelement <4 x i32> poison, i32 %2, i64 0
  %broadcast.splat164 = shufflevector <4 x i32> %broadcast.splatinsert163, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body158

vector.body158:                                   ; preds = %vector.body158, %vector.ph153
  %index159 = phi i64 [ 0, %vector.ph153 ], [ %index.next165, %vector.body158 ]
  %offset.idx160 = add i64 %66, %index159
  %72 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %offset.idx160
  %73 = getelementptr inbounds i8, ptr %72, i64 16
  %wide.load161 = load <4 x i32>, ptr %72, align 4, !tbaa !5
  %wide.load162 = load <4 x i32>, ptr %73, align 4, !tbaa !5
  %74 = add nsw <4 x i32> %wide.load161, %broadcast.splat164
  %75 = add nsw <4 x i32> %wide.load162, %broadcast.splat164
  store <4 x i32> %74, ptr %72, align 4, !tbaa !5
  store <4 x i32> %75, ptr %73, align 4, !tbaa !5
  %index.next165 = add nuw i64 %index159, 8
  %76 = icmp eq i64 %index.next165, %n.vec155
  br i1 %76, label %middle.block150, label %vector.body158, !llvm.loop !16

middle.block150:                                  ; preds = %vector.body158
  %cmp.n166 = icmp eq i64 %71, %n.vec155
  br i1 %cmp.n166, label %.preheader75, label %.lr.ph85.preheader203

.preheader75:                                     ; preds = %.lr.ph85, %middle.block150, %._crit_edge
  %.not7286.not = icmp slt i32 %61, %64
  br i1 %.not7286.not, label %._crit_edge98.sink.split, label %._crit_edge98

.lr.ph85:                                         ; preds = %.lr.ph85.preheader203, %.lr.ph85
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %.lr.ph85 ], [ %indvars.iv109.ph, %.lr.ph85.preheader203 ]
  %77 = getelementptr inbounds [1000010 x i32], ptr @val, i64 0, i64 %indvars.iv109
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %78, %2
  store i32 %79, ptr %77, align 4, !tbaa !5
  %indvars.iv.next110 = add nsw i64 %indvars.iv109, 1
  %lftr.wideiv112 = trunc i64 %indvars.iv.next110 to i32
  %exitcond113.not = icmp eq i32 %67, %lftr.wideiv112
  br i1 %exitcond113.not, label %.preheader75, label %.lr.ph85, !llvm.loop !17

._crit_edge98.sink.split:                         ; preds = %.preheader75, %._crit_edge93
  %.sink148 = phi i32 [ %21, %._crit_edge93 ], [ %61, %.preheader75 ]
  %.sink = phi i32 [ %24, %._crit_edge93 ], [ %64, %.preheader75 ]
  %80 = sext i32 %.sink148 to i64
  %81 = shl nsw i64 %80, 2
  %82 = add nsw i64 %81, 4
  %scevgep114 = getelementptr i8, ptr @cha, i64 %82
  %scevgep115 = getelementptr i8, ptr @val, i64 %82
  %83 = xor i32 %.sink148, -1
  %84 = add i32 %.sink, %83
  %85 = zext i32 %84 to i64
  %86 = shl nuw nsw i64 %85, 2
  %87 = add nuw nsw i64 %86, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep114, ptr noundef nonnull align 4 dereferenceable(1) %scevgep115, i64 %87, i1 false), !tbaa !5
  br label %._crit_edge98

._crit_edge98:                                    ; preds = %._crit_edge98.sink.split, %.preheader75, %._crit_edge93
  %.sink139 = phi i32 [ %21, %._crit_edge93 ], [ %61, %.preheader75 ], [ %.sink148, %._crit_edge98.sink.split ]
  %.sink137 = phi i32 [ %24, %._crit_edge93 ], [ %64, %.preheader75 ], [ %.sink, %._crit_edge98.sink.split ]
  %88 = sext i32 %.sink139 to i64
  %89 = getelementptr i32, ptr @cha, i64 %88
  %90 = getelementptr i8, ptr %89, i64 4
  %91 = sext i32 %.sink137 to i64
  %92 = getelementptr inbounds i32, ptr @cha, i64 %91
  %93 = getelementptr inbounds i8, ptr %92, i64 4
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull %90, ptr noundef nonnull %93)
  %.099 = add nsw i32 %6, 1
  %94 = icmp slt i32 %.099, %7
  br i1 %94, label %.lr.ph102.preheader, label %._crit_edge103

.lr.ph102.preheader:                              ; preds = %._crit_edge98
  %95 = sext i32 %.099 to i64
  %96 = add i32 %7, -2
  %97 = sub i32 %96, %6
  %98 = zext i32 %97 to i64
  %99 = add nuw nsw i64 %98, 1
  %min.iters.check186 = icmp ult i32 %97, 7
  br i1 %min.iters.check186, label %.lr.ph102.preheader201, label %vector.ph187

.lr.ph102.preheader201:                           ; preds = %middle.block184, %.lr.ph102.preheader
  %indvars.iv129.ph = phi i64 [ %95, %.lr.ph102.preheader ], [ %ind.end190, %middle.block184 ]
  br label %.lr.ph102

vector.ph187:                                     ; preds = %.lr.ph102.preheader
  %n.vec189 = and i64 %99, 8589934584
  %ind.end190 = add nsw i64 %n.vec189, %95
  %broadcast.splatinsert197 = insertelement <4 x i32> poison, i32 %2, i64 0
  %broadcast.splat198 = shufflevector <4 x i32> %broadcast.splatinsert197, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body192

vector.body192:                                   ; preds = %vector.body192, %vector.ph187
  %index193 = phi i64 [ 0, %vector.ph187 ], [ %index.next199, %vector.body192 ]
  %offset.idx194 = add i64 %index193, %95
  %100 = getelementptr inbounds [1010 x i32], ptr @add, i64 0, i64 %offset.idx194
  %101 = getelementptr inbounds i8, ptr %100, i64 16
  %wide.load195 = load <4 x i32>, ptr %100, align 4, !tbaa !5
  %wide.load196 = load <4 x i32>, ptr %101, align 4, !tbaa !5
  %102 = add nsw <4 x i32> %wide.load195, %broadcast.splat198
  %103 = add nsw <4 x i32> %wide.load196, %broadcast.splat198
  store <4 x i32> %102, ptr %100, align 4, !tbaa !5
  store <4 x i32> %103, ptr %101, align 4, !tbaa !5
  %index.next199 = add nuw i64 %index193, 8
  %104 = icmp eq i64 %index.next199, %n.vec189
  br i1 %104, label %middle.block184, label %vector.body192, !llvm.loop !18

middle.block184:                                  ; preds = %vector.body192
  %cmp.n200 = icmp eq i64 %99, %n.vec189
  br i1 %cmp.n200, label %._crit_edge103, label %.lr.ph102.preheader201

._crit_edge103:                                   ; preds = %.lr.ph102, %middle.block184, %._crit_edge98
  ret void

.lr.ph102:                                        ; preds = %.lr.ph102.preheader201, %.lr.ph102
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %.lr.ph102 ], [ %indvars.iv129.ph, %.lr.ph102.preheader201 ]
  %105 = getelementptr inbounds [1010 x i32], ptr @add, i64 0, i64 %indvars.iv129
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = add nsw i32 %106, %2
  store i32 %107, ptr %105, align 4, !tbaa !5
  %indvars.iv.next130 = add nsw i64 %indvars.iv129, 1
  %lftr.wideiv132 = trunc i64 %indvars.iv.next130 to i32
  %exitcond133.not = icmp eq i32 %7, %lftr.wideiv132
  br i1 %exitcond133.not, label %._crit_edge103, label %.lr.ph102, !llvm.loop !19
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z2Noi(i32 noundef) 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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !10, !11, !12}
!15 = distinct !{!15, !10, !12, !11}
!16 = distinct !{!16, !10, !11, !12}
!17 = distinct !{!17, !10, !12, !11}
!18 = distinct !{!18, !10, !11, !12}
!19 = distinct !{!19, !10, !12, !11}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopIdiomRecognizePass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass