; LLVM IR from tangjz/acm-icpc :: hackerrank (move-the-coins)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [50001 x i32], align 16
@f = external dso_local global [50001 x [2 x i32]], align 16
@dep = external dso_local global [50001 x i32], align 16
@fa = external dso_local global [16 x [50001 x i32]], align 16
@e = external dso_local global [50001 x %"class.std::vector"], align 16
@.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 [8 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 uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #0

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %26, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sle i32 %17, %18
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr @a, i64 %23
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %24)
  br label %26

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !9

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

30:                                               ; preds = %43, %29
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %46

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4, ptr noundef %5)
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %38
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %41
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %43

43:                                               ; preds = %35
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !5
  br label %30, !llvm.loop !11

46:                                               ; preds = %34
  call void @_Z3dfsi(i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %85, %46
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = shl i32 1, %48
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = icmp sle i32 %49, %50
  br i1 %51, label %53, label %52

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

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

54:                                               ; preds = %81, %53
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %84

59:                                               ; preds = %54
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %62
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sub nsw i32 %64, 1
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %66
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [50001 x i32], ptr %67, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [50001 x i32], ptr %63, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %76
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [50001 x i32], ptr %77, i64 0, i64 %79
  store i32 %74, ptr %80, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %59
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %8, align 4, !tbaa !5
  br label %54, !llvm.loop !12

84:                                               ; preds = %58
  br label %85

85:                                               ; preds = %84
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %6, align 4, !tbaa !5
  br label %47, !llvm.loop !13

88:                                               ; preds = %52
  %89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  br label %90

90:                                               ; preds = %170, %168, %88
  %91 = load i32, ptr @m, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr @m, align 4, !tbaa !5
  %93 = icmp ne i32 %91, 0
  br i1 %93, label %94, label %171

94:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %95 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %9, ptr noundef %10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %96 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %96, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %97 = load i32, ptr %10, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [50001 x i32], ptr @dep, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [50001 x i32], ptr @dep, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sub nsw i32 %100, %104
  store i32 %105, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %123, %94
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = icmp sgt i32 %107, 0
  br i1 %108, label %110, label %109

109:                                              ; preds = %106
  store i32 16, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %128

110:                                              ; preds = %106
  %111 = load i32, ptr %12, align 4, !tbaa !5
  %112 = and i32 %111, 1
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %122

114:                                              ; preds = %110
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %116
  %118 = load i32, ptr %11, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [50001 x i32], ptr %117, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  store i32 %121, ptr %11, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %114, %110
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %12, align 4, !tbaa !5
  %125 = ashr i32 %124, 1
  store i32 %125, ptr %12, align 4, !tbaa !5
  %126 = load i32, ptr %13, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %13, align 4, !tbaa !5
  br label %106, !llvm.loop !14

128:                                              ; preds = %109
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = load i32, ptr %11, align 4, !tbaa !5
  %131 = icmp eq i32 %129, %130
  br i1 %131, label %132, label %134

132:                                              ; preds = %128
  %133 = call i32 @puts(ptr noundef @.str.2)
  store i32 14, ptr %7, align 4
  br label %168, !llvm.loop !15

134:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %135 = load i32, ptr getelementptr inbounds ([2 x i32], ptr getelementptr inbounds ([50001 x [2 x i32]], ptr @f, i64 0, i64 1), i64 0, i64 1), align 4, !tbaa !5
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [50001 x i32], ptr @dep, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = and i32 %139, 1
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [50001 x i32], ptr @dep, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = and i32 %144, 1
  %146 = icmp eq i32 %140, %145
  br i1 %146, label %147, label %159

147:                                              ; preds = %134
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [50001 x [2 x i32]], ptr @f, i64 0, i64 %149
  %151 = getelementptr inbounds [2 x i32], ptr %150, i64 0, i64 0
  %152 = load i32, ptr %151, align 8, !tbaa !5
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [50001 x [2 x i32]], ptr @f, i64 0, i64 %154
  %156 = getelementptr inbounds [2 x i32], ptr %155, i64 0, i64 1
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = xor i32 %152, %157
  br label %160

159:                                              ; preds = %134
  br label %160

160:                                              ; preds = %159, %147
  %161 = phi i32 [ %158, %147 ], [ 0, %159 ]
  %162 = xor i32 %135, %161
  store i32 %162, ptr %14, align 4, !tbaa !5
  %163 = load i32, ptr %14, align 4, !tbaa !5
  %164 = icmp ne i32 %163, 0
  %165 = zext i1 %164 to i64
  %166 = select i1 %164, ptr @.str.3, ptr @.str.4
  %167 = call i32 @puts(ptr noundef %166)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  store i32 0, ptr %7, align 4
  br label %168

168:                                              ; preds = %160, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  %169 = load i32, ptr %7, align 4
  switch i32 %169, label %172 [
    i32 0, label %170
    i32 14, label %90
  ]

170:                                              ; preds = %168
  br label %90, !llvm.loop !15

171:                                              ; preds = %90
  ret i32 0

172:                                              ; preds = %168
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

declare i32 @puts(ptr noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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}
!15 = distinct !{!15, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [50001 x i32], align 16
@f = external dso_local local_unnamed_addr global [50001 x [2 x i32]], align 16
@dep = external dso_local local_unnamed_addr global [50001 x i32], align 16
@fa = external dso_local local_unnamed_addr global [16 x [50001 x i32]], align 16
@e = external dso_local global [50001 x %"class.std::vector"], align 16
@.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 [8 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 uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #0

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

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

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

.preheader34:                                     ; preds = %.lr.ph
  %7 = icmp sgt i32 %10, 1
  br i1 %7, label %.lr.ph38, label %._crit_edge

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

._crit_edge:                                      ; preds = %.lr.ph38, %0, %.preheader34
  call void @_Z3dfsi(i32 noundef 1)
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %.not2943 = icmp slt i32 %12, 2
  br i1 %.not2943, label %._crit_edge45, label %.preheader.preheader

.preheader.preheader:                             ; preds = %._crit_edge
  %13 = zext nneg i32 %12 to i64
  %xtraiter = and i64 %13, 1
  %unroll_iter = and i64 %13, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader

.lr.ph38:                                         ; preds = %.preheader34, %.lr.ph38
  %.02737 = phi i32 [ %21, %.lr.ph38 ], [ 1, %.preheader34 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %16
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %19
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %20, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %21 = add nuw nsw i32 %.02737, 1
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %.lr.ph38, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge42
  %indvars.iv60 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next61, %._crit_edge42 ]
  %24 = add nsw i64 %indvars.iv60, -1
  br label %36

._crit_edge45:                                    ; preds = %._crit_edge42, %._crit_edge
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = add nsw i32 %26, -1
  store i32 %27, ptr @m, align 4, !tbaa !5
  %.not3052 = icmp eq i32 %26, 0
  br i1 %.not3052, label %._crit_edge55, label %.lr.ph54

._crit_edge42.unr-lcssa:                          ; preds = %36
  br i1 %lcmp.mod.not, label %._crit_edge42, label %._crit_edge42.epilog-lcssa

._crit_edge42.epilog-lcssa:                       ; preds = %._crit_edge42.unr-lcssa
  %28 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %24, i64 %indvars.iv.next58.1
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %24, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %indvars.iv60, i64 %indvars.iv.next58.1
  store i32 %32, ptr %33, align 4, !tbaa !5
  br label %._crit_edge42

._crit_edge42:                                    ; preds = %._crit_edge42.unr-lcssa, %._crit_edge42.epilog-lcssa
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %34 = trunc nuw nsw i64 %indvars.iv60 to i32
  %35 = shl nuw i32 2, %34
  %.not29 = icmp sgt i32 %35, %12
  br i1 %.not29, label %._crit_edge45, label %.preheader, !llvm.loop !12

36:                                               ; preds = %36, %.preheader
  %indvars.iv57 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next58.1, %36 ]
  %niter = phi i64 [ 0, %.preheader ], [ %niter.next.1, %36 ]
  %37 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %24, i64 %indvars.iv57
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %24, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %indvars.iv60, i64 %indvars.iv57
  store i32 %41, ptr %42, align 4, !tbaa !5
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %43 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %24, i64 %indvars.iv.next58
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %24, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %indvars.iv60, i64 %indvars.iv.next58
  store i32 %47, ptr %48, align 4, !tbaa !5
  %indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge42.unr-lcssa, label %36, !llvm.loop !13

.lr.ph54:                                         ; preds = %._crit_edge45, %82
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [50001 x i32], ptr @dep, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [50001 x i32], ptr @dep, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = sub nsw i32 %53, %57
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph50, label %._crit_edge51

._crit_edge51:                                    ; preds = %66, %.lr.ph54
  %.024.lcssa = phi i32 [ %50, %.lr.ph54 ], [ %.1, %66 ]
  %60 = icmp eq i32 %54, %.024.lcssa
  br i1 %60, label %82, label %68, !llvm.loop !14

.lr.ph50:                                         ; preds = %.lr.ph54, %66
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %66 ], [ 0, %.lr.ph54 ]
  %.02347 = phi i32 [ %67, %66 ], [ %58, %.lr.ph54 ]
  %.02446 = phi i32 [ %.1, %66 ], [ %50, %.lr.ph54 ]
  %61 = and i32 %.02347, 1
  %.not32 = icmp eq i32 %61, 0
  br i1 %.not32, label %66, label %62

62:                                               ; preds = %.lr.ph50
  %63 = sext i32 %.02446 to i64
  %64 = getelementptr inbounds [16 x [50001 x i32]], ptr @fa, i64 0, i64 %indvars.iv63, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %.lr.ph50, %62
  %.1 = phi i32 [ %65, %62 ], [ %.02446, %.lr.ph50 ]
  %67 = lshr i32 %.02347, 1
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %.not = icmp ult i32 %.02347, 2
  br i1 %.not, label %._crit_edge51, label %.lr.ph50, !llvm.loop !15

68:                                               ; preds = %._crit_edge51
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @f, i64 12), align 4, !tbaa !5
  %70 = xor i32 %57, %53
  %71 = and i32 %70, 1
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %79

73:                                               ; preds = %68
  %74 = getelementptr inbounds [50001 x [2 x i32]], ptr @f, i64 0, i64 %55
  %75 = load i32, ptr %74, align 8, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %74, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = xor i32 %77, %75
  br label %79

79:                                               ; preds = %68, %73
  %80 = phi i32 [ %78, %73 ], [ 0, %68 ]
  %.not31 = icmp eq i32 %69, %80
  %81 = select i1 %.not31, ptr @.str.4, ptr @.str.3
  br label %82

82:                                               ; preds = %._crit_edge51, %79
  %.sink = phi ptr [ %81, %79 ], [ @.str.2, %._crit_edge51 ]
  %83 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.sink)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %84 = load i32, ptr @m, align 4, !tbaa !5
  %85 = add nsw i32 %84, -1
  store i32 %85, ptr @m, align 4, !tbaa !5
  %.not30 = icmp eq i32 %84, 0
  br i1 %.not30, label %._crit_edge55, label %.lr.ph54

._crit_edge55:                                    ; preds = %82, %._crit_edge45
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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


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