; LLVM IR from eyangch/competitive-programming :: JOI/2013/watching.ll (Z5worksi)

; 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
@P = external dso_local global i32, align 4
@Q = external dso_local global i32, align 4
@a = external dso_local global [100000 x i32], align 16
@dp = external dso_local global [2001 x [2001 x i32]], align 16
@jmps = external dso_local global [2001 x i32], align 16
@jmpl = external dso_local global [2001 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5worksi(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca double, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @N, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %17
  %19 = getelementptr inbounds [2001 x i32], ptr %18, i64 0, i64 0
  %20 = load i32, ptr @Q, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr %19, i64 %21
  %23 = getelementptr inbounds i32, ptr %22, i64 1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store double 1.000000e+09, ptr %3, align 8, !tbaa !9
  call void @_ZSt4fillIPidEvT_S1_RKT0_(ptr noundef @dp, ptr noundef %23, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  %24 = load i32, ptr @Q, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr @dp, i64 %25
  %27 = getelementptr inbounds i32, ptr %26, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @dp, ptr noundef %27, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %28 = load i32, ptr @N, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr @jmps, i64 %29
  %31 = getelementptr inbounds i32, ptr %30, i64 1
  call void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef @jmps, ptr noundef %31, i32 noundef -1)
  %32 = load i32, ptr @N, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr @jmpl, i64 %33
  %35 = getelementptr inbounds i32, ptr %34, i64 1
  call void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef @jmpl, ptr noundef %35, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %36 = load i32, ptr @N, align 4, !tbaa !5
  %37 = sub nsw i32 %36, 1
  store i32 %37, ptr %5, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %82, %1
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = icmp sge i32 %39, 0
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %43 = load i32, ptr @N, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr @a, i64 %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = sub nsw i32 %49, %50
  store i32 %51, ptr %7, align 4, !tbaa !5
  %52 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef @a, ptr noundef %45, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %53 = ptrtoint ptr %52 to i64
  %54 = sub i64 %53, ptrtoint (ptr @a to i64)
  %55 = sdiv exact i64 %54, 4
  %56 = sub nsw i64 %55, 1
  %57 = trunc i64 %56 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  store i32 %57, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %58 = load i32, ptr @N, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i32, ptr @a, i64 %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = mul nsw i32 2, %65
  %67 = sub nsw i32 %64, %66
  store i32 %67, ptr %9, align 4, !tbaa !5
  %68 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef @a, ptr noundef %60, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %69 = ptrtoint ptr %68 to i64
  %70 = sub i64 %69, ptrtoint (ptr @a to i64)
  %71 = sdiv exact i64 %70, 4
  %72 = sub nsw i64 %71, 1
  %73 = trunc i64 %72 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  store i32 %73, ptr %8, align 4, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [2001 x i32], ptr @jmps, i64 0, i64 %76
  store i32 %74, ptr %77, align 4, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [2001 x i32], ptr @jmpl, i64 0, i64 %80
  store i32 %78, ptr %81, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %82

82:                                               ; preds = %42
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = add nsw i32 %83, -1
  store i32 %84, ptr %5, align 4, !tbaa !5
  br label %38, !llvm.loop !11

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

86:                                               ; preds = %147, %85
  %87 = load i32, ptr %10, align 4, !tbaa !5
  %88 = load i32, ptr @N, align 4, !tbaa !5
  %89 = icmp sle i32 %87, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %150

91:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2001 x i32], ptr @jmps, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %98 = load i32, ptr %10, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2001 x i32], ptr @jmpl, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %13, align 4, !tbaa !5
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %105
  %107 = getelementptr inbounds [2001 x i32], ptr %106, i64 0, i64 0
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %111
  %113 = getelementptr inbounds [2001 x i32], ptr %112, i64 0, i64 0
  store i32 %109, ptr %113, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %143, %91
  %115 = load i32, ptr %14, align 4, !tbaa !5
  %116 = load i32, ptr @Q, align 4, !tbaa !5
  %117 = icmp sle i32 %115, %116
  br i1 %117, label %119, label %118

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

119:                                              ; preds = %114
  %120 = load i32, ptr %13, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %121
  %123 = load i32, ptr %14, align 4, !tbaa !5
  %124 = sub nsw i32 %123, 1
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [2001 x i32], ptr %122, i64 0, i64 %125
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %127 = load i32, ptr %12, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %128
  %130 = load i32, ptr %14, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [2001 x i32], ptr %129, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %15, align 4, !tbaa !5
  %135 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %126, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %138
  %140 = load i32, ptr %14, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [2001 x i32], ptr %139, i64 0, i64 %141
  store i32 %136, ptr %142, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %143

143:                                              ; preds = %119
  %144 = load i32, ptr %14, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %14, align 4, !tbaa !5
  br label %114, !llvm.loop !13

146:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %10, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %10, align 4, !tbaa !5
  br label %86, !llvm.loop !14

150:                                              ; preds = %90
  %151 = load i32, ptr @N, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %152
  %154 = load i32, ptr @Q, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [2001 x i32], ptr %153, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = load i32, ptr @P, align 4, !tbaa !5
  %159 = icmp sle i32 %157, %158
  ret i1 %159
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPidEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) #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 @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) #3

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

; 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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !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"

@N = 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
@a = external dso_local global [100000 x i32], align 16
@dp = external dso_local global [2001 x [2001 x i32]], align 16
@jmps = external dso_local global [2001 x i32], align 16
@jmpl = external dso_local global [2001 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5worksi(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca double, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %8
  %10 = load i32, ptr @Q, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds i32, ptr %9, i64 %11
  %13 = getelementptr inbounds i8, ptr %12, i64 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  store double 1.000000e+09, ptr %2, align 8, !tbaa !9
  call void @_ZSt4fillIPidEvT_S1_RKT0_(ptr noundef nonnull @dp, ptr noundef nonnull %13, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %14 = load i32, ptr @Q, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds i32, ptr @dp, i64 %15
  %17 = getelementptr inbounds i8, ptr %16, i64 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @dp, ptr noundef nonnull %17, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %18 = load i32, ptr @N, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i32, ptr @jmps, i64 %19
  %21 = getelementptr inbounds i8, ptr %20, i64 4
  call void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef nonnull @jmps, ptr noundef nonnull %21, i32 noundef -1)
  %22 = load i32, ptr @N, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr @jmpl, i64 %23
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  call void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef nonnull @jmpl, ptr noundef nonnull %25, i32 noundef -1)
  %26 = load i32, ptr @N, align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph, label %.preheader.thread

.preheader.thread:                                ; preds = %1
  %.pre4951 = load i32, ptr @Q, align 4, !tbaa !5
  br label %._crit_edge35

.lr.ph:                                           ; preds = %1
  %28 = shl nsw i32 %0, 1
  %29 = zext nneg i32 %26 to i64
  br label %51

.preheader:                                       ; preds = %51
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  %.not32 = icmp slt i32 %.pre, 1
  %.pre49 = load i32, ptr @Q, align 4, !tbaa !5
  br i1 %.not32, label %._crit_edge35, label %.lr.ph34

.lr.ph34:                                         ; preds = %.preheader
  %30 = icmp slt i32 %.pre49, 1
  br i1 %30, label %.lr.ph34.split.us, label %.lr.ph34.split

.lr.ph34.split.us:                                ; preds = %.lr.ph34
  %31 = zext nneg i32 %.pre to i64
  %xtraiter = and i64 %31, 1
  %32 = icmp eq i32 %.pre, 1
  br i1 %32, label %._crit_edge35.loopexit.unr-lcssa, label %.lr.ph34.split.us.new

.lr.ph34.split.us.new:                            ; preds = %.lr.ph34.split.us
  %unroll_iter = and i64 %31, 2147483646
  br label %33

33:                                               ; preds = %33, %.lr.ph34.split.us.new
  %indvars.iv45 = phi i64 [ 1, %.lr.ph34.split.us.new ], [ %indvars.iv.next46.1, %33 ]
  %niter = phi i64 [ 0, %.lr.ph34.split.us.new ], [ %niter.next.1, %33 ]
  %34 = add nsw i64 %indvars.iv45, -1
  %35 = getelementptr inbounds [2001 x i32], ptr @jmps, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  %42 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %indvars.iv45
  store i32 %41, ptr %42, align 4, !tbaa !5
  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
  %43 = getelementptr inbounds [2001 x i32], ptr @jmps, i64 0, i64 %indvars.iv45
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  %50 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %indvars.iv.next46
  store i32 %49, ptr %50, align 4, !tbaa !5
  %indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 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_edge35.loopexit.unr-lcssa, label %33, !llvm.loop !11

51:                                               ; preds = %.lr.ph, %51
  %indvars.iv = phi i64 [ %29, %.lr.ph ], [ %indvars.iv.next, %51 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %52 = load i32, ptr @N, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds i32, ptr @a, i64 %53
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %55 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv.next
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = sub nsw i32 %56, %0
  store i32 %57, ptr %4, align 4, !tbaa !5
  %58 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @a, ptr noundef nonnull %54, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %59 = ptrtoint ptr %58 to i64
  %60 = sub i64 %59, ptrtoint (ptr @a to i64)
  %61 = lshr exact i64 %60, 2
  %62 = trunc i64 %61 to i32
  %63 = add i32 %62, -1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %64 = load i32, ptr @N, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds i32, ptr @a, i64 %65
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %67 = load i32, ptr %55, align 4, !tbaa !5
  %68 = sub nsw i32 %67, %28
  store i32 %68, ptr %5, align 4, !tbaa !5
  %69 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @a, ptr noundef nonnull %66, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %70 = ptrtoint ptr %69 to i64
  %71 = sub i64 %70, ptrtoint (ptr @a to i64)
  %72 = lshr exact i64 %71, 2
  %73 = trunc i64 %72 to i32
  %74 = add i32 %73, -1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  %75 = getelementptr inbounds [2001 x i32], ptr @jmps, i64 0, i64 %indvars.iv.next
  store i32 %63, ptr %75, align 4, !tbaa !5
  %76 = getelementptr inbounds [2001 x i32], ptr @jmpl, i64 0, i64 %indvars.iv.next
  store i32 %74, ptr %76, align 4, !tbaa !5
  %77 = icmp ugt i64 %indvars.iv, 1
  br i1 %77, label %51, label %.preheader, !llvm.loop !13

._crit_edge35.loopexit.unr-lcssa:                 ; preds = %33, %.lr.ph34.split.us
  %indvars.iv45.unr = phi i64 [ 1, %.lr.ph34.split.us ], [ %indvars.iv.next46.1, %33 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge35, label %._crit_edge35.loopexit.epilog-lcssa

._crit_edge35.loopexit.epilog-lcssa:              ; preds = %._crit_edge35.loopexit.unr-lcssa
  %78 = add nsw i64 %indvars.iv45.unr, -1
  %79 = getelementptr inbounds [2001 x i32], ptr @jmps, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  %86 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %indvars.iv45.unr
  store i32 %85, ptr %86, align 4, !tbaa !5
  br label %._crit_edge35

._crit_edge35:                                    ; preds = %._crit_edge, %._crit_edge35.loopexit.epilog-lcssa, %._crit_edge35.loopexit.unr-lcssa, %.preheader.thread, %.preheader
  %87 = phi i32 [ %.pre49, %.preheader ], [ %.pre4951, %.preheader.thread ], [ %.pre49, %._crit_edge35.loopexit.unr-lcssa ], [ %.pre49, %._crit_edge35.loopexit.epilog-lcssa ], [ %110, %._crit_edge ]
  %.lcssa = phi i32 [ %.pre, %.preheader ], [ %26, %.preheader.thread ], [ %.pre, %._crit_edge35.loopexit.unr-lcssa ], [ %.pre, %._crit_edge35.loopexit.epilog-lcssa ], [ %109, %._crit_edge ]
  %88 = sext i32 %.lcssa to i64
  %89 = sext i32 %87 to i64
  %90 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %88, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr @P, align 4, !tbaa !5
  %93 = icmp sle i32 %91, %92
  ret i1 %93

.lr.ph34.split:                                   ; preds = %.lr.ph34, %._crit_edge
  %94 = phi i32 [ %109, %._crit_edge ], [ %.pre, %.lr.ph34 ]
  %95 = phi i32 [ %110, %._crit_edge ], [ %.pre49, %.lr.ph34 ]
  %indvars.iv42 = phi i64 [ %indvars.iv.next43, %._crit_edge ], [ 1, %.lr.ph34 ]
  %96 = add nsw i64 %indvars.iv42, -1
  %97 = getelementptr inbounds [2001 x i32], ptr @jmps, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  %100 = getelementptr inbounds [2001 x i32], ptr @jmpl, i64 0, i64 %96
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sext i32 %99 to i64
  %103 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  %106 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %indvars.iv42
  store i32 %105, ptr %106, align 4, !tbaa !5
  %.not2729 = icmp slt i32 %95, 1
  br i1 %.not2729, label %._crit_edge, label %.lr.ph31

.lr.ph31:                                         ; preds = %.lr.ph34.split
  %107 = add nsw i32 %101, 1
  %108 = sext i32 %107 to i64
  br label %112

._crit_edge.loopexit:                             ; preds = %112
  %.pre48 = load i32, ptr @N, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph34.split
  %109 = phi i32 [ %.pre48, %._crit_edge.loopexit ], [ %94, %.lr.ph34.split ]
  %110 = phi i32 [ %121, %._crit_edge.loopexit ], [ %95, %.lr.ph34.split ]
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %111 = sext i32 %109 to i64
  %.not.not = icmp slt i64 %indvars.iv42, %111
  br i1 %.not.not, label %.lr.ph34.split, label %._crit_edge35, !llvm.loop !14

112:                                              ; preds = %.lr.ph31, %112
  %indvars.iv39 = phi i64 [ 1, %.lr.ph31 ], [ %indvars.iv.next40, %112 ]
  %113 = add nsw i64 %indvars.iv39, -1
  %114 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %108, i64 %113
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %115 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %102, i64 %indvars.iv39
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %6, align 4, !tbaa !5
  %118 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %114, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = getelementptr inbounds [2001 x [2001 x i32]], ptr @dp, i64 0, i64 %indvars.iv42, i64 %indvars.iv39
  store i32 %119, ptr %120, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %121 = load i32, ptr @Q, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %.not27.not = icmp slt i64 %indvars.iv39, %122
  br i1 %.not27.not, label %112, label %._crit_edge.loopexit, !llvm.loop !16
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPidEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) 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 @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

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

; 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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 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, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass