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

; 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 { i32, i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@num = external dso_local global [50010 x i32], align 16
@nxt = external dso_local global [50010 x i32], align 16
@pos = external dso_local global [1000010 x i32], align 16
@ans = external dso_local global [200000 x i32], align 16
@que = external dso_local global [200000 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 [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumi(i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %20, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp sle i32 %11, %12
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [50010 x i32], ptr @num, i64 0, i64 %17
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %18)
  br label %20

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !9

23:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %24, ptr %3, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %47, %23
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %25
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [50010 x i32], ptr @num, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [50010 x i32], ptr @nxt, i64 0, i64 %38
  store i32 %36, ptr %39, align 4, !tbaa !5
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [50010 x i32], ptr @num, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %45
  store i32 %40, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %29
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %3, align 4, !tbaa !5
  br label %25, !llvm.loop !11

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

51:                                               ; preds = %67, %50
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = icmp slt i32 %52, 1000010
  br i1 %53, label %55, label %54

54:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %70

55:                                               ; preds = %51
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %66

61:                                               ; preds = %55
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %65, i32 noundef 1)
  br label %66

66:                                               ; preds = %61, %55
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %4, align 4, !tbaa !5
  br label %51, !llvm.loop !12

70:                                               ; preds = %54
  %71 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %92, %70
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = load i32, ptr @m, align 4, !tbaa !5
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %77, label %76

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

77:                                               ; preds = %72
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.Node, ptr %80, i32 0, i32 0
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %83
  %85 = getelementptr inbounds %struct.Node, ptr %84, i32 0, i32 1
  %86 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %81, ptr noundef %85)
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = load i32, ptr %5, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %89
  %91 = getelementptr inbounds %struct.Node, ptr %90, i32 0, i32 2
  store i32 %87, ptr %91, align 4, !tbaa !13
  br label %92

92:                                               ; preds = %77
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %5, align 4, !tbaa !5
  br label %72, !llvm.loop !15

95:                                               ; preds = %76
  %96 = load i32, ptr @m, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds %struct.Node, ptr @que, i64 %97
  call void @_ZSt4sortIP4NodeEvT_S2_(ptr noundef @que, ptr noundef %98)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %99

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

103:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %153

104:                                              ; preds = %99
  br label %105

105:                                              ; preds = %125, %104
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %108
  %110 = getelementptr inbounds %struct.Node, ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 4, !tbaa !16
  %112 = icmp slt i32 %106, %111
  br i1 %112, label %113, label %128

113:                                              ; preds = %105
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [50010 x i32], ptr @nxt, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %119, label %124

119:                                              ; preds = %113
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [50010 x i32], ptr @nxt, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  call void @_Z3addii(i32 noundef %123, i32 noundef 1)
  br label %124

124:                                              ; preds = %119, %113
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %7, align 4, !tbaa !5
  br label %105, !llvm.loop !17

128:                                              ; preds = %105
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %130
  %132 = getelementptr inbounds %struct.Node, ptr %131, i32 0, i32 1
  %133 = load i32, ptr %132, align 4, !tbaa !18
  %134 = call noundef i32 @_Z3sumi(i32 noundef %133)
  %135 = load i32, ptr %6, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %136
  %138 = getelementptr inbounds %struct.Node, ptr %137, i32 0, i32 0
  %139 = load i32, ptr %138, align 4, !tbaa !16
  %140 = sub nsw i32 %139, 1
  %141 = call noundef i32 @_Z3sumi(i32 noundef %140)
  %142 = sub nsw i32 %134, %141
  %143 = load i32, ptr %6, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %144
  %146 = getelementptr inbounds %struct.Node, ptr %145, i32 0, i32 2
  %147 = load i32, ptr %146, align 4, !tbaa !13
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [200000 x i32], ptr @ans, i64 0, i64 %148
  store i32 %142, ptr %149, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %128
  %151 = load i32, ptr %6, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %6, align 4, !tbaa !5
  br label %99, !llvm.loop !19

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

154:                                              ; preds = %165, %153
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = load i32, ptr @m, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %168

159:                                              ; preds = %154
  %160 = load i32, ptr %8, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [200000 x i32], ptr @ans, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %163)
  br label %165

165:                                              ; preds = %159
  %166 = load i32, ptr %8, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %8, align 4, !tbaa !5
  br label %154, !llvm.loop !20

168:                                              ; preds = %158
  ret i32 0
}

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

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

declare i32 @printf(ptr noundef, ...) #3

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@num = external dso_local global [50010 x i32], align 16
@nxt = external dso_local local_unnamed_addr global [50010 x i32], align 16
@pos = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@ans = external dso_local local_unnamed_addr global [200000 x i32], align 16
@que = external dso_local global [200000 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 [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3addii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sumi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not50 = icmp slt i32 %2, 1
  br i1 %.not50, label %.preheader47, label %.lr.ph

.preheader47:                                     ; preds = %.lr.ph, %0
  %.lcssa49 = phi i32 [ %2, %0 ], [ %13, %.lr.ph ]
  %.not4252 = icmp eq i32 %.lcssa49, 0
  br i1 %.not4252, label %.preheader46.preheader, label %.lr.ph54.preheader

.preheader46.preheader:                           ; preds = %.lr.ph54.prol.loopexit, %.lr.ph54, %.preheader47
  br label %.preheader46

.lr.ph54.preheader:                               ; preds = %.preheader47
  %3 = sext i32 %.lcssa49 to i64
  %xtraiter = and i64 %3, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph54.prol.loopexit, label %.lr.ph54.prol

.lr.ph54.prol:                                    ; preds = %.lr.ph54.preheader
  %4 = getelementptr inbounds [50010 x i32], ptr @num, i64 0, i64 %3
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %6
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %9 = getelementptr inbounds [50010 x i32], ptr @nxt, i64 0, i64 %3
  store i32 %8, ptr %9, align 4, !tbaa !5
  store i32 %.lcssa49, ptr %7, align 4, !tbaa !5
  %indvars.iv.next73.prol = add nsw i64 %3, -1
  br label %.lr.ph54.prol.loopexit

.lr.ph54.prol.loopexit:                           ; preds = %.lr.ph54.prol, %.lr.ph54.preheader
  %indvars.iv72.unr = phi i64 [ %3, %.lr.ph54.preheader ], [ %indvars.iv.next73.prol, %.lr.ph54.prol ]
  %10 = icmp eq i32 %.lcssa49, 1
  br i1 %10, label %.preheader46.preheader, label %.lr.ph54

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %11 = getelementptr inbounds [50010 x i32], ptr @num, i64 0, i64 %indvars.iv
  %12 = tail 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
  %.not.not = icmp slt i64 %indvars.iv, %14
  br i1 %.not.not, label %.lr.ph, label %.preheader47, !llvm.loop !9

.lr.ph54:                                         ; preds = %.lr.ph54.prol.loopexit, %.lr.ph54
  %indvars.iv72 = phi i64 [ %indvars.iv.next73.1, %.lr.ph54 ], [ %indvars.iv72.unr, %.lr.ph54.prol.loopexit ]
  %15 = getelementptr inbounds [50010 x i32], ptr @num, i64 0, i64 %indvars.iv72
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds [50010 x i32], ptr @nxt, i64 0, i64 %indvars.iv72
  store i32 %19, ptr %20, align 4, !tbaa !5
  %21 = trunc nsw i64 %indvars.iv72 to i32
  store i32 %21, ptr %18, align 4, !tbaa !5
  %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1
  %22 = getelementptr inbounds [50010 x i32], ptr @num, i64 0, i64 %indvars.iv.next73
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = getelementptr inbounds [50010 x i32], ptr @nxt, i64 0, i64 %indvars.iv.next73
  store i32 %26, ptr %27, align 4, !tbaa !5
  %28 = trunc nsw i64 %indvars.iv.next73 to i32
  store i32 %28, ptr %25, align 4, !tbaa !5
  %indvars.iv.next73.1 = add nsw i64 %indvars.iv72, -2
  %.not42.1 = icmp eq i64 %indvars.iv.next73.1, 0
  br i1 %.not42.1, label %.preheader46.preheader, label %.lr.ph54, !llvm.loop !11

29:                                               ; preds = %36
  %30 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph57, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %29
  %.pre90 = sext i32 %31 to i64
  br label %._crit_edge

.preheader46:                                     ; preds = %.preheader46.preheader, %36
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %36 ], [ 0, %.preheader46.preheader ]
  %33 = getelementptr inbounds [1000010 x i32], ptr @pos, i64 0, i64 %indvars.iv75
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %.not44 = icmp eq i32 %34, 0
  br i1 %.not44, label %36, label %35

35:                                               ; preds = %.preheader46
  tail call void @_Z3addii(i32 noundef %34, i32 noundef 1)
  br label %36

36:                                               ; preds = %.preheader46, %35
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next76, 1000010
  br i1 %exitcond.not, label %29, label %.preheader46, !llvm.loop !12

._crit_edge:                                      ; preds = %.lr.ph57, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre90, %.._crit_edge_crit_edge ], [ %46, %.lr.ph57 ]
  %37 = getelementptr inbounds %struct.Node, ptr @que, i64 %.pre-phi
  tail call void @_ZSt4sortIP4NodeEvT_S2_(ptr noundef nonnull @que, ptr noundef nonnull %37)
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.preheader45, label %._crit_edge68

.lr.ph57:                                         ; preds = %29, %.lr.ph57
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.lr.ph57 ], [ 0, %29 ]
  %40 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %indvars.iv78
  %41 = getelementptr inbounds i8, ptr %40, i64 4
  %42 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %40, ptr noundef nonnull %41)
  %43 = getelementptr inbounds i8, ptr %40, i64 8
  %44 = trunc nuw nsw i64 %indvars.iv78 to i32
  store i32 %44, ptr %43, align 4, !tbaa !13
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %45 = load i32, ptr @m, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next79, %46
  br i1 %47, label %.lr.ph57, label %._crit_edge, !llvm.loop !15

.preheader45:                                     ; preds = %._crit_edge, %._crit_edge61
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %._crit_edge61 ], [ 0, %._crit_edge ]
  %.03265 = phi i32 [ %.1.lcssa, %._crit_edge61 ], [ 1, %._crit_edge ]
  %48 = getelementptr inbounds [200000 x %struct.Node], ptr @que, i64 0, i64 %indvars.iv84
  %49 = load i32, ptr %48, align 4, !tbaa !16
  %50 = icmp slt i32 %.03265, %49
  br i1 %50, label %.lr.ph60.preheader, label %._crit_edge61

.lr.ph60.preheader:                               ; preds = %.preheader45
  %51 = sext i32 %.03265 to i64
  br label %.lr.ph60

.preheader:                                       ; preds = %._crit_edge61
  %52 = icmp sgt i32 %73, 0
  br i1 %52, label %.lr.ph67, label %._crit_edge68

.lr.ph60:                                         ; preds = %.lr.ph60.preheader, %57
  %53 = phi i32 [ %49, %.lr.ph60.preheader ], [ %58, %57 ]
  %indvars.iv81 = phi i64 [ %51, %.lr.ph60.preheader ], [ %indvars.iv.next82, %57 ]
  %54 = getelementptr inbounds [50010 x i32], ptr @nxt, i64 0, i64 %indvars.iv81
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %.not43 = icmp eq i32 %55, 0
  br i1 %.not43, label %57, label %56

56:                                               ; preds = %.lr.ph60
  tail call void @_Z3addii(i32 noundef %55, i32 noundef 1)
  %.pre = load i32, ptr %48, align 4, !tbaa !16
  br label %57

57:                                               ; preds = %.lr.ph60, %56
  %58 = phi i32 [ %53, %.lr.ph60 ], [ %.pre, %56 ]
  %indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
  %59 = sext i32 %58 to i64
  %60 = icmp slt i64 %indvars.iv.next82, %59
  br i1 %60, label %.lr.ph60, label %._crit_edge61.loopexit, !llvm.loop !17

._crit_edge61.loopexit:                           ; preds = %57
  %61 = trunc nsw i64 %indvars.iv.next82 to i32
  br label %._crit_edge61

._crit_edge61:                                    ; preds = %._crit_edge61.loopexit, %.preheader45
  %.1.lcssa = phi i32 [ %.03265, %.preheader45 ], [ %61, %._crit_edge61.loopexit ]
  %62 = getelementptr inbounds i8, ptr %48, i64 4
  %63 = load i32, ptr %62, align 4, !tbaa !18
  %64 = tail call noundef i32 @_Z3sumi(i32 noundef %63)
  %65 = load i32, ptr %48, align 4, !tbaa !16
  %66 = add nsw i32 %65, -1
  %67 = tail call noundef i32 @_Z3sumi(i32 noundef %66)
  %68 = sub nsw i32 %64, %67
  %69 = getelementptr inbounds i8, ptr %48, i64 8
  %70 = load i32, ptr %69, align 4, !tbaa !13
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [200000 x i32], ptr @ans, i64 0, i64 %71
  store i32 %68, ptr %72, align 4, !tbaa !5
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next85, %74
  br i1 %75, label %.preheader45, label %.preheader, !llvm.loop !19

._crit_edge68:                                    ; preds = %.lr.ph67, %._crit_edge, %.preheader
  ret i32 0

.lr.ph67:                                         ; preds = %.preheader, %.lr.ph67
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %.lr.ph67 ], [ 0, %.preheader ]
  %76 = getelementptr inbounds [200000 x i32], ptr @ans, i64 0, i64 %indvars.iv87
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %77)
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %79 = load i32, ptr @m, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = icmp slt i64 %indvars.iv.next88, %80
  br i1 %81, label %.lr.ph67, label %._crit_edge68, !llvm.loop !20
}

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!14, !6, i64 8}
!14 = !{!"_ZTS4Node", !6, i64 0, !6, i64 4, !6, i64 8}
!15 = distinct !{!15, !10}
!16 = !{!14, !6, i64 0}
!17 = distinct !{!17, !10}
!18 = !{!14, !6, i64 4}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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