; LLVM IR from tangjz/acm-icpc :: lydsy (1356)

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

%struct.Node = type { i64, i32, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global [1501 x i32], align 16
@y = external dso_local global [1501 x i32], align 16
@ans = external dso_local global i64, align 8
@seq = external dso_local global [1124251 x %struct.Node], 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 [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 %struct.Node, align 8
  %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 i64, align 8
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %14

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

18:                                               ; preds = %14
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %90

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr @x, i64 %21
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @y, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %22, ptr noundef %25)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %83, %19
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #7
  %33 = getelementptr inbounds %struct.Node, ptr %5, i32 0, i32 0
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sub nsw i32 %37, %41
  %43 = call noundef i64 @_Z3sqri(i32 noundef %42)
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sub nsw i32 %47, %51
  %53 = call noundef i64 @_Z3sqri(i32 noundef %52)
  %54 = add nsw i64 %43, %53
  store i64 %54, ptr %33, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.Node, ptr %5, i32 0, i32 1
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %59, %63
  store i32 %64, ptr %55, align 8, !tbaa !12
  %65 = getelementptr inbounds %struct.Node, ptr %5, i32 0, i32 2
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %69, %73
  store i32 %74, ptr %65, align 4, !tbaa !13
  %75 = getelementptr inbounds %struct.Node, ptr %5, i32 0, i32 3
  %76 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %76, ptr %75, align 8, !tbaa !14
  %77 = getelementptr inbounds %struct.Node, ptr %5, i32 0, i32 4
  %78 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %78, ptr %77, align 4, !tbaa !15
  %79 = load i32, ptr @m, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr @m, align 4, !tbaa !5
  %81 = sext i32 %79 to i64
  %82 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %81
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %82, ptr align 8 %5, i64 24, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #7
  br label %83

83:                                               ; preds = %32
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %4, align 4, !tbaa !5
  br label %27, !llvm.loop !18

86:                                               ; preds = %31
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %2, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !20

90:                                               ; preds = %18
  %91 = load i32, ptr @m, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds %struct.Node, ptr @seq, i64 %92
  call void @_ZSt4sortIP4NodeEvT_S2_(ptr noundef @seq, ptr noundef %93)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %192, %90
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = load i32, ptr @m, align 4, !tbaa !5
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %99, label %98

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

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

101:                                              ; preds = %189, %99
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = load i32, ptr @m, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %105, label %113

105:                                              ; preds = %101
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %107
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %110
  %112 = call noundef zeroext i1 @_ZNK4NodeeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %108, ptr noundef nonnull align 8 dereferenceable(24) %111)
  br label %113

113:                                              ; preds = %105, %101
  %114 = phi i1 [ false, %101 ], [ %112, %105 ]
  br i1 %114, label %116, label %115

115:                                              ; preds = %113
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %192

116:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %117 = load i32, ptr %6, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %118
  %120 = getelementptr inbounds %struct.Node, ptr %119, i32 0, i32 3
  %121 = load i32, ptr %120, align 8, !tbaa !14
  store i32 %121, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %122 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %122, ptr %9, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %185, %116
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = load i32, ptr %6, align 4, !tbaa !5
  %126 = icmp slt i32 %124, %125
  br i1 %126, label %128, label %127

127:                                              ; preds = %123
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %188

128:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.Node, ptr %131, i32 0, i32 3
  %133 = load i32, ptr %132, align 8, !tbaa !14
  store i32 %133, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %135
  %137 = getelementptr inbounds %struct.Node, ptr %136, i32 0, i32 4
  %138 = load i32, ptr %137, align 4, !tbaa !15
  store i32 %138, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %139 = load i32, ptr %10, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = load i32, ptr %8, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = sub nsw i32 %142, %146
  %148 = sext i32 %147 to i64
  %149 = load i32, ptr %11, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = load i32, ptr %8, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = sub nsw i32 %152, %156
  %158 = sext i32 %157 to i64
  %159 = mul nsw i64 %148, %158
  %160 = load i32, ptr %11, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = load i32, ptr %8, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sub nsw i32 %163, %167
  %169 = sext i32 %168 to i64
  %170 = load i32, ptr %10, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = load i32, ptr %8, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = sub nsw i32 %173, %177
  %179 = sext i32 %178 to i64
  %180 = mul nsw i64 %169, %179
  %181 = sub nsw i64 %159, %180
  %182 = call noundef i64 @_ZSt3absx(i64 noundef %181)
  store i64 %182, ptr %12, align 8, !tbaa !17
  %183 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %184 = load i64, ptr %183, align 8, !tbaa !17
  store i64 %184, ptr @ans, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %185

185:                                              ; preds = %128
  %186 = load i32, ptr %9, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %9, align 4, !tbaa !5
  br label %123, !llvm.loop !21

188:                                              ; preds = %127
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %189

189:                                              ; preds = %188
  %190 = load i32, ptr %6, align 4, !tbaa !5
  %191 = add nsw i32 %190, 1
  store i32 %191, ptr %6, align 4, !tbaa !5
  br label %101, !llvm.loop !22

192:                                              ; preds = %115
  br label %94, !llvm.loop !23

193:                                              ; preds = %98
  %194 = load i64, ptr @ans, align 8, !tbaa !17
  %195 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %194)
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3sqri(i32 noundef) #3

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

; 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 uwtable
declare dso_local void @_ZSt4sortIP4NodeEvT_S2_(ptr noundef, ptr noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4NodeeqERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #6 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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 = !{!10, !11, i64 0}
!10 = !{!"_ZTS4Node", !11, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!11 = !{!"long long", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 12}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 20}
!16 = !{i64 0, i64 8, !17, i64 8, i64 4, !5, i64 12, i64 4, !5, i64 16, i64 4, !5, i64 20, i64 4, !5}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = distinct !{!21, !19}
!22 = distinct !{!22, !19}
!23 = distinct !{!23, !19}


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

%struct.Node = type { i64, i32, i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@x = external dso_local global [1501 x i32], align 16
@y = external dso_local global [1501 x i32], align 16
@ans = external dso_local global i64, align 8
@seq = external dso_local global [1124251 x %struct.Node], 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 [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph44, label %._crit_edge45

._crit_edge45:                                    ; preds = %._crit_edge, %0
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds %struct.Node, ptr @seq, i64 %6
  tail call void @_ZSt4sortIP4NodeEvT_S2_(ptr noundef nonnull @seq, ptr noundef nonnull %7)
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.preheader, label %._crit_edge55

.lr.ph44:                                         ; preds = %0, %._crit_edge
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %._crit_edge ], [ 0, %0 ]
  %10 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv57
  %11 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv57
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %.not = icmp eq i64 %indvars.iv57, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph44
  %.pre = load i32, ptr %10, align 4, !tbaa !5
  %13 = trunc nuw nsw i64 %indvars.iv57 to i32
  br label %17

._crit_edge:                                      ; preds = %17, %.lr.ph44
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next58, %15
  br i1 %16, label %.lr.ph44, label %._crit_edge45, !llvm.loop !9

17:                                               ; preds = %.lr.ph, %17
  %18 = phi i32 [ %.pre, %.lr.ph ], [ %29, %17 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %17 ]
  %19 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %indvars.iv
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = sub nsw i32 %18, %20
  %22 = tail call noundef i64 @_Z3sqri(i32 noundef %21)
  %23 = load i32, ptr %11, align 4, !tbaa !5
  %24 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %indvars.iv
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = sub nsw i32 %23, %25
  %27 = tail call noundef i64 @_Z3sqri(i32 noundef %26)
  %28 = add nsw i64 %27, %22
  %29 = load i32, ptr %10, align 4, !tbaa !5
  %30 = load i32, ptr %19, align 4, !tbaa !5
  %31 = add nsw i32 %30, %29
  %32 = load i32, ptr %11, align 4, !tbaa !5
  %33 = load i32, ptr %24, align 4, !tbaa !5
  %34 = add nsw i32 %33, %32
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr @m, align 4, !tbaa !5
  %37 = sext i32 %35 to i64
  %38 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %37
  store i64 %28, ptr %38, align 8, !tbaa !11
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %38, i64 8
  store i32 %31, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %38, i64 12
  store i32 %34, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !5
  %.sroa.6.0..sroa_idx = getelementptr inbounds i8, ptr %38, i64 16
  %39 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %39, ptr %.sroa.6.0..sroa_idx, align 8, !tbaa !5
  %.sroa.7.0..sroa_idx = getelementptr inbounds i8, ptr %38, i64 20
  store i32 %13, ptr %.sroa.7.0..sroa_idx, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv57
  br i1 %exitcond.not, label %._crit_edge, label %17, !llvm.loop !13

.preheader:                                       ; preds = %._crit_edge45, %.critedge
  %40 = phi i32 [ %50, %.critedge ], [ %8, %._crit_edge45 ]
  %.04054 = phi i32 [ %.1.lcssa, %.critedge ], [ 0, %._crit_edge45 ]
  %41 = icmp slt i32 %.04054, %40
  br i1 %41, label %.lr.ph51, label %.critedge

.lr.ph51:                                         ; preds = %.preheader
  %42 = sext i32 %.04054 to i64
  %43 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %42
  br label %46

._crit_edge55:                                    ; preds = %.critedge, %._crit_edge45
  %44 = load i64, ptr @ans, align 8, !tbaa !11
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %44)
  ret i32 0

46:                                               ; preds = %.lr.ph51, %._crit_edge49
  %indvars.iv64 = phi i64 [ %42, %.lr.ph51 ], [ %indvars.iv.next65, %._crit_edge49 ]
  %47 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %indvars.iv64
  %48 = call noundef zeroext i1 @_ZNK4NodeeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(24) %43)
  %49 = trunc nsw i64 %indvars.iv64 to i32
  br i1 %48, label %52, label %..critedge.loopexit_crit_edge

..critedge.loopexit_crit_edge:                    ; preds = %46
  %.pre67.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %.critedge

.critedge.loopexitsplit:                          ; preds = %._crit_edge49
  %indvars = trunc i64 %indvars.iv.next65 to i32
  br label %.critedge

.critedge:                                        ; preds = %..critedge.loopexit_crit_edge, %.critedge.loopexitsplit, %.preheader
  %50 = phi i32 [ %40, %.preheader ], [ %.pre67.pre, %..critedge.loopexit_crit_edge ], [ %59, %.critedge.loopexitsplit ]
  %.1.lcssa = phi i32 [ %.04054, %.preheader ], [ %49, %..critedge.loopexit_crit_edge ], [ %indvars, %.critedge.loopexitsplit ]
  %51 = icmp slt i32 %.1.lcssa, %50
  br i1 %51, label %.preheader, label %._crit_edge55, !llvm.loop !14

52:                                               ; preds = %46
  %53 = icmp sgt i64 %indvars.iv64, %42
  br i1 %53, label %.lr.ph48, label %._crit_edge49

.lr.ph48:                                         ; preds = %52
  %54 = getelementptr inbounds i8, ptr %47, i64 16
  %55 = load i32, ptr %54, align 8, !tbaa !15
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %56
  %58 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %56
  br label %62

._crit_edge49:                                    ; preds = %62, %52
  %indvars.iv.next65 = add nsw i64 %indvars.iv64, 1
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = icmp slt i64 %indvars.iv.next65, %60
  br i1 %61, label %46, label %.critedge.loopexitsplit, !llvm.loop !17

62:                                               ; preds = %.lr.ph48, %62
  %indvars.iv60 = phi i64 [ %42, %.lr.ph48 ], [ %indvars.iv.next61, %62 ]
  %63 = getelementptr inbounds [1124251 x %struct.Node], ptr @seq, i64 0, i64 %indvars.iv60
  %64 = getelementptr inbounds i8, ptr %63, i64 16
  %65 = load i32, ptr %64, align 8, !tbaa !15
  %66 = getelementptr inbounds i8, ptr %63, i64 20
  %67 = load i32, ptr %66, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %68 = sext i32 %65 to i64
  %69 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = load i32, ptr %57, align 4, !tbaa !5
  %72 = sub nsw i32 %70, %71
  %73 = sext i32 %72 to i64
  %74 = sext i32 %67 to i64
  %75 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr %58, align 4, !tbaa !5
  %78 = sub nsw i32 %76, %77
  %79 = sext i32 %78 to i64
  %80 = mul nsw i64 %79, %73
  %81 = getelementptr inbounds [1501 x i32], ptr @x, i64 0, i64 %74
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = sub nsw i32 %82, %71
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1501 x i32], ptr @y, i64 0, i64 %68
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = sub nsw i32 %86, %77
  %88 = sext i32 %87 to i64
  %89 = mul nsw i64 %88, %84
  %90 = sub nsw i64 %80, %89
  %91 = call noundef i64 @_ZSt3absx(i64 noundef %90)
  store i64 %91, ptr %1, align 8, !tbaa !11
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %93 = load i64, ptr %92, align 8, !tbaa !11
  store i64 %93, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %indvars.iv.next61 = add nsw i64 %indvars.iv60, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next61 to i32
  %exitcond63.not = icmp eq i32 %lftr.wideiv, %49
  br i1 %exitcond63.not, label %._crit_edge49, label %62, !llvm.loop !19
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3sqri(i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK4NodeeqERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) local_unnamed_addr #3

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress 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 = { 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 #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 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!16, !6, i64 16}
!16 = !{!"_ZTS4Node", !12, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!17 = distinct !{!17, !10}
!18 = !{!16, !6, i64 20}
!19 = distinct !{!19, !10}


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