; LLVM IR from tangjz/acm-icpc :: codeforces/complete (722C)

; 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
@a = external dso_local global [100010 x i32], align 16
@p = external dso_local global [100010 x i32], align 16
@dsu = external dso_local global [100010 x i32], align 16
@L = external dso_local global [100010 x i64], align 16
@R = external dso_local global [100010 x i64], align 16
@C = external dso_local global [100010 x i64], align 16
@sum = external dso_local global i64, align 8
@ans = external dso_local global [100010 x i64], align 16
@vis = external dso_local global [100010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z5mergeii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %27, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %30

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @a, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %25)
  br label %27

27:                                               ; preds = %22
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

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

31:                                               ; preds = %41, %30
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %44

36:                                               ; preds = %31
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr @p, i64 %38
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %39)
  br label %41

41:                                               ; preds = %36
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %3, align 4, !tbaa !5
  br label %31, !llvm.loop !11

44:                                               ; preds = %35
  call void @llvm.memset.p0.i64(ptr align 16 @dsu, i8 -1, i64 400040, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %45 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %45, ptr %4, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %203, %44
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = icmp sge i32 %47, 1
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  store i64 %58, ptr %5, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  store i64 %66, ptr %6, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  store i64 %74, ptr %7, align 8, !tbaa !12
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100010 x i8], ptr @vis, i64 0, i64 %79
  store i8 1, ptr %80, align 1, !tbaa !14
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sub nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100010 x i8], ptr @vis, i64 0, i64 %86
  %88 = load i8, ptr %87, align 1, !tbaa !14, !range !16, !noundef !17
  %89 = trunc i8 %88 to i1
  br i1 %89, label %90, label %128

90:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  %96 = call noundef i32 @_Z4findi(i32 noundef %95)
  store i32 %96, ptr %8, align 4, !tbaa !5
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !12
  %104 = load i64, ptr %5, align 8, !tbaa !12
  %105 = add nsw i64 %103, %104
  store i64 %105, ptr %9, align 8, !tbaa !12
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %99, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %107 = load i64, ptr %106, align 8, !tbaa !12
  store i64 %107, ptr %5, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %108 = load i64, ptr %7, align 8, !tbaa !12
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !12
  %113 = add nsw i64 %108, %112
  store i64 %113, ptr %10, align 8, !tbaa !12
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %115 = load i64, ptr %114, align 8, !tbaa !12
  store i64 %115, ptr %6, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %117
  %119 = load i64, ptr %118, align 8, !tbaa !12
  %120 = load i64, ptr %7, align 8, !tbaa !12
  %121 = add nsw i64 %120, %119
  store i64 %121, ptr %7, align 8, !tbaa !12
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = load i32, ptr %4, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = call noundef i32 @_Z4findi(i32 noundef %126)
  call void @_Z5mergeii(i32 noundef %122, i32 noundef %127)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %128

128:                                              ; preds = %90, %50
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100010 x i8], ptr @vis, i64 0, i64 %134
  %136 = load i8, ptr %135, align 1, !tbaa !14, !range !16, !noundef !17
  %137 = trunc i8 %136 to i1
  br i1 %137, label %138, label %176

138:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %139 = load i32, ptr %4, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  %144 = call noundef i32 @_Z4findi(i32 noundef %143)
  store i32 %144, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %145 = load i64, ptr %7, align 8, !tbaa !12
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !12
  %150 = add nsw i64 %145, %149
  store i64 %150, ptr %12, align 8, !tbaa !12
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %152 = load i64, ptr %151, align 8, !tbaa !12
  store i64 %152, ptr %5, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %153 = load i32, ptr %11, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %154
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %156 = load i32, ptr %11, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %157
  %159 = load i64, ptr %158, align 8, !tbaa !12
  %160 = load i64, ptr %6, align 8, !tbaa !12
  %161 = add nsw i64 %159, %160
  store i64 %161, ptr %13, align 8, !tbaa !12
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %155, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %163 = load i64, ptr %162, align 8, !tbaa !12
  store i64 %163, ptr %6, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  %164 = load i32, ptr %11, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %165
  %167 = load i64, ptr %166, align 8, !tbaa !12
  %168 = load i64, ptr %7, align 8, !tbaa !12
  %169 = add nsw i64 %168, %167
  store i64 %169, ptr %7, align 8, !tbaa !12
  %170 = load i32, ptr %11, align 4, !tbaa !5
  %171 = load i32, ptr %4, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = call noundef i32 @_Z4findi(i32 noundef %174)
  call void @_Z5mergeii(i32 noundef %170, i32 noundef %175)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %176

176:                                              ; preds = %138, %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %177 = load i32, ptr %4, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = call noundef i32 @_Z4findi(i32 noundef %180)
  store i32 %181, ptr %14, align 4, !tbaa !5
  %182 = load i64, ptr %5, align 8, !tbaa !12
  %183 = load i32, ptr %14, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %184
  store i64 %182, ptr %185, align 8, !tbaa !12
  %186 = load i64, ptr %6, align 8, !tbaa !12
  %187 = load i32, ptr %14, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %188
  store i64 %186, ptr %189, align 8, !tbaa !12
  %190 = load i64, ptr %7, align 8, !tbaa !12
  %191 = load i32, ptr %14, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %192
  store i64 %190, ptr %193, align 8, !tbaa !12
  %194 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %194, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @sum, ptr noundef nonnull align 8 dereferenceable(8) %195)
  %197 = load i64, ptr %196, align 8, !tbaa !12
  store i64 %197, ptr @sum, align 8, !tbaa !12
  %198 = load i64, ptr @sum, align 8, !tbaa !12
  %199 = load i32, ptr %4, align 4, !tbaa !5
  %200 = sub nsw i32 %199, 1
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %201
  store i64 %198, ptr %202, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %203

203:                                              ; preds = %176
  %204 = load i32, ptr %4, align 4, !tbaa !5
  %205 = add nsw i32 %204, -1
  store i32 %205, ptr %4, align 4, !tbaa !5
  br label %46, !llvm.loop !18

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

207:                                              ; preds = %218, %206
  %208 = load i32, ptr %15, align 4, !tbaa !5
  %209 = load i32, ptr @n, align 4, !tbaa !5
  %210 = icmp sle i32 %208, %209
  br i1 %210, label %212, label %211

211:                                              ; preds = %207
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %221

212:                                              ; preds = %207
  %213 = load i32, ptr %15, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %214
  %216 = load i64, ptr %215, align 8, !tbaa !12
  %217 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %216)
  br label %218

218:                                              ; preds = %212
  %219 = load i32, ptr %15, align 4, !tbaa !5
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %15, align 4, !tbaa !5
  br label %207, !llvm.loop !19

221:                                              ; preds = %211
  ret i32 0
}

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

declare i32 @printf(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 = { 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 #2 = { 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 #3 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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
@a = external dso_local global [100010 x i32], align 16
@p = external dso_local global [100010 x i32], align 16
@dsu = external dso_local local_unnamed_addr global [100010 x i32], align 16
@L = external dso_local global [100010 x i64], align 16
@R = external dso_local global [100010 x i64], align 16
@C = external dso_local local_unnamed_addr global [100010 x i64], align 16
@sum = external dso_local global i64, align 8
@ans = external dso_local local_unnamed_addr global [100010 x i64], align 16
@vis = external dso_local local_unnamed_addr global [100010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z5mergeii(i32 noundef, i32 noundef) local_unnamed_addr #1

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

.preheader41:                                     ; preds = %.lr.ph
  %.not3944 = icmp slt i32 %12, 1
  br i1 %.not3944, label %._crit_edge.thread, label %.lr.ph46

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

._crit_edge.thread:                               ; preds = %.preheader41, %0
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @dsu, i8 -1, i64 400040, i1 false)
  br label %._crit_edge53

._crit_edge:                                      ; preds = %.lr.ph46
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @dsu, i8 -1, i64 400040, i1 false)
  %14 = icmp sgt i32 %18, 0
  br i1 %14, label %.lr.ph49.preheader, label %._crit_edge53

.lr.ph49.preheader:                               ; preds = %._crit_edge
  %15 = zext nneg i32 %18 to i64
  br label %.lr.ph49

.lr.ph46:                                         ; preds = %.preheader41, %.lr.ph46
  %indvars.iv56 = phi i64 [ %indvars.iv.next57, %.lr.ph46 ], [ 1, %.preheader41 ]
  %16 = getelementptr inbounds i32, ptr @p, i64 %indvars.iv56
  %17 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %16)
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %.not39.not = icmp slt i64 %indvars.iv56, %19
  br i1 %.not39.not, label %.lr.ph46, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %82
  %.pre66 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp slt i32 %.pre66, 1
  br i1 %20, label %._crit_edge53, label %.lr.ph52

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %82
  %indvars.iv59 = phi i64 [ %15, %.lr.ph49.preheader ], [ %indvars.iv.next60, %82 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %21 = getelementptr inbounds [100010 x i32], ptr @p, i64 0, i64 %indvars.iv59
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  store i64 %26, ptr %1, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  store i64 %26, ptr %2, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store i64 %26, ptr %3, align 8, !tbaa !12
  %27 = getelementptr inbounds [100010 x i8], ptr @vis, i64 0, i64 %23
  store i8 1, ptr %27, align 1, !tbaa !14
  %28 = add nsw i32 %22, -1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [100010 x i8], ptr @vis, i64 0, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !14, !range !16, !noundef !17
  %32 = trunc nuw i8 %31 to i1
  br i1 %32, label %33, label %54

33:                                               ; preds = %.lr.ph49
  %34 = call noundef i32 @_Z4findi(i32 noundef %28)
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %35
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %37 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %35
  %38 = load i64, ptr %37, align 8, !tbaa !12
  %39 = load i64, ptr %1, align 8, !tbaa !12
  %40 = add nsw i64 %39, %38
  store i64 %40, ptr %4, align 8, !tbaa !12
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %36, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %42 = load i64, ptr %41, align 8, !tbaa !12
  store i64 %42, ptr %1, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %43 = load i64, ptr %3, align 8, !tbaa !12
  %44 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %35
  %45 = load i64, ptr %44, align 8, !tbaa !12
  %46 = add nsw i64 %45, %43
  store i64 %46, ptr %5, align 8, !tbaa !12
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %48 = load i64, ptr %47, align 8, !tbaa !12
  store i64 %48, ptr %2, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  %49 = load i64, ptr %37, align 8, !tbaa !12
  %50 = load i64, ptr %3, align 8, !tbaa !12
  %51 = add nsw i64 %50, %49
  store i64 %51, ptr %3, align 8, !tbaa !12
  %52 = load i32, ptr %21, align 4, !tbaa !5
  %53 = call noundef i32 @_Z4findi(i32 noundef %52)
  call void @_Z5mergeii(i32 noundef %34, i32 noundef %53)
  %.pre = load i32, ptr %21, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %33, %.lr.ph49
  %55 = phi i32 [ %.pre, %33 ], [ %22, %.lr.ph49 ]
  %56 = add nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [100010 x i8], ptr @vis, i64 0, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !14, !range !16, !noundef !17
  %60 = trunc nuw i8 %59 to i1
  br i1 %60, label %61, label %82

61:                                               ; preds = %54
  %62 = call noundef i32 @_Z4findi(i32 noundef %56)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  %63 = load i64, ptr %3, align 8, !tbaa !12
  %64 = sext i32 %62 to i64
  %65 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !12
  %67 = add nsw i64 %66, %63
  store i64 %67, ptr %6, align 8, !tbaa !12
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %69 = load i64, ptr %68, align 8, !tbaa !12
  store i64 %69, ptr %1, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  %70 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %71 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %64
  %72 = load i64, ptr %71, align 8, !tbaa !12
  %73 = load i64, ptr %2, align 8, !tbaa !12
  %74 = add nsw i64 %73, %72
  store i64 %74, ptr %7, align 8, !tbaa !12
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %76 = load i64, ptr %75, align 8, !tbaa !12
  store i64 %76, ptr %2, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  %77 = load i64, ptr %71, align 8, !tbaa !12
  %78 = load i64, ptr %3, align 8, !tbaa !12
  %79 = add nsw i64 %78, %77
  store i64 %79, ptr %3, align 8, !tbaa !12
  %80 = load i32, ptr %21, align 4, !tbaa !5
  %81 = call noundef i32 @_Z4findi(i32 noundef %80)
  call void @_Z5mergeii(i32 noundef %62, i32 noundef %81)
  %.pre65 = load i32, ptr %21, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %61, %54
  %83 = phi i32 [ %.pre65, %61 ], [ %55, %54 ]
  %84 = call noundef i32 @_Z4findi(i32 noundef %83)
  %85 = load i64, ptr %1, align 8, !tbaa !12
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %86
  store i64 %85, ptr %87, align 8, !tbaa !12
  %88 = load i64, ptr %2, align 8, !tbaa !12
  %89 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %86
  store i64 %88, ptr %89, align 8, !tbaa !12
  %90 = load i64, ptr %3, align 8, !tbaa !12
  %91 = getelementptr inbounds [100010 x i64], ptr @C, i64 0, i64 %86
  store i64 %90, ptr %91, align 8, !tbaa !12
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %92, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @sum, ptr noundef nonnull align 8 dereferenceable(8) %93)
  %95 = load i64, ptr %94, align 8, !tbaa !12
  store i64 %95, ptr @sum, align 8, !tbaa !12
  %indvars.iv.next60 = add nsw i64 %indvars.iv59, -1
  %96 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %indvars.iv.next60
  store i64 %95, ptr %96, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %97 = icmp sgt i64 %indvars.iv59, 1
  br i1 %97, label %.lr.ph49, label %.preheader, !llvm.loop !18

._crit_edge53:                                    ; preds = %.lr.ph52, %._crit_edge.thread, %._crit_edge, %.preheader
  ret i32 0

.lr.ph52:                                         ; preds = %.preheader, %.lr.ph52
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %.lr.ph52 ], [ 1, %.preheader ]
  %98 = getelementptr inbounds [100010 x i64], ptr @ans, i64 0, i64 %indvars.iv62
  %99 = load i64, ptr %98, align 8, !tbaa !12
  %100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %99)
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %101 = load i32, ptr @n, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %.not40.not = icmp slt i64 %indvars.iv62, %102
  br i1 %.not40.not, label %.lr.ph52, label %._crit_edge53, !llvm.loop !19
}

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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 #2 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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}


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