; LLVM IR from upupming/algorithm :: acwing/算法竞赛进阶指南/0x18-总结与练习/160. 匹配统计 (main)

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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@ans = external dso_local global [200010 x i32], align 16
@f = external dso_local global [200010 x i64], align 16
@p = external dso_local global [200010 x i64], align 16
@g = external dso_local global [200010 x i64], align 16
@a = external dso_local global [200010 x i8], align 16
@b = external dso_local global [200010 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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
  store i32 0, ptr %1, align 4
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) @q)
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef getelementptr inbounds (i8, ptr @a, i64 1))
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef getelementptr inbounds (i8, ptr @b, i64 1))
  store i64 1, ptr @p, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %45, %0
  %14 = load i32, ptr %2, align 4, !tbaa !9
  %15 = load i32, ptr @n, align 4, !tbaa !9
  %16 = icmp sle 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 %48

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !9
  %20 = sub nsw i32 %19, 1
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [200010 x i64], ptr @f, i64 0, i64 %21
  %23 = load i64, ptr %22, align 8, !tbaa !5
  %24 = mul i64 %23, 131
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [200010 x i8], ptr @a, i64 0, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !11
  %29 = sext i8 %28 to i64
  %30 = add i64 %24, %29
  %31 = sub i64 %30, 48
  %32 = add i64 %31, 1
  %33 = load i32, ptr %2, align 4, !tbaa !9
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [200010 x i64], ptr @f, i64 0, i64 %34
  store i64 %32, ptr %35, align 8, !tbaa !5
  %36 = load i32, ptr %2, align 4, !tbaa !9
  %37 = sub nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = mul i64 %40, 131
  %42 = load i32, ptr %2, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %43
  store i64 %41, ptr %44, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %18
  %46 = load i32, ptr %2, align 4, !tbaa !9
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %2, align 4, !tbaa !9
  br label %13, !llvm.loop !12

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

49:                                               ; preds = %81, %48
  %50 = load i32, ptr %3, align 4, !tbaa !9
  %51 = load i32, ptr @m, align 4, !tbaa !9
  %52 = icmp sle i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %84

54:                                               ; preds = %49
  %55 = load i32, ptr %3, align 4, !tbaa !9
  %56 = sub nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [200010 x i64], ptr @g, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = mul i64 %59, 131
  %61 = load i32, ptr %3, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [200010 x i8], ptr @b, i64 0, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !11
  %65 = sext i8 %64 to i64
  %66 = add i64 %60, %65
  %67 = sub i64 %66, 48
  %68 = add i64 %67, 1
  %69 = load i32, ptr %3, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [200010 x i64], ptr @g, i64 0, i64 %70
  store i64 %68, ptr %71, align 8, !tbaa !5
  %72 = load i32, ptr %3, align 4, !tbaa !9
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !5
  %77 = mul i64 %76, 131
  %78 = load i32, ptr %3, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %79
  store i64 %77, ptr %80, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %54
  %82 = load i32, ptr %3, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %3, align 4, !tbaa !9
  br label %49, !llvm.loop !14

84:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %85

85:                                               ; preds = %122, %84
  %86 = load i32, ptr %4, align 4, !tbaa !9
  %87 = load i32, ptr @n, align 4, !tbaa !9
  %88 = icmp sle i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %125

90:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %91 = load i32, ptr %4, align 4, !tbaa !9
  %92 = sub nsw i32 %91, 1
  store i32 %92, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %93 = load i32, ptr @n, align 4, !tbaa !9
  store i32 %93, ptr %6, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %112, %90
  %95 = load i32, ptr %5, align 4, !tbaa !9
  %96 = load i32, ptr %6, align 4, !tbaa !9
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %98, label %113

98:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %99 = load i32, ptr %5, align 4, !tbaa !9
  %100 = load i32, ptr %6, align 4, !tbaa !9
  %101 = add nsw i32 %99, %100
  %102 = add nsw i32 %101, 1
  %103 = ashr i32 %102, 1
  store i32 %103, ptr %7, align 4, !tbaa !9
  %104 = load i32, ptr %4, align 4, !tbaa !9
  %105 = load i32, ptr %7, align 4, !tbaa !9
  %106 = call noundef zeroext i1 @_Z5validii(i32 noundef %104, i32 noundef %105)
  br i1 %106, label %107, label %109

107:                                              ; preds = %98
  %108 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %108, ptr %5, align 4, !tbaa !9
  br label %112

109:                                              ; preds = %98
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = sub nsw i32 %110, 1
  store i32 %111, ptr %6, align 4, !tbaa !9
  br label %112

112:                                              ; preds = %109, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %94, !llvm.loop !15

113:                                              ; preds = %94
  %114 = load i32, ptr %5, align 4, !tbaa !9
  %115 = load i32, ptr %4, align 4, !tbaa !9
  %116 = sub nsw i32 %114, %115
  %117 = add nsw i32 %116, 1
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !9
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %119, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %122

122:                                              ; preds = %113
  %123 = load i32, ptr %4, align 4, !tbaa !9
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %4, align 4, !tbaa !9
  br label %85, !llvm.loop !16

125:                                              ; preds = %89
  br label %126

126:                                              ; preds = %130, %125
  %127 = load i32, ptr @q, align 4, !tbaa !9
  %128 = add nsw i32 %127, -1
  store i32 %128, ptr @q, align 4, !tbaa !9
  %129 = icmp ne i32 %127, 0
  br i1 %129, label %130, label %138

130:                                              ; preds = %126
  %131 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %132 = load i32, ptr @x, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !9
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %135)
  %137 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %136, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %126, !llvm.loop !17

138:                                              ; preds = %126
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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 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 #2 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@ans = external dso_local local_unnamed_addr global [200010 x i32], align 16
@f = external dso_local local_unnamed_addr global [200010 x i64], align 16
@p = external dso_local local_unnamed_addr global [200010 x i64], align 16
@g = external dso_local local_unnamed_addr global [200010 x i64], align 16
@a = external dso_local global [200010 x i8], align 16
@b = external dso_local global [200010 x i8], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @q)
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 1))
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @b, i64 1))
  store i64 1, ptr @p, align 16, !tbaa !5
  %6 = load i32, ptr @n, align 4, !tbaa !9
  %.not38 = icmp slt i32 %6, 1
  br i1 %.not38, label %.preheader37, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %0
  %.pre = load i64, ptr @f, align 16, !tbaa !5
  %7 = zext nneg i32 %6 to i64
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i32 %6, 1
  br i1 %8, label %.preheader37.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %7, 2147483646
  br label %.lr.ph

.preheader37.loopexit.unr-lcssa.loopexit:         ; preds = %.lr.ph
  %9 = mul i64 %21, 2248091
  br label %.preheader37.loopexit.unr-lcssa

.preheader37.loopexit.unr-lcssa:                  ; preds = %.preheader37.loopexit.unr-lcssa.loopexit, %.lr.ph.preheader
  %.unr = phi i64 [ 131, %.lr.ph.preheader ], [ %9, %.preheader37.loopexit.unr-lcssa.loopexit ]
  %.unr60 = phi i64 [ %.pre, %.lr.ph.preheader ], [ %37, %.preheader37.loopexit.unr-lcssa.loopexit ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.preheader37.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader37, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader37.loopexit.unr-lcssa
  %10 = mul i64 %.unr60, 131
  %11 = getelementptr inbounds [200010 x i8], ptr @a, i64 0, i64 %indvars.iv.unr
  %12 = load i8, ptr %11, align 1, !tbaa !11
  %13 = sext i8 %12 to i64
  %14 = add i64 %10, -47
  %15 = add i64 %14, %13
  %16 = getelementptr inbounds [200010 x i64], ptr @f, i64 0, i64 %indvars.iv.unr
  store i64 %15, ptr %16, align 8, !tbaa !5
  %17 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %indvars.iv.unr
  store i64 %.unr, ptr %17, align 8, !tbaa !5
  br label %.preheader37

.preheader37:                                     ; preds = %.lr.ph.epil, %.preheader37.loopexit.unr-lcssa, %0
  %18 = load i32, ptr @m, align 4, !tbaa !9
  %.not3340 = icmp slt i32 %18, 1
  br i1 %.not3340, label %.preheader36, label %.lr.ph42.preheader

.lr.ph42.preheader:                               ; preds = %.preheader37
  %.pre58 = load i64, ptr @g, align 16, !tbaa !5
  %19 = zext nneg i32 %18 to i64
  %xtraiter61 = and i64 %19, 1
  %20 = icmp eq i32 %18, 1
  br i1 %20, label %.preheader36.loopexit.unr-lcssa, label %.lr.ph42.preheader.new

.lr.ph42.preheader.new:                           ; preds = %.lr.ph42.preheader
  %unroll_iter65 = and i64 %19, 2147483646
  br label %.lr.ph42

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %21 = phi i64 [ 1, %.lr.ph.preheader.new ], [ %39, %.lr.ph ]
  %22 = phi i64 [ %.pre, %.lr.ph.preheader.new ], [ %37, %.lr.ph ]
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %23 = mul i64 %22, 131
  %24 = getelementptr inbounds [200010 x i8], ptr @a, i64 0, i64 %indvars.iv
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = sext i8 %25 to i64
  %27 = add i64 %23, -47
  %28 = add i64 %27, %26
  %29 = getelementptr inbounds [200010 x i64], ptr @f, i64 0, i64 %indvars.iv
  store i64 %28, ptr %29, align 8, !tbaa !5
  %30 = mul i64 %21, 131
  %31 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %indvars.iv
  store i64 %30, ptr %31, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = mul i64 %28, 131
  %33 = getelementptr inbounds [200010 x i8], ptr @a, i64 0, i64 %indvars.iv.next
  %34 = load i8, ptr %33, align 1, !tbaa !11
  %35 = sext i8 %34 to i64
  %36 = add i64 %32, -47
  %37 = add i64 %36, %35
  %38 = getelementptr inbounds [200010 x i64], ptr @f, i64 0, i64 %indvars.iv.next
  store i64 %37, ptr %38, align 8, !tbaa !5
  %39 = mul i64 %21, 17161
  %40 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %indvars.iv.next
  store i64 %39, ptr %40, align 8, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader37.loopexit.unr-lcssa.loopexit, label %.lr.ph, !llvm.loop !12

.preheader36.loopexit.unr-lcssa.loopexit:         ; preds = %.lr.ph42
  %41 = mul i64 %50, 2248091
  br label %.preheader36.loopexit.unr-lcssa

.preheader36.loopexit.unr-lcssa:                  ; preds = %.preheader36.loopexit.unr-lcssa.loopexit, %.lr.ph42.preheader
  %.unr62 = phi i64 [ 131, %.lr.ph42.preheader ], [ %41, %.preheader36.loopexit.unr-lcssa.loopexit ]
  %.unr63 = phi i64 [ %.pre58, %.lr.ph42.preheader ], [ %66, %.preheader36.loopexit.unr-lcssa.loopexit ]
  %indvars.iv53.unr = phi i64 [ 1, %.lr.ph42.preheader ], [ %indvars.iv.next54.1, %.preheader36.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod64.not = icmp eq i64 %xtraiter61, 0
  br i1 %lcmp.mod64.not, label %.preheader36, label %.lr.ph42.epil

.lr.ph42.epil:                                    ; preds = %.preheader36.loopexit.unr-lcssa
  %42 = mul i64 %.unr63, 131
  %43 = getelementptr inbounds [200010 x i8], ptr @b, i64 0, i64 %indvars.iv53.unr
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = sext i8 %44 to i64
  %46 = add i64 %42, -47
  %47 = add i64 %46, %45
  %48 = getelementptr inbounds [200010 x i64], ptr @g, i64 0, i64 %indvars.iv53.unr
  store i64 %47, ptr %48, align 8, !tbaa !5
  %49 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %indvars.iv53.unr
  store i64 %.unr62, ptr %49, align 8, !tbaa !5
  br label %.preheader36

.preheader36:                                     ; preds = %.lr.ph42.epil, %.preheader36.loopexit.unr-lcssa, %.preheader37
  br i1 %.not38, label %.preheader, label %.lr.ph48

.lr.ph42:                                         ; preds = %.lr.ph42, %.lr.ph42.preheader.new
  %50 = phi i64 [ 1, %.lr.ph42.preheader.new ], [ %68, %.lr.ph42 ]
  %51 = phi i64 [ %.pre58, %.lr.ph42.preheader.new ], [ %66, %.lr.ph42 ]
  %indvars.iv53 = phi i64 [ 1, %.lr.ph42.preheader.new ], [ %indvars.iv.next54.1, %.lr.ph42 ]
  %niter66 = phi i64 [ 0, %.lr.ph42.preheader.new ], [ %niter66.next.1, %.lr.ph42 ]
  %52 = mul i64 %51, 131
  %53 = getelementptr inbounds [200010 x i8], ptr @b, i64 0, i64 %indvars.iv53
  %54 = load i8, ptr %53, align 1, !tbaa !11
  %55 = sext i8 %54 to i64
  %56 = add i64 %52, -47
  %57 = add i64 %56, %55
  %58 = getelementptr inbounds [200010 x i64], ptr @g, i64 0, i64 %indvars.iv53
  store i64 %57, ptr %58, align 8, !tbaa !5
  %59 = mul i64 %50, 131
  %60 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %indvars.iv53
  store i64 %59, ptr %60, align 8, !tbaa !5
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %61 = mul i64 %57, 131
  %62 = getelementptr inbounds [200010 x i8], ptr @b, i64 0, i64 %indvars.iv.next54
  %63 = load i8, ptr %62, align 1, !tbaa !11
  %64 = sext i8 %63 to i64
  %65 = add i64 %61, -47
  %66 = add i64 %65, %64
  %67 = getelementptr inbounds [200010 x i64], ptr @g, i64 0, i64 %indvars.iv.next54
  store i64 %66, ptr %67, align 8, !tbaa !5
  %68 = mul i64 %50, 17161
  %69 = getelementptr inbounds [200010 x i64], ptr @p, i64 0, i64 %indvars.iv.next54
  store i64 %68, ptr %69, align 8, !tbaa !5
  %indvars.iv.next54.1 = add nuw nsw i64 %indvars.iv53, 2
  %niter66.next.1 = add i64 %niter66, 2
  %niter66.ncmp.1 = icmp eq i64 %niter66.next.1, %unroll_iter65
  br i1 %niter66.ncmp.1, label %.preheader36.loopexit.unr-lcssa.loopexit, label %.lr.ph42, !llvm.loop !14

.preheader:                                       ; preds = %._crit_edge, %.preheader36
  %70 = load i32, ptr @q, align 4, !tbaa !9
  %71 = add nsw i32 %70, -1
  store i32 %71, ptr @q, align 4, !tbaa !9
  %.not3549 = icmp eq i32 %70, 0
  br i1 %.not3549, label %._crit_edge51, label %.lr.ph50

.lr.ph48:                                         ; preds = %.preheader36, %._crit_edge
  %72 = phi i32 [ %80, %._crit_edge ], [ %6, %.preheader36 ]
  %.03047 = phi i32 [ %86, %._crit_edge ], [ 1, %.preheader36 ]
  %73 = add nsw i32 %.03047, -1
  %.not = icmp sgt i32 %.03047, %72
  br i1 %.not, label %._crit_edge, label %.lr.ph45

.lr.ph45:                                         ; preds = %.lr.ph48, %.lr.ph45
  %.02744 = phi i32 [ %.1, %.lr.ph45 ], [ %72, %.lr.ph48 ]
  %.02843 = phi i32 [ %.129, %.lr.ph45 ], [ %73, %.lr.ph48 ]
  %74 = add nsw i32 %.02843, 1
  %75 = add i32 %74, %.02744
  %76 = ashr i32 %75, 1
  %77 = tail call noundef zeroext i1 @_Z5validii(i32 noundef %.03047, i32 noundef %76)
  %78 = add nsw i32 %76, -1
  %.129 = select i1 %77, i32 %76, i32 %.02843
  %.1 = select i1 %77, i32 %.02744, i32 %78
  %79 = icmp slt i32 %.129, %.1
  br i1 %79, label %.lr.ph45, label %._crit_edge.loopexit, !llvm.loop !15

._crit_edge.loopexit:                             ; preds = %.lr.ph45
  %.pre59 = load i32, ptr @n, align 4, !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph48
  %80 = phi i32 [ %72, %.lr.ph48 ], [ %.pre59, %._crit_edge.loopexit ]
  %.028.lcssa = phi i32 [ %73, %.lr.ph48 ], [ %.129, %._crit_edge.loopexit ]
  %reass.sub = sub i32 %.028.lcssa, %.03047
  %81 = add i32 %reass.sub, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %83, align 4, !tbaa !9
  %86 = add nuw nsw i32 %.03047, 1
  %.not34.not = icmp slt i32 %.03047, %80
  br i1 %.not34.not, label %.lr.ph48, label %.preheader, !llvm.loop !16

.lr.ph50:                                         ; preds = %.preheader, %.lr.ph50
  %87 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @x)
  %88 = load i32, ptr @x, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [200010 x i32], ptr @ans, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %91)
  %93 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %92, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %94 = load i32, ptr @q, align 4, !tbaa !9
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr @q, align 4, !tbaa !9
  %.not35 = icmp eq i32 %94, 0
  br i1 %.not35, label %._crit_edge51, label %.lr.ph50, !llvm.loop !17

._crit_edge51:                                    ; preds = %.lr.ph50, %.preheader
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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 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 #2 = { "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 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 = { 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" }

!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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


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