; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/171 Division 2/Problem C (C)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [100000 x i32], align 16
@up = external dso_local global [100000 x i32], align 16
@down = external dso_local global [100001 x i32], align 16
@l = 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.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

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

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

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %19
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %20)
  br label %22

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

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

26:                                               ; preds = %73, %25
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %76

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %5, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %51, %31
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %38, label %49

38:                                               ; preds = %34
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = sub nsw i32 %43, 1
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = icmp sge i32 %42, %47
  br label %49

49:                                               ; preds = %38, %34
  %50 = phi i1 [ false, %34 ], [ %48, %38 ]
  br i1 %50, label %51, label %54

51:                                               ; preds = %49
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %5, align 4, !tbaa !5
  br label %34, !llvm.loop !11

54:                                               ; preds = %49
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = add nsw i32 %55, -1
  store i32 %56, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %57 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %57, ptr %6, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %68, %54
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = icmp sle i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %71

63:                                               ; preds = %58
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100000 x i32], ptr @up, i64 0, i64 %66
  store i32 %64, ptr %67, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %63
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %6, align 4, !tbaa !5
  br label %58, !llvm.loop !12

71:                                               ; preds = %62
  %72 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %72, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %73

73:                                               ; preds = %71
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %3, align 4, !tbaa !5
  br label %26, !llvm.loop !13

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

77:                                               ; preds = %124, %76
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %8, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %102, %82
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %89, label %100

89:                                               ; preds = %85
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp sle i32 %93, %98
  br label %100

100:                                              ; preds = %89, %85
  %101 = phi i1 [ false, %85 ], [ %99, %89 ]
  br i1 %101, label %102, label %105

102:                                              ; preds = %100
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %8, align 4, !tbaa !5
  br label %85, !llvm.loop !14

105:                                              ; preds = %100
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %108 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %108, ptr %9, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %119, %105
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = icmp sle i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 18, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %122

114:                                              ; preds = %109
  %115 = load i32, ptr %8, align 4, !tbaa !5
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100001 x i32], ptr @down, i64 0, i64 %117
  store i32 %115, ptr %118, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %114
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %9, align 4, !tbaa !5
  br label %109, !llvm.loop !15

122:                                              ; preds = %113
  %123 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %123, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %124

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

127:                                              ; preds = %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %153, %127
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = load i32, ptr @m, align 4, !tbaa !5
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 21, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %156

133:                                              ; preds = %128
  %134 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @l, ptr noundef @r)
  %135 = load i32, ptr @l, align 4, !tbaa !5
  %136 = add nsw i32 %135, -1
  store i32 %136, ptr @l, align 4, !tbaa !5
  %137 = load i32, ptr @r, align 4, !tbaa !5
  %138 = add nsw i32 %137, -1
  store i32 %138, ptr @r, align 4, !tbaa !5
  %139 = load i32, ptr @l, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100000 x i32], ptr @up, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100001 x i32], ptr @down, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = load i32, ptr @r, align 4, !tbaa !5
  %147 = icmp sge i32 %145, %146
  br i1 %147, label %148, label %150

148:                                              ; preds = %133
  %149 = call i32 @puts(ptr noundef @.str.3)
  br label %152

150:                                              ; preds = %133
  %151 = call i32 @puts(ptr noundef @.str.4)
  br label %152

152:                                              ; preds = %150, %148
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %10, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %10, align 4, !tbaa !5
  br label %128, !llvm.loop !17

156:                                              ; preds = %132
  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

declare i32 @puts(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 = { 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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [100000 x i32], align 16
@up = external dso_local local_unnamed_addr global [100000 x i32], align 16
@down = external dso_local local_unnamed_addr global [100001 x i32], align 16
@l = 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.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

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

.preheader54:                                     ; preds = %.lr.ph
  %4 = icmp sgt i32 %8, 0
  br i1 %4, label %.preheader53.preheader, label %.preheader

.preheader53.preheader:                           ; preds = %.preheader54
  %5 = zext nneg i32 %8 to i64
  br label %.preheader53

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %6 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %6)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = icmp slt i64 %indvars.iv.next, %9
  br i1 %10, label %.lr.ph, label %.preheader54, !llvm.loop !9

.loopexit52:                                      ; preds = %.lr.ph58, %middle.block, %.critedge
  %11 = icmp slt i32 %.041.lcssa, %8
  br i1 %11, label %.preheader53, label %.preheader51, !llvm.loop !11

.preheader53:                                     ; preds = %.preheader53.preheader, %.loopexit52
  %.04259 = phi i32 [ %.041.lcssa, %.loopexit52 ], [ 0, %.preheader53.preheader ]
  %12 = sext i32 %.04259 to i64
  %13 = add nsw i32 %.04259, 1
  %smax = tail call i32 @llvm.smax.i32(i32 %8, i32 %13)
  %14 = add nsw i32 %smax, -1
  br label %16

.preheader51:                                     ; preds = %.loopexit52
  br i1 %4, label %.preheader50.preheader, label %.preheader

.preheader50.preheader:                           ; preds = %.preheader51
  %15 = zext nneg i32 %8 to i64
  br label %.preheader50

16:                                               ; preds = %.preheader53, %18
  %indvars.iv68 = phi i64 [ %12, %.preheader53 ], [ %indvars.iv.next69, %18 ]
  %indvars.iv.next69 = add nsw i64 %indvars.iv68, 1
  %17 = icmp slt i64 %indvars.iv.next69, %5
  br i1 %17, label %18, label %.critedge

18:                                               ; preds = %16
  %19 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv.next69
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv68
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %.not48 = icmp slt i32 %20, %22
  br i1 %.not48, label %.critedge.split.loop.exit86, label %16, !llvm.loop !12

.critedge.split.loop.exit86:                      ; preds = %18
  %23 = trunc nsw i64 %indvars.iv68 to i32
  %24 = trunc nsw i64 %indvars.iv.next69 to i32
  br label %.critedge

.critedge:                                        ; preds = %16, %.critedge.split.loop.exit86
  %.041.in.lcssa = phi i32 [ %23, %.critedge.split.loop.exit86 ], [ %14, %16 ]
  %.041.lcssa = phi i32 [ %24, %.critedge.split.loop.exit86 ], [ %smax, %16 ]
  %.not4956 = icmp sgt i32 %.04259, %.041.in.lcssa
  br i1 %.not4956, label %.loopexit52, label %.lr.ph58.preheader

.lr.ph58.preheader:                               ; preds = %.critedge
  %25 = add i32 %.041.in.lcssa, 1
  %26 = sub i32 %.041.in.lcssa, %.04259
  %27 = zext i32 %26 to i64
  %28 = add nuw nsw i64 %27, 1
  %min.iters.check = icmp ult i32 %26, 7
  br i1 %min.iters.check, label %.lr.ph58.preheader114, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph58.preheader
  %n.vec = and i64 %28, 8589934584
  %ind.end = add nsw i64 %n.vec, %12
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %.041.in.lcssa, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %12
  %29 = getelementptr inbounds [100000 x i32], ptr @up, i64 0, i64 %offset.idx
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  store <4 x i32> %broadcast.splat, ptr %29, align 4, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %30, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %28, %n.vec
  br i1 %cmp.n, label %.loopexit52, label %.lr.ph58.preheader114

.lr.ph58.preheader114:                            ; preds = %middle.block, %.lr.ph58.preheader
  %indvars.iv71.ph = phi i64 [ %12, %.lr.ph58.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph58

.lr.ph58:                                         ; preds = %.lr.ph58.preheader114, %.lr.ph58
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph58 ], [ %indvars.iv71.ph, %.lr.ph58.preheader114 ]
  %32 = getelementptr inbounds [100000 x i32], ptr @up, i64 0, i64 %indvars.iv71
  store i32 %.041.in.lcssa, ptr %32, align 4, !tbaa !5
  %indvars.iv.next72 = add nsw i64 %indvars.iv71, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next72 to i32
  %exitcond.not = icmp eq i32 %25, %lftr.wideiv
  br i1 %exitcond.not, label %.loopexit52, label %.lr.ph58, !llvm.loop !16

.loopexit:                                        ; preds = %.lr.ph62, %middle.block96, %.critedge2
  %33 = icmp slt i32 %.038.lcssa, %8
  br i1 %33, label %.preheader50, label %.preheader, !llvm.loop !17

.preheader50:                                     ; preds = %.preheader50.preheader, %.loopexit
  %.03963 = phi i32 [ %.038.lcssa, %.loopexit ], [ 0, %.preheader50.preheader ]
  %34 = sext i32 %.03963 to i64
  %35 = add nsw i32 %.03963, 1
  %smax76 = tail call i32 @llvm.smax.i32(i32 %8, i32 %35)
  %36 = add nsw i32 %smax76, -1
  br label %39

.preheader:                                       ; preds = %.loopexit, %0, %.preheader54, %.preheader51
  %37 = load i32, ptr @m, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph65, label %._crit_edge

39:                                               ; preds = %.preheader50, %41
  %indvars.iv74 = phi i64 [ %34, %.preheader50 ], [ %indvars.iv.next75, %41 ]
  %indvars.iv.next75 = add nsw i64 %indvars.iv74, 1
  %40 = icmp slt i64 %indvars.iv.next75, %15
  br i1 %40, label %41, label %.critedge2

41:                                               ; preds = %39
  %42 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv.next75
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = getelementptr inbounds [100000 x i32], ptr @a, i64 0, i64 %indvars.iv74
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %.not46 = icmp sgt i32 %43, %45
  br i1 %.not46, label %.critedge2.split.loop.exit89, label %39, !llvm.loop !18

.critedge2.split.loop.exit89:                     ; preds = %41
  %46 = trunc nsw i64 %indvars.iv74 to i32
  %47 = trunc nsw i64 %indvars.iv.next75 to i32
  br label %.critedge2

.critedge2:                                       ; preds = %39, %.critedge2.split.loop.exit89
  %.038.in.lcssa = phi i32 [ %46, %.critedge2.split.loop.exit89 ], [ %36, %39 ]
  %.038.lcssa = phi i32 [ %47, %.critedge2.split.loop.exit89 ], [ %smax76, %39 ]
  %.not4760 = icmp sgt i32 %.03963, %.038.in.lcssa
  br i1 %.not4760, label %.loopexit, label %.lr.ph62.preheader

.lr.ph62.preheader:                               ; preds = %.critedge2
  %48 = add i32 %.038.in.lcssa, 1
  %49 = sub i32 %.038.in.lcssa, %.03963
  %50 = zext i32 %49 to i64
  %51 = add nuw nsw i64 %50, 1
  %min.iters.check98 = icmp ult i32 %49, 7
  br i1 %min.iters.check98, label %.lr.ph62.preheader111, label %vector.ph99

vector.ph99:                                      ; preds = %.lr.ph62.preheader
  %n.vec101 = and i64 %51, 8589934584
  %ind.end102 = add nsw i64 %n.vec101, %34
  %broadcast.splatinsert107 = insertelement <4 x i32> poison, i32 %.038.in.lcssa, i64 0
  %broadcast.splat108 = shufflevector <4 x i32> %broadcast.splatinsert107, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body104

vector.body104:                                   ; preds = %vector.body104, %vector.ph99
  %index105 = phi i64 [ 0, %vector.ph99 ], [ %index.next109, %vector.body104 ]
  %offset.idx106 = add i64 %index105, %34
  %52 = getelementptr inbounds [100001 x i32], ptr @down, i64 0, i64 %offset.idx106
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  store <4 x i32> %broadcast.splat108, ptr %52, align 4, !tbaa !5
  store <4 x i32> %broadcast.splat108, ptr %53, align 4, !tbaa !5
  %index.next109 = add nuw i64 %index105, 8
  %54 = icmp eq i64 %index.next109, %n.vec101
  br i1 %54, label %middle.block96, label %vector.body104, !llvm.loop !19

middle.block96:                                   ; preds = %vector.body104
  %cmp.n110 = icmp eq i64 %51, %n.vec101
  br i1 %cmp.n110, label %.loopexit, label %.lr.ph62.preheader111

.lr.ph62.preheader111:                            ; preds = %middle.block96, %.lr.ph62.preheader
  %indvars.iv78.ph = phi i64 [ %34, %.lr.ph62.preheader ], [ %ind.end102, %middle.block96 ]
  br label %.lr.ph62

.lr.ph62:                                         ; preds = %.lr.ph62.preheader111, %.lr.ph62
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.lr.ph62 ], [ %indvars.iv78.ph, %.lr.ph62.preheader111 ]
  %55 = getelementptr inbounds [100001 x i32], ptr @down, i64 0, i64 %indvars.iv78
  store i32 %.038.in.lcssa, ptr %55, align 4, !tbaa !5
  %indvars.iv.next79 = add nsw i64 %indvars.iv78, 1
  %lftr.wideiv81 = trunc i64 %indvars.iv.next79 to i32
  %exitcond82.not = icmp eq i32 %48, %lftr.wideiv81
  br i1 %exitcond82.not, label %.loopexit, label %.lr.ph62, !llvm.loop !20

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

.lr.ph65:                                         ; preds = %.preheader, %.lr.ph65
  %.064 = phi i32 [ %68, %.lr.ph65 ], [ 0, %.preheader ]
  %56 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @l, ptr noundef nonnull @r)
  %57 = load i32, ptr @l, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr @l, align 4, !tbaa !5
  %59 = load i32, ptr @r, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr @r, align 4, !tbaa !5
  %61 = sext i32 %58 to i64
  %62 = getelementptr inbounds [100000 x i32], ptr @up, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @down, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %.not = icmp slt i32 %66, %60
  %.str.4..str.3 = select i1 %.not, ptr @.str.4, ptr @.str.3
  %67 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.4..str.3)
  %68 = add nuw nsw i32 %.064, 1
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %.lr.ph65, label %._crit_edge, !llvm.loop !21
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #2

attributes #0 = { mustprogress nofree norecurse 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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !14, !15}
!20 = distinct !{!20, !10, !15, !14}
!21 = distinct !{!21, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass