; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100959C)

; 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 [201 x i32], align 16
@dis = external dso_local global [60001 x i32], align 16
@que = external dso_local global [60001 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 [3 x i8], align 1
@.str.1 = 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

; 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
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  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) #5
  br label %26

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i32, ptr @a, 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.memset.p0.i64(ptr align 16 @dis, i8 63, i64 240004, i1 false)
  %27 = call noundef i32 @_Z3idxii(i32 noundef 0, i32 noundef 0)
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %28
  store i32 0, ptr %29, align 4, !tbaa !5
  %30 = call noundef i32 @_Z3idxii(i32 noundef 0, i32 noundef 0)
  %31 = load i32, ptr @R, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr @R, align 4, !tbaa !5
  %33 = sext i32 %31 to i64
  %34 = getelementptr inbounds [60001 x i32], ptr @que, i64 0, i64 %33
  store i32 %30, ptr %34, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %95, %26
  %36 = load i32, ptr @L, align 4, !tbaa !5
  %37 = load i32, ptr @R, align 4, !tbaa !5
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %39, label %96

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %40 = load i32, ptr @L, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr @L, align 4, !tbaa !5
  %42 = sext i32 %40 to i64
  %43 = getelementptr inbounds [60001 x i32], ptr @que, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  store i32 %44, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = call noundef i32 @_Z3rdxiRiS_(i32 noundef %45, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %92, %39
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sub nsw i32 %56, %57
  store i32 %58, ptr %8, align 4, !tbaa !5
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = call noundef zeroext i1 @_Z5validi(i32 noundef %59)
  br i1 %60, label %62, label %61

61:                                               ; preds = %52
  store i32 9, ptr %7, align 4
  br label %89

62:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = xor i32 %63, 1
  store i32 %64, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = load i32, ptr %9, align 4, !tbaa !5
  %67 = call noundef i32 @_Z3idxii(i32 noundef %65, i32 noundef %66)
  store i32 %67, ptr %10, align 4, !tbaa !5
  %68 = load i32, ptr %10, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp ne i32 %71, 1061109567
  br i1 %72, label %73, label %74

73:                                               ; preds = %62
  store i32 9, ptr %7, align 4
  br label %88

74:                                               ; preds = %62
  %75 = load i32, ptr %3, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  %80 = load i32, ptr %10, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %81
  store i32 %79, ptr %82, align 4, !tbaa !5
  %83 = load i32, ptr %10, align 4, !tbaa !5
  %84 = load i32, ptr @R, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr @R, align 4, !tbaa !5
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds [60001 x i32], ptr @que, i64 0, i64 %86
  store i32 %83, ptr %87, align 4, !tbaa !5
  store i32 0, ptr %7, align 4
  br label %88

88:                                               ; preds = %74, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %89

89:                                               ; preds = %88, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %90 = load i32, ptr %7, align 4
  switch i32 %90, label %137 [
    i32 0, label %91
    i32 9, label %92
  ]

91:                                               ; preds = %89
  br label %92

92:                                               ; preds = %91, %89
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %6, align 4, !tbaa !5
  br label %47, !llvm.loop !11

95:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %35, !llvm.loop !12

96:                                               ; preds = %35
  %97 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  br label %98

98:                                               ; preds = %133, %109, %96
  %99 = load i32, ptr @m, align 4, !tbaa !5
  %100 = add nsw i32 %99, -1
  store i32 %100, ptr @m, align 4, !tbaa !5
  %101 = icmp ne i32 %99, 0
  br i1 %101, label %102, label %136

102:                                              ; preds = %98
  %103 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @L, ptr noundef @R)
  %104 = load i32, ptr @L, align 4, !tbaa !5
  %105 = and i32 %104, 1
  %106 = load i32, ptr @R, align 4, !tbaa !5
  %107 = and i32 %106, 1
  %108 = icmp ne i32 %105, %107
  br i1 %108, label %109, label %111

109:                                              ; preds = %102
  %110 = call i32 @puts(ptr noundef @.str.2)
  br label %98, !llvm.loop !13

111:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %112 = load i32, ptr @L, align 4, !tbaa !5
  %113 = load i32, ptr @R, align 4, !tbaa !5
  %114 = add nsw i32 %112, %113
  %115 = ashr i32 %114, 1
  %116 = call noundef i32 @_Z3idxii(i32 noundef %115, i32 noundef 1)
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %117
  %119 = load i32, ptr @R, align 4, !tbaa !5
  %120 = load i32, ptr @L, align 4, !tbaa !5
  %121 = sub nsw i32 %119, %120
  %122 = ashr i32 %121, 1
  %123 = call noundef i32 @_Z3idxii(i32 noundef %122, i32 noundef 0)
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %124
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %118, ptr noundef nonnull align 4 dereferenceable(4) %125)
  %127 = load i32, ptr %126, align 4, !tbaa !5
  store i32 %127, ptr %11, align 4, !tbaa !5
  %128 = load i32, ptr %11, align 4, !tbaa !5
  %129 = icmp ne i32 %128, 1061109567
  br i1 %129, label %130, label %132

130:                                              ; preds = %111
  %131 = load i32, ptr %11, align 4, !tbaa !5
  br label %133

132:                                              ; preds = %111
  br label %133

133:                                              ; preds = %132, %130
  %134 = phi i32 [ %131, %130 ], [ -1, %132 ]
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %134)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %98, !llvm.loop !13

136:                                              ; preds = %98
  ret i32 0

137:                                              ; preds = %89
  unreachable
}

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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3idxii(i32 noundef, i32 noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3rdxiRiS_(i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validi(i32 noundef) #4

declare i32 @puts(ptr noundef) #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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !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 [201 x i32], align 16
@dis = external dso_local global [60001 x i32], align 16
@que = external dso_local local_unnamed_addr global [60001 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 [3 x i8], align 1
@.str.1 = 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

; Function Attrs: mustprogress norecurse nounwind 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)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(240004) @dis, i8 63, i64 240004, i1 false)
  %6 = tail call noundef i32 @_Z3idxii(i32 noundef 0, i32 noundef 0)
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %7
  store i32 0, ptr %8, align 4, !tbaa !5
  %9 = tail call noundef i32 @_Z3idxii(i32 noundef 0, i32 noundef 0)
  %10 = load i32, ptr @R, align 4, !tbaa !5
  %11 = add nsw i32 %10, 1
  store i32 %11, ptr @R, align 4, !tbaa !5
  %12 = sext i32 %10 to i64
  %13 = getelementptr inbounds [60001 x i32], ptr @que, i64 0, i64 %12
  store i32 %9, ptr %13, align 4, !tbaa !5
  %14 = load i32, ptr @L, align 4, !tbaa !5
  %.not33 = icmp sgt i32 %14, %10
  br i1 %.not33, label %._crit_edge28, label %.lr.ph27

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %15 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph27:                                         ; preds = %._crit_edge, %._crit_edge25
  %20 = phi i32 [ %30, %._crit_edge25 ], [ %14, %._crit_edge ]
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr @L, align 4, !tbaa !5
  %22 = sext i32 %20 to i64
  %23 = getelementptr inbounds [60001 x i32], ptr @que, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %25 = call noundef i32 @_Z3rdxiRiS_(i32 noundef %24, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %.lr.ph24, label %._crit_edge25

.lr.ph24:                                         ; preds = %.lr.ph27
  %28 = sext i32 %24 to i64
  %29 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %28
  br label %33

._crit_edge25:                                    ; preds = %53, %.lr.ph27
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %30 = load i32, ptr @L, align 4, !tbaa !5
  %31 = load i32, ptr @R, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph27, label %._crit_edge28, !llvm.loop !11

33:                                               ; preds = %.lr.ph24, %53
  %indvars.iv35 = phi i64 [ 0, %.lr.ph24 ], [ %indvars.iv.next36, %53 ]
  %34 = getelementptr inbounds [201 x i32], ptr @a, i64 0, i64 %indvars.iv35
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %37 = sub nsw i32 %35, %36
  %38 = call noundef zeroext i1 @_Z5validi(i32 noundef %37)
  br i1 %38, label %39, label %53

39:                                               ; preds = %33
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = xor i32 %40, 1
  %42 = call noundef i32 @_Z3idxii(i32 noundef %37, i32 noundef %41)
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %.not20 = icmp eq i32 %45, 1061109567
  br i1 %.not20, label %46, label %53

46:                                               ; preds = %39
  %47 = load i32, ptr %29, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %44, align 4, !tbaa !5
  %49 = load i32, ptr @R, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr @R, align 4, !tbaa !5
  %51 = sext i32 %49 to i64
  %52 = getelementptr inbounds [60001 x i32], ptr @que, i64 0, i64 %51
  store i32 %42, ptr %52, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %46, %39, %33
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next36, %55
  br i1 %56, label %33, label %._crit_edge25, !llvm.loop !12

._crit_edge28:                                    ; preds = %._crit_edge25, %._crit_edge
  %57 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %58 = load i32, ptr @m, align 4, !tbaa !5
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr @m, align 4, !tbaa !5
  %.not29 = icmp eq i32 %58, 0
  br i1 %.not29, label %._crit_edge32, label %.lr.ph31

.lr.ph31:                                         ; preds = %._crit_edge28, %.backedge
  %60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @L, ptr noundef nonnull @R)
  %61 = load i32, ptr @L, align 4, !tbaa !5
  %62 = load i32, ptr @R, align 4, !tbaa !5
  %63 = xor i32 %62, %61
  %64 = and i32 %63, 1
  %.not18 = icmp eq i32 %64, 0
  br i1 %.not18, label %69, label %65

65:                                               ; preds = %.lr.ph31
  %66 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %.backedge

.backedge:                                        ; preds = %65, %69
  %67 = load i32, ptr @m, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %67, 0
  br i1 %.not, label %._crit_edge32, label %.lr.ph31, !llvm.loop !13

69:                                               ; preds = %.lr.ph31
  %70 = add nsw i32 %62, %61
  %71 = ashr i32 %70, 1
  %72 = call noundef i32 @_Z3idxii(i32 noundef %71, i32 noundef 1)
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %73
  %75 = load i32, ptr @R, align 4, !tbaa !5
  %76 = load i32, ptr @L, align 4, !tbaa !5
  %77 = sub nsw i32 %75, %76
  %78 = ashr i32 %77, 1
  %79 = call noundef i32 @_Z3idxii(i32 noundef %78, i32 noundef 0)
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [60001 x i32], ptr @dis, i64 0, i64 %80
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %74, ptr noundef nonnull align 4 dereferenceable(4) %81)
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %.not19 = icmp eq i32 %83, 1061109567
  %84 = select i1 %.not19, i32 -1, i32 %83
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %84)
  br label %.backedge

._crit_edge32:                                    ; preds = %.backedge, %._crit_edge28
  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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3idxii(i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3rdxiRiS_(i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validi(i32 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) 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

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

attributes #0 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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