; LLVM IR from tangjz/acm-icpc :: hdu (6076)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [60001 x i32], align 16
@b = external dso_local global [60001 x i32], align 16
@c = external dso_local global [120003 x i32], align 16
@p = external dso_local global [60001 x i32], align 16
@tot = external dso_local global i32, align 4
@que = external dso_local global [21 x i32], 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 [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
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %20

20:                                               ; preds = %189, %0
  %21 = load i32, ptr @t, align 4, !tbaa !5
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr @t, align 4, !tbaa !5
  %23 = icmp ne i32 %21, 0
  br i1 %23, label %24, label %197

24:                                               ; preds = %20
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %36, %24
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr @a, i64 %33
  %35 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %34)
  br label %36

36:                                               ; preds = %31
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !5
  br label %26, !llvm.loop !9

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

40:                                               ; preds = %57, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %60

45:                                               ; preds = %40
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i32, ptr @b, i64 %47
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %48)
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [60001 x i32], ptr @b, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [60001 x i32], ptr @p, i64 0, i64 %55
  store i32 %50, ptr %56, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %45
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %3, align 4, !tbaa !5
  br label %40, !llvm.loop !11

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

61:                                               ; preds = %73, %60
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

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

66:                                               ; preds = %61
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sub nsw i32 %68, %69
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %71
  store i32 %67, ptr %72, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %66
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %4, align 4, !tbaa !5
  br label %61, !llvm.loop !12

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

77:                                               ; preds = %88, %76
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %91

82:                                               ; preds = %77
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = load i32, ptr @n, align 4, !tbaa !5
  %85 = add nsw i32 %83, %84
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %86
  store i32 0, ptr %87, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %82
  %89 = load i32, ptr %5, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %5, align 4, !tbaa !5
  br label %77, !llvm.loop !13

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

92:                                               ; preds = %186, %91
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = icmp sle i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %189

97:                                               ; preds = %92
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [60001 x i32], ptr @a, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr @m, align 4, !tbaa !5
  %103 = sub nsw i32 %101, %102
  store i32 %103, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %105 = load i32, ptr %104, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  store i32 %105, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [60001 x i32], ptr @a, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = load i32, ptr @m, align 4, !tbaa !5
  %111 = add nsw i32 %109, %110
  store i32 %111, ptr %12, align 4, !tbaa !5
  %112 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %113 = load i32, ptr %112, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  store i32 %113, ptr %11, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %128, %97
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = load i32, ptr %11, align 4, !tbaa !5
  %117 = icmp sle i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %131

119:                                              ; preds = %114
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [60001 x i32], ptr @p, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = load i32, ptr @tot, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr @tot, align 4, !tbaa !5
  %126 = sext i32 %124 to i64
  %127 = getelementptr inbounds [21 x i32], ptr @que, i64 0, i64 %126
  store i32 %123, ptr %127, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %119
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %8, align 4, !tbaa !5
  br label %114, !llvm.loop !14

131:                                              ; preds = %118
  %132 = load i32, ptr @tot, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i32, ptr @que, i64 %133
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @que, ptr noundef %134)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %182, %131
  %136 = load i32, ptr %13, align 4, !tbaa !5
  %137 = load i32, ptr @tot, align 4, !tbaa !5
  %138 = icmp slt i32 %136, %137
  br i1 %138, label %140, label %139

139:                                              ; preds = %135
  store i32 22, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %185

140:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %141 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %141, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %142 = load i32, ptr %13, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [21 x i32], ptr @que, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  store i32 %145, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %146 = load i32, ptr %14, align 4, !tbaa !5
  %147 = sub nsw i32 %146, 1
  %148 = load i32, ptr @n, align 4, !tbaa !5
  %149 = add nsw i32 %147, %148
  %150 = load i32, ptr %15, align 4, !tbaa !5
  %151 = sub nsw i32 %149, %150
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = load i32, ptr %14, align 4, !tbaa !5
  %156 = add nsw i32 %154, %155
  %157 = sub nsw i32 %156, 1
  store i32 %157, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %158 = load i32, ptr %14, align 4, !tbaa !5
  %159 = load i32, ptr @n, align 4, !tbaa !5
  %160 = add nsw i32 %158, %159
  %161 = load i32, ptr %15, align 4, !tbaa !5
  %162 = sub nsw i32 %160, %161
  %163 = add nsw i32 %162, 1
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = load i32, ptr %14, align 4, !tbaa !5
  %168 = add nsw i32 %166, %167
  store i32 %168, ptr %18, align 4, !tbaa !5
  %169 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  store i32 %171, ptr %16, align 4, !tbaa !5
  %172 = load i32, ptr %16, align 4, !tbaa !5
  %173 = load i32, ptr %14, align 4, !tbaa !5
  %174 = sub nsw i32 %172, %173
  %175 = load i32, ptr %14, align 4, !tbaa !5
  %176 = load i32, ptr @n, align 4, !tbaa !5
  %177 = add nsw i32 %175, %176
  %178 = load i32, ptr %15, align 4, !tbaa !5
  %179 = sub nsw i32 %177, %178
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %180
  store i32 %174, ptr %181, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %182

182:                                              ; preds = %140
  %183 = load i32, ptr %13, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %13, align 4, !tbaa !5
  br label %135, !llvm.loop !15

185:                                              ; preds = %139
  br label %186

186:                                              ; preds = %185
  %187 = load i32, ptr %6, align 4, !tbaa !5
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %6, align 4, !tbaa !5
  br label %92, !llvm.loop !16

189:                                              ; preds = %96
  %190 = load i32, ptr @n, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = load i32, ptr @n, align 4, !tbaa !5
  %195 = add nsw i32 %193, %194
  %196 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %195)
  br label %20, !llvm.loop !17

197:                                              ; preds = %20
  ret i32 0
}

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

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

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

; Function Attrs: 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)) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #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 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 #4 = { 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 #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}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [60001 x i32], align 16
@b = external dso_local global [60001 x i32], align 16
@c = external dso_local local_unnamed_addr global [120003 x i32], align 16
@p = external dso_local local_unnamed_addr global [60001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [21 x i32], 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 [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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %7 = load i32, ptr @t, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @t, align 4, !tbaa !5
  %.not80 = icmp eq i32 %7, 0
  br i1 %.not80, label %._crit_edge83, label %.lr.ph82

.lr.ph82:                                         ; preds = %0, %._crit_edge78
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %.not4656 = icmp slt i32 %10, 1
  br i1 %.not4656, label %.preheader53, label %.lr.ph

.preheader54:                                     ; preds = %.lr.ph
  %.not4758 = icmp slt i32 %13, 1
  br i1 %.not4758, label %.preheader53, label %.lr.ph60

.lr.ph:                                           ; preds = %.lr.ph82, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph82 ]
  %11 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %.not46.not = icmp slt i64 %indvars.iv, %14
  br i1 %.not46.not, label %.lr.ph, label %.preheader54, !llvm.loop !9

.preheader53:                                     ; preds = %.lr.ph60, %.lr.ph82, %.preheader54
  %15 = phi i32 [ %13, %.preheader54 ], [ %10, %.lr.ph82 ], [ %29, %.lr.ph60 ]
  %.not4861 = icmp slt i32 %15, 0
  br i1 %.not4861, label %.preheader.._crit_edge78_crit_edge, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %.preheader53
  %16 = zext nneg i32 %15 to i64
  %17 = add nuw i32 %15, 1
  %wide.trip.count = zext i32 %17 to i64
  %min.iters.check = icmp ult i32 %15, 7
  br i1 %min.iters.check, label %.lr.ph63.preheader129, label %vector.ph

.lr.ph63.preheader129:                            ; preds = %middle.block, %.lr.ph63.preheader
  %indvars.iv91.ph = phi i64 [ 0, %.lr.ph63.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph63

vector.ph:                                        ; preds = %.lr.ph63.preheader
  %n.vec = and i64 %wide.trip.count, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %18 = sub nsw i64 %16, %index
  %19 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %18
  %20 = getelementptr inbounds i8, ptr %19, i64 -12
  %21 = getelementptr inbounds i8, ptr %19, i64 -28
  %reverse = shufflevector <4 x i32> %vec.ind, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse, ptr %20, align 4, !tbaa !5
  %reverse128 = shufflevector <4 x i32> %step.add, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  store <4 x i32> %reverse128, ptr %21, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %22 = icmp eq i64 %index.next, %n.vec
  br i1 %22, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader52, label %.lr.ph63.preheader129

.lr.ph60:                                         ; preds = %.preheader54, %.lr.ph60
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %.lr.ph60 ], [ 1, %.preheader54 ]
  %23 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv88
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %23)
  %25 = load i32, ptr %23, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [60001 x i32], ptr @p, i64 0, i64 %26
  %28 = trunc nuw nsw i64 %indvars.iv88 to i32
  store i32 %28, ptr %27, align 4, !tbaa !5
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %.not47.not = icmp slt i64 %indvars.iv88, %30
  br i1 %.not47.not, label %.lr.ph60, label %.preheader53, !llvm.loop !14

.preheader52:                                     ; preds = %.lr.ph63, %middle.block
  %.not4964 = icmp eq i32 %15, 0
  br i1 %.not4964, label %.preheader.._crit_edge78_crit_edge, label %.lr.ph77.preheader

.lr.ph63:                                         ; preds = %.lr.ph63.preheader129, %.lr.ph63
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %.lr.ph63 ], [ %indvars.iv91.ph, %.lr.ph63.preheader129 ]
  %31 = sub nsw i64 %16, %indvars.iv91
  %32 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %31
  %33 = trunc nuw nsw i64 %indvars.iv91 to i32
  store i32 %33, ptr %32, align 4, !tbaa !5
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count
  br i1 %exitcond.not, label %.preheader52, label %.lr.ph63, !llvm.loop !15

.preheader.._crit_edge78_crit_edge:               ; preds = %.preheader53, %.preheader52
  %.pre = sext i32 %15 to i64
  br label %._crit_edge78

.lr.ph77.preheader:                               ; preds = %.preheader52
  %34 = zext nneg i32 %15 to i64
  %35 = shl nuw nsw i64 %34, 2
  %scevgep = getelementptr i8, ptr getelementptr inbounds (i8, ptr @c, i64 4), i64 %35
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %35, i1 false), !tbaa !5
  br label %.lr.ph77

._crit_edge78:                                    ; preds = %._crit_edge74, %.preheader.._crit_edge78_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader.._crit_edge78_crit_edge ], [ %75, %._crit_edge74 ]
  %.lcssa55 = phi i32 [ %15, %.preheader.._crit_edge78_crit_edge ], [ %74, %._crit_edge74 ]
  %36 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %.pre-phi
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = add nsw i32 %37, %.lcssa55
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %38)
  %40 = load i32, ptr @t, align 4, !tbaa !5
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %40, 0
  br i1 %.not, label %._crit_edge83, label %.lr.ph82, !llvm.loop !16

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %._crit_edge74
  %indvars.iv110 = phi i64 [ 1, %.lr.ph77.preheader ], [ %69, %._crit_edge74 ]
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %42 = getelementptr inbounds [60001 x i32], ptr @a, i64 0, i64 %indvars.iv110
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = load i32, ptr @m, align 4, !tbaa !5
  %45 = sub nsw i32 %43, %44
  store i32 %45, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %47 = load i32, ptr %46, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %48 = load i32, ptr %42, align 4, !tbaa !5
  %49 = load i32, ptr @m, align 4, !tbaa !5
  %50 = add nsw i32 %49, %48
  store i32 %50, ptr %3, align 4, !tbaa !5
  %51 = 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) @n)
  %52 = load i32, ptr %51, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  %.not5167 = icmp sgt i32 %47, %52
  br i1 %.not5167, label %63, label %.lr.ph69.preheader

.lr.ph69.preheader:                               ; preds = %.lr.ph77
  %53 = sext i32 %tot.promoted to i64
  %54 = shl nsw i64 %53, 2
  %scevgep97 = getelementptr i8, ptr @que, i64 %54
  %55 = sext i32 %47 to i64
  %56 = shl nsw i64 %55, 2
  %scevgep98 = getelementptr i8, ptr @p, i64 %56
  %57 = sub i32 %52, %47
  %58 = zext i32 %57 to i64
  %59 = shl nuw nsw i64 %58, 2
  %60 = add nuw nsw i64 %59, 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %scevgep97, ptr noundef nonnull align 4 dereferenceable(1) %scevgep98, i64 %60, i1 false), !tbaa !5
  %61 = add i32 %tot.promoted, 1
  %62 = add i32 %61, %57
  store i32 %62, ptr @tot, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %.lr.ph69.preheader, %.lr.ph77
  %64 = phi i32 [ %62, %.lr.ph69.preheader ], [ %tot.promoted, %.lr.ph77 ]
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr @que, i64 %65
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @que, ptr noundef nonnull %66)
  %67 = load i32, ptr @tot, align 4, !tbaa !5
  %68 = icmp sgt i32 %67, 0
  %.pre113 = load i32, ptr @n, align 4, !tbaa !5
  %69 = add nuw nsw i64 %indvars.iv110, 1
  br i1 %68, label %.lr.ph73, label %._crit_edge74

.lr.ph73:                                         ; preds = %63
  %70 = trunc nuw nsw i64 %indvars.iv110 to i32
  %71 = trunc i64 %indvars.iv110 to i32
  %72 = add i32 %71, -1
  %73 = trunc nuw i64 %69 to i32
  br label %76

._crit_edge74:                                    ; preds = %76, %63
  %74 = phi i32 [ %.pre113, %63 ], [ %96, %76 ]
  %75 = sext i32 %74 to i64
  %.not50.not = icmp slt i64 %indvars.iv110, %75
  br i1 %.not50.not, label %.lr.ph77, label %._crit_edge78, !llvm.loop !17

76:                                               ; preds = %.lr.ph73, %76
  %77 = phi i32 [ %.pre113, %.lr.ph73 ], [ %96, %76 ]
  %indvars.iv107 = phi i64 [ 0, %.lr.ph73 ], [ %indvars.iv.next108, %76 ]
  %78 = getelementptr inbounds [21 x i32], ptr @que, i64 0, i64 %indvars.iv107
  %79 = load i32, ptr %78, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %80 = xor i32 %79, -1
  %81 = add i32 %70, %80
  %82 = add i32 %81, %77
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = add i32 %72, %85
  store i32 %86, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %87 = sub i32 %73, %79
  %88 = add i32 %87, %77
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %91, %70
  store i32 %92, ptr %5, align 4, !tbaa !5
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %94 = load i32, ptr %93, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %reass.sub = sub i32 %94, %70
  %95 = add i32 %reass.sub, 1
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = sub i32 %70, %79
  %98 = add i32 %97, %96
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [120003 x i32], ptr @c, i64 0, i64 %99
  store i32 %95, ptr %100, align 4, !tbaa !5
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %101 = load i32, ptr @tot, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = icmp slt i64 %indvars.iv.next108, %102
  br i1 %103, label %76, label %._crit_edge74, !llvm.loop !18

._crit_edge83:                                    ; preds = %._crit_edge78, %0
  ret i32 0
}

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

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

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

; Function Attrs: 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 #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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 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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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