; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100554F)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@mx = external dso_local global i32, align 4
@l = external dso_local global [51 x i32], align 16
@r = external dso_local global [51 x i32], align 16
@mu = external dso_local global [50001 x i32], align 16
@f = external dso_local global [51 x [50001 x i32]], align 16
@h = external dso_local global [51 x [50001 x i32]], align 16
@e = external dso_local global [51 x %"class.std::vector"], align 16
@.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 [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3pfsi(i32 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: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %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 %"class.std::vector", align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([50001 x i32], ptr @mu, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %43, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 50001
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %46

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %21, %22
  store i32 %23, ptr %4, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %38, %20
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = icmp slt i32 %25, 50001
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %24
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [50001 x i32], ptr @mu, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [50001 x i32], ptr @mu, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sub nsw i32 %36, %32
  store i32 %37, ptr %35, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %28
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = add nsw i32 %40, %39
  store i32 %41, ptr %4, align 4, !tbaa !5
  br label %24, !llvm.loop !9

42:                                               ; preds = %27
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !11

46:                                               ; preds = %19
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %48

48:                                               ; preds = %189, %46
  %49 = load i32, ptr @t, align 4, !tbaa !5
  %50 = add nsw i32 %49, -1
  store i32 %50, ptr @t, align 4, !tbaa !5
  %51 = icmp ne i32 %49, 0
  br i1 %51, label %52, label %190

52:                                               ; preds = %48
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %64, %52
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %54
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i32, ptr @l, i64 %61
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %62)
  br label %64

64:                                               ; preds = %59
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %5, align 4, !tbaa !5
  br label %54, !llvm.loop !12

67:                                               ; preds = %58
  store i32 0, ptr @mx, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %90, %67
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %93

73:                                               ; preds = %68
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr @r, i64 %75
  %77 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %76)
  %78 = load i32, ptr @mx, align 4, !tbaa !5
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [51 x i32], ptr @r, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp slt i32 %78, %82
  br i1 %83, label %84, label %89

84:                                               ; preds = %73
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [51 x i32], ptr @r, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  store i32 %88, ptr @mx, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %84, %73
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %6, align 4, !tbaa !5
  br label %68, !llvm.loop !13

93:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %103, %93
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = icmp sle i32 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %106

99:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #6
  call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [51 x %"class.std::vector"], ptr @e, i64 0, i64 %101
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %102) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #6
  br label %103

103:                                              ; preds = %99
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %7, align 4, !tbaa !5
  br label %94, !llvm.loop !14

106:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  br label %107

107:                                              ; preds = %120, %106
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = icmp slt i32 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %123

112:                                              ; preds = %107
  %113 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %10, ptr noundef %11)
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [51 x %"class.std::vector"], ptr @e, i64 0, i64 %115
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %116, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %117 = load i32, ptr %11, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [51 x %"class.std::vector"], ptr @e, i64 0, i64 %118
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %119, ptr noundef nonnull align 4 dereferenceable(4) %10)
  br label %120

120:                                              ; preds = %112
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %9, align 4, !tbaa !5
  br label %107, !llvm.loop !15

123:                                              ; preds = %111
  call void @_Z3pfsi(i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %124 = load i32, ptr getelementptr inbounds ([51 x i32], ptr @l, i64 0, i64 1), align 4, !tbaa !5
  store i32 %124, ptr %12, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %134, %123
  %126 = load i32, ptr %12, align 4, !tbaa !5
  %127 = load i32, ptr getelementptr inbounds ([51 x i32], ptr @r, i64 0, i64 1), align 4, !tbaa !5
  %128 = icmp sle i32 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %137

130:                                              ; preds = %125
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([51 x [50001 x i32]], ptr @h, i64 0, i64 1), i64 0, i64 %132
  store i32 1, ptr %133, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %130
  %135 = load i32, ptr %12, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %12, align 4, !tbaa !5
  br label %125, !llvm.loop !16

137:                                              ; preds = %129
  call void @_Z3dfsi(i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %186, %137
  %139 = load i32, ptr %13, align 4, !tbaa !5
  %140 = load i32, ptr @n, align 4, !tbaa !5
  %141 = icmp sle i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 25, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %189

143:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %144 = load i32, ptr %13, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [51 x i32], ptr @l, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  store i32 %147, ptr %15, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %173, %143
  %149 = load i32, ptr %15, align 4, !tbaa !5
  %150 = load i32, ptr %13, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [51 x i32], ptr @r, i64 0, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = icmp sle i32 %149, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %148
  store i32 28, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %176

156:                                              ; preds = %148
  %157 = load i32, ptr %14, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = load i32, ptr %15, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = load i32, ptr %13, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [51 x [50001 x i32]], ptr @f, i64 0, i64 %162
  %164 = load i32, ptr %15, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [50001 x i32], ptr %163, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = mul nsw i64 %160, %168
  %170 = add nsw i64 %158, %169
  %171 = srem i64 %170, 1000000007
  %172 = trunc i64 %171 to i32
  store i32 %172, ptr %14, align 4, !tbaa !5
  br label %173

173:                                              ; preds = %156
  %174 = load i32, ptr %15, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %15, align 4, !tbaa !5
  br label %148, !llvm.loop !17

176:                                              ; preds = %155
  %177 = load i32, ptr %14, align 4, !tbaa !5
  %178 = load i32, ptr %13, align 4, !tbaa !5
  %179 = load i32, ptr @n, align 4, !tbaa !5
  %180 = icmp eq i32 %178, %179
  %181 = zext i1 %180 to i64
  %182 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %181
  %183 = load i8, ptr %182, align 1, !tbaa !18
  %184 = sext i8 %183 to i32
  %185 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %177, i32 noundef %184)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %186

186:                                              ; preds = %176
  %187 = load i32, ptr %13, align 4, !tbaa !5
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %13, align 4, !tbaa !5
  br label %138, !llvm.loop !19

189:                                              ; preds = %142
  br label %48, !llvm.loop !20

190:                                              ; preds = %48
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

declare i32 @printf(ptr noundef, ...) #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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { "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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@mx = external dso_local local_unnamed_addr global i32, align 4
@l = external dso_local global [51 x i32], align 16
@r = external dso_local global [51 x i32], align 16
@mu = external dso_local local_unnamed_addr global [50001 x i32], align 16
@f = external dso_local local_unnamed_addr global [51 x [50001 x i32]], align 16
@h = external dso_local local_unnamed_addr global [51 x [50001 x i32]], align 16
@e = external dso_local global [51 x %"class.std::vector"], align 16
@.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 [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3pfsi(i32 noundef) 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: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 1, ptr getelementptr inbounds (i8, ptr @mu, i64 4), align 4, !tbaa !5
  br label %8

4:                                                ; preds = %._crit_edge
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %6 = load i32, ptr @t, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @t, align 4, !tbaa !5
  %.not87 = icmp eq i32 %6, 0
  br i1 %.not87, label %._crit_edge90, label %.lr.ph89

8:                                                ; preds = %0, %._crit_edge
  %indvars.iv91 = phi i64 [ 1, %0 ], [ %indvars.iv.next92, %._crit_edge ]
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next, %._crit_edge ]
  %9 = icmp ult i64 %indvars.iv91, 25001
  br i1 %9, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8
  %10 = getelementptr inbounds [50001 x i32], ptr @mu, i64 0, i64 %indvars.iv91
  br label %11

._crit_edge:                                      ; preds = %11, %8
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not = icmp eq i64 %indvars.iv.next92, 50001
  br i1 %exitcond.not, label %4, label %8, !llvm.loop !9

11:                                               ; preds = %.lr.ph, %11
  %indvars.iv93 = phi i64 [ %indvars.iv, %.lr.ph ], [ %indvars.iv.next94, %11 ]
  %12 = load i32, ptr %10, align 4, !tbaa !5
  %13 = getelementptr inbounds [50001 x i32], ptr @mu, i64 0, i64 %indvars.iv93
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = sub nsw i32 %14, %12
  store i32 %15, ptr %13, align 4, !tbaa !5
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, %indvars.iv91
  %16 = icmp ult i64 %indvars.iv.next94, 50001
  br i1 %16, label %11, label %._crit_edge, !llvm.loop !11

.loopexit:                                        ; preds = %._crit_edge82, %._crit_edge76
  %17 = load i32, ptr @t, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %._crit_edge90, label %.lr.ph89, !llvm.loop !12

.lr.ph89:                                         ; preds = %4, %.loopexit
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %.not4755 = icmp slt i32 %20, 1
  br i1 %.not4755, label %._crit_edge59.thread, label %.lr.ph58

._crit_edge59.thread:                             ; preds = %.lr.ph89
  store i32 0, ptr @mx, align 4, !tbaa !5
  br label %._crit_edge67.thread

._crit_edge59:                                    ; preds = %.lr.ph58
  store i32 0, ptr @mx, align 4, !tbaa !5
  %.not4860 = icmp slt i32 %23, 1
  br i1 %.not4860, label %._crit_edge67.thread, label %.lr.ph63

.lr.ph58:                                         ; preds = %.lr.ph89, %.lr.ph58
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.lr.ph58 ], [ 1, %.lr.ph89 ]
  %21 = getelementptr inbounds i32, ptr @l, i64 %indvars.iv97
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %21)
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %.not47.not = icmp slt i64 %indvars.iv97, %24
  br i1 %.not47.not, label %.lr.ph58, label %._crit_edge59, !llvm.loop !13

.preheader:                                       ; preds = %31
  %.not4964 = icmp slt i32 %32, 1
  br i1 %.not4964, label %._crit_edge67.thread, label %.lr.ph66

.lr.ph63:                                         ; preds = %._crit_edge59, %31
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %31 ], [ 1, %._crit_edge59 ]
  %25 = getelementptr inbounds i32, ptr @r, i64 %indvars.iv100
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %25)
  %27 = load i32, ptr @mx, align 4, !tbaa !5
  %28 = load i32, ptr %25, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %.lr.ph63
  store i32 %28, ptr @mx, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %.lr.ph63, %30
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %.not48.not = icmp slt i64 %indvars.iv100, %33
  br i1 %.not48.not, label %.lr.ph63, label %.preheader, !llvm.loop !14

._crit_edge67.thread:                             ; preds = %.preheader, %._crit_edge59, %._crit_edge59.thread
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  br label %._crit_edge71

._crit_edge67:                                    ; preds = %.lr.ph66
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %34 = icmp sgt i32 %36, 1
  br i1 %34, label %.lr.ph70, label %._crit_edge71

.lr.ph66:                                         ; preds = %.preheader, %.lr.ph66
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %.lr.ph66 ], [ 1, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %35 = getelementptr inbounds [51 x %"class.std::vector"], ptr @e, i64 0, i64 %indvars.iv103
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %35) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #6
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %.not49.not = icmp slt i64 %indvars.iv103, %37
  br i1 %.not49.not, label %.lr.ph66, label %._crit_edge67, !llvm.loop !15

._crit_edge71:                                    ; preds = %.lr.ph70, %._crit_edge67.thread, %._crit_edge67
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @_Z3pfsi(i32 noundef 1)
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @l, i64 4), align 4, !tbaa !5
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @r, i64 4), align 4, !tbaa !5
  %.not5072 = icmp sgt i32 %38, %39
  br i1 %.not5072, label %._crit_edge76, label %.lr.ph75.preheader

.lr.ph75.preheader:                               ; preds = %._crit_edge71
  %40 = sext i32 %38 to i64
  %41 = add i32 %39, 1
  %42 = sub i32 %39, %38
  %43 = zext i32 %42 to i64
  %44 = add nuw nsw i64 %43, 1
  %min.iters.check = icmp ult i32 %42, 7
  br i1 %min.iters.check, label %.lr.ph75.preheader127, label %vector.ph

.lr.ph75.preheader127:                            ; preds = %middle.block, %.lr.ph75.preheader
  %indvars.iv106.ph = phi i64 [ %40, %.lr.ph75.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph75

vector.ph:                                        ; preds = %.lr.ph75.preheader
  %n.vec = and i64 %44, 8589934584
  %ind.end = add nsw i64 %n.vec, %40
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %40
  %45 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @h, i64 200004), i64 0, i64 %offset.idx
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %45, align 4, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %46, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %47 = icmp eq i64 %index.next, %n.vec
  br i1 %47, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %44, %n.vec
  br i1 %cmp.n, label %._crit_edge76, label %.lr.ph75.preheader127

.lr.ph70:                                         ; preds = %._crit_edge67, %.lr.ph70
  %.04068 = phi i32 [ %55, %.lr.ph70 ], [ 1, %._crit_edge67 ]
  %48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [51 x %"class.std::vector"], ptr @e, i64 0, i64 %50
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [51 x %"class.std::vector"], ptr @e, i64 0, i64 %53
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %54, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %55 = add nuw nsw i32 %.04068, 1
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %.lr.ph70, label %._crit_edge71, !llvm.loop !19

._crit_edge76:                                    ; preds = %.lr.ph75, %middle.block, %._crit_edge71
  call void @_Z3dfsi(i32 noundef 1)
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %.not5183 = icmp slt i32 %58, 1
  br i1 %.not5183, label %.loopexit, label %.lr.ph86

.lr.ph75:                                         ; preds = %.lr.ph75.preheader127, %.lr.ph75
  %indvars.iv106 = phi i64 [ %indvars.iv.next107, %.lr.ph75 ], [ %indvars.iv106.ph, %.lr.ph75.preheader127 ]
  %59 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @h, i64 200004), i64 0, i64 %indvars.iv106
  store i32 1, ptr %59, align 4, !tbaa !5
  %indvars.iv.next107 = add nsw i64 %indvars.iv106, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next107 to i32
  %exitcond109.not = icmp eq i32 %41, %lftr.wideiv
  br i1 %exitcond109.not, label %._crit_edge76, label %.lr.ph75, !llvm.loop !20

.lr.ph86:                                         ; preds = %._crit_edge76, %._crit_edge82
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %._crit_edge82 ], [ 1, %._crit_edge76 ]
  %60 = phi i32 [ %83, %._crit_edge82 ], [ %58, %._crit_edge76 ]
  %61 = getelementptr inbounds [51 x i32], ptr @l, i64 0, i64 %indvars.iv115
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = getelementptr inbounds [51 x i32], ptr @r, i64 0, i64 %indvars.iv115
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %.not5277 = icmp sgt i32 %62, %64
  br i1 %.not5277, label %._crit_edge82, label %.lr.ph81.preheader

.lr.ph81.preheader:                               ; preds = %.lr.ph86
  %65 = sext i32 %62 to i64
  %66 = add i32 %64, 1
  %67 = sub i32 %66, %62
  %xtraiter = and i32 %67, 1
  %68 = icmp eq i32 %64, %62
  br i1 %68, label %._crit_edge82.loopexit.unr-lcssa, label %.lr.ph81.preheader.new

.lr.ph81.preheader.new:                           ; preds = %.lr.ph81.preheader
  %unroll_iter = and i32 %67, -2
  br label %.lr.ph81

._crit_edge82.loopexit.unr-lcssa:                 ; preds = %.lr.ph81, %.lr.ph81.preheader
  %.lcssa130.ph = phi i64 [ poison, %.lr.ph81.preheader ], [ %96, %.lr.ph81 ]
  %indvars.iv110.unr = phi i64 [ %65, %.lr.ph81.preheader ], [ %indvars.iv.next111.1, %.lr.ph81 ]
  %.03778.unr = phi i64 [ 0, %.lr.ph81.preheader ], [ %96, %.lr.ph81 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge82.loopexit, label %.lr.ph81.epil

.lr.ph81.epil:                                    ; preds = %._crit_edge82.loopexit.unr-lcssa
  %69 = getelementptr inbounds [51 x [50001 x i32]], ptr @f, i64 0, i64 %indvars.iv115, i64 %indvars.iv110.unr
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = mul nsw i64 %indvars.iv110.unr, %71
  %73 = add nsw i64 %72, %.03778.unr
  %74 = srem i64 %73, 1000000007
  br label %._crit_edge82.loopexit

._crit_edge82.loopexit:                           ; preds = %._crit_edge82.loopexit.unr-lcssa, %.lr.ph81.epil
  %.lcssa130 = phi i64 [ %.lcssa130.ph, %._crit_edge82.loopexit.unr-lcssa ], [ %74, %.lr.ph81.epil ]
  %75 = trunc nsw i64 %.lcssa130 to i32
  br label %._crit_edge82

._crit_edge82:                                    ; preds = %._crit_edge82.loopexit, %.lr.ph86
  %.037.lcssa = phi i32 [ 0, %.lr.ph86 ], [ %75, %._crit_edge82.loopexit ]
  %76 = zext i32 %60 to i64
  %77 = icmp eq i64 %indvars.iv115, %76
  %78 = zext i1 %77 to i64
  %79 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %78
  %80 = load i8, ptr %79, align 1, !tbaa !21
  %81 = sext i8 %80 to i32
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.037.lcssa, i32 noundef %81)
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %.not51.not = icmp slt i64 %indvars.iv115, %84
  br i1 %.not51.not, label %.lr.ph86, label %.loopexit, !llvm.loop !22

.lr.ph81:                                         ; preds = %.lr.ph81, %.lr.ph81.preheader.new
  %indvars.iv110 = phi i64 [ %65, %.lr.ph81.preheader.new ], [ %indvars.iv.next111.1, %.lr.ph81 ]
  %.03778 = phi i64 [ 0, %.lr.ph81.preheader.new ], [ %96, %.lr.ph81 ]
  %niter = phi i32 [ 0, %.lr.ph81.preheader.new ], [ %niter.next.1, %.lr.ph81 ]
  %85 = getelementptr inbounds [51 x [50001 x i32]], ptr @f, i64 0, i64 %indvars.iv115, i64 %indvars.iv110
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = mul nsw i64 %indvars.iv110, %87
  %89 = add nsw i64 %88, %.03778
  %90 = srem i64 %89, 1000000007
  %indvars.iv.next111 = add nsw i64 %indvars.iv110, 1
  %91 = getelementptr inbounds [51 x [50001 x i32]], ptr @f, i64 0, i64 %indvars.iv115, i64 %indvars.iv.next111
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = mul nsw i64 %indvars.iv.next111, %93
  %95 = add nsw i64 %94, %90
  %96 = srem i64 %95, 1000000007
  %indvars.iv.next111.1 = add nsw i64 %indvars.iv110, 2
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge82.loopexit.unr-lcssa, label %.lr.ph81, !llvm.loop !23

._crit_edge90:                                    ; preds = %.loopexit, %4
  ret i32 0
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 #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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !18, !17}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}


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