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

; 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 [400020 x i32], align 16
@mx = external dso_local global [200010 x i32], align 16
@used = external dso_local global [400020 x i8], 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 [7 x i8], align 1

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

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

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

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i32, ptr @a, i64 %20
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %21)
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [400020 x i32], ptr @a, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %27, %28
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [400020 x i32], ptr @a, i64 0, i64 %30
  store i32 %26, ptr %31, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %18
  %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 %13, !llvm.loop !9

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

36:                                               ; preds = %170, %35
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %173

41:                                               ; preds = %36
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = srem i32 %42, %43
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  br label %170

47:                                               ; preds = %41
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = mul i64 %49, 4
  call void @llvm.memset.p0.i64(ptr align 16 @mx, i8 0, i64 %50, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %51

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

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

56:                                               ; preds = %51
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = srem i32 %57, %58
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %60
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [400020 x i32], ptr @a, i64 0, i64 %63
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %61, ptr noundef nonnull align 4 dereferenceable(4) %64)
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load i32, ptr %5, align 4, !tbaa !5
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = srem i32 %67, %68
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %70
  store i32 %66, ptr %71, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %56
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %5, align 4, !tbaa !5
  br label %51, !llvm.loop !11

75:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %98, %75
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = load i32, ptr @n, align 4, !tbaa !5
  %79 = shl i32 %78, 1
  %80 = icmp slt i32 %77, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %76
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %101

82:                                               ; preds = %76
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = srem i32 %83, %84
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [400020 x i32], ptr @a, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = icmp eq i32 %88, %92
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [400020 x i8], ptr @used, i64 0, i64 %95
  %97 = zext i1 %93 to i8
  store i8 %97, ptr %96, align 1, !tbaa !12
  br label %98

98:                                               ; preds = %82
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %6, align 4, !tbaa !5
  br label %76, !llvm.loop !14

101:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %165, %101
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = shl i32 %104, 1
  %106 = icmp sle i32 %103, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %102
  store i32 14, ptr %4, align 4
  br label %168

108:                                              ; preds = %102
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [400020 x i8], ptr @used, i64 0, i64 %110
  %112 = load i8, ptr %111, align 1, !tbaa !12, !range !15, !noundef !16
  %113 = trunc i8 %112 to i1
  br i1 %113, label %114, label %117

114:                                              ; preds = %108
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %8, align 4, !tbaa !5
  br label %164

117:                                              ; preds = %108
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = sub nsw i32 %118, %119
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %122 = icmp sge i32 %120, %121
  br i1 %122, label %123, label %124

123:                                              ; preds = %117
  store i32 14, ptr %4, align 4
  br label %168

124:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %125 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %125, ptr %9, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %159, %124
  %127 = load i32, ptr %9, align 4, !tbaa !5
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = icmp sle i32 %127, %128
  br i1 %129, label %130, label %134

130:                                              ; preds = %126
  %131 = load i32, ptr %9, align 4, !tbaa !5
  %132 = load i32, ptr @n, align 4, !tbaa !5
  %133 = icmp slt i32 %131, %132
  br label %134

134:                                              ; preds = %130, %126
  %135 = phi i1 [ false, %126 ], [ %133, %130 ]
  br i1 %135, label %137, label %136

136:                                              ; preds = %134
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %163

137:                                              ; preds = %134
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = load i32, ptr @n, align 4, !tbaa !5
  %140 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %138, i32 noundef %139)
  %141 = load i32, ptr %3, align 4, !tbaa !5
  %142 = icmp eq i32 %140, %141
  br i1 %142, label %143, label %158

143:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %144 = load i32, ptr %8, align 4, !tbaa !5
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = sub nsw i32 %144, %145
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %148 = load i32, ptr @n, align 4, !tbaa !5
  %149 = load i32, ptr %7, align 4, !tbaa !5
  %150 = sub nsw i32 %148, %149
  %151 = load i32, ptr %8, align 4, !tbaa !5
  %152 = add nsw i32 %150, %151
  store i32 %152, ptr %11, align 4, !tbaa !5
  %153 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = load i64, ptr @ans, align 8, !tbaa !17
  %157 = add nsw i64 %156, %155
  store i64 %157, ptr @ans, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %158

158:                                              ; preds = %143, %137
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %3, align 4, !tbaa !5
  %161 = load i32, ptr %9, align 4, !tbaa !5
  %162 = add nsw i32 %161, %160
  store i32 %162, ptr %9, align 4, !tbaa !5
  br label %126, !llvm.loop !19

163:                                              ; preds = %136
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %163, %114
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %7, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %7, align 4, !tbaa !5
  br label %102, !llvm.loop !20

168:                                              ; preds = %123, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %169

169:                                              ; preds = %168
  br label %170

170:                                              ; preds = %169, %46
  %171 = load i32, ptr %3, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %3, align 4, !tbaa !5
  br label %36, !llvm.loop !21

173:                                              ; preds = %40
  %174 = load i64, ptr @ans, align 8, !tbaa !17
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %174)
  ret i32 0
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) #5

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #6 = { 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 = !{!"bool", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !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 [400020 x i32], align 16
@mx = external dso_local global [200010 x i32], align 16
@used = external dso_local local_unnamed_addr global [400020 x i8], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.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 norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %4 = load i32, ptr @n, align 4
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

.preheader53:                                     ; preds = %.lr.ph
  %6 = icmp sgt i32 %10, 1
  br i1 %6, label %.lr.ph69, label %._crit_edge

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

._crit_edge:                                      ; preds = %.loopexit51, %0, %.preheader53
  %17 = load i64, ptr @ans, align 8, !tbaa !11
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %17)
  ret i32 0

.lr.ph69:                                         ; preds = %.preheader53, %.loopexit51
  %19 = phi i32 [ %99, %.loopexit51 ], [ %10, %.preheader53 ]
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.loopexit51 ], [ 1, %.preheader53 ]
  %20 = trunc nuw nsw i64 %indvars.iv81 to i32
  %21 = srem i32 %19, %20
  %.not = icmp eq i32 %21, 0
  br i1 %.not, label %22, label %.loopexit51

22:                                               ; preds = %.lr.ph69
  %23 = shl nuw nsw i64 %indvars.iv81, 2
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @mx, i8 0, i64 %23, i1 false)
  %24 = icmp sgt i32 %19, 0
  br i1 %24, label %.lr.ph56, label %.preheader52

.preheader52:                                     ; preds = %.lr.ph56, %22
  %25 = phi i32 [ %19, %22 ], [ %35, %.lr.ph56 ]
  %26 = shl i32 %25, 1
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph58.preheader, label %.preheader50

.lr.ph58.preheader:                               ; preds = %.preheader52
  %wide.trip.count = zext nneg i32 %26 to i64
  br label %.lr.ph58

.lr.ph56:                                         ; preds = %22, %.lr.ph56
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.lr.ph56 ], [ 0, %22 ]
  %28 = trunc nuw nsw i64 %indvars.iv72 to i32
  %29 = urem i32 %28, %20
  %30 = zext nneg i32 %29 to i64
  %31 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %30
  %32 = getelementptr inbounds [400020 x i32], ptr @a, i64 0, i64 %indvars.iv72
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %31, ptr noundef nonnull align 4 dereferenceable(4) %32)
  %34 = load i32, ptr %33, align 4, !tbaa !5
  store i32 %34, ptr %31, align 4, !tbaa !5
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %35 = load i32, ptr @n, align 4
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next73, %36
  br i1 %37, label %.lr.ph56, label %.preheader52, !llvm.loop !13

.preheader50:                                     ; preds = %.lr.ph58, %.preheader52
  %.mask = and i32 %25, 1073741824
  %.not4861.not = icmp eq i32 %.mask, 0
  br i1 %.not4861.not, label %.lr.ph65, label %.loopexit51

.lr.ph58:                                         ; preds = %.lr.ph58, %.lr.ph58.preheader
  %indvars.iv75 = phi i64 [ 0, %.lr.ph58.preheader ], [ %indvars.iv.next76.1, %.lr.ph58 ]
  %38 = trunc nuw nsw i64 %indvars.iv75 to i32
  %39 = urem i32 %38, %20
  %40 = zext nneg i32 %39 to i64
  %41 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds [400020 x i32], ptr @a, i64 0, i64 %indvars.iv75
  %44 = load i32, ptr %43, align 8, !tbaa !5
  %45 = icmp eq i32 %42, %44
  %46 = getelementptr inbounds [400020 x i8], ptr @used, i64 0, i64 %indvars.iv75
  %47 = zext i1 %45 to i8
  store i8 %47, ptr %46, align 2, !tbaa !14
  %indvars.iv.next76 = or disjoint i64 %indvars.iv75, 1
  %48 = trunc nuw nsw i64 %indvars.iv.next76 to i32
  %49 = urem i32 %48, %20
  %50 = zext nneg i32 %49 to i64
  %51 = getelementptr inbounds [200010 x i32], ptr @mx, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = getelementptr inbounds [400020 x i32], ptr @a, i64 0, i64 %indvars.iv.next76
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp eq i32 %52, %54
  %56 = getelementptr inbounds [400020 x i8], ptr @used, i64 0, i64 %indvars.iv.next76
  %57 = zext i1 %55 to i8
  store i8 %57, ptr %56, align 1, !tbaa !14
  %indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next76.1, %wide.trip.count
  br i1 %exitcond.not.1, label %.preheader50, label %.lr.ph58, !llvm.loop !16

.lr.ph65:                                         ; preds = %.preheader50, %.loopexit
  %58 = phi i32 [ %95, %.loopexit ], [ %25, %.preheader50 ]
  %59 = phi i32 [ %96, %.loopexit ], [ %25, %.preheader50 ]
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.loopexit ], [ 0, %.preheader50 ]
  %.04064 = phi i32 [ %.1, %.loopexit ], [ 0, %.preheader50 ]
  %60 = getelementptr inbounds [400020 x i8], ptr @used, i64 0, i64 %indvars.iv78
  %61 = load i8, ptr %60, align 1, !tbaa !14, !range !17, !noundef !18
  %62 = trunc nuw i8 %61 to i1
  br i1 %62, label %63, label %65

63:                                               ; preds = %.lr.ph65
  %64 = add nsw i32 %.04064, 1
  br label %.loopexit

65:                                               ; preds = %.lr.ph65
  %66 = trunc nuw nsw i64 %indvars.iv78 to i32
  %67 = sub nsw i32 %66, %.04064
  %.not49 = icmp slt i32 %67, %59
  br i1 %.not49, label %.preheader, label %.loopexit51

.preheader:                                       ; preds = %65
  %68 = sext i32 %.04064 to i64
  %69 = icmp sle i64 %indvars.iv81, %68
  %70 = sext i32 %59 to i64
  %71 = icmp slt i64 %indvars.iv81, %70
  %72 = and i1 %69, %71
  br i1 %72, label %.lr.ph60, label %.loopexit

.lr.ph60:                                         ; preds = %.preheader
  %73 = add nuw i32 %.04064, 1
  %74 = sub i32 %.04064, %66
  br label %75

75:                                               ; preds = %.lr.ph60, %89
  %76 = phi i32 [ %59, %.lr.ph60 ], [ %92, %89 ]
  %.059 = phi i32 [ %20, %.lr.ph60 ], [ %90, %89 ]
  %77 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %.059, i32 noundef %76)
  %78 = zext i32 %77 to i64
  %79 = icmp eq i64 %indvars.iv81, %78
  br i1 %79, label %80, label %89

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %81 = sub i32 %73, %.059
  store i32 %81, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %82 = load i32, ptr @n, align 4, !tbaa !5
  %83 = add i32 %74, %82
  store i32 %83, ptr %2, align 4, !tbaa !5
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = load i64, ptr @ans, align 8, !tbaa !11
  %88 = add nsw i64 %87, %86
  store i64 %88, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %89

89:                                               ; preds = %75, %80
  %90 = add nuw nsw i32 %.059, %20
  %91 = icmp sle i32 %90, %.04064
  %92 = load i32, ptr @n, align 4
  %93 = icmp slt i32 %90, %92
  %94 = select i1 %91, i1 %93, i1 false
  br i1 %94, label %75, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %89, %.preheader, %63
  %95 = phi i32 [ %58, %63 ], [ %58, %.preheader ], [ %92, %89 ]
  %96 = phi i32 [ %59, %63 ], [ %59, %.preheader ], [ %92, %89 ]
  %.1 = phi i32 [ %64, %63 ], [ 0, %.preheader ], [ 0, %89 ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %97 = shl i32 %96, 1
  %98 = sext i32 %97 to i64
  %.not48.not = icmp slt i64 %indvars.iv78, %98
  br i1 %.not48.not, label %.lr.ph65, label %.loopexit51, !llvm.loop !20

.loopexit51:                                      ; preds = %65, %.loopexit, %.preheader50, %.lr.ph69
  %99 = phi i32 [ %25, %.preheader50 ], [ %19, %.lr.ph69 ], [ %58, %65 ], [ %95, %.loopexit ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %100 = sext i32 %99 to i64
  %101 = icmp slt i64 %indvars.iv.next82, %100
  br i1 %101, label %.lr.ph69, label %._crit_edge, !llvm.loop !21
}

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) local_unnamed_addr #5

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

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

attributes #0 = { mustprogress norecurse nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 #6 = { 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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}


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