; LLVM IR from tangjz/acm-icpc :: buaa/oj3rd (1239)

; 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
@t = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@r = external dso_local global [100001 x i32], align 16
@c = external dso_local global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = 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
  store i32 0, ptr %1, align 4
  br label %8

8:                                                ; preds = %115, %0
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @t, ptr noundef @q)
  %10 = icmp eq i32 %9, 4
  br i1 %10, label %11, label %116

11:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  %14 = sext i32 %13 to i64
  %15 = mul i64 %14, 4
  call void @llvm.memset.p0.i64(ptr align 16 @r, i8 0, i64 %15, i1 false)
  %16 = load i32, ptr @m, align 4, !tbaa !5
  %17 = add nsw i32 %16, 1
  %18 = sext i32 %17 to i64
  %19 = mul i64 %18, 4
  call void @llvm.memset.p0.i64(ptr align 16 @c, i8 0, i64 %19, i1 false)
  br label %20

20:                                               ; preds = %24, %11
  %21 = load i32, ptr @t, align 4, !tbaa !5
  %22 = add nsw i32 %21, -1
  store i32 %22, ptr @t, align 4, !tbaa !5
  %23 = icmp ne i32 %21, 0
  br i1 %23, label %24, label %32

24:                                               ; preds = %20
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2, ptr noundef %3)
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %27
  store i32 1, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %30
  store i32 1, ptr %31, align 4, !tbaa !5
  br label %20, !llvm.loop !9

32:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 2, ptr %6, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %49, %32
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %52

38:                                               ; preds = %33
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = sub nsw i32 %39, 1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, %43
  store i32 %48, ptr %46, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %38
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %6, align 4, !tbaa !5
  br label %33, !llvm.loop !11

52:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 2, ptr %7, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %69, %52
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = load i32, ptr @m, align 4, !tbaa !5
  %56 = icmp sle i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %72

58:                                               ; preds = %53
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i32 %67, %63
  store i32 %68, ptr %66, align 4, !tbaa !5
  br label %69

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

72:                                               ; preds = %57
  br label %73

73:                                               ; preds = %110, %72
  %74 = load i32, ptr @q, align 4, !tbaa !5
  %75 = add nsw i32 %74, -1
  store i32 %75, ptr @q, align 4, !tbaa !5
  %76 = icmp ne i32 %74, 0
  br i1 %76, label %77, label %115

77:                                               ; preds = %73
  %78 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sub nsw i32 %82, %87
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = sub nsw i32 %89, %90
  %92 = add nsw i32 %91, 1
  %93 = icmp eq i32 %88, %92
  br i1 %93, label %110, label %94

94:                                               ; preds = %77
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = load i32, ptr %3, align 4, !tbaa !5
  %100 = sub nsw i32 %99, 1
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sub nsw i32 %98, %103
  %105 = load i32, ptr %5, align 4, !tbaa !5
  %106 = load i32, ptr %3, align 4, !tbaa !5
  %107 = sub nsw i32 %105, %106
  %108 = add nsw i32 %107, 1
  %109 = icmp eq i32 %104, %108
  br label %110

110:                                              ; preds = %94, %77
  %111 = phi i1 [ true, %77 ], [ %109, %94 ]
  %112 = zext i1 %111 to i64
  %113 = select i1 %111, ptr @.str.2, ptr @.str.3
  %114 = call i32 @puts(ptr noundef %113)
  br label %73, !llvm.loop !13

115:                                              ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %8, !llvm.loop !14

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

; 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@r = external dso_local local_unnamed_addr global [100001 x i32], align 16
@c = external dso_local local_unnamed_addr global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = 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 = 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, ptr noundef nonnull @m, ptr noundef nonnull @t, ptr noundef nonnull @q)
  %6 = icmp eq i32 %5, 4
  br i1 %6, label %.lr.ph26, label %._crit_edge27

.lr.ph26:                                         ; preds = %0, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = add nsw i32 %7, 1
  %9 = sext i32 %8 to i64
  %10 = shl nsw i64 %9, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @r, i8 0, i64 %10, i1 false)
  %11 = load i32, ptr @m, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  %13 = sext i32 %12 to i64
  %14 = shl nsw i64 %13, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @c, i8 0, i64 %14, i1 false)
  %15 = load i32, ptr @t, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr @t, align 4, !tbaa !5
  %.not16 = icmp eq i32 %15, 0
  br i1 %.not16, label %.preheader15, label %.lr.ph

.preheader15.loopexit:                            ; preds = %.lr.ph
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader15

.preheader15:                                     ; preds = %.preheader15.loopexit, %.lr.ph26
  %17 = phi i32 [ %.pre, %.preheader15.loopexit ], [ %7, %.lr.ph26 ]
  %.not917 = icmp slt i32 %17, 2
  br i1 %.not917, label %.preheader14, label %.lr.ph19.preheader

.lr.ph19.preheader:                               ; preds = %.preheader15
  %18 = add nuw i32 %17, 1
  %wide.trip.count = zext i32 %18 to i64
  %.pre34 = load i32, ptr getelementptr inbounds (i8, ptr @r, i64 4), align 4, !tbaa !5
  %19 = add nsw i64 %wide.trip.count, -2
  %20 = add nsw i64 %wide.trip.count, -3
  %xtraiter = and i64 %19, 3
  %21 = icmp ult i64 %20, 3
  br i1 %21, label %.preheader14.loopexit.unr-lcssa, label %.lr.ph19.preheader.new

.lr.ph19.preheader.new:                           ; preds = %.lr.ph19.preheader
  %unroll_iter = and i64 %19, -4
  br label %.lr.ph19

.lr.ph:                                           ; preds = %.lr.ph26, %.lr.ph
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %24
  store i32 1, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %27
  store i32 1, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr @t, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %.preheader15.loopexit, label %.lr.ph, !llvm.loop !9

.preheader14.loopexit.unr-lcssa:                  ; preds = %.lr.ph19, %.lr.ph19.preheader
  %.unr = phi i32 [ %.pre34, %.lr.ph19.preheader ], [ %52, %.lr.ph19 ]
  %indvars.iv.unr = phi i64 [ 2, %.lr.ph19.preheader ], [ %indvars.iv.next.3, %.lr.ph19 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader14, label %.lr.ph19.epil

.lr.ph19.epil:                                    ; preds = %.preheader14.loopexit.unr-lcssa, %.lr.ph19.epil
  %31 = phi i32 [ %34, %.lr.ph19.epil ], [ %.unr, %.preheader14.loopexit.unr-lcssa ]
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph19.epil ], [ %indvars.iv.unr, %.preheader14.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph19.epil ], [ 0, %.preheader14.loopexit.unr-lcssa ]
  %32 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %indvars.iv.epil
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = add nsw i32 %33, %31
  store i32 %34, ptr %32, align 4, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.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 %.preheader14, label %.lr.ph19.epil, !llvm.loop !11

.preheader14:                                     ; preds = %.preheader14.loopexit.unr-lcssa, %.lr.ph19.epil, %.preheader15
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %.not1020 = icmp slt i32 %35, 2
  br i1 %.not1020, label %.preheader, label %.lr.ph22.preheader

.lr.ph22.preheader:                               ; preds = %.preheader14
  %36 = add nuw i32 %35, 1
  %wide.trip.count32 = zext i32 %36 to i64
  %.pre35 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 4), align 4, !tbaa !5
  %37 = add nsw i64 %wide.trip.count32, -2
  %38 = add nsw i64 %wide.trip.count32, -3
  %xtraiter36 = and i64 %37, 3
  %39 = icmp ult i64 %38, 3
  br i1 %39, label %.preheader.loopexit.unr-lcssa, label %.lr.ph22.preheader.new

.lr.ph22.preheader.new:                           ; preds = %.lr.ph22.preheader
  %unroll_iter40 = and i64 %37, -4
  br label %.lr.ph22

.lr.ph19:                                         ; preds = %.lr.ph19, %.lr.ph19.preheader.new
  %40 = phi i32 [ %.pre34, %.lr.ph19.preheader.new ], [ %52, %.lr.ph19 ]
  %indvars.iv = phi i64 [ 2, %.lr.ph19.preheader.new ], [ %indvars.iv.next.3, %.lr.ph19 ]
  %niter = phi i64 [ 0, %.lr.ph19.preheader.new ], [ %niter.next.3, %.lr.ph19 ]
  %41 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %indvars.iv
  %42 = load i32, ptr %41, align 8, !tbaa !5
  %43 = add nsw i32 %42, %40
  store i32 %43, ptr %41, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %44 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %indvars.iv.next
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, %43
  store i32 %46, ptr %44, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %47 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %indvars.iv.next.1
  %48 = load i32, ptr %47, align 8, !tbaa !5
  %49 = add nsw i32 %48, %46
  store i32 %49, ptr %47, align 8, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %50 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %indvars.iv.next.2
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, %49
  store i32 %52, ptr %50, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 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 %.preheader14.loopexit.unr-lcssa, label %.lr.ph19, !llvm.loop !13

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph22, %.lr.ph22.preheader
  %.unr38 = phi i32 [ %.pre35, %.lr.ph22.preheader ], [ %71, %.lr.ph22 ]
  %indvars.iv29.unr = phi i64 [ 2, %.lr.ph22.preheader ], [ %indvars.iv.next30.3, %.lr.ph22 ]
  %lcmp.mod39.not = icmp eq i64 %xtraiter36, 0
  br i1 %lcmp.mod39.not, label %.preheader, label %.lr.ph22.epil

.lr.ph22.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph22.epil
  %53 = phi i32 [ %56, %.lr.ph22.epil ], [ %.unr38, %.preheader.loopexit.unr-lcssa ]
  %indvars.iv29.epil = phi i64 [ %indvars.iv.next30.epil, %.lr.ph22.epil ], [ %indvars.iv29.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter37 = phi i64 [ %epil.iter37.next, %.lr.ph22.epil ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %54 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %indvars.iv29.epil
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, %53
  store i32 %56, ptr %54, align 4, !tbaa !5
  %indvars.iv.next30.epil = add nuw nsw i64 %indvars.iv29.epil, 1
  %epil.iter37.next = add i64 %epil.iter37, 1
  %epil.iter37.cmp.not = icmp eq i64 %epil.iter37.next, %xtraiter36
  br i1 %epil.iter37.cmp.not, label %.preheader, label %.lr.ph22.epil, !llvm.loop !14

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph22.epil, %.preheader14
  %57 = load i32, ptr @q, align 4, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr @q, align 4, !tbaa !5
  %.not1123 = icmp eq i32 %57, 0
  br i1 %.not1123, label %._crit_edge, label %.lr.ph24

.lr.ph22:                                         ; preds = %.lr.ph22, %.lr.ph22.preheader.new
  %59 = phi i32 [ %.pre35, %.lr.ph22.preheader.new ], [ %71, %.lr.ph22 ]
  %indvars.iv29 = phi i64 [ 2, %.lr.ph22.preheader.new ], [ %indvars.iv.next30.3, %.lr.ph22 ]
  %niter41 = phi i64 [ 0, %.lr.ph22.preheader.new ], [ %niter41.next.3, %.lr.ph22 ]
  %60 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %indvars.iv29
  %61 = load i32, ptr %60, align 8, !tbaa !5
  %62 = add nsw i32 %61, %59
  store i32 %62, ptr %60, align 8, !tbaa !5
  %indvars.iv.next30 = or disjoint i64 %indvars.iv29, 1
  %63 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %indvars.iv.next30
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %64, %62
  store i32 %65, ptr %63, align 4, !tbaa !5
  %indvars.iv.next30.1 = add nuw nsw i64 %indvars.iv29, 2
  %66 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %indvars.iv.next30.1
  %67 = load i32, ptr %66, align 8, !tbaa !5
  %68 = add nsw i32 %67, %65
  store i32 %68, ptr %66, align 8, !tbaa !5
  %indvars.iv.next30.2 = add nuw nsw i64 %indvars.iv29, 3
  %69 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %indvars.iv.next30.2
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, %68
  store i32 %71, ptr %69, align 4, !tbaa !5
  %indvars.iv.next30.3 = add nuw nsw i64 %indvars.iv29, 4
  %niter41.next.3 = add i64 %niter41, 4
  %niter41.ncmp.3 = icmp eq i64 %niter41.next.3, %unroll_iter40
  br i1 %niter41.ncmp.3, label %.preheader.loopexit.unr-lcssa, label %.lr.ph22, !llvm.loop !15

.lr.ph24:                                         ; preds = %.preheader, %100
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = load i32, ptr %1, align 4, !tbaa !5
  %78 = add nsw i32 %77, -1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100001 x i32], ptr @r, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sub nsw i32 %76, %81
  %83 = add i32 %73, 1
  %84 = sub i32 %83, %77
  %85 = icmp eq i32 %82, %84
  br i1 %85, label %.thread, label %86

86:                                               ; preds = %.lr.ph24
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100001 x i32], ptr @c, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sub nsw i32 %90, %95
  %97 = add i32 %87, 1
  %98 = sub i32 %97, %91
  %99 = icmp eq i32 %96, %98
  %cond.fr = freeze i1 %99
  br i1 %cond.fr, label %.thread, label %100

.thread:                                          ; preds = %.lr.ph24, %86
  br label %100

100:                                              ; preds = %86, %.thread
  %101 = phi ptr [ @.str.2, %.thread ], [ @.str.3, %86 ]
  %102 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %101)
  %103 = load i32, ptr @q, align 4, !tbaa !5
  %104 = add nsw i32 %103, -1
  store i32 %104, ptr @q, align 4, !tbaa !5
  %.not11 = icmp eq i32 %103, 0
  br i1 %.not11, label %._crit_edge, label %.lr.ph24, !llvm.loop !16

._crit_edge:                                      ; preds = %100, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %105 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @t, ptr noundef nonnull @q)
  %106 = icmp eq i32 %105, 4
  br i1 %106, label %.lr.ph26, label %._crit_edge27, !llvm.loop !17

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

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

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

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


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