; LLVM IR from tangjz/acm-icpc :: TDL_training/2016-03-27 (B - Bishops - lzy)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@c = external dso_local global [2000018 x i32], align 16
@d = external dso_local global [2000018 x i32], align 16
@e = external dso_local global [2000018 x i32], align 16
@f = external dso_local global [2000018 x i32], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 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 ptr, align 8
  %14 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  br label %16

16:                                               ; preds = %20, %0
  %17 = load i32, ptr @m, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr @m, align 4, !tbaa !5
  %19 = icmp ne i32 %17, 0
  br i1 %19, label %20, label %36

20:                                               ; preds = %16
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x, ptr noundef @y)
  %22 = load i32, ptr @x, align 4, !tbaa !5
  %23 = load i32, ptr @y, align 4, !tbaa !5
  %24 = add nsw i32 %22, %23
  %25 = load i32, ptr @a, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @a, align 4, !tbaa !5
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds [2000018 x i32], ptr @c, i64 0, i64 %27
  store i32 %24, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr @x, align 4, !tbaa !5
  %30 = load i32, ptr @y, align 4, !tbaa !5
  %31 = sub nsw i32 %29, %30
  %32 = load i32, ptr @b, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr @b, align 4, !tbaa !5
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds [2000018 x i32], ptr @d, i64 0, i64 %34
  store i32 %31, ptr %35, align 4, !tbaa !5
  br label %16, !llvm.loop !9

36:                                               ; preds = %16
  %37 = load i32, ptr @a, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr @c, i64 %38
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @c, ptr noundef %39)
  %40 = load i32, ptr @a, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i32, ptr @c, i64 %41
  %43 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @c, ptr noundef %42)
  %44 = ptrtoint ptr %43 to i64
  %45 = sub i64 %44, ptrtoint (ptr @c to i64)
  %46 = sdiv exact i64 %45, 4
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr @a, align 4, !tbaa !5
  %48 = load i32, ptr @b, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr @d, i64 %49
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @d, ptr noundef %50)
  %51 = load i32, ptr @b, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr @d, i64 %52
  %54 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @d, ptr noundef %53)
  %55 = ptrtoint ptr %54 to i64
  %56 = sub i64 %55, ptrtoint (ptr @d to i64)
  %57 = sdiv exact i64 %56, 4
  %58 = trunc i64 %57 to i32
  store i32 %58, ptr @b, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %83, %36
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = load i32, ptr @a, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

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

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [2000018 x i32], ptr @c, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  store i32 %68, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = sub nsw i32 %69, 1
  store i32 %70, ptr %4, align 4, !tbaa !5
  %71 = 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) @n)
  %72 = load i32, ptr %71, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %75 = sub nsw i32 %73, %74
  store i32 %75, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = sub nsw i32 %72, %77
  %79 = add nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = load i64, ptr @ans, align 8, !tbaa !11
  %82 = add nsw i64 %81, %80
  store i64 %82, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %83

83:                                               ; preds = %64
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %2, align 4, !tbaa !5
  br label %59, !llvm.loop !13

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

87:                                               ; preds = %127, %86
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = load i32, ptr @b, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

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

92:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2000018 x i32], ptr @d, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  store i32 %96, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = add nsw i32 %97, %98
  store i32 %99, ptr %9, align 4, !tbaa !5
  %100 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %101 = load i32, ptr %100, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = add nsw i32 1, %102
  store i32 %103, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  %104 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sub nsw i32 %101, %105
  %107 = add nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  %109 = load i64, ptr @ans, align 8, !tbaa !11
  %110 = add nsw i64 %109, %108
  store i64 %110, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = and i32 %111, 1
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %120

114:                                              ; preds = %92
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = load i32, ptr @p, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr @p, align 4, !tbaa !5
  %118 = sext i32 %116 to i64
  %119 = getelementptr inbounds [2000018 x i32], ptr @e, i64 0, i64 %118
  store i32 %115, ptr %119, align 4, !tbaa !5
  br label %126

120:                                              ; preds = %92
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = load i32, ptr @q, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr @q, align 4, !tbaa !5
  %124 = sext i32 %122 to i64
  %125 = getelementptr inbounds [2000018 x i32], ptr @f, i64 0, i64 %124
  store i32 %121, ptr %125, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %120, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %7, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %7, align 4, !tbaa !5
  br label %87, !llvm.loop !14

130:                                              ; preds = %91
  br label %131

131:                                              ; preds = %180, %130
  %132 = load i32, ptr @a, align 4, !tbaa !5
  %133 = add nsw i32 %132, -1
  store i32 %133, ptr @a, align 4, !tbaa !5
  %134 = icmp ne i32 %132, 0
  br i1 %134, label %135, label %189

135:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %136 = load i32, ptr @a, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [2000018 x i32], ptr @c, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  store i32 %139, ptr %12, align 4, !tbaa !5
  %140 = load i32, ptr %12, align 4, !tbaa !5
  %141 = load i32, ptr @n, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  %143 = icmp sle i32 %140, %142
  br i1 %143, label %144, label %149

144:                                              ; preds = %135
  %145 = load i32, ptr %12, align 4, !tbaa !5
  %146 = sub nsw i32 2, %145
  store i32 %146, ptr @s, align 4, !tbaa !5
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = sub nsw i32 %147, 2
  store i32 %148, ptr @t, align 4, !tbaa !5
  br label %158

149:                                              ; preds = %135
  %150 = load i32, ptr %12, align 4, !tbaa !5
  %151 = load i32, ptr @n, align 4, !tbaa !5
  %152 = mul nsw i32 2, %151
  %153 = sub nsw i32 %150, %152
  store i32 %153, ptr @s, align 4, !tbaa !5
  %154 = load i32, ptr @n, align 4, !tbaa !5
  %155 = mul nsw i32 2, %154
  %156 = load i32, ptr %12, align 4, !tbaa !5
  %157 = sub nsw i32 %155, %156
  store i32 %157, ptr @t, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %149, %144
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %159 = load i32, ptr %12, align 4, !tbaa !5
  %160 = and i32 %159, 1
  %161 = icmp ne i32 %160, 0
  br i1 %161, label %162, label %171

162:                                              ; preds = %158
  %163 = load i32, ptr @p, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds i32, ptr @e, i64 %164
  %166 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @e, ptr noundef %165, ptr noundef nonnull align 4 dereferenceable(4) @s)
  store ptr %166, ptr %13, align 8, !tbaa !15
  %167 = load i32, ptr @p, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds i32, ptr @e, i64 %168
  %170 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef @e, ptr noundef %169, ptr noundef nonnull align 4 dereferenceable(4) @t)
  store ptr %170, ptr %14, align 8, !tbaa !15
  br label %180

171:                                              ; preds = %158
  %172 = load i32, ptr @q, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds i32, ptr @f, i64 %173
  %175 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @f, ptr noundef %174, ptr noundef nonnull align 4 dereferenceable(4) @s)
  store ptr %175, ptr %13, align 8, !tbaa !15
  %176 = load i32, ptr @q, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds i32, ptr @f, i64 %177
  %179 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef @f, ptr noundef %178, ptr noundef nonnull align 4 dereferenceable(4) @t)
  store ptr %179, ptr %14, align 8, !tbaa !15
  br label %180

180:                                              ; preds = %171, %162
  %181 = load ptr, ptr %14, align 8, !tbaa !15
  %182 = load ptr, ptr %13, align 8, !tbaa !15
  %183 = ptrtoint ptr %181 to i64
  %184 = ptrtoint ptr %182 to i64
  %185 = sub i64 %183, %184
  %186 = sdiv exact i64 %185, 4
  %187 = load i64, ptr @ans, align 8, !tbaa !11
  %188 = sub nsw i64 %187, %186
  store i64 %188, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %131, !llvm.loop !17

189:                                              ; preds = %131
  %190 = load i32, ptr @n, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = load i32, ptr @n, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = mul nsw i64 %191, %193
  %195 = load i64, ptr @ans, align 8, !tbaa !11
  %196 = sub nsw i64 %194, %195
  %197 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %196)
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

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

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

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

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 = { 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!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"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local local_unnamed_addr global i32, align 4
@q = external dso_local local_unnamed_addr global i32, align 4
@c = external dso_local global [2000018 x i32], align 16
@d = external dso_local global [2000018 x i32], align 16
@e = external dso_local global [2000018 x i32], align 16
@f = external dso_local global [2000018 x i32], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr @m, align 4, !tbaa !5
  %.not30 = icmp eq i32 %8, 0
  br i1 %.not30, label %.._crit_edge_crit_edge, label %.lr.ph

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

.lr.ph:                                           ; preds = %0, %.lr.ph
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x, ptr noundef nonnull @y)
  %11 = load i32, ptr @x, align 4, !tbaa !5
  %12 = load i32, ptr @y, align 4, !tbaa !5
  %13 = add nsw i32 %12, %11
  %14 = load i32, ptr @a, align 4, !tbaa !5
  %15 = add nsw i32 %14, 1
  store i32 %15, ptr @a, align 4, !tbaa !5
  %16 = sext i32 %14 to i64
  %17 = getelementptr inbounds [2000018 x i32], ptr @c, i64 0, i64 %16
  store i32 %13, ptr %17, align 4, !tbaa !5
  %18 = sub nsw i32 %11, %12
  %19 = load i32, ptr @b, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr @b, align 4, !tbaa !5
  %21 = sext i32 %19 to i64
  %22 = getelementptr inbounds [2000018 x i32], ptr @d, i64 0, i64 %21
  store i32 %18, ptr %22, align 4, !tbaa !5
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %25 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %15, %.lr.ph ]
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr @c, i64 %26
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @c, ptr noundef nonnull %27)
  %28 = load i32, ptr @a, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr @c, i64 %29
  %31 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @c, ptr noundef nonnull %30)
  %32 = ptrtoint ptr %31 to i64
  %33 = sub i64 %32, ptrtoint (ptr @c to i64)
  %34 = lshr exact i64 %33, 2
  %35 = trunc i64 %34 to i32
  store i32 %35, ptr @a, align 4, !tbaa !5
  %36 = load i32, ptr @b, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr @d, i64 %37
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @d, ptr noundef nonnull %38)
  %39 = load i32, ptr @b, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr @d, i64 %40
  %42 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @d, ptr noundef nonnull %41)
  %43 = ptrtoint ptr %42 to i64
  %44 = sub i64 %43, ptrtoint (ptr @d to i64)
  %45 = lshr exact i64 %44, 2
  %46 = trunc i64 %45 to i32
  store i32 %46, ptr @b, align 4, !tbaa !5
  %47 = load i32, ptr @a, align 4, !tbaa !5
  %48 = icmp sgt i32 %47, 0
  br i1 %48, label %.lr.ph33, label %.preheader29

.preheader29.loopexit:                            ; preds = %.lr.ph33
  %.pre43 = load i32, ptr @b, align 4, !tbaa !5
  br label %.preheader29

.preheader29:                                     ; preds = %.preheader29.loopexit, %._crit_edge
  %49 = phi i32 [ %66, %.preheader29.loopexit ], [ %47, %._crit_edge ]
  %50 = phi i32 [ %.pre43, %.preheader29.loopexit ], [ %46, %._crit_edge ]
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %.lr.ph35, label %.preheader

.lr.ph33:                                         ; preds = %._crit_edge, %.lr.ph33
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph33 ], [ 0, %._crit_edge ]
  %52 = getelementptr inbounds [2000018 x i32], ptr @c, i64 0, i64 %indvars.iv
  %53 = load i32, ptr %52, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr %1, align 4, !tbaa !5
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %56 = load i32, ptr %55, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = sub nsw i32 %53, %57
  store i32 %58, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = add i32 %56, 1
  %62 = sub i32 %61, %60
  %63 = sext i32 %62 to i64
  %64 = load i64, ptr @ans, align 8, !tbaa !11
  %65 = add nsw i64 %64, %63
  store i64 %65, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %66 = load i32, ptr @a, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next, %67
  br i1 %68, label %.lr.ph33, label %.preheader29.loopexit, !llvm.loop !13

.preheader.loopexit:                              ; preds = %.lr.ph35
  %.pre44 = load i32, ptr @a, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader29
  %69 = phi i32 [ %.pre44, %.preheader.loopexit ], [ %49, %.preheader29 ]
  %70 = add nsw i32 %69, -1
  store i32 %70, ptr @a, align 4, !tbaa !5
  %.not2436 = icmp eq i32 %69, 0
  br i1 %.not2436, label %.preheader.._crit_edge38_crit_edge, label %.lr.ph37

.preheader.._crit_edge38_crit_edge:               ; preds = %.preheader
  %.pre45 = load i64, ptr @ans, align 8, !tbaa !11
  br label %._crit_edge38

.lr.ph35:                                         ; preds = %.preheader29, %.lr.ph35
  %indvars.iv40 = phi i64 [ %indvars.iv.next41, %.lr.ph35 ], [ 0, %.preheader29 ]
  %71 = getelementptr inbounds [2000018 x i32], ptr @d, i64 0, i64 %indvars.iv40
  %72 = load i32, ptr %71, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %73 = load i32, ptr @n, align 4, !tbaa !5
  %74 = add nsw i32 %73, %72
  store i32 %74, ptr %4, align 4, !tbaa !5
  %75 = 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) @n)
  %76 = load i32, ptr %75, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %77 = add nsw i32 %72, 1
  store i32 %77, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add i32 %76, 1
  %81 = sub i32 %80, %79
  %82 = sext i32 %81 to i64
  %83 = load i64, ptr @ans, align 8, !tbaa !11
  %84 = add nsw i64 %83, %82
  store i64 %84, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %85 = and i32 %72, 1
  %.not27 = icmp eq i32 %85, 0
  %q.p = select i1 %.not27, ptr @q, ptr @p
  %f.e = select i1 %.not27, ptr @f, ptr @e
  %86 = load i32, ptr %q.p, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %q.p, align 4, !tbaa !5
  %88 = sext i32 %86 to i64
  %89 = getelementptr inbounds [2000018 x i32], ptr %f.e, i64 0, i64 %88
  store i32 %72, ptr %89, align 4, !tbaa !5
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %90 = load i32, ptr @b, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next41, %91
  br i1 %92, label %.lr.ph35, label %.preheader.loopexit, !llvm.loop !14

.lr.ph37:                                         ; preds = %.preheader, %106
  %93 = phi i32 [ %123, %106 ], [ %70, %.preheader ]
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2000018 x i32], ptr @c, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr @n, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  %.not25 = icmp sgt i32 %96, %98
  br i1 %.not25, label %102, label %99

99:                                               ; preds = %.lr.ph37
  %100 = sub nsw i32 2, %96
  %101 = add nsw i32 %96, -2
  br label %106

102:                                              ; preds = %.lr.ph37
  %103 = shl nsw i32 %97, 1
  %104 = sub nsw i32 %96, %103
  %105 = sub nsw i32 %103, %96
  br label %106

106:                                              ; preds = %102, %99
  %.sink = phi i32 [ %104, %102 ], [ %100, %99 ]
  %storemerge = phi i32 [ %105, %102 ], [ %101, %99 ]
  store i32 %.sink, ptr @s, align 4
  store i32 %storemerge, ptr @t, align 4, !tbaa !5
  %107 = and i32 %96, 1
  %.not26 = icmp eq i32 %107, 0
  %q.p66 = select i1 %.not26, ptr @q, ptr @p
  %f.e67 = select i1 %.not26, ptr @f, ptr @e
  %108 = load i32, ptr %q.p66, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %f.e67, i64 %109
  %111 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull %f.e67, ptr noundef nonnull %110, ptr noundef nonnull align 4 dereferenceable(4) @s)
  %112 = load i32, ptr %q.p66, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %f.e67, i64 %113
  %115 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull %f.e67, ptr noundef nonnull %114, ptr noundef nonnull align 4 dereferenceable(4) @t)
  %116 = ptrtoint ptr %115 to i64
  %117 = ptrtoint ptr %111 to i64
  %118 = sub i64 %116, %117
  %119 = ashr exact i64 %118, 2
  %120 = load i64, ptr @ans, align 8, !tbaa !11
  %121 = sub nsw i64 %120, %119
  store i64 %121, ptr @ans, align 8, !tbaa !11
  %122 = load i32, ptr @a, align 4, !tbaa !5
  %123 = add nsw i32 %122, -1
  store i32 %123, ptr @a, align 4, !tbaa !5
  %.not24 = icmp eq i32 %122, 0
  br i1 %.not24, label %._crit_edge38, label %.lr.ph37, !llvm.loop !15

._crit_edge38:                                    ; preds = %106, %.preheader.._crit_edge38_crit_edge
  %124 = phi i64 [ %.pre45, %.preheader.._crit_edge38_crit_edge ], [ %121, %106 ]
  %125 = load i32, ptr @n, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = mul nsw i64 %126, %126
  %128 = sub nsw i64 %127, %124
  %129 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %128)
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 #4

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

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

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

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

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

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

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

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


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