; LLVM IR from tangjz/acm-icpc :: lydsy (5455)

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

@tot = external dso_local global i32, align 4
@pr = external dso_local global [1221 x i32], align 16
@d = external dso_local global [5000001 x i32], align 16
@mu = external dso_local global [5000001 x i32], align 16
@e = external dso_local global [5000001 x i32], align 16
@f = external dso_local global [5000001 x i32], align 16
@g = external dso_local global [5000001 x i32], align 16
@t = external dso_local global i32, align 4
@nLim = external dso_local global i32, align 4
@seq = external dso_local global [10001 x i64], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1Fx(i64 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1Gx(i64 noundef) #0

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

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

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

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i64, ptr @seq, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %25)
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10001 x i64], ptr @seq, i64 0, i64 %28
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i64, ptr %30, align 8, !tbaa !9
  store i64 %31, ptr @ans, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %22
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !11

35:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store i64 5000001, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %36 = load i64, ptr @ans, align 8, !tbaa !9
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr %4, align 8, !tbaa !9
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = trunc i64 %39 to i32
  store i32 %40, ptr @nLim, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  store i32 1, ptr getelementptr inbounds ([5000001 x i32], ptr @g, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([5000001 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([5000001 x i32], ptr @mu, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([5000001 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %174, %35
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = load i32, ptr @nLim, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %177

46:                                               ; preds = %41
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [5000001 x i32], ptr @d, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %70, label %52

52:                                               ; preds = %46
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [5000001 x i32], ptr @d, i64 0, i64 %55
  store i32 %53, ptr %56, align 4, !tbaa !5
  %57 = load i32, ptr @tot, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr @tot, align 4, !tbaa !5
  %59 = sext i32 %57 to i64
  %60 = getelementptr inbounds [1221 x i32], ptr @pr, i64 0, i64 %59
  store i32 %53, ptr %60, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %62
  store i32 -1, ptr %63, align 4, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %65
  store i32 1, ptr %66, align 4, !tbaa !5
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %68
  store i32 2, ptr %69, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %52, %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  br label %71

71:                                               ; preds = %144, %70
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1221 x i32], ptr @pr, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = mul nsw i32 %72, %76
  store i32 %77, ptr %8, align 4, !tbaa !5
  %78 = load i32, ptr @nLim, align 4, !tbaa !5
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %71
  store i32 8, ptr %6, align 4
  br label %147

81:                                               ; preds = %71
  %82 = load i32, ptr %7, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1221 x i32], ptr @pr, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [5000001 x i32], ptr @d, i64 0, i64 %87
  store i32 %85, ptr %88, align 4, !tbaa !5
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [5000001 x i32], ptr @d, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1221 x i32], ptr @pr, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp eq i32 %92, %96
  br i1 %97, label %98, label %124

98:                                               ; preds = %81
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %105
  store i32 %103, ptr %106, align 4, !tbaa !5
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %5, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sdiv i32 %114, %118
  %120 = add nsw i32 %110, %119
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %122
  store i32 %120, ptr %123, align 4, !tbaa !5
  store i32 8, ptr %6, align 4
  br label %147

124:                                              ; preds = %81
  %125 = load i32, ptr %5, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = sub nsw i32 0, %128
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %131
  store i32 %129, ptr %132, align 4, !tbaa !5
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %134
  store i32 1, ptr %135, align 4, !tbaa !5
  %136 = load i32, ptr %5, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = shl i32 %139, 1
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %142
  store i32 %140, ptr %143, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %124
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %7, align 4, !tbaa !5
  br label %71, !llvm.loop !13

147:                                              ; preds = %98, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %5, align 4, !tbaa !5
  %150 = sub nsw i32 %149, 1
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = load i32, ptr %5, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = add nsw i32 %157, %153
  store i32 %158, ptr %156, align 4, !tbaa !5
  %159 = load i32, ptr %5, align 4, !tbaa !5
  %160 = sub nsw i32 %159, 1
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [5000001 x i32], ptr @g, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = load i32, ptr %5, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = icmp ne i32 %167, 0
  %169 = zext i1 %168 to i32
  %170 = add nsw i32 %163, %169
  %171 = load i32, ptr %5, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [5000001 x i32], ptr @g, i64 0, i64 %172
  store i32 %170, ptr %173, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %148
  %175 = load i32, ptr %5, align 4, !tbaa !5
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %5, align 4, !tbaa !5
  br label %41, !llvm.loop !14

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

178:                                              ; preds = %219, %177
  %179 = load i32, ptr %9, align 4, !tbaa !5
  %180 = load i32, ptr @t, align 4, !tbaa !5
  %181 = icmp slt i32 %179, %180
  br i1 %181, label %183, label %182

182:                                              ; preds = %178
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %222

183:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %184 = load i32, ptr %9, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [10001 x i64], ptr @seq, i64 0, i64 %185
  store ptr %186, ptr %10, align 8, !tbaa !15
  store i64 0, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 0, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  br label %187

187:                                              ; preds = %213, %183
  %188 = load i64, ptr %11, align 8, !tbaa !9
  %189 = load ptr, ptr %10, align 8, !tbaa !15
  %190 = load i64, ptr %189, align 8, !tbaa !9
  %191 = icmp slt i64 %188, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %187
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %216

193:                                              ; preds = %187
  %194 = load ptr, ptr %10, align 8, !tbaa !15
  %195 = load i64, ptr %194, align 8, !tbaa !9
  %196 = load i64, ptr %11, align 8, !tbaa !9
  %197 = add nsw i64 %196, 1
  %198 = sdiv i64 %195, %197
  store i64 %198, ptr %13, align 8, !tbaa !9
  %199 = load ptr, ptr %10, align 8, !tbaa !15
  %200 = load i64, ptr %199, align 8, !tbaa !9
  %201 = load i64, ptr %13, align 8, !tbaa !9
  %202 = sdiv i64 %200, %201
  store i64 %202, ptr %12, align 8, !tbaa !9
  %203 = load i64, ptr %12, align 8, !tbaa !9
  %204 = call noundef i64 @_Z1Fx(i64 noundef %203)
  store i64 %204, ptr %15, align 8, !tbaa !9
  %205 = load i64, ptr %15, align 8, !tbaa !9
  %206 = load i64, ptr %14, align 8, !tbaa !9
  %207 = sub nsw i64 %205, %206
  %208 = load i64, ptr %13, align 8, !tbaa !9
  %209 = call noundef i64 @_Z1Gx(i64 noundef %208)
  %210 = mul nsw i64 %207, %209
  %211 = load i64, ptr @ans, align 8, !tbaa !9
  %212 = add nsw i64 %211, %210
  store i64 %212, ptr @ans, align 8, !tbaa !9
  br label %213

213:                                              ; preds = %193
  %214 = load i64, ptr %12, align 8, !tbaa !9
  store i64 %214, ptr %11, align 8, !tbaa !9
  %215 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %215, ptr %14, align 8, !tbaa !9
  br label %187, !llvm.loop !17

216:                                              ; preds = %192
  %217 = load i64, ptr @ans, align 8, !tbaa !9
  %218 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %217)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %219

219:                                              ; preds = %216
  %220 = load i32, ptr %9, align 4, !tbaa !5
  %221 = add nsw i32 %220, 1
  store i32 %221, ptr %9, align 4, !tbaa !5
  br label %178, !llvm.loop !18

222:                                              ; preds = %182
  ret i32 0
}

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

; 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)) #4

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@tot = external dso_local local_unnamed_addr global i32, align 4
@pr = external dso_local local_unnamed_addr global [1221 x i32], align 16
@d = external dso_local local_unnamed_addr global [5000001 x i32], align 16
@mu = external dso_local local_unnamed_addr global [5000001 x i32], align 16
@e = external dso_local local_unnamed_addr global [5000001 x i32], align 16
@f = external dso_local local_unnamed_addr global [5000001 x i32], align 16
@g = external dso_local local_unnamed_addr global [5000001 x i32], align 16
@t = external dso_local global i32, align 4
@nLim = external dso_local local_unnamed_addr global i32, align 4
@seq = external dso_local global [10001 x i64], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1Fx(i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z1Gx(i64 noundef) local_unnamed_addr #0

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

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = load i64, ptr @ans, align 8, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %6 = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %15, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  store i64 5000001, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %7 = add nsw i64 %6, 1
  store i64 %7, ptr %2, align 8, !tbaa !9
  %8 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = trunc i64 %9 to i32
  store i32 %10, ptr @nLim, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  store i32 1, ptr getelementptr inbounds (i8, ptr @g, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @mu, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @d, i64 4), align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 2
  br i1 %11, label %.lr.ph62.preheader, label %.preheader

.lr.ph62.preheader:                               ; preds = %._crit_edge
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  %wide.trip.count = and i64 %9, 2147483647
  br label %.lr.ph62

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds i64, ptr @seq, i64 %indvars.iv
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %12)
  %14 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %15 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %15, ptr @ans, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @t, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %.loopexit, %._crit_edge
  %19 = load i32, ptr @t, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph69, label %._crit_edge70

.lr.ph62:                                         ; preds = %.lr.ph62.preheader, %.loopexit
  %21 = phi i32 [ 1, %.lr.ph62.preheader ], [ %76, %.loopexit ]
  %indvars.iv77 = phi i64 [ 2, %.lr.ph62.preheader ], [ %indvars.iv.next78, %.loopexit ]
  %22 = phi i32 [ %tot.promoted, %.lr.ph62.preheader ], [ %33, %.loopexit ]
  %23 = getelementptr inbounds [5000001 x i32], ptr @d, i64 0, i64 %indvars.iv77
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %.not = icmp eq i32 %24, 0
  %25 = trunc nuw nsw i64 %indvars.iv77 to i32
  br i1 %.not, label %26, label %.lr.ph62._crit_edge

26:                                               ; preds = %.lr.ph62
  store i32 %25, ptr %23, align 4, !tbaa !5
  %27 = add nsw i32 %22, 1
  store i32 %27, ptr @tot, align 4, !tbaa !5
  %28 = sext i32 %22 to i64
  %29 = getelementptr inbounds [1221 x i32], ptr @pr, i64 0, i64 %28
  store i32 %25, ptr %29, align 4, !tbaa !5
  %30 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %indvars.iv77
  store i32 -1, ptr %30, align 4, !tbaa !5
  %31 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %indvars.iv77
  store i32 1, ptr %31, align 4, !tbaa !5
  %32 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %indvars.iv77
  store i32 2, ptr %32, align 4, !tbaa !5
  br label %.lr.ph62._crit_edge

.lr.ph62._crit_edge:                              ; preds = %.lr.ph62, %26
  %33 = phi i32 [ %27, %26 ], [ %22, %.lr.ph62 ]
  %34 = load i32, ptr @pr, align 16, !tbaa !5
  %35 = mul nsw i32 %34, %25
  %36 = icmp slt i32 %35, %10
  br i1 %36, label %.lr.ph59, label %.loopexit

.lr.ph59:                                         ; preds = %.lr.ph62._crit_edge
  %37 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %indvars.iv77
  %38 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %indvars.iv77
  br label %39

39:                                               ; preds = %.lr.ph59, %55
  %indvars.iv74 = phi i64 [ 0, %.lr.ph59 ], [ %indvars.iv.next75, %55 ]
  %40 = phi i32 [ %35, %.lr.ph59 ], [ %64, %55 ]
  %41 = phi i32 [ %34, %.lr.ph59 ], [ %63, %55 ]
  %42 = sext i32 %40 to i64
  %43 = getelementptr inbounds [5000001 x i32], ptr @d, i64 0, i64 %42
  store i32 %41, ptr %43, align 4, !tbaa !5
  %44 = load i32, ptr %23, align 4, !tbaa !5
  %45 = icmp eq i32 %44, %41
  %46 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %42
  br i1 %45, label %47, label %55

47:                                               ; preds = %39
  %48 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %indvars.iv77
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  %51 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %42
  store i32 %50, ptr %51, align 4, !tbaa !5
  %52 = load i32, ptr %38, align 4, !tbaa !5
  %53 = sdiv i32 %52, %50
  %54 = add nsw i32 %53, %52
  store i32 %54, ptr %46, align 4, !tbaa !5
  br label %.loopexit

55:                                               ; preds = %39
  %56 = load i32, ptr %37, align 4, !tbaa !5
  %57 = sub nsw i32 0, %56
  %58 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %42
  store i32 %57, ptr %58, align 4, !tbaa !5
  %59 = getelementptr inbounds [5000001 x i32], ptr @e, i64 0, i64 %42
  store i32 1, ptr %59, align 4, !tbaa !5
  %60 = load i32, ptr %38, align 4, !tbaa !5
  %61 = shl i32 %60, 1
  store i32 %61, ptr %46, align 4, !tbaa !5
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %62 = getelementptr inbounds [1221 x i32], ptr @pr, i64 0, i64 %indvars.iv.next75
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = mul nsw i32 %63, %25
  %65 = icmp slt i32 %64, %10
  br i1 %65, label %39, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %55, %.lr.ph62._crit_edge, %47
  %66 = add nsw i64 %indvars.iv77, -1
  %67 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = getelementptr inbounds [5000001 x i32], ptr @f, i64 0, i64 %indvars.iv77
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, %68
  store i32 %71, ptr %69, align 4, !tbaa !5
  %72 = getelementptr inbounds [5000001 x i32], ptr @mu, i64 0, i64 %indvars.iv77
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp ne i32 %73, 0
  %75 = zext i1 %74 to i32
  %76 = add nuw nsw i32 %21, %75
  %77 = getelementptr inbounds [5000001 x i32], ptr @g, i64 0, i64 %indvars.iv77
  store i32 %76, ptr %77, align 4, !tbaa !5
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph62, !llvm.loop !14

._crit_edge70:                                    ; preds = %._crit_edge67, %.preheader
  ret i32 0

.lr.ph69:                                         ; preds = %.preheader, %._crit_edge67
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %._crit_edge67 ], [ 0, %.preheader ]
  %78 = getelementptr inbounds [10001 x i64], ptr @seq, i64 0, i64 %indvars.iv80
  store i64 0, ptr @ans, align 8, !tbaa !9
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = icmp sgt i64 %79, 0
  br i1 %80, label %.lr.ph66, label %._crit_edge67

._crit_edge67:                                    ; preds = %.lr.ph66, %.lr.ph69
  %storemerge.lcssa = phi i64 [ 0, %.lr.ph69 ], [ %94, %.lr.ph66 ]
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %storemerge.lcssa)
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %82 = load i32, ptr @t, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = icmp slt i64 %indvars.iv.next81, %83
  br i1 %84, label %.lr.ph69, label %._crit_edge70, !llvm.loop !15

.lr.ph66:                                         ; preds = %.lr.ph69, %.lr.ph66
  %85 = phi i64 [ %95, %.lr.ph66 ], [ %79, %.lr.ph69 ]
  %.04964 = phi i64 [ %89, %.lr.ph66 ], [ 0, %.lr.ph69 ]
  %.05163 = phi i64 [ %88, %.lr.ph66 ], [ 0, %.lr.ph69 ]
  %86 = add nuw nsw i64 %.05163, 1
  %87 = udiv i64 %85, %86
  %88 = sdiv i64 %85, %87
  %89 = call noundef i64 @_Z1Fx(i64 noundef %88)
  %90 = sub nsw i64 %89, %.04964
  %91 = call noundef i64 @_Z1Gx(i64 noundef %87)
  %92 = mul nsw i64 %90, %91
  %93 = load i64, ptr @ans, align 8, !tbaa !9
  %94 = add nsw i64 %93, %92
  store i64 %94, ptr @ans, align 8, !tbaa !9
  %95 = load i64, ptr %78, align 8, !tbaa !9
  %96 = icmp slt i64 %88, %95
  br i1 %96, label %.lr.ph66, label %._crit_edge67, !llvm.loop !16
}

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

; 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 #4

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

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

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


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