; LLVM IR from tangjz/acm-icpc :: 51nod (1851)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@buf = external dso_local global [10000001 x i8], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [4 x i32], align 16
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %11

11:                                               ; preds = %162, %0
  %12 = load i32, ptr @t, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @t, align 4, !tbaa !5
  %14 = icmp ne i32 %12, 0
  br i1 %14, label %15, label %163

15:                                               ; preds = %11
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp sge i32 %17, 2
  br i1 %18, label %19, label %62

19:                                               ; preds = %15
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %21 = icmp sge i32 %20, 2
  br i1 %21, label %22, label %62

22:                                               ; preds = %19
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 2
  br i1 %24, label %28, label %25

25:                                               ; preds = %22
  %26 = load i32, ptr @m, align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 2
  br i1 %27, label %28, label %62

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

29:                                               ; preds = %53, %28
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr @n, align 4, !tbaa !5
  %32 = icmp ne i32 %30, 0
  br i1 %32, label %33, label %54

33:                                               ; preds = %29
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %50, %33
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr @m, align 4, !tbaa !5
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %53

40:                                               ; preds = %35
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = sext i8 %44 to i32
  %46 = icmp eq i32 %45, 49
  %47 = zext i1 %46 to i32
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, %47
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %40
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  br label %35, !llvm.loop !10

53:                                               ; preds = %39
  br label %29, !llvm.loop !12

54:                                               ; preds = %29
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = and i32 %55, 1
  %57 = icmp ne i32 %56, 0
  %58 = xor i1 %57, true
  %59 = zext i1 %58 to i64
  %60 = select i1 %58, ptr @.str.3, ptr @.str.4
  %61 = call i32 @puts(ptr noundef %60)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %162

62:                                               ; preds = %25, %19, %15
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp eq i32 %63, 2
  br i1 %64, label %65, label %102

65:                                               ; preds = %62
  %66 = load i32, ptr @m, align 4, !tbaa !5
  %67 = icmp eq i32 %66, 2
  br i1 %67, label %68, label %102

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

69:                                               ; preds = %93, %68
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = add nsw i32 %70, -1
  store i32 %71, ptr @n, align 4, !tbaa !5
  %72 = icmp ne i32 %70, 0
  br i1 %72, label %73, label %94

73:                                               ; preds = %69
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %90, %73
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = load i32, ptr @m, align 4, !tbaa !5
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %93

80:                                               ; preds = %75
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !9
  %85 = sext i8 %84 to i32
  %86 = icmp eq i32 %85, 49
  %87 = zext i1 %86 to i32
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = add nsw i32 %88, %87
  store i32 %89, ptr %4, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %80
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %5, align 4, !tbaa !5
  br label %75, !llvm.loop !13

93:                                               ; preds = %79
  br label %69, !llvm.loop !14

94:                                               ; preds = %69
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = and i32 %95, 3
  %97 = icmp ne i32 %96, 0
  %98 = xor i1 %97, true
  %99 = zext i1 %98 to i64
  %100 = select i1 %98, ptr @.str.3, ptr @.str.4
  %101 = call i32 @puts(ptr noundef %100)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %161

102:                                              ; preds = %65, %62
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  call void @llvm.memset.p0.i64(ptr align 16 %6, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %135, %102
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = load i32, ptr @n, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 14, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %138

108:                                              ; preds = %103
  %109 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %131, %108
  %111 = load i32, ptr %9, align 4, !tbaa !5
  %112 = load i32, ptr @m, align 4, !tbaa !5
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %134

115:                                              ; preds = %110
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %117
  %119 = load i8, ptr %118, align 1, !tbaa !9
  %120 = sext i8 %119 to i32
  %121 = icmp eq i32 %120, 49
  %122 = zext i1 %121 to i32
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = add nsw i32 %123, %124
  %126 = and i32 %125, 3
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = xor i32 %129, %122
  store i32 %130, ptr %128, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %115
  %132 = load i32, ptr %9, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %9, align 4, !tbaa !5
  br label %110, !llvm.loop !15

134:                                              ; preds = %114
  br label %135

135:                                              ; preds = %134
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %7, align 4, !tbaa !5
  br label %103, !llvm.loop !16

138:                                              ; preds = %107
  %139 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 0
  %140 = load i32, ptr %139, align 16, !tbaa !5
  %141 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 1
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = icmp eq i32 %140, %142
  br i1 %143, label %144, label %156

144:                                              ; preds = %138
  %145 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 1
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 2
  %148 = load i32, ptr %147, align 8, !tbaa !5
  %149 = icmp eq i32 %146, %148
  br i1 %149, label %150, label %156

150:                                              ; preds = %144
  %151 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 2
  %152 = load i32, ptr %151, align 8, !tbaa !5
  %153 = getelementptr inbounds [4 x i32], ptr %6, i64 0, i64 3
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = icmp eq i32 %152, %154
  br label %156

156:                                              ; preds = %150, %144, %138
  %157 = phi i1 [ false, %144 ], [ false, %138 ], [ %155, %150 ]
  %158 = zext i1 %157 to i64
  %159 = select i1 %157, ptr @.str.3, ptr @.str.4
  %160 = call i32 @puts(ptr noundef %159)
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  br label %161

161:                                              ; preds = %156, %94
  br label %162

162:                                              ; preds = %161, %54
  br label %11, !llvm.loop !17

163:                                              ; preds = %11
  ret i32 0
}

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

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

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

declare i32 @puts(ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}


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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@buf = external dso_local global [10000001 x i8], 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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [4 x i32], align 16
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %3 = load i32, ptr @t, align 4, !tbaa !5
  %4 = add nsw i32 %3, -1
  store i32 %4, ptr @t, align 4, !tbaa !5
  %.not63 = icmp eq i32 %3, 0
  br i1 %.not63, label %._crit_edge66, label %.lr.ph65

.lr.ph65:                                         ; preds = %0
  %5 = getelementptr inbounds i8, ptr %1, i64 4
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = getelementptr inbounds i8, ptr %1, i64 12
  br label %8

8:                                                ; preds = %.lr.ph65, %132
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 1
  %12 = load i32, ptr @m, align 4
  %13 = icmp sgt i32 %12, 1
  %or.cond = select i1 %11, i1 %13, i1 false
  br i1 %or.cond, label %14, label %42

14:                                               ; preds = %8
  %15 = icmp ugt i32 %10, 2
  %16 = icmp ugt i32 %12, 2
  %or.cond3 = select i1 %15, i1 true, i1 %16
  br i1 %or.cond3, label %.lr.ph60.preheader, label %.lr.ph50.preheader

.lr.ph60.preheader:                               ; preds = %14
  %17 = add nsw i32 %10, -1
  store i32 %17, ptr @n, align 4, !tbaa !5
  br label %.lr.ph60

.loopexit:                                        ; preds = %.lr.ph56, %middle.block, %.lr.ph60
  %.127.lcssa = phi i32 [ %.02659, %.lr.ph60 ], [ %33, %middle.block ], [ %38, %.lr.ph56 ]
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @n, align 4, !tbaa !5
  %.not34 = icmp eq i32 %18, 0
  br i1 %.not34, label %._crit_edge61, label %.lr.ph60, !llvm.loop !9

.lr.ph60:                                         ; preds = %.lr.ph60.preheader, %.loopexit
  %.02659 = phi i32 [ %.127.lcssa, %.loopexit ], [ 0, %.lr.ph60.preheader ]
  %20 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @buf)
  %21 = load i32, ptr @m, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph56.preheader, label %.loopexit

.lr.ph56.preheader:                               ; preds = %.lr.ph60
  %wide.trip.count80 = zext nneg i32 %21 to i64
  %min.iters.check = icmp ult i32 %21, 8
  br i1 %min.iters.check, label %.lr.ph56.preheader122, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph56.preheader
  %n.vec = and i64 %wide.trip.count80, 2147483640
  %23 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.02659, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %23, %vector.ph ], [ %30, %vector.body ]
  %vec.phi88 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %31, %vector.body ]
  %24 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %index
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  %wide.load = load <4 x i8>, ptr %24, align 8, !tbaa !11
  %wide.load89 = load <4 x i8>, ptr %25, align 4, !tbaa !11
  %26 = icmp eq <4 x i8> %wide.load, <i8 49, i8 49, i8 49, i8 49>
  %27 = icmp eq <4 x i8> %wide.load89, <i8 49, i8 49, i8 49, i8 49>
  %28 = zext <4 x i1> %26 to <4 x i32>
  %29 = zext <4 x i1> %27 to <4 x i32>
  %30 = add <4 x i32> %vec.phi, %28
  %31 = add <4 x i32> %vec.phi88, %29
  %index.next = add nuw i64 %index, 8
  %32 = icmp eq i64 %index.next, %n.vec
  br i1 %32, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %31, %30
  %33 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count80
  br i1 %cmp.n, label %.loopexit, label %.lr.ph56.preheader122

.lr.ph56.preheader122:                            ; preds = %middle.block, %.lr.ph56.preheader
  %indvars.iv77.ph = phi i64 [ 0, %.lr.ph56.preheader ], [ %n.vec, %middle.block ]
  %.12753.ph = phi i32 [ %.02659, %.lr.ph56.preheader ], [ %33, %middle.block ]
  br label %.lr.ph56

.lr.ph56:                                         ; preds = %.lr.ph56.preheader122, %.lr.ph56
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %.lr.ph56 ], [ %indvars.iv77.ph, %.lr.ph56.preheader122 ]
  %.12753 = phi i32 [ %38, %.lr.ph56 ], [ %.12753.ph, %.lr.ph56.preheader122 ]
  %34 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %indvars.iv77
  %35 = load i8, ptr %34, align 1, !tbaa !11
  %36 = icmp eq i8 %35, 49
  %37 = zext i1 %36 to i32
  %38 = add nsw i32 %.12753, %37
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond81.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count80
  br i1 %exitcond81.not, label %.loopexit, label %.lr.ph56, !llvm.loop !15

._crit_edge61:                                    ; preds = %.loopexit
  %39 = and i32 %.127.lcssa, 1
  %.not35 = icmp eq i32 %39, 0
  %40 = select i1 %.not35, ptr @.str.3, ptr @.str.4
  %41 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %40)
  br label %132

42:                                               ; preds = %8
  %43 = icmp eq i32 %10, 2
  %44 = icmp eq i32 %12, 2
  %or.cond5 = select i1 %43, i1 %44, i1 false
  br i1 %or.cond5, label %.lr.ph50.preheader, label %69

.lr.ph50.preheader:                               ; preds = %14, %42
  store i32 1, ptr @n, align 4, !tbaa !5
  br label %.lr.ph50

.loopexit37:                                      ; preds = %.lr.ph47, %middle.block90, %.lr.ph50
  %.1.lcssa = phi i32 [ %.02449, %.lr.ph50 ], [ %60, %middle.block90 ], [ %65, %.lr.ph47 ]
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr @n, align 4, !tbaa !5
  %.not32 = icmp eq i32 %45, 0
  br i1 %.not32, label %._crit_edge51, label %.lr.ph50, !llvm.loop !16

.lr.ph50:                                         ; preds = %.lr.ph50.preheader, %.loopexit37
  %.02449 = phi i32 [ %.1.lcssa, %.loopexit37 ], [ 0, %.lr.ph50.preheader ]
  %47 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @buf)
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph47.preheader, label %.loopexit37

.lr.ph47.preheader:                               ; preds = %.lr.ph50
  %wide.trip.count75 = zext nneg i32 %48 to i64
  %min.iters.check92 = icmp ult i32 %48, 8
  br i1 %min.iters.check92, label %.lr.ph47.preheader123, label %vector.ph93

vector.ph93:                                      ; preds = %.lr.ph47.preheader
  %n.vec95 = and i64 %wide.trip.count75, 2147483640
  %50 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.02449, i64 0
  br label %vector.body97

vector.body97:                                    ; preds = %vector.body97, %vector.ph93
  %index98 = phi i64 [ 0, %vector.ph93 ], [ %index.next103, %vector.body97 ]
  %vec.phi99 = phi <4 x i32> [ %50, %vector.ph93 ], [ %57, %vector.body97 ]
  %vec.phi100 = phi <4 x i32> [ zeroinitializer, %vector.ph93 ], [ %58, %vector.body97 ]
  %51 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %index98
  %52 = getelementptr inbounds i8, ptr %51, i64 4
  %wide.load101 = load <4 x i8>, ptr %51, align 8, !tbaa !11
  %wide.load102 = load <4 x i8>, ptr %52, align 4, !tbaa !11
  %53 = icmp eq <4 x i8> %wide.load101, <i8 49, i8 49, i8 49, i8 49>
  %54 = icmp eq <4 x i8> %wide.load102, <i8 49, i8 49, i8 49, i8 49>
  %55 = zext <4 x i1> %53 to <4 x i32>
  %56 = zext <4 x i1> %54 to <4 x i32>
  %57 = add <4 x i32> %vec.phi99, %55
  %58 = add <4 x i32> %vec.phi100, %56
  %index.next103 = add nuw i64 %index98, 8
  %59 = icmp eq i64 %index.next103, %n.vec95
  br i1 %59, label %middle.block90, label %vector.body97, !llvm.loop !17

middle.block90:                                   ; preds = %vector.body97
  %bin.rdx104 = add <4 x i32> %58, %57
  %60 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx104)
  %cmp.n105 = icmp eq i64 %n.vec95, %wide.trip.count75
  br i1 %cmp.n105, label %.loopexit37, label %.lr.ph47.preheader123

.lr.ph47.preheader123:                            ; preds = %middle.block90, %.lr.ph47.preheader
  %indvars.iv72.ph = phi i64 [ 0, %.lr.ph47.preheader ], [ %n.vec95, %middle.block90 ]
  %.144.ph = phi i32 [ %.02449, %.lr.ph47.preheader ], [ %60, %middle.block90 ]
  br label %.lr.ph47

.lr.ph47:                                         ; preds = %.lr.ph47.preheader123, %.lr.ph47
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.lr.ph47 ], [ %indvars.iv72.ph, %.lr.ph47.preheader123 ]
  %.144 = phi i32 [ %65, %.lr.ph47 ], [ %.144.ph, %.lr.ph47.preheader123 ]
  %61 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %indvars.iv72
  %62 = load i8, ptr %61, align 1, !tbaa !11
  %63 = icmp eq i8 %62, 49
  %64 = zext i1 %63 to i32
  %65 = add nsw i32 %.144, %64
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count75
  br i1 %exitcond76.not, label %.loopexit37, label %.lr.ph47, !llvm.loop !18

._crit_edge51:                                    ; preds = %.loopexit37
  %66 = and i32 %.1.lcssa, 3
  %.not33 = icmp eq i32 %66, 0
  %67 = select i1 %.not33, ptr @.str.3, ptr @.str.4
  %68 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %67)
  br label %132

69:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %1, i8 0, i64 16, i1 false)
  %70 = icmp sgt i32 %10, 0
  br i1 %70, label %.lr.ph42, label %._crit_edge43.thread

._crit_edge43:                                    ; preds = %._crit_edge
  %.pre = load i32, ptr %1, align 16, !tbaa !5
  %.pre82 = load i32, ptr %5, align 4, !tbaa !5
  %71 = icmp eq i32 %.pre, %.pre82
  br i1 %71, label %._crit_edge43.thread, label %.thread

.lr.ph42:                                         ; preds = %69, %._crit_edge
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %._crit_edge ], [ 0, %69 ]
  %72 = trunc i64 %indvars.iv69 to i2
  %73 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @buf)
  %74 = load i32, ptr @m, align 4, !tbaa !5
  %75 = icmp sgt i32 %74, 0
  br i1 %75, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph42
  %wide.trip.count = zext nneg i32 %74 to i64
  %min.iters.check109 = icmp ult i32 %74, 8
  br i1 %min.iters.check109, label %.lr.ph.preheader124, label %vector.scevcheck

.lr.ph.preheader124:                              ; preds = %vector.scevcheck, %.lr.ph.preheader
  %xtraiter = and i64 %wide.trip.count, 1
  %76 = icmp eq i32 %74, 1
  br i1 %76, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader124.new

.lr.ph.preheader124.new:                          ; preds = %.lr.ph.preheader124
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph

vector.scevcheck:                                 ; preds = %.lr.ph.preheader
  %77 = add nsw i64 %wide.trip.count, -1
  %78 = trunc i64 %77 to i2
  %79 = xor i2 %72, -1
  %80 = icmp ult i2 %79, %78
  %81 = icmp ugt i64 %77, 3
  %82 = or i1 %80, %81
  br i1 %82, label %.lr.ph.preheader124, label %vector.body114.preheader

vector.body114.preheader:                         ; preds = %vector.scevcheck
  %83 = and i64 %indvars.iv69, 3
  %84 = getelementptr inbounds [4 x i32], ptr %1, i64 0, i64 %83
  %85 = getelementptr inbounds i8, ptr %84, i64 16
  %.promoted = load <4 x i32>, ptr %84, align 4, !tbaa !5
  %.promoted138 = load <4 x i32>, ptr %85, align 4, !tbaa !5
  br label %vector.body114

vector.body114:                                   ; preds = %vector.body114.preheader, %vector.body114
  %wide.load119139 = phi <4 x i32> [ %93, %vector.body114 ], [ %.promoted138, %vector.body114.preheader ]
  %wide.load118137 = phi <4 x i32> [ %92, %vector.body114 ], [ %.promoted, %vector.body114.preheader ]
  %index115 = phi i64 [ %index.next120, %vector.body114 ], [ 0, %vector.body114.preheader ]
  %86 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %index115
  %87 = getelementptr inbounds i8, ptr %86, i64 4
  %wide.load116 = load <4 x i8>, ptr %86, align 8, !tbaa !11
  %wide.load117 = load <4 x i8>, ptr %87, align 4, !tbaa !11
  %88 = icmp eq <4 x i8> %wide.load116, <i8 49, i8 49, i8 49, i8 49>
  %89 = icmp eq <4 x i8> %wide.load117, <i8 49, i8 49, i8 49, i8 49>
  %90 = zext <4 x i1> %88 to <4 x i32>
  %91 = zext <4 x i1> %89 to <4 x i32>
  %92 = xor <4 x i32> %wide.load118137, %90
  %93 = xor <4 x i32> %wide.load119139, %91
  %index.next120 = add nuw i64 %index115, 8
  br label %vector.body114, !llvm.loop !19

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader124
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader124 ], [ %indvars.iv.next.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %94 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %indvars.iv.unr
  %95 = load i8, ptr %94, align 1, !tbaa !11
  %96 = icmp eq i8 %95, 49
  %97 = zext i1 %96 to i32
  %98 = add nuw nsw i64 %indvars.iv.unr, %indvars.iv69
  %99 = and i64 %98, 3
  %100 = getelementptr inbounds [4 x i32], ptr %1, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = xor i32 %101, %97
  store i32 %102, ptr %100, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %._crit_edge.loopexit.unr-lcssa, %.lr.ph42
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = icmp slt i64 %indvars.iv.next70, %104
  br i1 %105, label %.lr.ph42, label %._crit_edge43, !llvm.loop !20

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader124.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader124.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader124.new ], [ %niter.next.1, %.lr.ph ]
  %106 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %indvars.iv
  %107 = load i8, ptr %106, align 2, !tbaa !11
  %108 = icmp eq i8 %107, 49
  %109 = zext i1 %108 to i32
  %110 = add nuw nsw i64 %indvars.iv, %indvars.iv69
  %111 = and i64 %110, 3
  %112 = getelementptr inbounds [4 x i32], ptr %1, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = xor i32 %113, %109
  store i32 %114, ptr %112, align 4, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %115 = getelementptr inbounds [10000001 x i8], ptr @buf, i64 0, i64 %indvars.iv.next
  %116 = load i8, ptr %115, align 1, !tbaa !11
  %117 = icmp eq i8 %116, 49
  %118 = zext i1 %117 to i32
  %119 = add nuw nsw i64 %indvars.iv.next, %indvars.iv69
  %120 = and i64 %119, 3
  %121 = getelementptr inbounds [4 x i32], ptr %1, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = xor i32 %122, %118
  store i32 %123, ptr %121, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !21

._crit_edge43.thread:                             ; preds = %69, %._crit_edge43
  %124 = phi i32 [ %.pre82, %._crit_edge43 ], [ 0, %69 ]
  %125 = load i32, ptr %6, align 8, !tbaa !5
  %126 = icmp eq i32 %124, %125
  br i1 %126, label %127, label %.thread

127:                                              ; preds = %._crit_edge43.thread
  %128 = load i32, ptr %7, align 4, !tbaa !5
  %129 = icmp eq i32 %124, %128
  %cond.fr = freeze i1 %129
  %spec.select = select i1 %cond.fr, ptr @.str.3, ptr @.str.4
  br label %.thread

.thread:                                          ; preds = %127, %._crit_edge43, %._crit_edge43.thread
  %130 = phi ptr [ @.str.4, %._crit_edge43.thread ], [ @.str.4, %._crit_edge43 ], [ %spec.select, %127 ]
  %131 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %130)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #5
  br label %132

132:                                              ; preds = %._crit_edge51, %.thread, %._crit_edge61
  %133 = load i32, ptr @t, align 4, !tbaa !5
  %134 = add nsw i32 %133, -1
  store i32 %134, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %133, 0
  br i1 %.not, label %._crit_edge66, label %8, !llvm.loop !22

._crit_edge66:                                    ; preds = %132, %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 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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #4

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


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