; LLVM IR from tangjz/acm-icpc :: codeforces/complete (946G)

; 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 [200001 x i32], align 16
@f = external dso_local global [200001 x i32], align 16
@mx = external dso_local global i32, align 4
@g = external dso_local global [200001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr @a, i64 %21
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %22)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %24 = load i32, ptr @mx, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr @g, i64 %25
  %27 = getelementptr inbounds i32, ptr %26, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sub nsw i32 %31, %32
  store i32 %33, ptr %4, align 4, !tbaa !5
  %34 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @g, i64 1), ptr noundef %27, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %35 = ptrtoint ptr %34 to i64
  %36 = sub i64 %35, ptrtoint (ptr @g to i64)
  %37 = sdiv exact i64 %36, 4
  %38 = trunc i64 %37 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  store i32 %38, ptr %3, align 4, !tbaa !5
  %39 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %40 = load i32, ptr %39, align 4, !tbaa !5
  store i32 %40, ptr @mx, align 4, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [200001 x i32], ptr @f, i64 0, i64 %43
  store i32 %41, ptr %44, align 4, !tbaa !5
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sub nsw i32 %48, %49
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [200001 x i32], ptr @g, i64 0, i64 %52
  store i32 %50, ptr %53, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %54

54:                                               ; preds = %19
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !9

57:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = load i32, ptr @mx, align 4, !tbaa !5
  %61 = sub nsw i32 %59, %60
  store i32 %61, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  store i32 %63, ptr %5, align 4, !tbaa !5
  store i32 0, ptr @mx, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %64, ptr %8, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %131, %57
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = icmp sgt i32 %66, 1
  br i1 %67, label %69, label %68

68:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %134

69:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %70 = load i32, ptr @mx, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr @g, i64 %71
  %73 = getelementptr inbounds i32, ptr %72, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = sub nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = sub nsw i32 0, %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = add nsw i32 %79, %80
  %82 = sub nsw i32 %81, 1
  store i32 %82, ptr %10, align 4, !tbaa !5
  %83 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @g, i64 1), ptr noundef %73, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %84 = ptrtoint ptr %83 to i64
  %85 = sub i64 %84, ptrtoint (ptr @g to i64)
  %86 = sdiv exact i64 %85, 4
  %87 = trunc i64 %86 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  store i32 %87, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %88 = load i32, ptr @n, align 4, !tbaa !5
  %89 = sub nsw i32 %88, 1
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sub nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [200001 x i32], ptr @f, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = add nsw i32 %94, %95
  %97 = sub nsw i32 %96, 1
  %98 = sub nsw i32 %89, %97
  store i32 %98, ptr %11, align 4, !tbaa !5
  %99 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %100 = load i32, ptr %99, align 4, !tbaa !5
  store i32 %100, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %101 = load i32, ptr @mx, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr @g, i64 %102
  %104 = getelementptr inbounds i32, ptr %103, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sub nsw i32 0, %108
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = add nsw i32 %109, %110
  %112 = sub nsw i32 %111, 1
  store i32 %112, ptr %12, align 4, !tbaa !5
  %113 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @g, i64 1), ptr noundef %104, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %114 = ptrtoint ptr %113 to i64
  %115 = sub i64 %114, ptrtoint (ptr @g to i64)
  %116 = sdiv exact i64 %115, 4
  %117 = trunc i64 %116 to i32
  store i32 %117, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %118 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %119 = load i32, ptr %118, align 4, !tbaa !5
  store i32 %119, ptr @mx, align 4, !tbaa !5
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sub nsw i32 0, %123
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = add nsw i32 %124, %125
  %127 = sub nsw i32 %126, 1
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [200001 x i32], ptr @g, i64 0, i64 %129
  store i32 %127, ptr %130, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %131

131:                                              ; preds = %69
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = add nsw i32 %132, -1
  store i32 %133, ptr %8, align 4, !tbaa !5
  br label %65, !llvm.loop !11

134:                                              ; preds = %68
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %135)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local 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: 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !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 [200001 x i32], align 16
@f = external dso_local local_unnamed_addr global [200001 x i32], align 16
@mx = external dso_local global i32, align 4
@g = external dso_local global [200001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %.not20 = icmp slt i32 %11, 1
  br i1 %.not20, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = load i32, ptr @mx, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %12 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %33, %.lr.ph ]
  %.lcssa = phi i32 [ %11, %.._crit_edge_crit_edge ], [ %40, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %13 = xor i32 %12, -1
  %14 = add i32 %.lcssa, %13
  store i32 %14, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %16 = load i32, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  store i32 %16, ptr %3, align 4, !tbaa !5
  store i32 0, ptr @mx, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph26.preheader, label %._crit_edge27

.lr.ph26.preheader:                               ; preds = %._crit_edge
  %19 = zext nneg i32 %17 to i64
  br label %.lr.ph26

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %20 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %20)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %22 = load i32, ptr @mx, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @g, i64 4), i64 %23
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %24 = load i32, ptr %20, align 4, !tbaa !5
  %25 = trunc nuw nsw i64 %indvars.iv to i32
  %26 = sub nsw i32 %24, %25
  store i32 %26, ptr %2, align 4, !tbaa !5
  %27 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 4), ptr noundef nonnull %gep, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %28 = ptrtoint ptr %27 to i64
  %29 = sub i64 %28, ptrtoint (ptr @g to i64)
  %30 = lshr exact i64 %29, 2
  %31 = trunc i64 %30 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  store i32 %31, ptr %1, align 4, !tbaa !5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %33, ptr @mx, align 4, !tbaa !5
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = getelementptr inbounds [200001 x i32], ptr @f, i64 0, i64 %indvars.iv
  store i32 %34, ptr %35, align 4, !tbaa !5
  %36 = load i32, ptr %20, align 4, !tbaa !5
  %37 = sub nsw i32 %36, %25
  %38 = sext i32 %34 to i64
  %39 = getelementptr inbounds [200001 x i32], ptr @g, i64 0, i64 %38
  store i32 %37, ptr %39, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %.not.not = icmp slt i64 %indvars.iv, %41
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge27.loopexit:                           ; preds = %.lr.ph26
  %.pre33 = load i32, ptr %3, align 4, !tbaa !5
  br label %._crit_edge27

._crit_edge27:                                    ; preds = %._crit_edge27.loopexit, %._crit_edge
  %42 = phi i32 [ %.pre33, %._crit_edge27.loopexit ], [ %16, %._crit_edge ]
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %42)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret i32 0

.lr.ph26:                                         ; preds = %.lr.ph26.preheader, %.lr.ph26
  %44 = phi i32 [ 0, %.lr.ph26.preheader ], [ %75, %.lr.ph26 ]
  %indvars.iv30 = phi i64 [ %19, %.lr.ph26.preheader ], [ %indvars.iv.next31, %.lr.ph26 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %45 = sext i32 %44 to i64
  %gep22 = getelementptr i32, ptr getelementptr inbounds (i8, ptr @g, i64 4), i64 %45
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %indvars.iv.next31 = add nsw i64 %indvars.iv30, -1
  %46 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %indvars.iv.next31
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = xor i32 %47, -1
  %49 = trunc nuw nsw i64 %indvars.iv30 to i32
  %50 = add i32 %49, %48
  store i32 %50, ptr %7, align 4, !tbaa !5
  %51 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 4), ptr noundef nonnull %gep22, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %52 = ptrtoint ptr %51 to i64
  %53 = sub i64 %52, ptrtoint (ptr @g to i64)
  %54 = lshr exact i64 %53, 2
  %55 = trunc i64 %54 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  store i32 %55, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = getelementptr inbounds [200001 x i32], ptr @f, i64 0, i64 %indvars.iv.next31
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add i32 %58, %55
  %60 = sub i32 %56, %59
  store i32 %60, ptr %8, align 4, !tbaa !5
  %61 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %62 = load i32, ptr %61, align 4, !tbaa !5
  store i32 %62, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  %63 = load i32, ptr @mx, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %gep23 = getelementptr i32, ptr getelementptr inbounds (i8, ptr @g, i64 4), i64 %64
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  %65 = getelementptr inbounds [200001 x i32], ptr @a, i64 0, i64 %indvars.iv30
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = xor i32 %66, -1
  %68 = add i32 %49, %67
  store i32 %68, ptr %9, align 4, !tbaa !5
  %69 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @g, i64 4), ptr noundef nonnull %gep23, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %70 = ptrtoint ptr %69 to i64
  %71 = sub i64 %70, ptrtoint (ptr @g to i64)
  %72 = lshr exact i64 %71, 2
  %73 = trunc i64 %72 to i32
  store i32 %73, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mx, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %75 = load i32, ptr %74, align 4, !tbaa !5
  store i32 %75, ptr @mx, align 4, !tbaa !5
  %76 = load i32, ptr %65, align 4, !tbaa !5
  %77 = xor i32 %76, -1
  %78 = add i32 %49, %77
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [200001 x i32], ptr @g, i64 0, i64 %80
  store i32 %78, ptr %81, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %82 = icmp ugt i64 %indvars.iv30, 2
  br i1 %82, label %.lr.ph26, label %._crit_edge27.loopexit, !llvm.loop !11
}

; 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: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local 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: 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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