; LLVM IR from ippeb/ACM-ICPC :: dynamic_programming/RMQ (RMQ_sparse_table)

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

@A = external dso_local global [100001 x i32], align 16
@M = external dso_local global [100001 x [66 x i32]], align 16
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3RMQii(i32 noundef, i32 noundef) #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
  %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)
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %13

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

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %26

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

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

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

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

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %41

32:                                               ; preds = %27
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %35
  %37 = getelementptr inbounds [66 x i32], ptr %36, i64 0, i64 0
  store i32 %33, ptr %37, align 8, !tbaa !5
  br label %38

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

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

42:                                               ; preds = %126, %41
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = shl i32 1, %43
  %45 = sub nsw i32 %44, 1
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %42
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %129

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

50:                                               ; preds = %122, %49
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = shl i32 1, %52
  %54 = add nsw i32 %51, %53
  %55 = sub nsw i32 %54, 1
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %50
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %125

59:                                               ; preds = %50
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %61
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [66 x i32], ptr %62, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = shl i32 1, %73
  %75 = add nsw i32 %71, %74
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %76
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = sub nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [66 x i32], ptr %77, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = icmp sgt i32 %70, %85
  br i1 %86, label %87, label %102

87:                                               ; preds = %59
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %89
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sub nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [66 x i32], ptr %90, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = load i32, ptr %6, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %97
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [66 x i32], ptr %98, i64 0, i64 %100
  store i32 %95, ptr %101, align 4, !tbaa !5
  br label %121

102:                                              ; preds = %59
  %103 = load i32, ptr %6, align 4, !tbaa !5
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 1
  %106 = shl i32 1, %105
  %107 = add nsw i32 %103, %106
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %108
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = sub nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [66 x i32], ptr %109, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %116
  %118 = load i32, ptr %4, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [66 x i32], ptr %117, i64 0, i64 %119
  store i32 %114, ptr %120, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %102, %87
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %6, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %6, align 4, !tbaa !5
  br label %50, !llvm.loop !12

125:                                              ; preds = %58
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %4, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %4, align 4, !tbaa !5
  br label %42, !llvm.loop !13

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

130:                                              ; preds = %144, %129
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = load i32, ptr @q, align 4, !tbaa !5
  %133 = icmp slt i32 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %147

135:                                              ; preds = %130
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %136 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %8, ptr noundef %9)
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = call noundef i32 @_Z3RMQii(i32 noundef %137, i32 noundef %138)
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %142)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %144

144:                                              ; preds = %135
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %7, align 4, !tbaa !5
  br label %130, !llvm.loop !14

147:                                              ; preds = %134
  %148 = load i32, ptr %1, align 4
  ret i32 %148
}

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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}


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

@A = external dso_local global [100001 x i32], align 16
@M = external dso_local local_unnamed_addr global [100001 x [66 x i32]], align 16
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3RMQii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %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)
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @q)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.preheader

.preheader36:                                     ; preds = %.lr.ph
  %7 = icmp sgt i32 %11, 0
  br i1 %7, label %.lr.ph39.preheader, label %.preheader

.lr.ph39.preheader:                               ; preds = %.preheader36
  %wide.trip.count = zext nneg i32 %11 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %8 = icmp ult i32 %11, 4
  br i1 %8, label %.preheader35.unr-lcssa, label %.lr.ph39.preheader.new

.lr.ph39.preheader.new:                           ; preds = %.lr.ph39.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483644
  br label %.lr.ph39

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

.preheader35.unr-lcssa:                           ; preds = %.lr.ph39, %.lr.ph39.preheader
  %indvars.iv47.unr = phi i64 [ 0, %.lr.ph39.preheader ], [ %indvars.iv.next48.3, %.lr.ph39 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader35, label %.lr.ph39.epil

.lr.ph39.epil:                                    ; preds = %.preheader35.unr-lcssa, %.lr.ph39.epil
  %indvars.iv47.epil = phi i64 [ %indvars.iv.next48.epil, %.lr.ph39.epil ], [ %indvars.iv47.unr, %.preheader35.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph39.epil ], [ 0, %.preheader35.unr-lcssa ]
  %14 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv47.epil
  %15 = trunc nuw nsw i64 %indvars.iv47.epil to i32
  store i32 %15, ptr %14, align 8, !tbaa !5
  %indvars.iv.next48.epil = add nuw nsw i64 %indvars.iv47.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader35, label %.lr.ph39.epil, !llvm.loop !11

.preheader35:                                     ; preds = %.lr.ph39.epil, %.preheader35.unr-lcssa
  %.not41 = icmp eq i32 %11, 1
  br i1 %.not41, label %.preheader, label %.preheader34.preheader

.preheader34.preheader:                           ; preds = %.preheader35
  %16 = zext nneg i32 %11 to i64
  br label %.preheader34

.lr.ph39:                                         ; preds = %.lr.ph39, %.lr.ph39.preheader.new
  %indvars.iv47 = phi i64 [ 0, %.lr.ph39.preheader.new ], [ %indvars.iv.next48.3, %.lr.ph39 ]
  %niter = phi i64 [ 0, %.lr.ph39.preheader.new ], [ %niter.next.3, %.lr.ph39 ]
  %17 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv47
  %18 = trunc nuw nsw i64 %indvars.iv47 to i32
  store i32 %18, ptr %17, align 16, !tbaa !5
  %indvars.iv.next48 = or disjoint i64 %indvars.iv47, 1
  %19 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv.next48
  %20 = trunc nuw nsw i64 %indvars.iv.next48 to i32
  store i32 %20, ptr %19, align 8, !tbaa !5
  %indvars.iv.next48.1 = or disjoint i64 %indvars.iv47, 2
  %21 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv.next48.1
  %22 = trunc nuw nsw i64 %indvars.iv.next48.1 to i32
  store i32 %22, ptr %21, align 16, !tbaa !5
  %indvars.iv.next48.2 = or disjoint i64 %indvars.iv47, 3
  %23 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv.next48.2
  %24 = trunc nuw nsw i64 %indvars.iv.next48.2 to i32
  store i32 %24, ptr %23, align 8, !tbaa !5
  %indvars.iv.next48.3 = add nuw nsw i64 %indvars.iv47, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader35.unr-lcssa, label %.lr.ph39, !llvm.loop !13

.preheader34:                                     ; preds = %.preheader34.preheader, %49
  %indvars.iv53 = phi i64 [ 1, %.preheader34.preheader ], [ %indvars.iv.next54, %49 ]
  %25 = phi i32 [ 2, %.preheader34.preheader ], [ %51, %49 ]
  %26 = add nsw i64 %indvars.iv53, -1
  %27 = trunc nuw nsw i64 %26 to i32
  %28 = shl nuw i32 1, %27
  %29 = sext i32 %25 to i64
  %30 = sext i32 %28 to i64
  %invariant.op = sub nsw i64 %16, %29
  %smax = tail call i64 @llvm.smax.i64(i64 %invariant.op, i64 0)
  %31 = icmp slt i64 %invariant.op, 1
  br i1 %31, label %.unr-lcssa, label %.preheader34.new

.preheader34.new:                                 ; preds = %.preheader34
  %32 = add nuw nsw i64 %smax, 1
  %unroll_iter63 = and i64 %32, 9223372036854775806
  br label %52

.preheader:                                       ; preds = %49, %0, %.preheader36, %.preheader35
  %33 = load i32, ptr @q, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph44, label %._crit_edge

.unr-lcssa:                                       ; preds = %52, %.preheader34
  %indvars.iv50.unr = phi i64 [ 0, %.preheader34 ], [ %indvars.iv.next51.1, %52 ]
  %35 = and i64 %smax, 1
  %lcmp.mod62.not.not = icmp eq i64 %35, 0
  br i1 %lcmp.mod62.not.not, label %.epilog-lcssa, label %49

.epilog-lcssa:                                    ; preds = %.unr-lcssa
  %36 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv50.unr, i64 %26
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nuw nsw i64 %indvars.iv50.unr, %30
  %42 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %41, i64 %26
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = icmp sgt i32 %40, %46
  %spec.select.epil = select i1 %47, i32 %37, i32 %43
  %48 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv50.unr, i64 %indvars.iv53
  store i32 %spec.select.epil, ptr %48, align 4
  br label %49

49:                                               ; preds = %.unr-lcssa, %.epilog-lcssa
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %50 = trunc nuw nsw i64 %indvars.iv53 to i32
  %51 = shl nuw i32 2, %50
  %.not = icmp sgt i32 %51, %11
  br i1 %.not, label %.preheader, label %.preheader34, !llvm.loop !14

52:                                               ; preds = %52, %.preheader34.new
  %indvars.iv50 = phi i64 [ 0, %.preheader34.new ], [ %indvars.iv.next51.1, %52 ]
  %niter64 = phi i64 [ 0, %.preheader34.new ], [ %niter64.next.1, %52 ]
  %53 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv50, i64 %26
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = add nuw nsw i64 %indvars.iv50, %30
  %59 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %58, i64 %26
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp sgt i32 %57, %63
  %spec.select = select i1 %64, i32 %54, i32 %60
  %65 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv50, i64 %indvars.iv53
  store i32 %spec.select, ptr %65, align 4
  %indvars.iv.next51 = or disjoint i64 %indvars.iv50, 1
  %66 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv.next51, i64 %26
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nuw nsw i64 %indvars.iv.next51, %30
  %72 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %71, i64 %26
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp sgt i32 %70, %76
  %spec.select.1 = select i1 %77, i32 %67, i32 %73
  %78 = getelementptr inbounds [100001 x [66 x i32]], ptr @M, i64 0, i64 %indvars.iv.next51, i64 %indvars.iv53
  store i32 %spec.select.1, ptr %78, align 4
  %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
  %niter64.next.1 = add i64 %niter64, 2
  %niter64.ncmp.1.not = icmp eq i64 %niter64.next.1, %unroll_iter63
  br i1 %niter64.ncmp.1.not, label %.unr-lcssa, label %52, !llvm.loop !15

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

.lr.ph44:                                         ; preds = %.preheader, %.lr.ph44
  %.02943 = phi i32 [ %87, %.lr.ph44 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %79 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %80 = load i32, ptr %1, align 4, !tbaa !5
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = call noundef i32 @_Z3RMQii(i32 noundef %80, i32 noundef %81)
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100001 x i32], ptr @A, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %85)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %87 = add nuw nsw i32 %.02943, 1
  %88 = load i32, ptr @q, align 4, !tbaa !5
  %89 = icmp slt i32 %87, %88
  br i1 %89, label %.lr.ph44, label %._crit_edge, !llvm.loop !16
}

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

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

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

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


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