; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (4007（暴力枚举）)

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

@node = external dso_local global [1005 x %struct.Node], align 16
@xx = external dso_local global [1005 x i32], align 16
@yy = external dso_local global [1005 x i32], align 16
@xcnt = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %10

10:                                               ; preds = %137, %0
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @N, ptr noundef @R)
  %12 = xor i32 %11, -1
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %140

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

15:                                               ; preds = %38, %14
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @N, align 4, !tbaa !5
  %18 = icmp sle i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %22
  %24 = getelementptr inbounds %struct.Node, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.Node, ptr %27, i32 0, i32 1
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %24, ptr noundef %28)
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.Node, ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !9
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1005 x i32], ptr @yy, i64 0, i64 %36
  store i32 %34, ptr %37, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %20
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !11

41:                                               ; preds = %19
  %42 = load i32, ptr @N, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @yy, i64 1), i64 %43
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef getelementptr inbounds (i32, ptr @yy, i64 1), ptr noundef %44)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %134, %41
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = load i32, ptr @N, align 4, !tbaa !5
  %48 = icmp sle i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  store i32 0, ptr @xcnt, 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 %51

51:                                               ; preds = %91, %50
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = load i32, ptr @N, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 10, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %94

56:                                               ; preds = %51
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %58
  %60 = getelementptr inbounds %struct.Node, ptr %59, i32 0, i32 1
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1005 x i32], ptr @yy, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp sge i32 %61, %65
  br i1 %66, label %67, label %90

67:                                               ; preds = %56
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %69
  %71 = getelementptr inbounds %struct.Node, ptr %70, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !9
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1005 x i32], ptr @yy, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr @R, align 4, !tbaa !5
  %78 = add nsw i32 %76, %77
  %79 = icmp sle i32 %72, %78
  br i1 %79, label %80, label %90

80:                                               ; preds = %67
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %82
  %84 = getelementptr inbounds %struct.Node, ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 8, !tbaa !13
  %86 = load i32, ptr @xcnt, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr @xcnt, align 4, !tbaa !5
  %88 = sext i32 %86 to i64
  %89 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %88
  store i32 %85, ptr %89, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %80, %67, %56
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !5
  br label %51, !llvm.loop !14

94:                                               ; preds = %55
  %95 = load i32, ptr @xcnt, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr @xx, i64 %96
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @xx, ptr noundef %97)
  %98 = load i32, ptr @xcnt, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr @xcnt, align 4, !tbaa !5
  %100 = sext i32 %98 to i64
  %101 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %100
  store i32 2000000000, ptr %101, align 4, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %130, %94
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = load i32, ptr @xcnt, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 1
  %106 = icmp slt i32 %103, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %102
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %133

108:                                              ; preds = %102
  br label %109

109:                                              ; preds = %121, %108
  %110 = load i32, ptr %3, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = load i32, ptr %8, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr @R, align 4, !tbaa !5
  %119 = add nsw i32 %117, %118
  %120 = icmp sle i32 %113, %119
  br i1 %120, label %121, label %124

121:                                              ; preds = %109
  %122 = load i32, ptr %3, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %3, align 4, !tbaa !5
  br label %109, !llvm.loop !15

124:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %125 = load i32, ptr %3, align 4, !tbaa !5
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sub nsw i32 %125, %126
  store i32 %127, ptr %9, align 4, !tbaa !5
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %129 = load i32, ptr %128, align 4, !tbaa !5
  store i32 %129, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %130

130:                                              ; preds = %124
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %8, align 4, !tbaa !5
  br label %102, !llvm.loop !16

133:                                              ; preds = %107
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %5, align 4, !tbaa !5
  br label %45, !llvm.loop !17

137:                                              ; preds = %49
  %138 = load i32, ptr %4, align 4, !tbaa !5
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %138)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %10, !llvm.loop !18

140:                                              ; preds = %10
  ret i32 0
}

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

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

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

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

; 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

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 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 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 = !{!10, !6, i64 4}
!10 = !{!"_ZTS4Node", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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

@node = external dso_local global [1005 x %struct.Node], align 16
@xx = external dso_local global [1005 x i32], align 16
@yy = external dso_local global [1005 x i32], align 16
@xcnt = external dso_local local_unnamed_addr global i32, align 4
@N = external dso_local global i32, align 4
@R = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @R)
  %.not51 = icmp eq i32 %3, -1
  br i1 %.not51, label %._crit_edge52, label %.preheader35

.preheader35:                                     ; preds = %0, %._crit_edge50
  %4 = load i32, ptr @N, align 4, !tbaa !5
  %.not2936 = icmp slt i32 %4, 1
  br i1 %.not2936, label %.preheader35.._crit_edge_crit_edge, label %.lr.ph

.preheader35.._crit_edge_crit_edge:               ; preds = %.preheader35
  %.pre67 = sext i32 %4 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader35.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre67, %.preheader35.._crit_edge_crit_edge ], [ %13, %.lr.ph ]
  %5 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @yy, i64 4), i64 %.pre-phi
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @yy, i64 4), ptr noundef nonnull %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  %6 = load i32, ptr @N, align 4, !tbaa !5
  %.not3046 = icmp slt i32 %6, 1
  br i1 %.not3046, label %._crit_edge50, label %.lr.ph49

.lr.ph:                                           ; preds = %.preheader35, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader35 ]
  %7 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv
  %8 = getelementptr inbounds i8, ptr %7, i64 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %10 = load i32, ptr %8, align 4, !tbaa !9
  %11 = getelementptr inbounds [1005 x i32], ptr @yy, i64 0, i64 %indvars.iv
  store i32 %10, ptr %11, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = load i32, ptr @N, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %.not29.not = icmp slt i64 %indvars.iv, %13
  br i1 %.not29.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge50.loopexit:                           ; preds = %._crit_edge45
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge50

._crit_edge50:                                    ; preds = %._crit_edge50.loopexit, %._crit_edge
  %14 = phi i32 [ %.pre, %._crit_edge50.loopexit ], [ 0, %._crit_edge ]
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %14)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @N, ptr noundef nonnull @R)
  %.not = icmp eq i32 %16, -1
  br i1 %.not, label %._crit_edge52, label %.preheader35, !llvm.loop !13

.lr.ph49:                                         ; preds = %._crit_edge, %._crit_edge45
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %._crit_edge45 ], [ 1, %._crit_edge ]
  %17 = phi i32 [ %67, %._crit_edge45 ], [ %6, %._crit_edge ]
  store i32 0, ptr @xcnt, align 4, !tbaa !5
  %.not3138 = icmp slt i32 %17, 1
  br i1 %.not3138, label %._crit_edge42, label %.lr.ph41

.lr.ph41:                                         ; preds = %.lr.ph49
  %18 = getelementptr inbounds [1005 x i32], ptr @yy, i64 0, i64 %indvars.iv64
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = load i32, ptr @R, align 4
  %21 = add nsw i32 %20, %19
  %22 = zext nneg i32 %17 to i64
  %xtraiter = and i64 %22, 1
  %23 = icmp eq i32 %17, 1
  br i1 %23, label %._crit_edge42.loopexit.unr-lcssa, label %.lr.ph41.new

.lr.ph41.new:                                     ; preds = %.lr.ph41
  %unroll_iter = and i64 %22, 2147483646
  br label %40

._crit_edge42.loopexit.unr-lcssa:                 ; preds = %60, %.lr.ph41
  %.lcssa70.ph = phi i32 [ poison, %.lr.ph41 ], [ %61, %60 ]
  %indvars.iv55.unr = phi i64 [ 1, %.lr.ph41 ], [ %indvars.iv.next56.1, %60 ]
  %.unr = phi i32 [ 0, %.lr.ph41 ], [ %61, %60 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge42, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge42.loopexit.unr-lcssa
  %24 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv55.unr
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %.not33.epil = icmp slt i32 %26, %19
  %.not34.epil = icmp sgt i32 %26, %21
  %or.cond.epil = select i1 %.not33.epil, i1 true, i1 %.not34.epil
  br i1 %or.cond.epil, label %._crit_edge42, label %27

27:                                               ; preds = %.epil.preheader
  %28 = load i32, ptr %24, align 8, !tbaa !14
  %29 = add nsw i32 %.unr, 1
  store i32 %29, ptr @xcnt, align 4, !tbaa !5
  %30 = sext i32 %.unr to i64
  %31 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %30
  store i32 %28, ptr %31, align 4, !tbaa !5
  br label %._crit_edge42

._crit_edge42:                                    ; preds = %._crit_edge42.loopexit.unr-lcssa, %27, %.epil.preheader, %.lr.ph49
  %32 = phi i32 [ 0, %.lr.ph49 ], [ %.lcssa70.ph, %._crit_edge42.loopexit.unr-lcssa ], [ %.unr, %.epil.preheader ], [ %29, %27 ]
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr @xx, i64 %33
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @xx, ptr noundef nonnull %34)
  %35 = load i32, ptr @xcnt, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr @xcnt, align 4, !tbaa !5
  %37 = sext i32 %35 to i64
  %38 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %37
  store i32 2000000000, ptr %38, align 4, !tbaa !5
  %39 = icmp sgt i32 %35, 0
  br i1 %39, label %.preheader, label %._crit_edge45

40:                                               ; preds = %60, %.lr.ph41.new
  %indvars.iv55 = phi i64 [ 1, %.lr.ph41.new ], [ %indvars.iv.next56.1, %60 ]
  %41 = phi i32 [ 0, %.lr.ph41.new ], [ %61, %60 ]
  %niter = phi i64 [ 0, %.lr.ph41.new ], [ %niter.next.1, %60 ]
  %42 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv55
  %43 = getelementptr inbounds i8, ptr %42, i64 4
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %.not33 = icmp slt i32 %44, %19
  %.not34 = icmp sgt i32 %44, %21
  %or.cond = select i1 %.not33, i1 true, i1 %.not34
  br i1 %or.cond, label %50, label %45

45:                                               ; preds = %40
  %46 = load i32, ptr %42, align 8, !tbaa !14
  %47 = add nsw i32 %41, 1
  store i32 %47, ptr @xcnt, align 4, !tbaa !5
  %48 = sext i32 %41 to i64
  %49 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %48
  store i32 %46, ptr %49, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %40, %45
  %51 = phi i32 [ %41, %40 ], [ %47, %45 ]
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %52 = getelementptr inbounds [1005 x %struct.Node], ptr @node, i64 0, i64 %indvars.iv.next56
  %53 = getelementptr inbounds i8, ptr %52, i64 4
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %.not33.1 = icmp slt i32 %54, %19
  %.not34.1 = icmp sgt i32 %54, %21
  %or.cond.1 = select i1 %.not33.1, i1 true, i1 %.not34.1
  br i1 %or.cond.1, label %60, label %55

55:                                               ; preds = %50
  %56 = load i32, ptr %52, align 8, !tbaa !14
  %57 = add nsw i32 %51, 1
  store i32 %57, ptr @xcnt, align 4, !tbaa !5
  %58 = sext i32 %51 to i64
  %59 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %58
  store i32 %56, ptr %59, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %55, %50
  %61 = phi i32 [ %51, %50 ], [ %57, %55 ]
  %indvars.iv.next56.1 = add nuw nsw i64 %indvars.iv55, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge42.loopexit.unr-lcssa, label %40, !llvm.loop !15

.preheader:                                       ; preds = %._crit_edge42, %72
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %72 ], [ 0, %._crit_edge42 ]
  %.02443 = phi i64 [ %indvars.iv58, %72 ], [ 0, %._crit_edge42 ]
  %62 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %indvars.iv61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr @R, align 4, !tbaa !5
  %65 = add nsw i32 %64, %63
  %sext = shl i64 %.02443, 32
  %66 = ashr exact i64 %sext, 32
  br label %69

._crit_edge45:                                    ; preds = %72, %._crit_edge42
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %67 = load i32, ptr @N, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %.not30.not = icmp slt i64 %indvars.iv64, %68
  br i1 %.not30.not, label %.lr.ph49, label %._crit_edge50.loopexit, !llvm.loop !16

69:                                               ; preds = %69, %.preheader
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %69 ], [ %66, %.preheader ]
  %70 = getelementptr inbounds [1005 x i32], ptr @xx, i64 0, i64 %indvars.iv58
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %.not32 = icmp sgt i32 %71, %65
  %indvars.iv.next59 = add nsw i64 %indvars.iv58, 1
  br i1 %.not32, label %72, label %69, !llvm.loop !17

72:                                               ; preds = %69
  %73 = trunc nsw i64 %indvars.iv58 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %74 = trunc nuw nsw i64 %indvars.iv61 to i32
  %75 = sub nsw i32 %73, %74
  store i32 %75, ptr %2, align 4, !tbaa !5
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %77 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %77, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %78 = load i32, ptr @xcnt, align 4, !tbaa !5
  %79 = add nsw i32 %78, -1
  %80 = sext i32 %79 to i64
  %81 = icmp slt i64 %indvars.iv.next62, %80
  br i1 %81, label %.preheader, label %._crit_edge45, !llvm.loop !18

._crit_edge52:                                    ; preds = %._crit_edge50, %0
  ret i32 0
}

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

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

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

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

; 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: 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 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 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 = !{!10, !6, i64 4}
!10 = !{!"_ZTS4Node", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!10, !6, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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